@seedprotocol/sdk 0.4.10 → 0.4.12
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/{ArweaveClient-sN5h2FvY.js → ArweaveClient-Bot35vMf.js} +3 -3
- package/dist/{ArweaveClient-sN5h2FvY.js.map → ArweaveClient-Bot35vMf.js.map} +1 -1
- package/dist/{ArweaveClient-DFqnm5Kj.js → ArweaveClient-C6mBPWwy.js} +3 -3
- package/dist/{ArweaveClient-DFqnm5Kj.js.map → ArweaveClient-C6mBPWwy.js.map} +1 -1
- package/dist/{Db-DIythELU.js → Db-DP7ELP9S.js} +3 -3
- package/dist/{Db-DIythELU.js.map → Db-DP7ELP9S.js.map} +1 -1
- package/dist/{Db-Dz17KxVs.js → Db-rlxROH4S.js} +3 -3
- package/dist/{Db-Dz17KxVs.js.map → Db-rlxROH4S.js.map} +1 -1
- package/dist/{EasClient-BadfcFDk.js → EasClient-CHI9lBP8.js} +2 -2
- package/dist/{EasClient-DosbWaZN.js.map → EasClient-CHI9lBP8.js.map} +1 -1
- package/dist/{EasClient-DosbWaZN.js → EasClient-CszJzwqw.js} +2 -2
- package/dist/{EasClient-BadfcFDk.js.map → EasClient-CszJzwqw.js.map} +1 -1
- package/dist/{FileManager-Wthr5yHO.js → FileManager-C7yOhPvS.js} +2 -2
- package/dist/{FileManager-Wthr5yHO.js.map → FileManager-C7yOhPvS.js.map} +1 -1
- package/dist/{FileManager-BHuVNWT3.js → FileManager-Dy3BbIxq.js} +2 -2
- package/dist/{FileManager-BHuVNWT3.js.map → FileManager-Dy3BbIxq.js.map} +1 -1
- package/dist/{ModelProperty-B9Z2DRxI.js → ModelProperty--OQb3Dy0.js} +57 -18
- package/dist/ModelProperty--OQb3Dy0.js.map +1 -0
- package/dist/{PathResolver-NEpTSgQK.js → PathResolver-BtnV9pXS.js} +2 -2
- package/dist/{PathResolver-NEpTSgQK.js.map → PathResolver-BtnV9pXS.js.map} +1 -1
- package/dist/{PathResolver-Cd1PZDLG.js → PathResolver-D--w4fFE.js} +2 -2
- package/dist/{PathResolver-Cd1PZDLG.js.map → PathResolver-D--w4fFE.js.map} +1 -1
- package/dist/{QueryClient-C9U8oZUe.js → QueryClient-BdNnK6Es.js} +2 -2
- package/dist/{QueryClient-C9U8oZUe.js.map → QueryClient-BdNnK6Es.js.map} +1 -1
- package/dist/{QueryClient-ndmA8MYL.js → QueryClient-Bia5wKCO.js} +2 -2
- package/dist/{QueryClient-ndmA8MYL.js.map → QueryClient-Bia5wKCO.js.map} +1 -1
- package/dist/{Schema-D1-HjT8z.js → Schema-DF4mLt86.js} +21 -21
- package/dist/{Schema-D1-HjT8z.js.map → Schema-DF4mLt86.js.map} +1 -1
- package/dist/{SchemaValidationService-CIXKzSpb.js → SchemaValidationService-D4LwnnIB.js} +2 -2
- package/dist/{SchemaValidationService-CIXKzSpb.js.map → SchemaValidationService-D4LwnnIB.js.map} +1 -1
- package/dist/cjs/{ModelProperty-09hNvSBl.js → ModelProperty-C5BRfISV.js} +57 -18
- package/dist/cjs/ModelProperty-C5BRfISV.js.map +1 -0
- package/dist/cjs/{Schema-BcwvUABB.js → Schema-DVJG8ISB.js} +20 -20
- package/dist/cjs/{Schema-BcwvUABB.js.map → Schema-DVJG8ISB.js.map} +1 -1
- package/dist/cjs/{SchemaValidationService-zty4nfCu.js → SchemaValidationService-_wef0VX6.js} +2 -2
- package/dist/cjs/{SchemaValidationService-zty4nfCu.js.map → SchemaValidationService-_wef0VX6.js.map} +1 -1
- package/dist/cjs/{getItem-Dlb5YSQn.js → getItem-CUGoglni.js} +2 -2
- package/dist/cjs/{getItem-Dlb5YSQn.js.map → getItem-CUGoglni.js.map} +1 -1
- package/dist/cjs/{getPublishPayload-BqL06sEI.js → getPublishPayload-CGl97AXX.js} +5 -5
- package/dist/cjs/{getPublishPayload-BqL06sEI.js.map → getPublishPayload-CGl97AXX.js.map} +1 -1
- package/dist/cjs/{getPublishUploads-oukGI2N6.js → getPublishUploads-BA5PdoJ3.js} +3 -3
- package/dist/cjs/{getPublishUploads-oukGI2N6.js.map → getPublishUploads-BA5PdoJ3.js.map} +1 -1
- package/dist/cjs/{getSegmentedItemProperties-JT984OOp.js → getSegmentedItemProperties-D3iBFPeo.js} +2 -2
- package/dist/cjs/{getSegmentedItemProperties-JT984OOp.js.map → getSegmentedItemProperties-D3iBFPeo.js.map} +1 -1
- package/dist/cjs/{index-BLETlVgA.js → index-B3K0jG2t.js} +109 -55
- package/dist/cjs/index-B3K0jG2t.js.map +1 -0
- package/dist/cjs/{index-jubgGeM2.js → index-CpBFvNId.js} +2 -2
- package/dist/cjs/index-CpBFvNId.js.map +1 -0
- package/dist/cjs/{ownership-vfvyz3KJ.js → ownership-CkgGUliG.js} +2 -2
- package/dist/cjs/{ownership-vfvyz3KJ.js.map → ownership-CkgGUliG.js.map} +1 -1
- package/dist/{getItem-f9rNUz7I.js → getItem-CbGS6wbp.js} +2 -2
- package/dist/{getItem-f9rNUz7I.js.map → getItem-CbGS6wbp.js.map} +1 -1
- package/dist/{getPublishPayload-BBI_j9I2.js → getPublishPayload-jUcwhhs1.js} +5 -5
- package/dist/{getPublishPayload-BBI_j9I2.js.map → getPublishPayload-jUcwhhs1.js.map} +1 -1
- package/dist/{getPublishUploads-BFM94w5S.js → getPublishUploads-BAsUuLSM.js} +3 -3
- package/dist/{getPublishUploads-BFM94w5S.js.map → getPublishUploads-BAsUuLSM.js.map} +1 -1
- package/dist/{getSegmentedItemProperties-Di9vevKz.js → getSegmentedItemProperties-1QklOMkN.js} +2 -2
- package/dist/{getSegmentedItemProperties-Di9vevKz.js.map → getSegmentedItemProperties-1QklOMkN.js.map} +1 -1
- package/dist/{index-j8WN8W6V.js → index-BUFvepcD.js} +124 -70
- package/dist/index-BUFvepcD.js.map +1 -0
- package/dist/{index-CSAVWKeA.js → index-BnBV-CWp.js} +3 -3
- package/dist/index-BnBV-CWp.js.map +1 -0
- package/dist/{index-ajj6SHkh.js → index-CjAALVQh.js} +2 -2
- package/dist/index-CjAALVQh.js.map +1 -0
- package/dist/main.cjs +1 -1
- package/dist/main.js +11 -11
- package/dist/node.js +10 -10
- package/dist/{ownership-DLNI17NE.js → ownership-CeuRaVwP.js} +2 -2
- package/dist/{ownership-DLNI17NE.js.map → ownership-CeuRaVwP.js.map} +1 -1
- package/dist/{property-C6qoOzLG.js → property-BiZvboSH.js} +4 -4
- package/dist/{property-C6qoOzLG.js.map → property-BiZvboSH.js.map} +1 -1
- package/dist/{queries-jMaUn86w.js → queries-B2xdenwS.js} +2 -2
- package/dist/{queries-jMaUn86w.js.map → queries-B2xdenwS.js.map} +1 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts.map +1 -1
- package/dist/src/Model/service/modelMachine.d.ts.map +1 -1
- package/dist/src/ModelProperty/ModelProperty.d.ts +5 -0
- package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
- package/dist/src/helpers/db.d.ts.map +1 -1
- package/dist/src/services/write/actors/writeToDatabase.d.ts.map +1 -1
- package/dist/src/vite/index.d.ts.map +1 -1
- package/dist/vite.cjs +10 -1
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.js +10 -1
- package/dist/vite.js.map +1 -1
- package/package.json +4 -1
- package/dist/ModelProperty-B9Z2DRxI.js.map +0 -1
- package/dist/cjs/ModelProperty-09hNvSBl.js.map +0 -1
- package/dist/cjs/index-BLETlVgA.js.map +0 -1
- package/dist/cjs/index-jubgGeM2.js.map +0 -1
- package/dist/index-CSAVWKeA.js.map +0 -1
- package/dist/index-ajj6SHkh.js.map +0 -1
- package/dist/index-j8WN8W6V.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { fromCallback, setup, assign, createActor } from 'xstate';
|
|
2
2
|
import 'reflect-metadata';
|
|
3
|
-
import { j as BaseDb, af as writeProcessMachine, u as models, v as properties, M as Model, r as modelPropertiesToObject, a0 as schemas, U as modelSchemas, n as normalizeDataType,
|
|
3
|
+
import { j as BaseDb, af as writeProcessMachine, u as models, v as properties, M as Model, r as modelPropertiesToObject, a0 as schemas, U as modelSchemas, ag as getModelIdByFileId, n as normalizeDataType, ah as generateId, ai as waitForEntityIdle, aj as createReactiveProxy, ak as findEntity, C as BaseFileManager, al as forceRemoveFromCaches, am as runDestroyLifecycle, an as getModelId } from './index-BUFvepcD.js';
|
|
4
4
|
import 'pluralize';
|
|
5
5
|
import { eq, and } from 'drizzle-orm';
|
|
6
6
|
import debug from 'debug';
|
|
7
|
-
import { S as Schema } from './Schema-
|
|
7
|
+
import { S as Schema } from './Schema-DF4mLt86.js';
|
|
8
8
|
import 'drizzle-orm/sqlite-core';
|
|
9
9
|
import 'nanoid';
|
|
10
10
|
import 'nanoid-dictionary';
|
|
@@ -15,7 +15,7 @@ import 'drizzle-orm/casing';
|
|
|
15
15
|
import 'eventemitter3';
|
|
16
16
|
import 'arweave';
|
|
17
17
|
import '@sinclair/typebox';
|
|
18
|
-
import './SchemaValidationService-
|
|
18
|
+
import './SchemaValidationService-D4LwnnIB.js';
|
|
19
19
|
import '@sinclair/typebox/value';
|
|
20
20
|
|
|
21
21
|
const logger$3 = debug('seedSdk:modelProperty:actors:saveToSchema');
|
|
@@ -26,14 +26,14 @@ const logger$3 = debug('seedSdk:modelProperty:actors:saveToSchema');
|
|
|
26
26
|
*/
|
|
27
27
|
async function getSchemaNameFromModel(modelName) {
|
|
28
28
|
// Get the latest schema files and find which one contains this model
|
|
29
|
-
const _mod_0 = await import('./index-
|
|
29
|
+
const _mod_0 = await import('./index-BUFvepcD.js');
|
|
30
30
|
const _ns_0 = _mod_0.aZ;
|
|
31
31
|
const schemaHelpersMod = _ns_0;
|
|
32
32
|
const { listLatestSchemaFiles } = schemaHelpersMod;
|
|
33
33
|
const latestSchemas = await listLatestSchemaFiles();
|
|
34
34
|
for (const schema of latestSchemas) {
|
|
35
35
|
try {
|
|
36
|
-
const _mod_1 = await import('./index-
|
|
36
|
+
const _mod_1 = await import('./index-BUFvepcD.js');
|
|
37
37
|
const _ns_1 = _mod_1.aX;
|
|
38
38
|
const fileManagerMod = _ns_1;
|
|
39
39
|
const { BaseFileManager } = fileManagerMod;
|
|
@@ -53,7 +53,7 @@ async function getSchemaNameFromModel(modelName) {
|
|
|
53
53
|
const saveToSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
54
54
|
const _saveToSchema = async () => {
|
|
55
55
|
// Use dynamic import to break circular dependency
|
|
56
|
-
const validationServiceMod = await import('./SchemaValidationService-
|
|
56
|
+
const validationServiceMod = await import('./SchemaValidationService-D4LwnnIB.js');
|
|
57
57
|
const { SchemaValidationService } = validationServiceMod;
|
|
58
58
|
const validationService = new SchemaValidationService();
|
|
59
59
|
// Validate property structure before saving
|
|
@@ -72,7 +72,7 @@ const saveToSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
72
72
|
throw new Error(`Model not found for modelId: ${context.modelId}`);
|
|
73
73
|
}
|
|
74
74
|
// Persist to database only - schema file is updated only when user calls Schema.saveNewVersion()
|
|
75
|
-
const _mod_2 = await import('./index-
|
|
75
|
+
const _mod_2 = await import('./index-BUFvepcD.js');
|
|
76
76
|
const _ns_2 = _mod_2.aY;
|
|
77
77
|
const dbMod = _ns_2;
|
|
78
78
|
const { savePropertyToDb } = dbMod;
|
|
@@ -80,7 +80,7 @@ const saveToSchema = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
80
80
|
// Mark schema as draft so user knows to save
|
|
81
81
|
const schemaName = context._schemaName ?? (await getSchemaNameFromModel(context.modelName));
|
|
82
82
|
if (schemaName) {
|
|
83
|
-
const _mod_3 = await import('./Schema-
|
|
83
|
+
const _mod_3 = await import('./Schema-DF4mLt86.js');
|
|
84
84
|
const _ns_3 = _mod_3.b;
|
|
85
85
|
const schemaMod = _ns_3;
|
|
86
86
|
const { Schema } = schemaMod;
|
|
@@ -115,7 +115,7 @@ const compareAndMarkDraft = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
115
115
|
const schemaFileIdForResolve = fullContext._propertyFileId || (typeof fullContext.id === 'string' ? fullContext.id : undefined);
|
|
116
116
|
if (schemaFileIdForResolve && (fullContext.modelName === undefined || fullContext.dataType === undefined)) {
|
|
117
117
|
try {
|
|
118
|
-
const _mod_4 = await import('./index-
|
|
118
|
+
const _mod_4 = await import('./index-BUFvepcD.js');
|
|
119
119
|
const _ns_4 = _mod_4.aY;
|
|
120
120
|
const dbMod = _ns_4;
|
|
121
121
|
const { getPropertyModelNameAndDataType, getModelNameByModelId } = dbMod;
|
|
@@ -162,7 +162,7 @@ const compareAndMarkDraft = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
162
162
|
if (fullContext.modelName && fullContext.name && schemaFileId) {
|
|
163
163
|
logger$2(`[compareAndMarkDraft] _originalValues not set, but saving to database anyway for property ${context.modelName}:${context.name} (schemaFileId: ${schemaFileId})`);
|
|
164
164
|
try {
|
|
165
|
-
const _mod_5 = await import('./index-
|
|
165
|
+
const _mod_5 = await import('./index-BUFvepcD.js');
|
|
166
166
|
const _ns_5 = _mod_5.aY;
|
|
167
167
|
const dbMod = _ns_5;
|
|
168
168
|
const { savePropertyToDb } = dbMod;
|
|
@@ -224,7 +224,7 @@ const compareAndMarkDraft = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
224
224
|
logger$2(`Property ${fullContext.modelName}:${fullContext.name} has changes, marking as edited`);
|
|
225
225
|
logger$2(`[compareAndMarkDraft] Context when saving: id=${fullContext.id}, _propertyFileId=${fullContext._propertyFileId}, name=${fullContext.name}, _originalValues.name=${fullContext._originalValues?.name}`);
|
|
226
226
|
// Use dynamic import to break circular dependency
|
|
227
|
-
const _mod_6 = await import('./index-
|
|
227
|
+
const _mod_6 = await import('./index-BUFvepcD.js');
|
|
228
228
|
const _ns_6 = _mod_6.aY;
|
|
229
229
|
const dbMod = _ns_6;
|
|
230
230
|
const { savePropertyToDb } = dbMod;
|
|
@@ -240,7 +240,7 @@ const compareAndMarkDraft = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
240
240
|
// Mark schema as draft if schema name is available
|
|
241
241
|
if (fullContext._schemaName) {
|
|
242
242
|
// Get the Schema instance and mark it as draft
|
|
243
|
-
const _mod_7 = await import('./Schema-
|
|
243
|
+
const _mod_7 = await import('./Schema-DF4mLt86.js');
|
|
244
244
|
const _ns_7 = _mod_7.b;
|
|
245
245
|
const schemaMod = _ns_7;
|
|
246
246
|
const { Schema } = schemaMod;
|
|
@@ -259,7 +259,7 @@ const compareAndMarkDraft = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
259
259
|
logger$2(`Property ${fullContext.modelName}:${fullContext.name} has no changes`);
|
|
260
260
|
// Clear isEdited flag in database
|
|
261
261
|
try {
|
|
262
|
-
const _mod_8 = await import('./index-
|
|
262
|
+
const _mod_8 = await import('./index-CjAALVQh.js');
|
|
263
263
|
const _ns_8 = _mod_8.s;
|
|
264
264
|
const seedSchemaMod = _ns_8;
|
|
265
265
|
const { properties: propertiesTable, models: modelsTable } = seedSchemaMod;
|
|
@@ -325,7 +325,7 @@ const validateProperty = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
325
325
|
// Brief wait so trackPendingWrite from ModelProperty.create() has time to run (it's in setTimeout(0))
|
|
326
326
|
await new Promise((r) => setTimeout(r, 60));
|
|
327
327
|
try {
|
|
328
|
-
const _mod_9 = await import('./index-
|
|
328
|
+
const _mod_9 = await import('./index-BUFvepcD.js');
|
|
329
329
|
const _ns_9 = _mod_9.aY;
|
|
330
330
|
const dbMod = _ns_9;
|
|
331
331
|
const { getPropertyModelNameAndDataType, getModelNameByModelId } = dbMod;
|
|
@@ -379,10 +379,10 @@ const validateProperty = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
379
379
|
fullContext = { ...fullContext, dataType: (fullContext.dataType ?? context._originalValues?.dataType) || 'Text' };
|
|
380
380
|
}
|
|
381
381
|
// Use dynamic imports to break circular dependencies
|
|
382
|
-
const validationServiceMod = await import('./SchemaValidationService-
|
|
382
|
+
const validationServiceMod = await import('./SchemaValidationService-D4LwnnIB.js');
|
|
383
383
|
const { SchemaValidationService } = validationServiceMod;
|
|
384
384
|
const validationService = new SchemaValidationService();
|
|
385
|
-
const _mod_10 = await import('./Schema-
|
|
385
|
+
const _mod_10 = await import('./Schema-DF4mLt86.js');
|
|
386
386
|
const _ns_10 = _mod_10.b;
|
|
387
387
|
const schemaMod = _ns_10;
|
|
388
388
|
const { Schema } = schemaMod;
|
|
@@ -1138,6 +1138,41 @@ class ModelProperty {
|
|
|
1138
1138
|
// If we can't get schema name, that's okay - it will be set later if needed
|
|
1139
1139
|
}
|
|
1140
1140
|
}
|
|
1141
|
+
/**
|
|
1142
|
+
* Resolve schema name from DB when _schemaName is missing (e.g. destroy ran before _setSchemaName finished).
|
|
1143
|
+
* Uses context.id (schemaFileId) and context.modelId to query properties → model_schemas → schemas.
|
|
1144
|
+
*/
|
|
1145
|
+
async _resolveSchemaNameForDestroy(db, context) {
|
|
1146
|
+
try {
|
|
1147
|
+
let modelId = context.modelId;
|
|
1148
|
+
const schemaFileId = context.id ?? context._propertyFileId;
|
|
1149
|
+
// If we don't have modelId, get it from the property row by schemaFileId
|
|
1150
|
+
if (modelId == null && schemaFileId) {
|
|
1151
|
+
const propRows = await db
|
|
1152
|
+
.select({ modelId: properties.modelId })
|
|
1153
|
+
.from(properties)
|
|
1154
|
+
.where(eq(properties.schemaFileId, schemaFileId))
|
|
1155
|
+
.limit(1);
|
|
1156
|
+
if (propRows.length > 0 && propRows[0].modelId != null) {
|
|
1157
|
+
modelId = propRows[0].modelId;
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
if (modelId == null)
|
|
1161
|
+
return undefined;
|
|
1162
|
+
// Resolve modelFileId (string) to database ID (number) if needed - modelSchemas.modelId expects number
|
|
1163
|
+
const modelIdNum = typeof modelId === 'string' ? await getModelIdByFileId(modelId) : modelId;
|
|
1164
|
+
const modelSchemaRecords = await db
|
|
1165
|
+
.select({ schemaName: schemas.name })
|
|
1166
|
+
.from(modelSchemas)
|
|
1167
|
+
.innerJoin(schemas, eq(modelSchemas.schemaId, schemas.id))
|
|
1168
|
+
.where(eq(modelSchemas.modelId, modelIdNum))
|
|
1169
|
+
.limit(1);
|
|
1170
|
+
return modelSchemaRecords.length > 0 ? modelSchemaRecords[0].schemaName ?? undefined : undefined;
|
|
1171
|
+
}
|
|
1172
|
+
catch {
|
|
1173
|
+
return undefined;
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1141
1176
|
/**
|
|
1142
1177
|
* Manually set the schema name for this property
|
|
1143
1178
|
* Useful when you know the schema name from context (e.g., when working with Schema instances)
|
|
@@ -1681,11 +1716,15 @@ class ModelProperty {
|
|
|
1681
1716
|
getService: (instance) => instance._service,
|
|
1682
1717
|
doDestroy: async () => {
|
|
1683
1718
|
const db = BaseDb.getAppDb();
|
|
1684
|
-
|
|
1719
|
+
let schemaName = context._schemaName;
|
|
1685
1720
|
const modelName = context.modelName;
|
|
1686
1721
|
const propertyName = context.name;
|
|
1687
1722
|
if (!modelName || !propertyName)
|
|
1688
1723
|
return;
|
|
1724
|
+
// Resolve schema name from DB when _schemaName is missing (e.g. destroy ran before _setSchemaName finished)
|
|
1725
|
+
if (!schemaName && db) {
|
|
1726
|
+
schemaName = await this._resolveSchemaNameForDestroy(db, context);
|
|
1727
|
+
}
|
|
1689
1728
|
if (db && schemaName) {
|
|
1690
1729
|
const propertyRecords = await db
|
|
1691
1730
|
.select({ propertyId: properties.id })
|
|
@@ -1728,4 +1767,4 @@ var ModelProperty$1 = /*#__PURE__*/Object.freeze({
|
|
|
1728
1767
|
});
|
|
1729
1768
|
|
|
1730
1769
|
export { ModelProperty };
|
|
1731
|
-
//# sourceMappingURL=ModelProperty
|
|
1770
|
+
//# sourceMappingURL=ModelProperty--OQb3Dy0.js.map
|