@seedprotocol/sdk 0.6.6 → 0.6.8
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/{BasePathResolver-BGxb4Qod.js → BasePathResolver-B6CKqoKw.js} +137 -4
- package/dist/BasePathResolver-B6CKqoKw.js.map +1 -0
- package/dist/{index-CJNKYI37.js → ClientManager-ChcmUL47.js} +1928 -5543
- package/dist/ClientManager-ChcmUL47.js.map +1 -0
- package/dist/{ModelProperty-Bvg9cJcd.js → ModelProperty-D79uV42p.js} +42 -36
- package/dist/ModelProperty-D79uV42p.js.map +1 -0
- package/dist/{Schema-BNJBY80k.js → Schema-a8uO-hIZ.js} +48 -47
- package/dist/Schema-a8uO-hIZ.js.map +1 -0
- package/dist/{SchemaValidationService-aqXkwXTr.js → SchemaValidationService-Y49vqast.js} +16 -12
- package/dist/SchemaValidationService-Y49vqast.js.map +1 -0
- package/dist/{backfillMetadataPropertyIds-DYkvoOMz.js → backfillMetadataPropertyIds-CBsf7LnU.js} +6 -3
- package/dist/{backfillMetadataPropertyIds-DYkvoOMz.js.map → backfillMetadataPropertyIds-CBsf7LnU.js.map} +1 -1
- package/dist/cjs/{ModelProperty-alntkSnH.js → ModelProperty-D9FGaGuE.js} +25 -20
- package/dist/cjs/ModelProperty-D9FGaGuE.js.map +1 -0
- package/dist/cjs/{Schema-ByFv6fcb.js → Schema-BiJIPLEL.js} +29 -27
- package/dist/cjs/Schema-BiJIPLEL.js.map +1 -0
- package/dist/cjs/{SchemaValidationService-D55MWsxv.js → SchemaValidationService-DtYs_CNY.js} +9 -6
- package/dist/cjs/SchemaValidationService-DtYs_CNY.js.map +1 -0
- package/dist/cjs/{backfillMetadataPropertyIds-DrrL5RqD.js → backfillMetadataPropertyIds-2XaN3b9S.js} +7 -5
- package/dist/cjs/{backfillMetadataPropertyIds-DrrL5RqD.js.map → backfillMetadataPropertyIds-2XaN3b9S.js.map} +1 -1
- package/dist/cjs/{eas-D2E3_i_c.js → eas-CMNppmGE.js} +32 -6
- package/dist/cjs/eas-CMNppmGE.js.map +1 -0
- package/dist/cjs/{getItem-B2zLVB_l.js → getItem-B6jEINjW.js} +6 -4
- package/dist/cjs/{getItem-B2zLVB_l.js.map → getItem-B6jEINjW.js.map} +1 -1
- package/dist/cjs/{getPublishPayload-Bv94k4ak.js → getPublishPayload-D5DhLGvN.js} +66 -60
- package/dist/cjs/getPublishPayload-D5DhLGvN.js.map +1 -0
- package/dist/cjs/{getPublishUploads-CSbHUxYk.js → getPublishUploads-DMhCCKYF.js} +21 -13
- package/dist/cjs/getPublishUploads-DMhCCKYF.js.map +1 -0
- package/dist/cjs/{getSegmentedItemProperties-CMhXKQHz.js → getSegmentedItemProperties-CU8rtBAo.js} +3 -51
- package/dist/cjs/getSegmentedItemProperties-CU8rtBAo.js.map +1 -0
- package/dist/cjs/{index-D-9WglxG.js → index-CSNtEnbF.js} +5986 -5389
- package/dist/cjs/index-CSNtEnbF.js.map +1 -0
- package/dist/cjs/{index-pSLjO-ch.js → index-DPp9rdRL.js} +10 -6
- package/dist/cjs/index-DPp9rdRL.js.map +1 -0
- package/dist/cjs/{property-gUK2PijH.js → property-DlKiAWt4.js} +11 -7
- package/dist/cjs/{property-gUK2PijH.js.map → property-DlKiAWt4.js.map} +1 -1
- package/dist/cjs/{syncDbWithEas-CYtl7VTD.js → syncDbWithEas-C6n34o_Q.js} +14 -8
- package/dist/cjs/syncDbWithEas-C6n34o_Q.js.map +1 -0
- package/dist/{configurePlatform-bGvKBBQy.js → configurePlatform-CE0Vew17.js} +6 -3
- package/dist/{configurePlatform-bGvKBBQy.js.map → configurePlatform-CE0Vew17.js.map} +1 -1
- package/dist/db/drizzle/0014_add_error_code_to_publish_processes.sql +1 -0
- package/dist/db/drizzle/meta/0014_snapshot.json +1269 -0
- package/dist/db/drizzle/meta/_journal.json +7 -0
- package/dist/{db-YiH_kIpE.js → db-WbrzEf7c.js} +266 -53
- package/dist/db-WbrzEf7c.js.map +1 -0
- package/dist/{eas-1nUCcmeh.js → eas-CfYCu4IX.js} +9 -6
- package/dist/eas-CfYCu4IX.js.map +1 -0
- package/dist/generateId-BopUwD8F.js +9 -0
- package/dist/generateId-BopUwD8F.js.map +1 -0
- package/dist/{getItem-Bb8bTYzY.js → getItem-Br-bGNFO.js} +12 -10
- package/dist/{getItem-Bb8bTYzY.js.map → getItem-Br-bGNFO.js.map} +1 -1
- package/dist/{getPublishPayload-BHw8mPSb.js → getPublishPayload-BIrTVUxb.js} +72 -65
- package/dist/getPublishPayload-BIrTVUxb.js.map +1 -0
- package/dist/{getPublishUploads-BYhckxFl.js → getPublishUploads-C6cDeZdz.js} +22 -13
- package/dist/getPublishUploads-C6cDeZdz.js.map +1 -0
- package/dist/{getSegmentedItemProperties-B73nMPBv.js → getSegmentedItemProperties-BmKE71vU.js} +5 -5
- package/dist/{getSegmentedItemProperties-B73nMPBv.js.map → getSegmentedItemProperties-BmKE71vU.js.map} +1 -1
- package/dist/index-280bL-n4.js +1122 -0
- package/dist/index-280bL-n4.js.map +1 -0
- package/dist/{index-DzgMt8ba.js → index-ClSv5pTA.js} +17 -14
- package/dist/index-ClSv5pTA.js.map +1 -0
- package/dist/{index-C_5xwOPQ.js → index-Djd3667v.js} +2 -2
- package/dist/index-Djd3667v.js.map +1 -0
- package/dist/index-HRHkbVQd.js +3492 -0
- package/dist/index-HRHkbVQd.js.map +1 -0
- package/dist/{index.node-ZLiBj9Cu.js → index.node-DBtQkEfz.js} +8 -7
- package/dist/index.node-DBtQkEfz.js.map +1 -0
- package/dist/main.cjs +10 -4
- package/dist/main.cjs.map +1 -1
- package/dist/main.js +43 -43
- package/dist/main.js.map +1 -1
- package/dist/model-DGMe-TTm.js +25 -0
- package/dist/model-DGMe-TTm.js.map +1 -0
- package/dist/node.js +21 -17
- package/dist/node.js.map +1 -1
- package/dist/platform.browser.js +162 -63
- package/dist/platform.browser.js.map +1 -1
- package/dist/platform.node.js +5 -5
- package/dist/{property-Dcb50seV.js → property-CQjuZ4JW.js} +20 -17
- package/dist/property-CQjuZ4JW.js.map +1 -0
- package/dist/seedSchema/PublishProcessSchema.ts +1 -0
- package/dist/src/Item/Item.d.ts +6 -0
- package/dist/src/Item/Item.d.ts.map +1 -1
- package/dist/src/Item/service/actors/loadOrCreateItem.d.ts.map +1 -1
- package/dist/src/ItemProperty/ItemProperty.d.ts +10 -1
- package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/hydrateFromDb.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/loadOrCreateProperty.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/resolveRelatedValue.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveRelation.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/propertyMachine.d.ts.map +1 -1
- package/dist/src/Model/service/actors/loadOrCreateModel.d.ts.map +1 -1
- package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
- package/dist/src/Schema/service/actors/loadOrCreateSchema.d.ts.map +1 -1
- package/dist/src/Schema/service/actors/writeModelsToDb.d.ts.map +1 -1
- package/dist/src/Schema/service/addModelsMachine.d.ts.map +1 -1
- package/dist/src/Schema/service/validation/SchemaValidationService.d.ts.map +1 -1
- package/dist/src/browser/db/Db.d.ts.map +1 -1
- package/dist/src/browser/db/drizzleFiles.d.ts +3 -2
- package/dist/src/browser/db/drizzleFiles.d.ts.map +1 -1
- package/dist/src/browser/db/embeddedMigrations.d.ts +17 -0
- package/dist/src/browser/db/embeddedMigrations.d.ts.map +1 -0
- package/dist/src/browser/helpers/ArweaveClient.d.ts.map +1 -1
- package/dist/src/browser/helpers/EasClient.d.ts +2 -1
- package/dist/src/browser/helpers/EasClient.d.ts.map +1 -1
- package/dist/src/browser/helpers/FileManager.d.ts +1 -1
- package/dist/src/browser/helpers/FileManager.d.ts.map +1 -1
- package/dist/src/browser/workers/FileDownloader.d.ts +1 -1
- package/dist/src/browser/workers/FileDownloader.d.ts.map +1 -1
- package/dist/src/browser/workers/filesDownload.d.ts.map +1 -1
- package/dist/src/client/ClientManager.d.ts +18 -3
- package/dist/src/client/ClientManager.d.ts.map +1 -1
- package/dist/src/client/actors/platformClassesInit.d.ts.map +1 -1
- package/dist/src/client/actors/saveConfig.d.ts.map +1 -1
- package/dist/src/client/clientManagerMachine.d.ts +6 -1
- package/dist/src/client/clientManagerMachine.d.ts.map +1 -1
- package/dist/src/client/constants.d.ts +4 -0
- package/dist/src/client/constants.d.ts.map +1 -1
- package/dist/src/client/nodeEndpointDefaults.d.ts +8 -0
- package/dist/src/client/nodeEndpointDefaults.d.ts.map +1 -0
- package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
- package/dist/src/db/read/getPublishUploads.d.ts.map +1 -1
- package/dist/src/db/read/getRelatedItemsForPublish.d.ts.map +1 -1
- package/dist/src/db/write/createMetadata.d.ts.map +1 -1
- package/dist/src/eas.d.ts +2 -2
- package/dist/src/eas.d.ts.map +1 -1
- package/dist/src/events/files/download.d.ts.map +1 -1
- package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
- package/dist/src/helpers/ArweaveClient/index.d.ts.map +1 -1
- package/dist/src/helpers/ArweaveClient/selectReadGateway.d.ts +1 -1
- package/dist/src/helpers/ArweaveClient/selectReadGateway.d.ts.map +1 -1
- package/dist/src/helpers/FileManager/BaseFileManager.d.ts +2 -2
- package/dist/src/helpers/FileManager/BaseFileManager.d.ts.map +1 -1
- package/dist/src/helpers/FileManager/IFileManager.d.ts +4 -0
- package/dist/src/helpers/FileManager/IFileManager.d.ts.map +1 -1
- package/dist/src/helpers/constants.d.ts +9 -2
- package/dist/src/helpers/constants.d.ts.map +1 -1
- package/dist/src/helpers/crypto.d.ts +3 -2
- package/dist/src/helpers/crypto.d.ts.map +1 -1
- package/dist/src/helpers/db.d.ts +6 -0
- package/dist/src/helpers/db.d.ts.map +1 -1
- package/dist/src/helpers/ensureImageLocal.d.ts +24 -0
- package/dist/src/helpers/ensureImageLocal.d.ts.map +1 -0
- package/dist/src/helpers/ethereumUtils.d.ts.map +1 -1
- package/dist/src/helpers/gateway/gatewayState.d.ts +1 -1
- package/dist/src/helpers/gateway/gatewayState.d.ts.map +1 -1
- package/dist/src/helpers/index.d.ts +10 -2
- package/dist/src/helpers/index.d.ts.map +1 -1
- package/dist/src/helpers/localDbChain.d.ts +22 -0
- package/dist/src/helpers/localDbChain.d.ts.map +1 -0
- package/dist/src/helpers/metadataPropertyNames.d.ts +9 -0
- package/dist/src/helpers/metadataPropertyNames.d.ts.map +1 -1
- package/dist/src/helpers/property/index.d.ts +12 -0
- package/dist/src/helpers/property/index.d.ts.map +1 -1
- package/dist/src/helpers/readHtmlBodyForStorageSeed.d.ts.map +1 -1
- package/dist/src/helpers/relationSeedRef.d.ts +8 -0
- package/dist/src/helpers/relationSeedRef.d.ts.map +1 -1
- package/dist/src/imports/json.d.ts.map +1 -1
- package/dist/src/index.d.ts +11 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/node/easLodashHook.d.ts +2 -0
- package/dist/src/node/easLodashHook.d.ts.map +1 -0
- package/dist/src/node/easLodashRegister.d.ts +2 -0
- package/dist/src/node/easLodashRegister.d.ts.map +1 -0
- package/dist/src/node/helpers/FileManager.d.ts +2 -1
- package/dist/src/node/helpers/FileManager.d.ts.map +1 -1
- package/dist/src/node/index.d.ts +2 -1
- package/dist/src/node/index.d.ts.map +1 -1
- package/dist/src/seedSchema/PublishProcessSchema.d.ts +19 -0
- package/dist/src/seedSchema/PublishProcessSchema.d.ts.map +1 -1
- package/dist/src/types/fileManager.d.ts +4 -0
- package/dist/src/types/fileManager.d.ts.map +1 -1
- package/dist/src/types/index.d.ts +15 -1
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/{syncDbWithEas-B0RUeDuj.js → syncDbWithEas-CuARXfyN.js} +24 -18
- package/dist/syncDbWithEas-CuARXfyN.js.map +1 -0
- package/dist/{updateSeedRevokedAt-D5ZbBehZ.js → updateSeedRevokedAt-CBcLfHWs.js} +2 -2
- package/dist/{updateSeedRevokedAt-D5ZbBehZ.js.map → updateSeedRevokedAt-CBcLfHWs.js.map} +1 -1
- package/package.json +12 -8
- package/src/node/easLodashHook.js +22 -0
- package/src/node/easLodashRegister.js +13 -0
- package/dist/BasePathResolver-BGxb4Qod.js.map +0 -1
- package/dist/ModelProperty-Bvg9cJcd.js.map +0 -1
- package/dist/Schema-BNJBY80k.js.map +0 -1
- package/dist/SchemaValidationService-aqXkwXTr.js.map +0 -1
- package/dist/cjs/ModelProperty-alntkSnH.js.map +0 -1
- package/dist/cjs/Schema-ByFv6fcb.js.map +0 -1
- package/dist/cjs/SchemaValidationService-D55MWsxv.js.map +0 -1
- package/dist/cjs/eas-D2E3_i_c.js.map +0 -1
- package/dist/cjs/getPublishPayload-Bv94k4ak.js.map +0 -1
- package/dist/cjs/getPublishUploads-CSbHUxYk.js.map +0 -1
- package/dist/cjs/getSegmentedItemProperties-CMhXKQHz.js.map +0 -1
- package/dist/cjs/index-D-9WglxG.js.map +0 -1
- package/dist/cjs/index-pSLjO-ch.js.map +0 -1
- package/dist/cjs/syncDbWithEas-CYtl7VTD.js.map +0 -1
- package/dist/constants-Bre6dTJR.js +0 -122
- package/dist/constants-Bre6dTJR.js.map +0 -1
- package/dist/constants-CTs2RUrM.js +0 -657
- package/dist/constants-CTs2RUrM.js.map +0 -1
- package/dist/db-YiH_kIpE.js.map +0 -1
- package/dist/eas-1nUCcmeh.js.map +0 -1
- package/dist/getPublishPayload-BHw8mPSb.js.map +0 -1
- package/dist/getPublishUploads-BYhckxFl.js.map +0 -1
- package/dist/index-CJNKYI37.js.map +0 -1
- package/dist/index-C_5xwOPQ.js.map +0 -1
- package/dist/index-DzgMt8ba.js.map +0 -1
- package/dist/index.node-ZLiBj9Cu.js.map +0 -1
- package/dist/property-Dcb50seV.js.map +0 -1
- package/dist/seedSchema/AppStateSchema.d.ts +0 -82
- package/dist/seedSchema/AppStateSchema.d.ts.map +0 -1
- package/dist/seedSchema/ConfigSchema.d.ts +0 -101
- package/dist/seedSchema/ConfigSchema.d.ts.map +0 -1
- package/dist/seedSchema/MetadataSchema.d.ts +0 -422
- package/dist/seedSchema/MetadataSchema.d.ts.map +0 -1
- package/dist/seedSchema/ModelSchema.d.ts +0 -243
- package/dist/seedSchema/ModelSchema.d.ts.map +0 -1
- package/dist/seedSchema/ModelSchemaSchema.d.ts +0 -61
- package/dist/seedSchema/ModelSchemaSchema.d.ts.map +0 -1
- package/dist/seedSchema/ModelUidSchema.d.ts +0 -64
- package/dist/seedSchema/ModelUidSchema.d.ts.map +0 -1
- package/dist/seedSchema/PropertyUidSchema.d.ts +0 -64
- package/dist/seedSchema/PropertyUidSchema.d.ts.map +0 -1
- package/dist/seedSchema/SchemaSchema.d.ts +0 -169
- package/dist/seedSchema/SchemaSchema.d.ts.map +0 -1
- package/dist/seedSchema/SeedSchema.d.ts +0 -192
- package/dist/seedSchema/SeedSchema.d.ts.map +0 -1
- package/dist/seedSchema/VersionSchema.d.ts +0 -194
- package/dist/seedSchema/VersionSchema.d.ts.map +0 -1
- package/dist/seedSchema/index.d.ts +0 -14
- package/dist/seedSchema/index.d.ts.map +0 -1
- package/dist/syncDbWithEas-B0RUeDuj.js.map +0 -1
|
@@ -99,6 +99,13 @@
|
|
|
99
99
|
"when": 1774300000000,
|
|
100
100
|
"tag": "0013_eas_sync_processes",
|
|
101
101
|
"breakpoints": true
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"idx": 14,
|
|
105
|
+
"version": "6",
|
|
106
|
+
"when": 1774400000000,
|
|
107
|
+
"tag": "0014_add_error_code_to_publish_processes",
|
|
108
|
+
"breakpoints": true
|
|
102
109
|
}
|
|
103
110
|
]
|
|
104
111
|
}
|
|
@@ -1,8 +1,218 @@
|
|
|
1
|
-
import { a as BaseDb,
|
|
1
|
+
import { a as BaseDb, c as appState, m as models, i as modelSchemas, p as properties, s as schemas, b as metadata } from './BasePathResolver-B6CKqoKw.js';
|
|
2
2
|
import { toSnakeCase } from 'drizzle-orm/casing';
|
|
3
3
|
import { eq, and, isNull } from 'drizzle-orm';
|
|
4
4
|
import { upperFirst, camelCase } from 'lodash-es';
|
|
5
5
|
import debug from 'debug';
|
|
6
|
+
import 'pluralize';
|
|
7
|
+
import { Type } from '@sinclair/typebox';
|
|
8
|
+
|
|
9
|
+
/** Default maximum length for Text properties when not explicitly set. Html holds arbitrary-length content and does not use this limit. */
|
|
10
|
+
const DEFAULT_TEXT_MAX_LENGTH = 255;
|
|
11
|
+
/**
|
|
12
|
+
* TypeBox schema for ValidationRules
|
|
13
|
+
*/
|
|
14
|
+
const TValidationRules = Type.Object({
|
|
15
|
+
pattern: Type.Optional(Type.String()),
|
|
16
|
+
minLength: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
17
|
+
maxLength: Type.Optional(Type.Integer({ minimum: 1 })),
|
|
18
|
+
enum: Type.Optional(Type.Array(Type.Any())),
|
|
19
|
+
custom: Type.Optional(Type.String()),
|
|
20
|
+
}, { additionalProperties: true });
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Enum for all property data types
|
|
24
|
+
*/
|
|
25
|
+
var ModelPropertyDataTypes;
|
|
26
|
+
(function (ModelPropertyDataTypes) {
|
|
27
|
+
ModelPropertyDataTypes["Text"] = "Text";
|
|
28
|
+
ModelPropertyDataTypes["Number"] = "Number";
|
|
29
|
+
ModelPropertyDataTypes["List"] = "List";
|
|
30
|
+
ModelPropertyDataTypes["Relation"] = "Relation";
|
|
31
|
+
ModelPropertyDataTypes["Image"] = "Image";
|
|
32
|
+
ModelPropertyDataTypes["Json"] = "Json";
|
|
33
|
+
ModelPropertyDataTypes["File"] = "File";
|
|
34
|
+
ModelPropertyDataTypes["Boolean"] = "Boolean";
|
|
35
|
+
ModelPropertyDataTypes["Date"] = "Date";
|
|
36
|
+
ModelPropertyDataTypes["Html"] = "Html";
|
|
37
|
+
})(ModelPropertyDataTypes || (ModelPropertyDataTypes = {}));
|
|
38
|
+
/** Known data types in lowercase for normalization */
|
|
39
|
+
const DATA_TYPE_LOWER_MAP = {
|
|
40
|
+
text: 'Text',
|
|
41
|
+
string: 'Text', // JSON Schema convention
|
|
42
|
+
number: 'Number',
|
|
43
|
+
list: 'List',
|
|
44
|
+
relation: 'Relation',
|
|
45
|
+
image: 'Image',
|
|
46
|
+
json: 'Json',
|
|
47
|
+
file: 'File',
|
|
48
|
+
boolean: 'Boolean',
|
|
49
|
+
date: 'Date',
|
|
50
|
+
html: 'Html',
|
|
51
|
+
blob: 'Blob',
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Normalize dataType to canonical PascalCase form.
|
|
55
|
+
* Accepts lowercase (e.g. 'text') or mixed case and returns 'Text'.
|
|
56
|
+
* Use when ingesting dataType from JSON schema files.
|
|
57
|
+
*/
|
|
58
|
+
function normalizeDataType(value) {
|
|
59
|
+
if (!value || typeof value !== 'string')
|
|
60
|
+
return value ?? '';
|
|
61
|
+
const lower = value.toLowerCase().trim();
|
|
62
|
+
return DATA_TYPE_LOWER_MAP[lower] ?? value.charAt(0).toUpperCase() + value.slice(1).toLowerCase();
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Case-insensitive dataType check. Use instead of `dataType === 'List'` so schemas
|
|
66
|
+
* (or existing DB rows) with lowercase types like "list" still match.
|
|
67
|
+
*/
|
|
68
|
+
function isDataType(value, expected) {
|
|
69
|
+
if (!value)
|
|
70
|
+
return false;
|
|
71
|
+
return normalizeDataType(value) === expected;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Normalize a property definition to the internal shape ItemProperty reads (`dataType`,
|
|
75
|
+
* `refValueType`, `ref`, `storageType`, ...). Accepts schema-file shape (`type`, `model`,
|
|
76
|
+
* `items`, `storage`) and any casing. Mirrors the conversion in imports/json createModelFromJson
|
|
77
|
+
* for the fallback paths that read schema-file properties directly.
|
|
78
|
+
*/
|
|
79
|
+
function normalizePropertyRecordSchema(def) {
|
|
80
|
+
if (!def || typeof def !== 'object')
|
|
81
|
+
return def;
|
|
82
|
+
const src = def;
|
|
83
|
+
const out = { ...src };
|
|
84
|
+
const rawType = src.dataType ?? src.type;
|
|
85
|
+
if (typeof rawType === 'string' && rawType)
|
|
86
|
+
out.dataType = normalizeDataType(rawType);
|
|
87
|
+
const ref = src.ref ?? src.refModelName ?? src.items?.model ?? src.model;
|
|
88
|
+
if (ref && !out.ref)
|
|
89
|
+
out.ref = ref;
|
|
90
|
+
if (ref && !out.refModelName)
|
|
91
|
+
out.refModelName = ref;
|
|
92
|
+
const rawRefValueType = src.refValueType ?? src.items?.type;
|
|
93
|
+
if (typeof rawRefValueType === 'string' && rawRefValueType) {
|
|
94
|
+
out.refValueType = normalizeDataType(rawRefValueType);
|
|
95
|
+
}
|
|
96
|
+
else if (out.dataType === ModelPropertyDataTypes.List && ref) {
|
|
97
|
+
out.refValueType = ModelPropertyDataTypes.Relation;
|
|
98
|
+
}
|
|
99
|
+
if (src.storage && typeof src.storage === 'object' && !out.storageType) {
|
|
100
|
+
out.storageType = src.storage.type === 'ItemStorage' ? 'ItemStorage' : 'PropertyStorage';
|
|
101
|
+
if (src.storage.path !== undefined && out.localStorageDir === undefined)
|
|
102
|
+
out.localStorageDir = src.storage.path;
|
|
103
|
+
if (src.storage.extension !== undefined && out.filenameSuffix === undefined)
|
|
104
|
+
out.filenameSuffix = src.storage.extension;
|
|
105
|
+
}
|
|
106
|
+
return out;
|
|
107
|
+
}
|
|
108
|
+
const TPropertyDataType = Type.Union([
|
|
109
|
+
Type.Literal(ModelPropertyDataTypes.Text),
|
|
110
|
+
Type.Literal(ModelPropertyDataTypes.Number),
|
|
111
|
+
Type.Literal(ModelPropertyDataTypes.List),
|
|
112
|
+
Type.Literal(ModelPropertyDataTypes.Relation),
|
|
113
|
+
Type.Literal(ModelPropertyDataTypes.Image),
|
|
114
|
+
Type.Literal(ModelPropertyDataTypes.Json),
|
|
115
|
+
Type.Literal(ModelPropertyDataTypes.File),
|
|
116
|
+
Type.Literal(ModelPropertyDataTypes.Boolean),
|
|
117
|
+
Type.Literal(ModelPropertyDataTypes.Date),
|
|
118
|
+
Type.Literal(ModelPropertyDataTypes.Html),
|
|
119
|
+
]);
|
|
120
|
+
const TStorageType = Type.Union([
|
|
121
|
+
Type.Literal('ItemStorage'), // Looks for a storageTransactionId property on the item
|
|
122
|
+
Type.Literal('PropertyStorage'), // Looks for a storageTransactionId value on the property
|
|
123
|
+
]);
|
|
124
|
+
/** How publish handles `data:image/*` URIs inside Html storage. Only applies when `dataType === 'Html'`. */
|
|
125
|
+
const THtmlEmbeddedDataUriPolicy = Type.Union([
|
|
126
|
+
Type.Literal('materialize'),
|
|
127
|
+
Type.Literal('preserve'),
|
|
128
|
+
]);
|
|
129
|
+
const TProperty = Type.Object({
|
|
130
|
+
id: Type.Optional(Type.String()), // schemaFileId (string) - public ID
|
|
131
|
+
_dbId: Type.Optional(Type.Number()), // Database integer ID - internal only
|
|
132
|
+
name: Type.Optional(Type.String()),
|
|
133
|
+
dataType: TPropertyDataType,
|
|
134
|
+
ref: Type.Optional(Type.String()),
|
|
135
|
+
// modelId: string (modelFileId) in code; number only for DB foreign keys when resolved
|
|
136
|
+
modelId: Type.Optional(Type.Union([Type.Number(), Type.String()])),
|
|
137
|
+
modelName: Type.Optional(Type.String()),
|
|
138
|
+
refModelId: Type.Optional(Type.Number()),
|
|
139
|
+
refModelName: Type.Optional(Type.String()),
|
|
140
|
+
refValueType: Type.Optional(TPropertyDataType),
|
|
141
|
+
storageType: Type.Optional(TStorageType),
|
|
142
|
+
localStorageDir: Type.Optional(Type.String()),
|
|
143
|
+
filenameSuffix: Type.Optional(Type.String()),
|
|
144
|
+
validation: Type.Optional(TValidationRules),
|
|
145
|
+
required: Type.Optional(Type.Boolean()),
|
|
146
|
+
/** When set on an Html property: `materialize` uploads embedded images as Image seeds and rewrites src; `preserve` leaves data URIs. */
|
|
147
|
+
htmlEmbeddedDataUriPolicy: Type.Optional(THtmlEmbeddedDataUriPolicy),
|
|
148
|
+
});
|
|
149
|
+
const TPropertyConstructor = Type.Function([
|
|
150
|
+
Type.Optional(Type.Union([Type.String(), TStorageType, Type.Undefined()])),
|
|
151
|
+
Type.Optional(Type.Union([Type.String(), TPropertyDataType])),
|
|
152
|
+
Type.Optional(Type.Union([Type.String(), Type.Boolean()])),
|
|
153
|
+
], TProperty);
|
|
154
|
+
const TPropertyDefs = Type.Record(TPropertyDataType, TPropertyConstructor);
|
|
155
|
+
function htmlPropertyFactory(opts) {
|
|
156
|
+
return {
|
|
157
|
+
dataType: ModelPropertyDataTypes.Html,
|
|
158
|
+
...(opts?.htmlEmbeddedDataUriPolicy
|
|
159
|
+
? { htmlEmbeddedDataUriPolicy: opts.htmlEmbeddedDataUriPolicy }
|
|
160
|
+
: {}),
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
const Property = {
|
|
164
|
+
Text: (storageType, localStorageDir, filenameSuffix) => ({
|
|
165
|
+
dataType: ModelPropertyDataTypes.Text,
|
|
166
|
+
storageType,
|
|
167
|
+
localStorageDir,
|
|
168
|
+
filenameSuffix,
|
|
169
|
+
TObject: Type.String(),
|
|
170
|
+
}),
|
|
171
|
+
Json: () => ({ dataType: ModelPropertyDataTypes.Json }),
|
|
172
|
+
File: () => ({ dataType: ModelPropertyDataTypes.File }),
|
|
173
|
+
Number: () => ({ dataType: ModelPropertyDataTypes.Number }),
|
|
174
|
+
/**
|
|
175
|
+
* Create a List property. refValueType is required; ref is required only for list of relations.
|
|
176
|
+
* @param refValueType - Element type: 'Text', 'Number', 'Relation', etc.
|
|
177
|
+
* @param ref - Model name when refValueType is 'Relation' (optional for primitives)
|
|
178
|
+
* @example List('Text') - list of strings
|
|
179
|
+
* @example List('Relation', 'Tag') - list of relations to Tag model
|
|
180
|
+
*/
|
|
181
|
+
List: (refValueType, ref) => ({
|
|
182
|
+
dataType: ModelPropertyDataTypes.List,
|
|
183
|
+
ref,
|
|
184
|
+
refValueType,
|
|
185
|
+
}),
|
|
186
|
+
Relation: (ref, refValueType, required) => ({
|
|
187
|
+
dataType: ModelPropertyDataTypes.Relation,
|
|
188
|
+
ref,
|
|
189
|
+
refValueType,
|
|
190
|
+
required,
|
|
191
|
+
}),
|
|
192
|
+
Image: () => ({ dataType: ModelPropertyDataTypes.Image }),
|
|
193
|
+
Boolean: () => ({ dataType: ModelPropertyDataTypes.Boolean }),
|
|
194
|
+
Date: () => ({ dataType: ModelPropertyDataTypes.Date }),
|
|
195
|
+
Html: htmlPropertyFactory,
|
|
196
|
+
/** `Html` opts are not representable in `TPropertyConstructor`; keep runtime shape via double assert. */
|
|
197
|
+
};
|
|
198
|
+
const PropertyMetadataKey = Symbol('property');
|
|
199
|
+
const PropertyConstructor = (propertyType) => {
|
|
200
|
+
return function (parentClassPrototype, propertyKey) {
|
|
201
|
+
const existingProperties = Reflect.getMetadata(PropertyMetadataKey, parentClassPrototype) || [];
|
|
202
|
+
existingProperties.push({ propertyKey, propertyType });
|
|
203
|
+
Reflect.defineMetadata(PropertyMetadataKey, existingProperties, parentClassPrototype);
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
const Text = (storageType, srcDir, filenameSuffix) => PropertyConstructor(Property.Text(storageType, srcDir, filenameSuffix));
|
|
207
|
+
const Number$1 = () => PropertyConstructor(Property.Number());
|
|
208
|
+
const Json = () => PropertyConstructor(Property.Json());
|
|
209
|
+
const File = () => PropertyConstructor(Property.File());
|
|
210
|
+
const Image = () => PropertyConstructor(Property.Image());
|
|
211
|
+
const Relation = (ref, refValueType, required) => PropertyConstructor(Property.Relation(ref, refValueType, required)); // Adjust for actual relation type
|
|
212
|
+
const List = (refValueType, ref) => PropertyConstructor(Property.List(refValueType, ref));
|
|
213
|
+
const Boolean = () => PropertyConstructor(Property.Boolean());
|
|
214
|
+
const Date$1 = () => PropertyConstructor(Property.Date());
|
|
215
|
+
const Html = (opts) => PropertyConstructor(htmlPropertyFactory(opts));
|
|
6
216
|
|
|
7
217
|
/**
|
|
8
218
|
* Detect SQLite UNIQUE constraint failures across better-sqlite3 and drizzle/wasm wrappers.
|
|
@@ -109,6 +319,23 @@ function normalizeAddressConfig(addresses) {
|
|
|
109
319
|
}
|
|
110
320
|
|
|
111
321
|
const logger = debug('seedSdk:helpers:db');
|
|
322
|
+
/**
|
|
323
|
+
* Resolve property_id (integer properties.id) from a property's schemaFileId (the string `id` in
|
|
324
|
+
* schema files and propertyRecordSchema). Scoped to the model since schemaFileIds are per schema file.
|
|
325
|
+
* @returns properties.id or null if not found
|
|
326
|
+
*/
|
|
327
|
+
async function getPropertyIdForSchemaFileId(modelNameOrType, schemaFileId) {
|
|
328
|
+
const db = BaseDb.getAppDb();
|
|
329
|
+
if (!db || !modelNameOrType || !schemaFileId)
|
|
330
|
+
return null;
|
|
331
|
+
const rows = await db
|
|
332
|
+
.select({ id: properties.id })
|
|
333
|
+
.from(properties)
|
|
334
|
+
.innerJoin(models, eq(properties.modelId, models.id))
|
|
335
|
+
.where(and(eq(models.name, upperFirst(camelCase(modelNameOrType))), eq(properties.schemaFileId, schemaFileId)))
|
|
336
|
+
.limit(1);
|
|
337
|
+
return rows[0]?.id ?? null;
|
|
338
|
+
}
|
|
112
339
|
/**
|
|
113
340
|
* Resolve property_id from model name/type and property name.
|
|
114
341
|
* Handles property name variants (e.g. htmlId -> html, avatarImageIds -> avatarImages).
|
|
@@ -159,19 +386,10 @@ async function migrateMetadataForPropertyRename(modelName, oldPropertyName, newP
|
|
|
159
386
|
logger('[migrateMetadataForPropertyRename] Database not available, skipping');
|
|
160
387
|
return 0;
|
|
161
388
|
}
|
|
162
|
-
const normalizedModelName = upperFirst(camelCase(modelName));
|
|
163
389
|
// Find the property row by schemaFileId (preferred) or by name
|
|
164
390
|
let propertyId = null;
|
|
165
391
|
if (propertySchemaFileId) {
|
|
166
|
-
|
|
167
|
-
.select({ id: properties.id })
|
|
168
|
-
.from(properties)
|
|
169
|
-
.innerJoin(models, eq(properties.modelId, models.id))
|
|
170
|
-
.where(and(eq(models.name, normalizedModelName), eq(properties.schemaFileId, propertySchemaFileId)))
|
|
171
|
-
.limit(1);
|
|
172
|
-
if (rows.length > 0 && rows[0].id != null) {
|
|
173
|
-
propertyId = rows[0].id;
|
|
174
|
-
}
|
|
392
|
+
propertyId = await getPropertyIdForSchemaFileId(modelName, propertySchemaFileId);
|
|
175
393
|
}
|
|
176
394
|
if (propertyId == null) {
|
|
177
395
|
propertyId = await getPropertyIdForModelAndName(modelName, oldPropertyName);
|
|
@@ -653,8 +871,8 @@ const renameModelInDb = async (oldName, newName, schemaNameOrId) => {
|
|
|
653
871
|
if (!db) {
|
|
654
872
|
throw new Error('Database not found');
|
|
655
873
|
}
|
|
656
|
-
const _mod_0 = await import('./BasePathResolver-
|
|
657
|
-
const _ns_0 = _mod_0.
|
|
874
|
+
const _mod_0 = await import('./BasePathResolver-B6CKqoKw.js');
|
|
875
|
+
const _ns_0 = _mod_0.O;
|
|
658
876
|
const { schemas: schemasTable } = _ns_0;
|
|
659
877
|
// Find the model by old name, optionally scoped by schema
|
|
660
878
|
let existingModels;
|
|
@@ -937,9 +1155,7 @@ const addModelsToDb = async (models$1, schema, modelRenames, schemaFileData) =>
|
|
|
937
1155
|
schema = pendingProperties;
|
|
938
1156
|
}
|
|
939
1157
|
else {
|
|
940
|
-
const
|
|
941
|
-
const _ns_1 = _mod_1.ao;
|
|
942
|
-
const modelHelpersMod = _ns_1;
|
|
1158
|
+
const modelHelpersMod = await import('./model-DGMe-TTm.js');
|
|
943
1159
|
const { modelPropertiesToObject } = modelHelpersMod;
|
|
944
1160
|
const modelProperties = modelClass.properties || [];
|
|
945
1161
|
schema = modelPropertiesToObject(modelProperties);
|
|
@@ -958,9 +1174,7 @@ const addModelsToDb = async (models$1, schema, modelRenames, schemaFileData) =>
|
|
|
958
1174
|
// If no propertyFileId from map, generate a random ID
|
|
959
1175
|
// IDs should be generated in the import process before calling addModelsToDb
|
|
960
1176
|
if (!propertyFileId) {
|
|
961
|
-
const
|
|
962
|
-
const _ns_2 = _mod_2.an;
|
|
963
|
-
const { generateId } = _ns_2;
|
|
1177
|
+
const { generateId } = await import('./generateId-BopUwD8F.js');
|
|
964
1178
|
propertyFileId = generateId();
|
|
965
1179
|
logger(`Generated propertyFileId "${propertyFileId}" for property "${modelName}:${propertyName}" (not found in propertyFileIds map)`);
|
|
966
1180
|
}
|
|
@@ -977,7 +1191,7 @@ const addModelsToDb = async (models$1, schema, modelRenames, schemaFileData) =>
|
|
|
977
1191
|
const propertyData = {
|
|
978
1192
|
name: propertyName,
|
|
979
1193
|
modelId: modelRecord.id,
|
|
980
|
-
dataType: propertyValues.dataType,
|
|
1194
|
+
dataType: normalizeDataType(propertyValues.dataType),
|
|
981
1195
|
schemaFileId: propertyFileId || null,
|
|
982
1196
|
required: propertyValues.required ?? false,
|
|
983
1197
|
};
|
|
@@ -1003,7 +1217,7 @@ const addModelsToDb = async (models$1, schema, modelRenames, schemaFileData) =>
|
|
|
1003
1217
|
propertyData.refModelId = null;
|
|
1004
1218
|
}
|
|
1005
1219
|
if (propertyValues.refValueType) {
|
|
1006
|
-
propertyData.refValueType = propertyValues.refValueType;
|
|
1220
|
+
propertyData.refValueType = normalizeDataType(propertyValues.refValueType);
|
|
1007
1221
|
}
|
|
1008
1222
|
else {
|
|
1009
1223
|
// If refValueType is not set, ensure it's null
|
|
@@ -1198,7 +1412,7 @@ const loadModelsFromDbForSchema = async (schemaId) => {
|
|
|
1198
1412
|
// Note: This is a simplified reconstruction - full property schemas
|
|
1199
1413
|
// (like Relation details, List configs, etc.) should come from schemaData
|
|
1200
1414
|
const propertyData = {
|
|
1201
|
-
dataType: prop.dataType,
|
|
1415
|
+
dataType: normalizeDataType(prop.dataType ?? undefined),
|
|
1202
1416
|
};
|
|
1203
1417
|
if (prop.schemaFileId) {
|
|
1204
1418
|
propertyData.schemaFileId = prop.schemaFileId;
|
|
@@ -1216,7 +1430,7 @@ const loadModelsFromDbForSchema = async (schemaId) => {
|
|
|
1216
1430
|
}
|
|
1217
1431
|
}
|
|
1218
1432
|
if (prop.refValueType) {
|
|
1219
|
-
propertyData.refValueType = prop.refValueType;
|
|
1433
|
+
propertyData.refValueType = normalizeDataType(prop.refValueType ?? undefined);
|
|
1220
1434
|
}
|
|
1221
1435
|
modelProperties[prop.name] = propertyData;
|
|
1222
1436
|
}
|
|
@@ -1388,7 +1602,7 @@ const savePropertyToDb = async (property) => {
|
|
|
1388
1602
|
const propertyData = {
|
|
1389
1603
|
name: property.name,
|
|
1390
1604
|
modelId: modelRecord.id,
|
|
1391
|
-
dataType: property.dataType
|
|
1605
|
+
dataType: normalizeDataType(property.dataType),
|
|
1392
1606
|
};
|
|
1393
1607
|
// Preserve schemaFileId if we have it
|
|
1394
1608
|
if (schemaFileId) {
|
|
@@ -1409,7 +1623,7 @@ const savePropertyToDb = async (property) => {
|
|
|
1409
1623
|
propertyData.refModelId = null;
|
|
1410
1624
|
}
|
|
1411
1625
|
if (property.refValueType) {
|
|
1412
|
-
propertyData.refValueType = property.refValueType;
|
|
1626
|
+
propertyData.refValueType = normalizeDataType(property.refValueType);
|
|
1413
1627
|
}
|
|
1414
1628
|
else {
|
|
1415
1629
|
// If refValueType is not set, ensure it's null
|
|
@@ -1637,9 +1851,9 @@ async function writeModelToDb(modelFileId, data) {
|
|
|
1637
1851
|
throw new Error(`Model with id ${modelId} does not exist in database. Cannot create join record.`);
|
|
1638
1852
|
}
|
|
1639
1853
|
// Verify schemaId exists and get name/fileId for invalidation broadcast
|
|
1640
|
-
const
|
|
1641
|
-
const
|
|
1642
|
-
const schemaSchemaMod =
|
|
1854
|
+
const _mod_1 = await import('./BasePathResolver-B6CKqoKw.js');
|
|
1855
|
+
const _ns_1 = _mod_1.O;
|
|
1856
|
+
const schemaSchemaMod = _ns_1;
|
|
1643
1857
|
const { schemas: schemasTable } = schemaSchemaMod;
|
|
1644
1858
|
const schemaCheck = await db
|
|
1645
1859
|
.select({
|
|
@@ -1706,9 +1920,7 @@ async function writeModelToDb(modelFileId, data) {
|
|
|
1706
1920
|
else {
|
|
1707
1921
|
// Generate random propertyFileId
|
|
1708
1922
|
// IDs should be generated in the import process before calling writeModelToDb
|
|
1709
|
-
const
|
|
1710
|
-
const _ns_4 = _mod_4.an;
|
|
1711
|
-
const { generateId } = _ns_4;
|
|
1923
|
+
const { generateId } = await import('./generateId-BopUwD8F.js');
|
|
1712
1924
|
propertyFileId = generateId();
|
|
1713
1925
|
logger(`Generated propertyFileId "${propertyFileId}" for property "${data.modelName}:${propName}"`);
|
|
1714
1926
|
}
|
|
@@ -1749,7 +1961,7 @@ async function writePropertyToDb(propertyFileId, data, isEdited = false) {
|
|
|
1749
1961
|
const propertyData = {
|
|
1750
1962
|
name: data.name,
|
|
1751
1963
|
modelId: data.modelId,
|
|
1752
|
-
dataType: data.dataType
|
|
1964
|
+
dataType: normalizeDataType(data.dataType),
|
|
1753
1965
|
schemaFileId: propertyFileId,
|
|
1754
1966
|
isEdited: isEdited, // Persist isEdited flag
|
|
1755
1967
|
};
|
|
@@ -1770,7 +1982,7 @@ async function writePropertyToDb(propertyFileId, data, isEdited = false) {
|
|
|
1770
1982
|
propertyData.refModelId = null;
|
|
1771
1983
|
}
|
|
1772
1984
|
if (data.refValueType) {
|
|
1773
|
-
propertyData.refValueType = data.refValueType;
|
|
1985
|
+
propertyData.refValueType = normalizeDataType(data.refValueType);
|
|
1774
1986
|
}
|
|
1775
1987
|
else {
|
|
1776
1988
|
// If refValueType is not set, ensure it's null
|
|
@@ -1849,9 +2061,9 @@ async function getSchemaId(schemaNameOrFileId) {
|
|
|
1849
2061
|
if (!db) {
|
|
1850
2062
|
throw new Error('Database not available');
|
|
1851
2063
|
}
|
|
1852
|
-
const
|
|
1853
|
-
const
|
|
1854
|
-
const schemaSchemaMod =
|
|
2064
|
+
const _mod_2 = await import('./BasePathResolver-B6CKqoKw.js');
|
|
2065
|
+
const _ns_2 = _mod_2.O;
|
|
2066
|
+
const schemaSchemaMod = _ns_2;
|
|
1855
2067
|
const { schemas: schemasTable } = schemaSchemaMod;
|
|
1856
2068
|
const drizzleMod = await import('drizzle-orm');
|
|
1857
2069
|
const { eq, desc } = drizzleMod;
|
|
@@ -1887,9 +2099,9 @@ async function getSchemaIdByFileId(schemaFileId) {
|
|
|
1887
2099
|
if (!db) {
|
|
1888
2100
|
throw new Error('Database not available');
|
|
1889
2101
|
}
|
|
1890
|
-
const
|
|
1891
|
-
const
|
|
1892
|
-
const schemaSchemaMod =
|
|
2102
|
+
const _mod_3 = await import('./BasePathResolver-B6CKqoKw.js');
|
|
2103
|
+
const _ns_3 = _mod_3.O;
|
|
2104
|
+
const schemaSchemaMod = _ns_3;
|
|
1893
2105
|
const { schemas: schemasTable } = schemaSchemaMod;
|
|
1894
2106
|
const drizzleMod = await import('drizzle-orm');
|
|
1895
2107
|
const { eq, desc } = drizzleMod;
|
|
@@ -1916,9 +2128,9 @@ async function getModelId(modelNameOrFileId, schemaNameOrId) {
|
|
|
1916
2128
|
if (!db) {
|
|
1917
2129
|
throw new Error('Database not available');
|
|
1918
2130
|
}
|
|
1919
|
-
const
|
|
1920
|
-
const
|
|
1921
|
-
const modelSchemaMod =
|
|
2131
|
+
const _mod_4 = await import('./BasePathResolver-B6CKqoKw.js');
|
|
2132
|
+
const _ns_4 = _mod_4.M;
|
|
2133
|
+
const modelSchemaMod = _ns_4;
|
|
1922
2134
|
const { models: modelsTable } = modelSchemaMod;
|
|
1923
2135
|
const drizzleMod = await import('drizzle-orm');
|
|
1924
2136
|
const { eq, and, or } = drizzleMod;
|
|
@@ -1933,13 +2145,13 @@ async function getModelId(modelNameOrFileId, schemaNameOrId) {
|
|
|
1933
2145
|
[eq(modelsTable.name, modelNameOrFileId)];
|
|
1934
2146
|
// If schema is provided, narrow the search
|
|
1935
2147
|
if (schemaNameOrId !== undefined) {
|
|
1936
|
-
const
|
|
1937
|
-
const
|
|
1938
|
-
const modelSchemaSchemaMod =
|
|
2148
|
+
const _mod_5 = await import('./BasePathResolver-B6CKqoKw.js');
|
|
2149
|
+
const _ns_5 = _mod_5.Q;
|
|
2150
|
+
const modelSchemaSchemaMod = _ns_5;
|
|
1939
2151
|
const { modelSchemas } = modelSchemaSchemaMod;
|
|
1940
|
-
const
|
|
1941
|
-
const
|
|
1942
|
-
const schemaSchemaMod =
|
|
2152
|
+
const _mod_6 = await import('./BasePathResolver-B6CKqoKw.js');
|
|
2153
|
+
const _ns_6 = _mod_6.O;
|
|
2154
|
+
const schemaSchemaMod = _ns_6;
|
|
1943
2155
|
const { schemas: schemasTable } = schemaSchemaMod;
|
|
1944
2156
|
if (typeof schemaNameOrId === 'number') {
|
|
1945
2157
|
// schemaNameOrId is schemaId
|
|
@@ -1987,9 +2199,9 @@ async function getModelIdByFileId(modelFileId) {
|
|
|
1987
2199
|
if (!db) {
|
|
1988
2200
|
throw new Error('Database not available');
|
|
1989
2201
|
}
|
|
1990
|
-
const
|
|
1991
|
-
const
|
|
1992
|
-
const modelSchemaMod =
|
|
2202
|
+
const _mod_7 = await import('./BasePathResolver-B6CKqoKw.js');
|
|
2203
|
+
const _ns_7 = _mod_7.M;
|
|
2204
|
+
const modelSchemaMod = _ns_7;
|
|
1993
2205
|
const { models: modelsTable } = modelSchemaMod;
|
|
1994
2206
|
const drizzleMod = await import('drizzle-orm');
|
|
1995
2207
|
const { eq } = drizzleMod;
|
|
@@ -2020,6 +2232,7 @@ var db = /*#__PURE__*/Object.freeze({
|
|
|
2020
2232
|
getObjectForRow: getObjectForRow,
|
|
2021
2233
|
getOwnedAddressesFromDb: getOwnedAddressesFromDb,
|
|
2022
2234
|
getPropertyIdForModelAndName: getPropertyIdForModelAndName,
|
|
2235
|
+
getPropertyIdForSchemaFileId: getPropertyIdForSchemaFileId,
|
|
2023
2236
|
getPropertyModelNameAndDataType: getPropertyModelNameAndDataType,
|
|
2024
2237
|
getSchemaId: getSchemaId,
|
|
2025
2238
|
getSchemaIdByFileId: getSchemaIdByFileId,
|
|
@@ -2033,5 +2246,5 @@ var db = /*#__PURE__*/Object.freeze({
|
|
|
2033
2246
|
writePropertyToDb: writePropertyToDb
|
|
2034
2247
|
});
|
|
2035
2248
|
|
|
2036
|
-
export {
|
|
2037
|
-
//# sourceMappingURL=db-
|
|
2249
|
+
export { addSchemaToDb as A, Boolean as B, renameModelInDb as C, DEFAULT_TEXT_MAX_LENGTH as D, loadModelsFromDbForSchema as E, File as F, getOwnedAddressesFromDb as G, Html as H, Image as I, Json as J, getPropertyIdForSchemaFileId as K, List as L, ModelPropertyDataTypes as M, Number$1 as N, getWatchedAddressesFromDb as O, Property as P, db as Q, Relation as R, THtmlEmbeddedDataUriPolicy as T, Date$1 as a, PropertyConstructor as b, PropertyMetadataKey as c, TProperty as d, TPropertyConstructor as e, TPropertyDataType as f, TPropertyDefs as g, TStorageType as h, TValidationRules as i, Text as j, isDataType as k, normalizePropertyRecordSchema as l, getPropertyIdForModelAndName as m, normalizeDataType as n, normalizePublisher as o, getAllAddressesFromDb as p, escapeSqliteString as q, normalizeHexAddress as r, addModelsToDb as s, getModelIdByFileId as t, getModelId as u, getAddressesForItemsFilter as v, normalizeAddressConfig as w, normalizeAddressList as x, writeModelToDb as y, writePropertyToDb as z };
|
|
2250
|
+
//# sourceMappingURL=db-WbrzEf7c.js.map
|