@seedprotocol/sdk 0.7.4-next.793.g6dd83dd → 0.7.4
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-DT63t0XU.js → BasePathResolver-DrzGVH9L.js} +231 -39
- package/dist/BasePathResolver-DrzGVH9L.js.map +1 -0
- package/dist/{ClientManager-Cos8NaRU.js → ClientManager-Dfu4jcgm.js} +300 -188
- package/dist/ClientManager-Dfu4jcgm.js.map +1 -0
- package/dist/{Item-CoP48bl3.js → Item-BUUFuywT.js} +75 -219
- package/dist/Item-BUUFuywT.js.map +1 -0
- package/dist/{ModelProperty-jSo2QWIc.js → ModelProperty-B6cnRvIz.js} +37 -38
- package/dist/ModelProperty-B6cnRvIz.js.map +1 -0
- package/dist/{Schema-DN1KwJ57.js → Schema-Bf-jOLq0.js} +36 -35
- package/dist/{Schema-DN1KwJ57.js.map → Schema-Bf-jOLq0.js.map} +1 -1
- package/dist/{SchemaValidationService-CCG9Bu__.js → SchemaValidationService-BNYMacsx.js} +7 -8
- package/dist/{SchemaValidationService-CCG9Bu__.js.map → SchemaValidationService-BNYMacsx.js.map} +1 -1
- package/dist/{backfillMetadataPropertyIds-D8t61oNl.js → backfillMetadataPropertyIds-C2-s_jUa.js} +4 -5
- package/dist/{backfillMetadataPropertyIds-D8t61oNl.js.map → backfillMetadataPropertyIds-C2-s_jUa.js.map} +1 -1
- package/dist/{configurePlatform-Su9vV5qO.js → configurePlatform-BzfirKuM.js} +3 -4
- package/dist/{configurePlatform-Su9vV5qO.js.map → configurePlatform-BzfirKuM.js.map} +1 -1
- package/dist/{detachRowsBeforeDelete-DcWDZ8KP.js → detachRowsBeforeDelete-B0Daoz9Z.js} +3 -4
- package/dist/{detachRowsBeforeDelete-DcWDZ8KP.js.map → detachRowsBeforeDelete-B0Daoz9Z.js.map} +1 -1
- package/dist/{eas-Ce0KDpvb.js → eas-Dq5Kx_Nd.js} +14 -32
- package/dist/eas-Dq5Kx_Nd.js.map +1 -0
- package/dist/{errors-D1brJy1k.js → errors-DdWbxb_n.js} +42 -39
- package/dist/errors-DdWbxb_n.js.map +1 -0
- package/dist/{getItem-Cs5IIZCQ.js → getItem-9bYSErSj.js} +4 -5
- package/dist/{getItem-Cs5IIZCQ.js.map → getItem-9bYSErSj.js.map} +1 -1
- package/dist/{getPublishPayload-CquFaK1c.js → getPublishPayload-DPy-uMrR.js} +28 -29
- package/dist/getPublishPayload-DPy-uMrR.js.map +1 -0
- package/dist/{getPublishUploads-Bv9aOq2x.js → getPublishUploads-J-143iSV.js} +10 -11
- package/dist/{getPublishUploads-Bv9aOq2x.js.map → getPublishUploads-J-143iSV.js.map} +1 -1
- package/dist/{index-BPrJV9Wt.js → index-7y2f_iQz.js} +2 -2
- package/dist/index-7y2f_iQz.js.map +1 -0
- package/dist/{index-DhP5gMMF.js → index-C61Rxy0F.js} +9 -10
- package/dist/index-C61Rxy0F.js.map +1 -0
- package/dist/{index.browser-cpZehMwT.js → index.browser-C1pisOEa.js} +10 -10
- package/dist/{index.browser-cpZehMwT.js.map → index.browser-C1pisOEa.js.map} +1 -1
- package/dist/{index.node-D_-a9z-S.js → index.node-BAlST8pD.js} +6 -6
- package/dist/{index.node-D_-a9z-S.js.map → index.node-BAlST8pD.js.map} +1 -1
- package/dist/main.js +27 -28
- package/dist/main.js.map +1 -1
- package/dist/node.js +12 -13
- package/dist/node.js.map +1 -1
- package/dist/platform.browser.js +6 -7
- package/dist/platform.browser.js.map +1 -1
- package/dist/platform.node.js +5 -6
- package/dist/platform.node.js.map +1 -1
- package/dist/{property-DNfhGsdq.js → property-zFPMtR3T.js} +10 -14
- package/dist/property-zFPMtR3T.js.map +1 -0
- package/dist/{propertyValidationRules-BiEBQvPZ.js → propertyValidationRules-CeFVhdQg.js} +10 -10
- package/dist/{propertyValidationRules-BiEBQvPZ.js.map → propertyValidationRules-CeFVhdQg.js.map} +1 -1
- package/dist/{publishDraftGraph-BZ6gku_X.js → publishDraftGraph-CuVq6iAR.js} +7 -6
- package/dist/{publishDraftGraph-BZ6gku_X.js.map → publishDraftGraph-CuVq6iAR.js.map} +1 -1
- package/dist/{resetAmbiguousLegacyItemData-CkSoBEOU.js → resetAmbiguousLegacyItemData-DsFTnMBz.js} +5 -6
- package/dist/resetAmbiguousLegacyItemData-DsFTnMBz.js.map +1 -0
- package/dist/{resolveModelForSyncedSeed-CsnKV72V.js → resolveModelForSyncedSeed-RUsgAZXG.js} +2 -2
- package/dist/{resolveModelForSyncedSeed-CsnKV72V.js.map → resolveModelForSyncedSeed-RUsgAZXG.js.map} +1 -1
- package/dist/src/Item/Item.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/propertyMachine.d.ts +4 -4
- package/dist/src/Model/Model.d.ts +3 -2
- package/dist/src/Model/Model.d.ts.map +1 -1
- package/dist/src/ModelProperty/ModelProperty.d.ts +1 -1
- package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts +1 -1
- package/dist/src/Schema/service/schemaMachine.d.ts +2 -2
- package/dist/src/client/ClientManager.d.ts +6 -6
- package/dist/src/client/clientManagerMachine.d.ts +2 -2
- package/dist/src/client/clientManagerMachine.d.ts.map +1 -1
- package/dist/src/db/canonicalizeModelTypes.d.ts +18 -0
- package/dist/src/db/canonicalizeModelTypes.d.ts.map +1 -0
- package/dist/src/db/read/getModelSchemas.d.ts +6 -0
- package/dist/src/db/read/getModelSchemas.d.ts.map +1 -1
- package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
- package/dist/src/db/read/resolveModelRecord.d.ts.map +1 -1
- package/dist/src/db/write/createMetadata.d.ts.map +1 -1
- package/dist/src/db/write/updateMetadata.d.ts.map +1 -1
- package/dist/src/eas.d.ts.map +1 -1
- package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
- package/dist/src/helpers/db.d.ts +20 -0
- package/dist/src/helpers/db.d.ts.map +1 -1
- package/dist/src/helpers/index.d.ts +3 -1
- package/dist/src/helpers/index.d.ts.map +1 -1
- package/dist/src/helpers/metadataPropertyNames.d.ts +12 -0
- package/dist/src/helpers/metadataPropertyNames.d.ts.map +1 -1
- package/dist/src/imports/json.d.ts +10 -0
- package/dist/src/imports/json.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/query/createLocalQueryDataSource.d.ts.map +1 -1
- package/dist/src/types/import.d.ts +4 -0
- package/dist/src/types/import.d.ts.map +1 -1
- package/dist/{syncDbWithEas-CfRijZhj.js → syncDbWithEas-CRpnkq00.js} +157 -61
- package/dist/syncDbWithEas-CRpnkq00.js.map +1 -0
- package/dist/{tabEvents-D5X2Hwcp.js → tabEvents-nBUq_1u1.js} +6 -6
- package/dist/{tabEvents-D5X2Hwcp.js.map → tabEvents-nBUq_1u1.js.map} +1 -1
- package/dist/{tolerantWebAccess-BNYRvW9a.js → tolerantWebAccess-DIt3R8_u.js} +7 -8
- package/dist/{tolerantWebAccess-BNYRvW9a.js.map → tolerantWebAccess-DIt3R8_u.js.map} +1 -1
- package/dist/{updateSeedRevokedAt-B-xAQxaj.js → updateSeedRevokedAt-DtTPSzpM.js} +3 -3
- package/dist/{updateSeedRevokedAt-B-xAQxaj.js.map → updateSeedRevokedAt-DtTPSzpM.js.map} +1 -1
- package/package.json +5 -5
- package/dist/BasePathResolver-DT63t0XU.js.map +0 -1
- package/dist/ClientManager-Cos8NaRU.js.map +0 -1
- package/dist/Item-CoP48bl3.js.map +0 -1
- package/dist/ModelProperty-jSo2QWIc.js.map +0 -1
- package/dist/eas-Ce0KDpvb.js.map +0 -1
- package/dist/errors-D1brJy1k.js.map +0 -1
- package/dist/getPublishPayload-CquFaK1c.js.map +0 -1
- package/dist/index-BPrJV9Wt.js.map +0 -1
- package/dist/index-DhP5gMMF.js.map +0 -1
- package/dist/property-DNfhGsdq.js.map +0 -1
- package/dist/resetAmbiguousLegacyItemData-CkSoBEOU.js.map +0 -1
- package/dist/syncDbWithEas-CfRijZhj.js.map +0 -1
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { waitFor, fromCallback, setup, assign, stateIn, createActor, isMachineSnapshot } from 'xstate';
|
|
2
|
-
import {
|
|
2
|
+
import { E as BaseDb, C as versions, m as metadata, A as seeds, F as resolveStorageNameToSchemaName, aV as toSchemaPropertyName, z as schemas, s as models, q as modelSchemas, aT as getOwnedAddressesFromDb, ac as ZERO_BYTES32, aE as normalizeAddressList, a0 as normalizeHexAddress, aB as getAddressesForItemsFilter, ag as INTERNAL_PROPERTY_NAMES, J as BaseFileManager, aW as getStorageTransactionIdForSeedUid, aX as convertTxIdToImage, i as isDataType, X as normalizePublisher, n as normalizeDataType, aY as getMetadataPropertyNamesForQuery, aA as ensureImageLocal, as as ImageSize, aZ as downloadTransactionIdWithDedupe, a_ as resolveMetadataRecord, u as properties, M as ModelPropertyDataTypes, $ as generateId, aj as INTERNAL_DATA_TYPES, r as modelUids, a1 as listRelationEasPropertyName, a2 as easPropertyNameForPublish, L as resolveItemModelFileId, a$ as getPropertyIdForSchemaFileId, K as getPropertyIdForModelAndName, a3 as toMetadataPropertyName, b0 as getDataTypeFromString, b1 as getMimeType, ap as INTERNAL_STORAGE_MODEL_FILE_IDS, V as getItemStorageSubdir, W as getItemStorageLocalFileName, g as normalizePropertyRecordSchema, b2 as listRelationStoragePropertyName, b3 as PROPERTY_NAMES_EXEMPT_FROM_ID_SUFFIX_STRIP, a8 as getCorrectId, H as eventEmitter, b4 as getAlternatePropertyNameForInstanceLookup, ah as isStorageSeedRef } from './BasePathResolver-DrzGVH9L.js';
|
|
3
3
|
import { or, isNull, eq, max, count, and, getTableColumns, sql, desc, inArray, isNotNull, gt } from 'drizzle-orm';
|
|
4
|
-
import pluralize from 'pluralize';
|
|
5
4
|
import debug from 'debug';
|
|
6
5
|
import { BehaviorSubject } from 'rxjs';
|
|
6
|
+
import pluralize from 'pluralize';
|
|
7
7
|
import { startCase, upperFirst, camelCase, orderBy } from 'lodash-es';
|
|
8
|
-
import {
|
|
9
|
-
import { isValidEasAttestationUid, isPlaceholderUid, BaseQueryClient, BaseEasClient, GET_SCHEMAS, getEasSchemaUidForSchemaDefinition, getSchemaUidForModelFromCache, setSchemaUidForModel, cachedSchemaLookup, getEasSchemaUidForExactDefinition } from '@seedprotocol/eas';
|
|
8
|
+
import { isValidEasAttestationUid, easName, isPlaceholderUid, BaseQueryClient, BaseEasClient, GET_SCHEMAS, getEasSchemaUidForSchemaDefinition, getSchemaUidForModelFromCache, setSchemaUidForModel, cachedSchemaLookup, getEasSchemaUidForExactDefinition } from '@seedprotocol/eas';
|
|
10
9
|
import { fetchArweaveRawTextAcrossGateways } from '@seedprotocol/arweave';
|
|
11
|
-
import { d as notifyFileSaved, f as withTabLock } from './tabEvents-
|
|
10
|
+
import { d as notifyFileSaved, f as withTabLock } from './tabEvents-nBUq_1u1.js';
|
|
12
11
|
import { modelPropertiesToObject } from './model-oHA3YhOd.js';
|
|
13
12
|
|
|
14
13
|
/**
|
|
@@ -145,150 +144,6 @@ var publishConfig = /*#__PURE__*/Object.freeze({
|
|
|
145
144
|
setUploadExecutor: setUploadExecutor
|
|
146
145
|
});
|
|
147
146
|
|
|
148
|
-
/** Ref model name when propDef is a List of Relation, else undefined. */
|
|
149
|
-
function listRelationRef(propDef) {
|
|
150
|
-
if (!propDef)
|
|
151
|
-
return undefined;
|
|
152
|
-
if (normalizeDataType(propDef.dataType) !== 'List')
|
|
153
|
-
return undefined;
|
|
154
|
-
return propDef.ref || propDef.refModelName || undefined;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Storage/EAS name for a List-of-relation property (`authorIdentityIds`), given either its
|
|
158
|
-
* schema key (`authors`) or its storage name. A name already in storage form is returned as-is,
|
|
159
|
-
* so this is safe on ItemProperties built before their schema was known.
|
|
160
|
-
* Returns undefined when propDef is not a List of Relation.
|
|
161
|
-
*/
|
|
162
|
-
function listRelationEasPropertyName(propertyName, propDef) {
|
|
163
|
-
const ref = listRelationRef(propDef);
|
|
164
|
-
if (!ref || !propertyName)
|
|
165
|
-
return undefined;
|
|
166
|
-
if (propertyName.endsWith(`${ref}Ids`))
|
|
167
|
-
return propertyName;
|
|
168
|
-
return `${pluralize(propertyName, 1)}${ref}Ids`;
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* For a schema property key like `authors` (List of Relation to Identity), returns the
|
|
172
|
-
* internal storage/EAS name: `authorIdentityIds` (singular + ref + Ids).
|
|
173
|
-
*/
|
|
174
|
-
function listRelationStoragePropertyName(propertySchemas, schemaPropertyKey) {
|
|
175
|
-
return listRelationEasPropertyName(schemaPropertyKey, propertySchemas[schemaPropertyKey]);
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Reverse of listRelationStoragePropertyName: maps DB/EAS name `authorIdentityIds` to schema key `authors`.
|
|
179
|
-
*/
|
|
180
|
-
function resolveStorageNameToSchemaName(propertySchemas, storagePropertyName) {
|
|
181
|
-
for (const [schemaKey, propDef] of Object.entries(propertySchemas)) {
|
|
182
|
-
if (normalizeDataType(propDef?.dataType) !== 'List')
|
|
183
|
-
continue;
|
|
184
|
-
const ref = propDef.ref || propDef.refModelName;
|
|
185
|
-
if (!ref)
|
|
186
|
-
continue;
|
|
187
|
-
const internalName = `${pluralize(schemaKey, 1)}${ref}Ids`;
|
|
188
|
-
if (internalName === storagePropertyName) {
|
|
189
|
-
return schemaKey;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
return undefined;
|
|
193
|
-
}
|
|
194
|
-
/** Internal property names that never use Id-suffix metadata convention */
|
|
195
|
-
const ID_SUFFIX_EXCLUDE = new Set(['storageTransactionId', 'transactionId']);
|
|
196
|
-
/** Data types that store metadata with Id suffix in DB */
|
|
197
|
-
const METADATA_ID_SUFFIX_TYPES = ['Image', 'File', 'Html', 'Relation'];
|
|
198
|
-
/**
|
|
199
|
-
* Whether this type uses Id suffix in metadata table.
|
|
200
|
-
*/
|
|
201
|
-
function needsMetadataIdSuffix(dataType, refValueType) {
|
|
202
|
-
const dt = normalizeDataType(dataType);
|
|
203
|
-
const rvt = normalizeDataType(refValueType);
|
|
204
|
-
return (METADATA_ID_SUFFIX_TYPES.includes(dt) ||
|
|
205
|
-
METADATA_ID_SUFFIX_TYPES.includes(rvt));
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Canonical metadata property name for WRITES.
|
|
209
|
-
* Use when creating/updating metadata.
|
|
210
|
-
*/
|
|
211
|
-
function toMetadataPropertyName(propertyName, dataType, refValueType) {
|
|
212
|
-
if (ID_SUFFIX_EXCLUDE.has(propertyName))
|
|
213
|
-
return propertyName;
|
|
214
|
-
if (propertyName.endsWith('Ids'))
|
|
215
|
-
return propertyName;
|
|
216
|
-
if (propertyName.endsWith('Id'))
|
|
217
|
-
return propertyName;
|
|
218
|
-
if (needsMetadataIdSuffix(dataType, refValueType)) {
|
|
219
|
-
return `${propertyName}Id`;
|
|
220
|
-
}
|
|
221
|
-
return propertyName;
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* For READS: property names to include in OR query (both variants).
|
|
225
|
-
* When dataType is undefined, includes all variants for safety (backwards compat with getPropertyData).
|
|
226
|
-
*/
|
|
227
|
-
function getMetadataPropertyNamesForQuery(propertyName, dataType, refValueType) {
|
|
228
|
-
if (ID_SUFFIX_EXCLUDE.has(propertyName))
|
|
229
|
-
return [propertyName];
|
|
230
|
-
if (propertyName.endsWith('Ids'))
|
|
231
|
-
return [propertyName];
|
|
232
|
-
if (propertyName.endsWith('Id')) {
|
|
233
|
-
const base = propertyName.slice(0, -2);
|
|
234
|
-
return [propertyName, base];
|
|
235
|
-
}
|
|
236
|
-
const needsId = needsMetadataIdSuffix(dataType, refValueType) ||
|
|
237
|
-
(dataType === undefined && refValueType === undefined);
|
|
238
|
-
if (needsId) {
|
|
239
|
-
return [propertyName, `${propertyName}Id`, `${propertyName}Ids`];
|
|
240
|
-
}
|
|
241
|
-
return [propertyName];
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* Schema property name from metadata name (strip Id/Ids suffix).
|
|
245
|
-
*/
|
|
246
|
-
function toSchemaPropertyName(propertyName) {
|
|
247
|
-
if (propertyName.endsWith('Ids'))
|
|
248
|
-
return propertyName.slice(0, -3);
|
|
249
|
-
if (propertyName.endsWith('Id'))
|
|
250
|
-
return propertyName.slice(0, -2);
|
|
251
|
-
return undefined;
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Alternate property name for instance lookup (base <-> Id variant).
|
|
255
|
-
*/
|
|
256
|
-
function getAlternatePropertyNameForInstanceLookup(propertyName) {
|
|
257
|
-
if (ID_SUFFIX_EXCLUDE.has(propertyName))
|
|
258
|
-
return undefined;
|
|
259
|
-
if (propertyName.endsWith('Id'))
|
|
260
|
-
return propertyName.slice(0, -2);
|
|
261
|
-
return `${propertyName}Id`;
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Resolve the best metadata record when multiple variants exist (base + Id).
|
|
265
|
-
* For Image/File/Html: prefer the record with refResolvedValue (Id variant has filename).
|
|
266
|
-
*/
|
|
267
|
-
function resolveMetadataRecord(records, preferredPropertyName, dataType, refValueType) {
|
|
268
|
-
if (records.length === 0)
|
|
269
|
-
throw new Error('No records to resolve');
|
|
270
|
-
if (records.length === 1)
|
|
271
|
-
return records[0];
|
|
272
|
-
const needsId = needsMetadataIdSuffix(dataType, refValueType) ||
|
|
273
|
-
(dataType === undefined && refValueType === undefined);
|
|
274
|
-
// For Image/File/Html: prefer the record with refResolvedValue (Id variant has filename)
|
|
275
|
-
if (needsId) {
|
|
276
|
-
const withRef = records.find((r) => r.refResolvedValue);
|
|
277
|
-
if (withRef)
|
|
278
|
-
return withRef;
|
|
279
|
-
}
|
|
280
|
-
// Also prefer by refSeedType when we need file ref
|
|
281
|
-
if (needsId) {
|
|
282
|
-
const byRefSeed = records.find((r) => r.refSeedType === 'image' ||
|
|
283
|
-
r.refSeedType === 'file' ||
|
|
284
|
-
r.refSeedType === 'html');
|
|
285
|
-
if (byRefSeed)
|
|
286
|
-
return byRefSeed;
|
|
287
|
-
}
|
|
288
|
-
// Fallback: prefer exact propertyName match, else first
|
|
289
|
-
return (records.find((r) => r.propertyName === preferredPropertyName) ?? records[0]);
|
|
290
|
-
}
|
|
291
|
-
|
|
292
147
|
/**
|
|
293
148
|
* Proxy [[GetOwnProperty]] that stays compatible with the target.
|
|
294
149
|
* Never overrides an own descriptor, never invents on a non-extensible target,
|
|
@@ -725,7 +580,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
725
580
|
const itemPropertyMod = await Promise.resolve().then(function () { return ItemProperty$1; });
|
|
726
581
|
const { ItemProperty } = itemPropertyMod;
|
|
727
582
|
const { modelPropertiesToObject } = await import('./model-oHA3YhOd.js');
|
|
728
|
-
const _mod_0 = await import('./errors-
|
|
583
|
+
const _mod_0 = await import('./errors-DdWbxb_n.js');
|
|
729
584
|
const _ns_0 = _mod_0.h;
|
|
730
585
|
const { Model } = _ns_0;
|
|
731
586
|
// Resolve Model and build property schemas (use getByNameAsync for models not yet in cache)
|
|
@@ -743,7 +598,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
743
598
|
const schemaNameToTry = schemaName ?? model?.schemaName;
|
|
744
599
|
if (schemaNameToTry) {
|
|
745
600
|
try {
|
|
746
|
-
const _mod_1 = await import('./Schema-
|
|
601
|
+
const _mod_1 = await import('./Schema-Bf-jOLq0.js');
|
|
747
602
|
const _ns_1 = _mod_1.b;
|
|
748
603
|
const { Schema } = _ns_1;
|
|
749
604
|
const schemaInstance = Schema.create(schemaNameToTry, { waitForReady: false });
|
|
@@ -759,7 +614,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
759
614
|
}
|
|
760
615
|
if (Object.keys(propertySchemas).length === 0) {
|
|
761
616
|
try {
|
|
762
|
-
const _mod_2 = await import('./ClientManager-
|
|
617
|
+
const _mod_2 = await import('./ClientManager-Dfu4jcgm.js');
|
|
763
618
|
const _ns_2 = _mod_2.L;
|
|
764
619
|
const { loadAllSchemasFromDb } = _ns_2;
|
|
765
620
|
const allSchemas = await loadAllSchemasFromDb();
|
|
@@ -780,11 +635,11 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
780
635
|
}
|
|
781
636
|
if (Object.keys(propertySchemas).length === 0) {
|
|
782
637
|
try {
|
|
783
|
-
const _mod_3 = await import('./ClientManager-
|
|
638
|
+
const _mod_3 = await import('./ClientManager-Dfu4jcgm.js');
|
|
784
639
|
const _ns_3 = _mod_3.L;
|
|
785
640
|
const { listCompleteSchemaFiles } = _ns_3;
|
|
786
|
-
const _mod_4 = await import('./BasePathResolver-
|
|
787
|
-
const _ns_4 = _mod_4.
|
|
641
|
+
const _mod_4 = await import('./BasePathResolver-DrzGVH9L.js');
|
|
642
|
+
const _ns_4 = _mod_4.b7;
|
|
788
643
|
const { BaseFileManager } = _ns_4;
|
|
789
644
|
const schemaFiles = await listCompleteSchemaFiles();
|
|
790
645
|
for (const { filePath } of schemaFiles) {
|
|
@@ -804,7 +659,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
804
659
|
}
|
|
805
660
|
}
|
|
806
661
|
if (Object.keys(propertySchemas).length === 0) {
|
|
807
|
-
const schemaMod = await import('./index-
|
|
662
|
+
const schemaMod = await import('./index-C61Rxy0F.js');
|
|
808
663
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
809
664
|
const KNOWN_MODEL_FALLBACKS = {
|
|
810
665
|
Post: {
|
|
@@ -821,7 +676,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
821
676
|
}
|
|
822
677
|
}
|
|
823
678
|
// Fallbacks above may return schema-file shape ({ type, model, items }); normalize to dataType/ref/refValueType.
|
|
824
|
-
const { normalizePropertyRecordSchema } = await import('./property-
|
|
679
|
+
const { normalizePropertyRecordSchema } = await import('./property-zFPMtR3T.js');
|
|
825
680
|
propertySchemas = Object.fromEntries(Object.entries(propertySchemas).map(([name, def]) => [name, normalizePropertyRecordSchema(def)]));
|
|
826
681
|
// Collapse rows that map to the same instance key (e.g. authorIdentityIds + authors -> authors).
|
|
827
682
|
// ItemProperty.create cache does not sync propertyValue on hit; processing order would otherwise
|
|
@@ -854,7 +709,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
854
709
|
// Infer propertyRecordSchema from metadata when schema is missing (enables persistence)
|
|
855
710
|
let propSchema = propertySchemas[propertyName];
|
|
856
711
|
if (!propSchema && isRefTypeFromMeta) {
|
|
857
|
-
const schemaMod = await import('./index-
|
|
712
|
+
const schemaMod = await import('./index-C61Rxy0F.js');
|
|
858
713
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
859
714
|
propSchema = {
|
|
860
715
|
dataType: refSeedType === 'html' ? ModelPropertyDataTypes.Html
|
|
@@ -1438,7 +1293,7 @@ const getItemData = async ({ modelName, seedLocalId, seedUid, }) => {
|
|
|
1438
1293
|
const { localId, uid, ...rest } = getTableColumns(seeds);
|
|
1439
1294
|
const whereClauses = [];
|
|
1440
1295
|
if (modelName) {
|
|
1441
|
-
whereClauses.push(eq(seeds.type,
|
|
1296
|
+
whereClauses.push(eq(seeds.type, easName(modelName)));
|
|
1442
1297
|
}
|
|
1443
1298
|
if (seedUid) {
|
|
1444
1299
|
whereClauses.push(eq(seeds.uid, seedUid));
|
|
@@ -1857,11 +1712,11 @@ const getItemsData = async ({ modelName, modelFileId, schemaName, deleted, inclu
|
|
|
1857
1712
|
conditions.push(placeholderUidSql(seeds.uid));
|
|
1858
1713
|
}
|
|
1859
1714
|
if (modelName) {
|
|
1860
|
-
conditions.push(eq(seeds.type,
|
|
1715
|
+
conditions.push(eq(seeds.type, easName(modelName)));
|
|
1861
1716
|
}
|
|
1862
1717
|
if (!modelFileId && schemaName && modelName) {
|
|
1863
|
-
const _mod_5 = await import('./BasePathResolver-
|
|
1864
|
-
const _ns_5 = _mod_5.
|
|
1718
|
+
const _mod_5 = await import('./BasePathResolver-DrzGVH9L.js');
|
|
1719
|
+
const _ns_5 = _mod_5.ba;
|
|
1865
1720
|
const { resolveModelRecord } = _ns_5;
|
|
1866
1721
|
modelFileId = (await resolveModelRecord(modelName, { schemaName }))?.schemaFileId ?? undefined;
|
|
1867
1722
|
if (!modelFileId)
|
|
@@ -1990,7 +1845,7 @@ const waitForDb = fromCallback(({ sendBack }) => {
|
|
|
1990
1845
|
|
|
1991
1846
|
const getEasSchemaForItemProperty = async ({ schemaUid, propertyName, easDataType, }) => {
|
|
1992
1847
|
try {
|
|
1993
|
-
const propertyNameSnakeCase =
|
|
1848
|
+
const propertyNameSnakeCase = easName(propertyName);
|
|
1994
1849
|
const isMissingSchemaUid = !schemaUid || schemaUid === 'null' || schemaUid === 'undefined';
|
|
1995
1850
|
const queryClient = BaseQueryClient.getQueryClient();
|
|
1996
1851
|
const easClient = BaseEasClient.getEasClient();
|
|
@@ -2143,7 +1998,7 @@ const resolveRelatedValue = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2143
1998
|
const { isRelation, propertyValue, propertyName, seedUid, propertyRecordSchema, populatedFromDb, schemaUid, } = context;
|
|
2144
1999
|
const _resolveRelatedValue = async () => {
|
|
2145
2000
|
// Use dynamic import to break circular dependency
|
|
2146
|
-
const schemaMod = await import('./index-
|
|
2001
|
+
const schemaMod = await import('./index-C61Rxy0F.js');
|
|
2147
2002
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
2148
2003
|
if (!propertyValue || !isRelation || populatedFromDb) {
|
|
2149
2004
|
return;
|
|
@@ -2578,8 +2433,8 @@ async function readHtmlBodyFromChildStorageArweave(seedLocalId) {
|
|
|
2578
2433
|
/* offline / bad tx id */
|
|
2579
2434
|
}
|
|
2580
2435
|
try {
|
|
2581
|
-
const _mod_6 = await import('./BasePathResolver-
|
|
2582
|
-
const _ns_6 = _mod_6.
|
|
2436
|
+
const _mod_6 = await import('./BasePathResolver-DrzGVH9L.js');
|
|
2437
|
+
const _ns_6 = _mod_6.bc;
|
|
2583
2438
|
const { downloadTransactionIdWithDedupe } = _ns_6;
|
|
2584
2439
|
await downloadTransactionIdWithDedupe(txId);
|
|
2585
2440
|
const retryFp = BaseFileManager.getFilesPath('html', `${seedLocalId}.html`);
|
|
@@ -2639,7 +2494,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2639
2494
|
// to use dynamically imported ModelPropertyDataTypes
|
|
2640
2495
|
const _hydrateFromDb = async () => {
|
|
2641
2496
|
// Use dynamic import to break circular dependency
|
|
2642
|
-
const schemaMod = await import('./index-
|
|
2497
|
+
const schemaMod = await import('./index-C61Rxy0F.js');
|
|
2643
2498
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
2644
2499
|
const appDb = BaseDb.getAppDb();
|
|
2645
2500
|
const whereClauses = [];
|
|
@@ -2920,12 +2775,12 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
|
|
|
2920
2775
|
const modelNameForNew = context.modelName;
|
|
2921
2776
|
if (modelNameForNew) {
|
|
2922
2777
|
try {
|
|
2923
|
-
const _mod_7 = await import('./errors-
|
|
2778
|
+
const _mod_7 = await import('./errors-DdWbxb_n.js');
|
|
2924
2779
|
const _ns_7 = _mod_7.h;
|
|
2925
2780
|
const { Model } = _ns_7;
|
|
2926
2781
|
const { modelPropertiesToObject } = await import('./model-oHA3YhOd.js');
|
|
2927
|
-
const _mod_8 = await import('./BasePathResolver-
|
|
2928
|
-
const _ns_8 = _mod_8.
|
|
2782
|
+
const _mod_8 = await import('./BasePathResolver-DrzGVH9L.js');
|
|
2783
|
+
const _ns_8 = _mod_8.ba;
|
|
2929
2784
|
const { resolveItemModelFileId } = _ns_8;
|
|
2930
2785
|
const normalizedModelName = upperFirst(camelCase(modelNameForNew));
|
|
2931
2786
|
const itemModelFileId = await resolveItemModelFileId({
|
|
@@ -2935,7 +2790,7 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
|
|
|
2935
2790
|
});
|
|
2936
2791
|
let model = await Model.resolveAsync(normalizedModelName, { modelFileId: itemModelFileId });
|
|
2937
2792
|
if (!model?.properties?.length && !itemModelFileId) {
|
|
2938
|
-
model = Model.findByModelType(
|
|
2793
|
+
model = Model.findByModelType(easName(modelNameForNew));
|
|
2939
2794
|
}
|
|
2940
2795
|
if (model?.properties?.length) {
|
|
2941
2796
|
const schemas = modelPropertiesToObject(model.properties);
|
|
@@ -2978,8 +2833,8 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
|
|
|
2978
2833
|
// It ends up in the context below, and later lookups by name (Model.getByName) can't match it.
|
|
2979
2834
|
const modelName = context.modelName || (metadataRecord.modelType ? upperFirst(camelCase(metadataRecord.modelType)) : undefined);
|
|
2980
2835
|
// Model names are only unique per schema: pin lookups to the item's own model row.
|
|
2981
|
-
const _mod_9 = await import('./BasePathResolver-
|
|
2982
|
-
const _ns_9 = _mod_9.
|
|
2836
|
+
const _mod_9 = await import('./BasePathResolver-DrzGVH9L.js');
|
|
2837
|
+
const _ns_9 = _mod_9.ba;
|
|
2983
2838
|
const { resolveItemModelFileId, resolveModelRecord } = _ns_9;
|
|
2984
2839
|
const modelFileId = await resolveItemModelFileId({
|
|
2985
2840
|
modelFileId: context.modelFileId,
|
|
@@ -3023,7 +2878,7 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
|
|
|
3023
2878
|
required: propRecord.required ?? undefined,
|
|
3024
2879
|
};
|
|
3025
2880
|
// Validation rules (enum, pattern, ...) aren't in the properties table
|
|
3026
|
-
const { resolvePropertyValidationRules } = await import('./propertyValidationRules-
|
|
2881
|
+
const { resolvePropertyValidationRules } = await import('./propertyValidationRules-CeFVhdQg.js');
|
|
3027
2882
|
const validation = await resolvePropertyValidationRules(normalizedModelName, propertyName, {
|
|
3028
2883
|
modelFileId: modelRecord?.schemaFileId ?? modelFileId,
|
|
3029
2884
|
});
|
|
@@ -3040,7 +2895,7 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
|
|
|
3040
2895
|
}
|
|
3041
2896
|
if (!propertyRecordSchema && modelName) {
|
|
3042
2897
|
try {
|
|
3043
|
-
const _mod_10 = await import('./errors-
|
|
2898
|
+
const _mod_10 = await import('./errors-DdWbxb_n.js');
|
|
3044
2899
|
const _ns_10 = _mod_10.h;
|
|
3045
2900
|
const { Model } = _ns_10;
|
|
3046
2901
|
const { modelPropertiesToObject } = await import('./model-oHA3YhOd.js');
|
|
@@ -3048,7 +2903,7 @@ const loadOrCreateProperty = fromCallback(({ sendBack, input: { context } }) =>
|
|
|
3048
2903
|
// Try PascalCase first ("post" -> "Post"); then findByModelType for names with spaces ("new_model" -> "New model")
|
|
3049
2904
|
let model = Model.resolve(normalizedModelName, { modelFileId });
|
|
3050
2905
|
if (!model?.properties?.length && !modelFileId) {
|
|
3051
|
-
model = Model.findByModelType(
|
|
2906
|
+
model = Model.findByModelType(easName(modelName));
|
|
3052
2907
|
}
|
|
3053
2908
|
if (model?.properties?.length) {
|
|
3054
2909
|
const schemas = modelPropertiesToObject(model.properties);
|
|
@@ -3474,9 +3329,9 @@ const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
|
|
|
3474
3329
|
return false;
|
|
3475
3330
|
}
|
|
3476
3331
|
// Use dynamic import to break circular dependency
|
|
3477
|
-
const schemaMod = await import('./index-
|
|
3332
|
+
const schemaMod = await import('./index-C61Rxy0F.js');
|
|
3478
3333
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
3479
|
-
const { SchemaValidationService } = await import('./SchemaValidationService-
|
|
3334
|
+
const { SchemaValidationService } = await import('./SchemaValidationService-BNYMacsx.js');
|
|
3480
3335
|
let propertyName = propertyNameRaw;
|
|
3481
3336
|
if (!propertyName) {
|
|
3482
3337
|
throw new Error('propertyName is required');
|
|
@@ -3753,7 +3608,7 @@ const createMetadata = async (metadataValues, propertyRecordSchema, options) =>
|
|
|
3753
3608
|
metadataValues.publisher = publisher;
|
|
3754
3609
|
}
|
|
3755
3610
|
if (!metadataValues.modelType && metadataValues.modelName) {
|
|
3756
|
-
metadataValues.modelType =
|
|
3611
|
+
metadataValues.modelType = easName(metadataValues.modelName);
|
|
3757
3612
|
}
|
|
3758
3613
|
// List of Relation rows live under the storage name (authors → authorIdentityIds), never the schema key.
|
|
3759
3614
|
if (metadataValues.propertyName) {
|
|
@@ -3788,7 +3643,7 @@ const createMetadata = async (metadataValues, propertyRecordSchema, options) =>
|
|
|
3788
3643
|
propertyRecordSchema?.validation &&
|
|
3789
3644
|
metadataValues.propertyValue != null &&
|
|
3790
3645
|
metadataValues.propertyValue !== '') {
|
|
3791
|
-
const { SchemaValidationService } = await import('./SchemaValidationService-
|
|
3646
|
+
const { SchemaValidationService } = await import('./SchemaValidationService-BNYMacsx.js');
|
|
3792
3647
|
const validationService = new SchemaValidationService();
|
|
3793
3648
|
const validationResult = validationService.validatePropertyValue(metadataValues.propertyValue, normalizeDataType(propertyRecordSchema.dataType), propertyRecordSchema.validation, propertyRecordSchema.refValueType
|
|
3794
3649
|
? normalizeDataType(String(propertyRecordSchema.refValueType))
|
|
@@ -3810,7 +3665,8 @@ const createMetadata = async (metadataValues, propertyRecordSchema, options) =>
|
|
|
3810
3665
|
const dataTypeKey = normalizeDataType(propertyRecordSchema.dataType);
|
|
3811
3666
|
const easDataType = INTERNAL_DATA_TYPES[dataTypeKey]?.eas;
|
|
3812
3667
|
if (easDataType) {
|
|
3813
|
-
|
|
3668
|
+
// The name publish registers (ADR 0008): a single relation's key, not its authorId storage name.
|
|
3669
|
+
const propertyNameSnakeCase = easPropertyNameForPublish(metadataValues.propertyName, propertyRecordSchema);
|
|
3814
3670
|
// Cached, including misses: every item of a model looks up the same property schemas.
|
|
3815
3671
|
const schemaUid = await getEasSchemaUidForExactDefinition(`${easDataType} ${propertyNameSnakeCase}`);
|
|
3816
3672
|
if (schemaUid) {
|
|
@@ -4400,7 +4256,7 @@ const saveRelation = fromCallback(({ sendBack, input: { context, event } }) => {
|
|
|
4400
4256
|
}
|
|
4401
4257
|
const _saveRelation = async () => {
|
|
4402
4258
|
// Use dynamic import to break circular dependency
|
|
4403
|
-
const schemaMod = await import('./index-
|
|
4259
|
+
const schemaMod = await import('./index-C61Rxy0F.js');
|
|
4404
4260
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
4405
4261
|
if (!propertyNameRaw) {
|
|
4406
4262
|
throw new Error('propertyName is required');
|
|
@@ -5119,11 +4975,11 @@ const getPropertyData = async ({ propertyName, seedLocalId, seedUid, modelName,
|
|
|
5119
4975
|
let names = [...getMetadataPropertyNamesForQuery(propertyName)];
|
|
5120
4976
|
if (modelName) {
|
|
5121
4977
|
try {
|
|
5122
|
-
const _mod_11 = await import('./errors-
|
|
4978
|
+
const _mod_11 = await import('./errors-DdWbxb_n.js');
|
|
5123
4979
|
const _ns_11 = _mod_11.h;
|
|
5124
4980
|
const { Model } = _ns_11;
|
|
5125
|
-
const _mod_12 = await import('./BasePathResolver-
|
|
5126
|
-
const _ns_12 = _mod_12.
|
|
4981
|
+
const _mod_12 = await import('./BasePathResolver-DrzGVH9L.js');
|
|
4982
|
+
const _ns_12 = _mod_12.ba;
|
|
5127
4983
|
const { resolveItemModelFileId } = _ns_12;
|
|
5128
4984
|
// Model names are only unique per schema: use the seed's own model when it is recorded.
|
|
5129
4985
|
const modelFileId = await resolveItemModelFileId({ seedLocalId, seedUid });
|
|
@@ -5323,7 +5179,7 @@ const HTML_PROP_SEED_UID_RE = /^0x[a-fA-F0-9]{64}$/;
|
|
|
5323
5179
|
*/
|
|
5324
5180
|
const resolvePropertyRecordSchemaFromSchemaData = async (modelName, propertyName, modelType, schemaName) => {
|
|
5325
5181
|
try {
|
|
5326
|
-
const _mod_13 = await import('./ClientManager-
|
|
5182
|
+
const _mod_13 = await import('./ClientManager-Dfu4jcgm.js');
|
|
5327
5183
|
const _ns_13 = _mod_13.L;
|
|
5328
5184
|
const { loadAllSchemasFromDb } = _ns_13;
|
|
5329
5185
|
const allSchemas = await loadAllSchemasFromDb();
|
|
@@ -5377,12 +5233,12 @@ hints = {}) => {
|
|
|
5377
5233
|
return undefined;
|
|
5378
5234
|
}
|
|
5379
5235
|
try {
|
|
5380
|
-
const _mod_14 = await import('./errors-
|
|
5236
|
+
const _mod_14 = await import('./errors-DdWbxb_n.js');
|
|
5381
5237
|
const _ns_14 = _mod_14.h;
|
|
5382
5238
|
const { Model } = _ns_14;
|
|
5383
5239
|
const { modelPropertiesToObject } = await import('./model-oHA3YhOd.js');
|
|
5384
|
-
const _mod_15 = await import('./BasePathResolver-
|
|
5385
|
-
const _ns_15 = _mod_15.
|
|
5240
|
+
const _mod_15 = await import('./BasePathResolver-DrzGVH9L.js');
|
|
5241
|
+
const _ns_15 = _mod_15.ba;
|
|
5386
5242
|
const { resolveItemModelFileId } = _ns_15;
|
|
5387
5243
|
const modelFileId = await resolveItemModelFileId(hints);
|
|
5388
5244
|
let model = modelFileId
|
|
@@ -5541,7 +5397,7 @@ class ItemProperty {
|
|
|
5541
5397
|
return;
|
|
5542
5398
|
}
|
|
5543
5399
|
// Use dynamic import to break circular dependency
|
|
5544
|
-
const schemaMod = await import('./index-
|
|
5400
|
+
const schemaMod = await import('./index-C61Rxy0F.js');
|
|
5545
5401
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
5546
5402
|
const { context } = snapshot;
|
|
5547
5403
|
const { propertyRecordSchema } = context;
|
|
@@ -5712,7 +5568,7 @@ class ItemProperty {
|
|
|
5712
5568
|
const normalizedRefValueType = normalizeDataType(propertyRecordSchema?.refValueType);
|
|
5713
5569
|
const propertyNames = getMetadataPropertyNamesForQuery(propertyName, normalizedDataType, normalizedRefValueType);
|
|
5714
5570
|
const propertyNameVariant = propertyNames.length > 1 ? propertyNames[1] : undefined;
|
|
5715
|
-
const _mod_16 = await import('./index-
|
|
5571
|
+
const _mod_16 = await import('./index-7y2f_iQz.js');
|
|
5716
5572
|
const _ns_16 = _mod_16.s;
|
|
5717
5573
|
const seedSchemaMod = _ns_16;
|
|
5718
5574
|
const { metadata } = seedSchemaMod;
|
|
@@ -5936,8 +5792,8 @@ class ItemProperty {
|
|
|
5936
5792
|
const ctx = this._service.getSnapshot().context;
|
|
5937
5793
|
let modelFileId;
|
|
5938
5794
|
try {
|
|
5939
|
-
const _mod_17 = await import('./BasePathResolver-
|
|
5940
|
-
const _ns_17 = _mod_17.
|
|
5795
|
+
const _mod_17 = await import('./BasePathResolver-DrzGVH9L.js');
|
|
5796
|
+
const _ns_17 = _mod_17.ba;
|
|
5941
5797
|
const { resolveItemModelFileId } = _ns_17;
|
|
5942
5798
|
modelFileId = await resolveItemModelFileId({
|
|
5943
5799
|
modelFileId: ctx.modelFileId,
|
|
@@ -6299,8 +6155,8 @@ class ItemProperty {
|
|
|
6299
6155
|
const propertiesData = await getItemProperties({ seedLocalId, seedUid });
|
|
6300
6156
|
const instances = [];
|
|
6301
6157
|
const seenNormalized = new Set();
|
|
6302
|
-
const _mod_18 = await import('./BasePathResolver-
|
|
6303
|
-
const _ns_18 = _mod_18.
|
|
6158
|
+
const _mod_18 = await import('./BasePathResolver-DrzGVH9L.js');
|
|
6159
|
+
const _ns_18 = _mod_18.ba;
|
|
6304
6160
|
const { resolveItemModelFileId } = _ns_18;
|
|
6305
6161
|
const itemModelFileId = await resolveItemModelFileId({ seedLocalId, seedUid });
|
|
6306
6162
|
for (const data of propertiesData) {
|
|
@@ -6317,7 +6173,7 @@ class ItemProperty {
|
|
|
6317
6173
|
}
|
|
6318
6174
|
else if (baseName) {
|
|
6319
6175
|
try {
|
|
6320
|
-
const _mod_19 = await import('./errors-
|
|
6176
|
+
const _mod_19 = await import('./errors-DdWbxb_n.js');
|
|
6321
6177
|
const _ns_19 = _mod_19.h;
|
|
6322
6178
|
const { Model } = _ns_19;
|
|
6323
6179
|
const { modelPropertiesToObject } = await import('./model-oHA3YhOd.js');
|
|
@@ -6334,7 +6190,7 @@ class ItemProperty {
|
|
|
6334
6190
|
}
|
|
6335
6191
|
if (modelName && propertyName) {
|
|
6336
6192
|
try {
|
|
6337
|
-
const _mod_20 = await import('./errors-
|
|
6193
|
+
const _mod_20 = await import('./errors-DdWbxb_n.js');
|
|
6338
6194
|
const _ns_20 = _mod_20.h;
|
|
6339
6195
|
const { Model } = _ns_20;
|
|
6340
6196
|
const { modelPropertiesToObject } = await import('./model-oHA3YhOd.js');
|
|
@@ -6666,7 +6522,7 @@ class ItemProperty {
|
|
|
6666
6522
|
if (!propertyName || (!seedLocalId && !seedUid))
|
|
6667
6523
|
return;
|
|
6668
6524
|
if (db) {
|
|
6669
|
-
const _mod_21 = await import('./index-
|
|
6525
|
+
const _mod_21 = await import('./index-7y2f_iQz.js');
|
|
6670
6526
|
const _ns_21 = _mod_21.s;
|
|
6671
6527
|
const seedSchemaMod = _ns_21;
|
|
6672
6528
|
const { metadata } = seedSchemaMod;
|
|
@@ -6709,9 +6565,9 @@ const createNewItem = async ({ modelName, modelFileId, ...propertyData }) => {
|
|
|
6709
6565
|
if (!modelName) {
|
|
6710
6566
|
throw new Error('A model name is required for createNewItem');
|
|
6711
6567
|
}
|
|
6712
|
-
const seedType =
|
|
6568
|
+
const seedType = easName(modelName);
|
|
6713
6569
|
// Dynamic import to break circular dependency
|
|
6714
|
-
const _mod_22 = await import('./errors-
|
|
6570
|
+
const _mod_22 = await import('./errors-DdWbxb_n.js');
|
|
6715
6571
|
const _ns_22 = _mod_22.h;
|
|
6716
6572
|
const modelMod = _ns_22;
|
|
6717
6573
|
const { Model } = modelMod;
|
|
@@ -6719,7 +6575,7 @@ const createNewItem = async ({ modelName, modelFileId, ...propertyData }) => {
|
|
|
6719
6575
|
const propertySchemas = model?.properties ? modelPropertiesToObject(model.properties) : undefined;
|
|
6720
6576
|
modelFileId ?? (modelFileId = model?.id);
|
|
6721
6577
|
const newSeedId = await createSeed({ type: seedType, modelFileId });
|
|
6722
|
-
const newVersionId = await createVersion({ seedLocalId: newSeedId, seedType:
|
|
6578
|
+
const newVersionId = await createVersion({ seedLocalId: newSeedId, seedType: easName(modelName) });
|
|
6723
6579
|
// Build set of all properties to create metadata for: union of model schema + propertyData
|
|
6724
6580
|
// This ensures we create metadata for ALL model properties even when creating with no initial values
|
|
6725
6581
|
// (fixes first-item persistence: loadOrCreateItem needs metadata rows to run createItemPropertyInstances)
|
|
@@ -6894,7 +6750,7 @@ const getModel = () => {
|
|
|
6894
6750
|
// the fragile `import(...).then(n => n.X)` chunk-namespace pattern.
|
|
6895
6751
|
if (!modelImportPromise) {
|
|
6896
6752
|
modelImportPromise = (async () => {
|
|
6897
|
-
const _mod_23 = await import('./errors-
|
|
6753
|
+
const _mod_23 = await import('./errors-DdWbxb_n.js');
|
|
6898
6754
|
const _ns_23 = _mod_23.h;
|
|
6899
6755
|
const mod = _ns_23;
|
|
6900
6756
|
ModelClass = mod.Model;
|
|
@@ -7062,12 +6918,12 @@ class Item {
|
|
|
7062
6918
|
};
|
|
7063
6919
|
this.getPublishUploads = async (options) => {
|
|
7064
6920
|
// Use dynamic import to break circular dependency
|
|
7065
|
-
const getPublishUploadsMod = await import('./getPublishUploads-
|
|
6921
|
+
const getPublishUploadsMod = await import('./getPublishUploads-J-143iSV.js');
|
|
7066
6922
|
const { getPublishUploads } = getPublishUploadsMod;
|
|
7067
6923
|
return await getPublishUploads(this, [], undefined, options);
|
|
7068
6924
|
};
|
|
7069
6925
|
this.getPublishPayload = async (uploadedTransactions, options) => {
|
|
7070
|
-
const _mod_24 = await import('./getPublishPayload-
|
|
6926
|
+
const _mod_24 = await import('./getPublishPayload-DPy-uMrR.js');
|
|
7071
6927
|
const _ns_24 = _mod_24.g;
|
|
7072
6928
|
const getPublishPayloadMod = _ns_24;
|
|
7073
6929
|
const { getPublishPayload } = getPublishPayloadMod;
|
|
@@ -7603,8 +7459,8 @@ class Item {
|
|
|
7603
7459
|
const db = BaseDb.getAppDb();
|
|
7604
7460
|
if (db && props.modelName) {
|
|
7605
7461
|
// Model names are only unique per schema: resolve the exact models row from the most specific scope.
|
|
7606
|
-
const _mod_25 = await import('./BasePathResolver-
|
|
7607
|
-
const _ns_25 = _mod_25.
|
|
7462
|
+
const _mod_25 = await import('./BasePathResolver-DrzGVH9L.js');
|
|
7463
|
+
const _ns_25 = _mod_25.ba;
|
|
7608
7464
|
const { resolveModelRecord } = _ns_25;
|
|
7609
7465
|
const modelRecord = await resolveModelRecord(props.modelName, {
|
|
7610
7466
|
modelFileId: props.modelFileId ?? modelInstance?.id,
|
|
@@ -7612,7 +7468,7 @@ class Item {
|
|
|
7612
7468
|
});
|
|
7613
7469
|
const modelRecords = modelRecord ? [modelRecord] : [];
|
|
7614
7470
|
if (!modelRecord) {
|
|
7615
|
-
const _mod_26 = await import('./errors-
|
|
7471
|
+
const _mod_26 = await import('./errors-DdWbxb_n.js');
|
|
7616
7472
|
const _ns_26 = _mod_26.j;
|
|
7617
7473
|
const { UnknownModelError } = _ns_26;
|
|
7618
7474
|
throw new UnknownModelError(props.modelName, schemaName ?? modelInstance?.schemaName);
|
|
@@ -7623,11 +7479,11 @@ class Item {
|
|
|
7623
7479
|
// Scope the constructor's Model lookup to this model's schema (as getItemData does on reload),
|
|
7624
7480
|
// so a same-named model cached from another schema can't supply the property set.
|
|
7625
7481
|
if (modelRecord && !props.schemaName) {
|
|
7626
|
-
const _mod_27 = await import('./BasePathResolver-
|
|
7627
|
-
const _ns_27 = _mod_27.
|
|
7482
|
+
const _mod_27 = await import('./BasePathResolver-DrzGVH9L.js');
|
|
7483
|
+
const _ns_27 = _mod_27.b9;
|
|
7628
7484
|
const { modelSchemas } = _ns_27;
|
|
7629
|
-
const _mod_28 = await import('./BasePathResolver-
|
|
7630
|
-
const _ns_28 = _mod_28.
|
|
7485
|
+
const _mod_28 = await import('./BasePathResolver-DrzGVH9L.js');
|
|
7486
|
+
const _ns_28 = _mod_28.b8;
|
|
7631
7487
|
const { schemas: schemasTable } = _ns_28;
|
|
7632
7488
|
const schemaRows = await db
|
|
7633
7489
|
.select({ schemaName: schemasTable.name })
|
|
@@ -7985,7 +7841,7 @@ class Item {
|
|
|
7985
7841
|
if (!appDb || Item.instanceCache.size === 0) {
|
|
7986
7842
|
return;
|
|
7987
7843
|
}
|
|
7988
|
-
const _mod_29 = await import('./index-
|
|
7844
|
+
const _mod_29 = await import('./index-7y2f_iQz.js');
|
|
7989
7845
|
const _ns_29 = _mod_29.s;
|
|
7990
7846
|
const { metadata } = _ns_29;
|
|
7991
7847
|
const { eq, and } = await import('drizzle-orm');
|
|
@@ -8148,11 +8004,11 @@ class Item {
|
|
|
8148
8004
|
}
|
|
8149
8005
|
/** Throws ItemCreateValidationError for unknown keys and values that break their property's rules. */
|
|
8150
8006
|
static async assertValidCreateValues(props, propertyNames, dataTypeByPropertyName, skipKeys) {
|
|
8151
|
-
const _mod_30 = await import('./errors-
|
|
8007
|
+
const _mod_30 = await import('./errors-DdWbxb_n.js');
|
|
8152
8008
|
const _ns_30 = _mod_30.j;
|
|
8153
8009
|
const { ItemCreateValidationError } = _ns_30;
|
|
8154
|
-
const { getPropertySchema } = await import('./property-
|
|
8155
|
-
const { SchemaValidationService } = await import('./SchemaValidationService-
|
|
8010
|
+
const { getPropertySchema } = await import('./property-zFPMtR3T.js');
|
|
8011
|
+
const { SchemaValidationService } = await import('./SchemaValidationService-BNYMacsx.js');
|
|
8156
8012
|
const validationService = new SchemaValidationService();
|
|
8157
8013
|
const modelName = props.modelName;
|
|
8158
8014
|
const known = new Set(propertyNames);
|
|
@@ -8189,7 +8045,7 @@ class Item {
|
|
|
8189
8045
|
// Not JSON: validated as given, and rejected as a non-array
|
|
8190
8046
|
}
|
|
8191
8047
|
}
|
|
8192
|
-
const { resolvePropertyValidationRules } = await import('./propertyValidationRules-
|
|
8048
|
+
const { resolvePropertyValidationRules } = await import('./propertyValidationRules-CeFVhdQg.js');
|
|
8193
8049
|
const rules = propertySchema?.validation ??
|
|
8194
8050
|
(await resolvePropertyValidationRules(modelName, key, {
|
|
8195
8051
|
modelFileId: props.modelFileId,
|
|
@@ -8520,7 +8376,7 @@ class Item {
|
|
|
8520
8376
|
itemActor.send(event);
|
|
8521
8377
|
};
|
|
8522
8378
|
try {
|
|
8523
|
-
const _mod_31 = await import('./index-
|
|
8379
|
+
const _mod_31 = await import('./index-7y2f_iQz.js');
|
|
8524
8380
|
const _ns_31 = _mod_31.s;
|
|
8525
8381
|
const seedSchemaMod = _ns_31;
|
|
8526
8382
|
const { seeds, versions, metadata } = seedSchemaMod;
|
|
@@ -8884,5 +8740,5 @@ var Item$1 = /*#__PURE__*/Object.freeze({
|
|
|
8884
8740
|
Item: Item
|
|
8885
8741
|
});
|
|
8886
8742
|
|
|
8887
|
-
export {
|
|
8888
|
-
//# sourceMappingURL=Item-
|
|
8743
|
+
export { unloadEntity as $, getPublishExecutor as A, getRevokeExecutor as B, ClientManagerState as C, DEFAULT_READY_TIMEOUT_MS as D, getUploadExecutor as E, getVersionData$1 as F, isLocalUnsealedDraft as G, isSeedRowOwned as H, Item as I, localUnsealedDraftSql as J, ownedPublisherSql as K, ownedSeedsSql as L, METADATA_LATEST_FIRST_ORDER_SQL as M, pickLatestMetadataRowPerProperty as N, OwnershipError as O, PUBLISH_NOT_CONFIGURED_MESSAGE as P, placeholderUidSql as Q, propertyMachine as R, publisherInAddressListSql as S, publisherIsInOwnedSet as T, setAdditionalSyncAddresses as U, setGetPublisherForNewSeeds as V, setPublishExecutor as W, setRevokeExecutor as X, setUploadExecutor as Y, getInvariantSafePropertyDescriptor as Z, clearDestroySubscriptions as _, chunkValues as a, ClientManagerEvents as a0, withLockedItemStorageRow as a1, getItemStorageFilePath as a2, writeItemStorageFile as a3, resolvePublisherFromSeedRow as a4, getPropertyData$1 as a5, Item$1 as a6, getGetAdditionalSyncAddresses as b, compareMetadataRowsLatestFirst as c, ItemProperty as d, ItemPropertySaveValidationError as e, assertItemOwned as f, getItemData as g, getEasSchemaUidForModel as h, isItemOwned as i, getLatestPublishedVersionRow as j, isVersionRevoked as k, waitForEntityIdle as l, createReactiveProxy as m, findEntity as n, forceRemoveFromCaches as o, parseListPropertyValueFromStorage as p, runDestroyLifecycle as q, rowsPerInsert as r, selectInBatches as s, isPublishedMetadataRow as t, MachineIds as u, createNewItem as v, writeInBatches as w, getEasSchemaForItemProperty as x, getGetPublisherForNewSeeds as y, getMetadataLatest as z };
|
|
8744
|
+
//# sourceMappingURL=Item-BUUFuywT.js.map
|