@seedprotocol/sdk 0.7.1 → 0.7.2
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-DRT09oVv.js → BasePathResolver-BdxCSIzn.js} +2 -2
- package/dist/{BasePathResolver-DRT09oVv.js.map → BasePathResolver-BdxCSIzn.js.map} +1 -1
- package/dist/{ClientManager-DngaZdw6.js → ClientManager-ClCwwhwo.js} +27 -22
- package/dist/ClientManager-ClCwwhwo.js.map +1 -0
- package/dist/{Item-ZUAmf943.js → Item-B9Y4VuK1.js} +75 -55
- package/dist/Item-B9Y4VuK1.js.map +1 -0
- package/dist/{ModelProperty-6llK4MTH.js → ModelProperty-BMePcicQ.js} +26 -27
- package/dist/ModelProperty-BMePcicQ.js.map +1 -0
- package/dist/{Schema-D-Ud-XYw.js → Schema-COsEXXaR.js} +30 -31
- package/dist/{Schema-D-Ud-XYw.js.map → Schema-COsEXXaR.js.map} +1 -1
- package/dist/{SchemaValidationService-IoS7JquP.js → SchemaValidationService-DabGMzSE.js} +7 -8
- package/dist/{SchemaValidationService-IoS7JquP.js.map → SchemaValidationService-DabGMzSE.js.map} +1 -1
- package/dist/{backfillMetadataPropertyIds-BlVeE7w7.js → backfillMetadataPropertyIds-Ck6fumnm.js} +4 -4
- package/dist/{backfillMetadataPropertyIds-BlVeE7w7.js.map → backfillMetadataPropertyIds-Ck6fumnm.js.map} +1 -1
- package/dist/cjs/{ModelProperty-Dv7AQfmQ.js → ModelProperty-BT6Un_MB.js} +21 -21
- package/dist/cjs/{ModelProperty-Dv7AQfmQ.js.map → ModelProperty-BT6Un_MB.js.map} +1 -1
- package/dist/cjs/{Schema-BHVp1g-M.js → Schema-BXhXdUsA.js} +23 -23
- package/dist/cjs/{Schema-BHVp1g-M.js.map → Schema-BXhXdUsA.js.map} +1 -1
- package/dist/cjs/{SchemaValidationService-BSU9knjf.js → SchemaValidationService-CC18QDfc.js} +2 -2
- package/dist/cjs/{SchemaValidationService-BSU9knjf.js.map → SchemaValidationService-CC18QDfc.js.map} +1 -1
- package/dist/cjs/{backfillMetadataPropertyIds-WIovQ_d8.js → backfillMetadataPropertyIds-DEHC9ejq.js} +3 -3
- package/dist/cjs/{backfillMetadataPropertyIds-WIovQ_d8.js.map → backfillMetadataPropertyIds-DEHC9ejq.js.map} +1 -1
- package/dist/cjs/{eas-CUYXdr2t.js → eas-C3CL0l7l.js} +3 -3
- package/dist/cjs/{eas-CUYXdr2t.js.map → eas-C3CL0l7l.js.map} +1 -1
- package/dist/cjs/{getItem-z1tHu0hu.js → getItem-CrwWYCkj.js} +2 -2
- package/dist/cjs/{getItem-z1tHu0hu.js.map → getItem-CrwWYCkj.js.map} +1 -1
- package/dist/cjs/{getPublishPayload-CEP_e-Kv.js → getPublishPayload-DRJh7WR0.js} +22 -16
- package/dist/cjs/getPublishPayload-DRJh7WR0.js.map +1 -0
- package/dist/cjs/{getPublishUploads-Ctn5k1k6.js → getPublishUploads-Bh22D3zJ.js} +4 -4
- package/dist/cjs/{getPublishUploads-Ctn5k1k6.js.map → getPublishUploads-Bh22D3zJ.js.map} +1 -1
- package/dist/cjs/{index-DfGhF1dc.js → index-BA1RIYFG.js} +3 -3
- package/dist/cjs/index-BA1RIYFG.js.map +1 -0
- package/dist/cjs/{index-Cvvt0-5B.js → index-Dls7aMjr.js} +74 -40
- package/dist/cjs/index-Dls7aMjr.js.map +1 -0
- package/dist/cjs/{property-DbEPQ1m9.js → property-ZerTWizX.js} +5 -5
- package/dist/cjs/{property-DbEPQ1m9.js.map → property-ZerTWizX.js.map} +1 -1
- package/dist/cjs/{publishDraftGraph-C38gf302.js → publishDraftGraph-CPOAcQFf.js} +4 -4
- package/dist/cjs/{publishDraftGraph-C38gf302.js.map → publishDraftGraph-CPOAcQFf.js.map} +1 -1
- package/dist/cjs/{resetAmbiguousLegacyItemData-CfMhRHwK.js → resetAmbiguousLegacyItemData-adDl4LcT.js} +2 -2
- package/dist/cjs/{resetAmbiguousLegacyItemData-CfMhRHwK.js.map → resetAmbiguousLegacyItemData-adDl4LcT.js.map} +1 -1
- package/dist/cjs/{resolveModelForSyncedSeed-CNYaLOir.js → resolveModelForSyncedSeed-DoNThPdL.js} +2 -2
- package/dist/cjs/{resolveModelForSyncedSeed-CNYaLOir.js.map → resolveModelForSyncedSeed-DoNThPdL.js.map} +1 -1
- package/dist/cjs/{syncDbWithEas-d1iOdTTI.js → syncDbWithEas-CYfPkus9.js} +7 -7
- package/dist/cjs/{syncDbWithEas-d1iOdTTI.js.map → syncDbWithEas-CYfPkus9.js.map} +1 -1
- package/dist/{configurePlatform-CZpjyuCo.js → configurePlatform-xU3Hsno3.js} +4 -4
- package/dist/{configurePlatform-CZpjyuCo.js.map → configurePlatform-xU3Hsno3.js.map} +1 -1
- package/dist/{db-Lw0KVZmc.js → db-W1g29qsM.js} +30 -26
- package/dist/{db-Lw0KVZmc.js.map → db-W1g29qsM.js.map} +1 -1
- package/dist/{eas-CQ-Smzk2.js → eas-CSwV6MvB.js} +5 -5
- package/dist/{eas-CQ-Smzk2.js.map → eas-CSwV6MvB.js.map} +1 -1
- package/dist/{getItem-CSfSok9f.js → getItem-BYQeM3DY.js} +5 -6
- package/dist/{getItem-CSfSok9f.js.map → getItem-BYQeM3DY.js.map} +1 -1
- package/dist/{getPublishPayload-76_KfB5Y.js → getPublishPayload-D5CQZd-y.js} +27 -21
- package/dist/getPublishPayload-D5CQZd-y.js.map +1 -0
- package/dist/{getPublishUploads-CqgMBD8f.js → getPublishUploads-BGpDsrBp.js} +9 -10
- package/dist/{getPublishUploads-CqgMBD8f.js.map → getPublishUploads-BGpDsrBp.js.map} +1 -1
- package/dist/{index-BpgD305l.js → index-Bev-hZF-.js} +9 -10
- package/dist/index-Bev-hZF-.js.map +1 -0
- package/dist/{index-5b3JsS55.js → index-CSOQFAOn.js} +2 -2
- package/dist/index-CSOQFAOn.js.map +1 -0
- package/dist/{index-Y-yYyRBf.js → index-DRXC5Mra.js} +38 -37
- package/dist/{index-Y-yYyRBf.js.map → index-DRXC5Mra.js.map} +1 -1
- package/dist/{index.browser-DaTzn79x.js → index.browser-DO20vYuP.js} +8 -8
- package/dist/{index.browser-DaTzn79x.js.map → index.browser-DO20vYuP.js.map} +1 -1
- package/dist/{index.node-NYKqFOoe.js → index.node-C4iyOhdo.js} +5 -5
- package/dist/{index.node-NYKqFOoe.js.map → index.node-C4iyOhdo.js.map} +1 -1
- package/dist/main.cjs +1 -1
- package/dist/main.js +28 -29
- package/dist/main.js.map +1 -1
- package/dist/node.js +14 -15
- package/dist/node.js.map +1 -1
- package/dist/platform.browser.js +5 -5
- package/dist/platform.node.js +3 -3
- package/dist/{property-ByaiSyUK.js → property-BT1zDSkd.js} +9 -10
- package/dist/property-BT1zDSkd.js.map +1 -0
- package/dist/{publishDraftGraph-BRm6Pq3Q.js → publishDraftGraph-Bcfrdj7-.js} +8 -8
- package/dist/{publishDraftGraph-BRm6Pq3Q.js.map → publishDraftGraph-Bcfrdj7-.js.map} +1 -1
- package/dist/{resetAmbiguousLegacyItemData-B4dX6ZA1.js → resetAmbiguousLegacyItemData-Ci6PM_vC.js} +2 -2
- package/dist/{resetAmbiguousLegacyItemData-B4dX6ZA1.js.map → resetAmbiguousLegacyItemData-Ci6PM_vC.js.map} +1 -1
- package/dist/{resolveModelForSyncedSeed-B0tco3zG.js → resolveModelForSyncedSeed-CLlumTBq.js} +2 -2
- package/dist/{resolveModelForSyncedSeed-B0tco3zG.js.map → resolveModelForSyncedSeed-CLlumTBq.js.map} +1 -1
- package/dist/src/Item/Item.d.ts.map +1 -1
- package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
- package/dist/src/helpers/generateId.d.ts +4 -0
- package/dist/src/helpers/generateId.d.ts.map +1 -1
- package/dist/src/query/createLocalQueryDataSource.d.ts.map +1 -1
- package/dist/{syncDbWithEas-BPap9Sru.js → syncDbWithEas-BQsXjGhe.js} +13 -14
- package/dist/syncDbWithEas-BQsXjGhe.js.map +1 -0
- package/dist/{tabEvents-C6NXS6Jl.js → tabEvents-C9qUKx_z.js} +28 -11
- package/dist/tabEvents-C9qUKx_z.js.map +1 -0
- package/dist/{tolerantWebAccess-NBQ1NB4i.js → tolerantWebAccess-B-9bwxbw.js} +6 -6
- package/dist/{tolerantWebAccess-NBQ1NB4i.js.map → tolerantWebAccess-B-9bwxbw.js.map} +1 -1
- package/dist/{updateSeedRevokedAt-CYwgVNlM.js → updateSeedRevokedAt-D6q0h7pj.js} +3 -3
- package/dist/{updateSeedRevokedAt-CYwgVNlM.js.map → updateSeedRevokedAt-D6q0h7pj.js.map} +1 -1
- package/package.json +10 -5
- package/dist/ClientManager-DngaZdw6.js.map +0 -1
- package/dist/Item-ZUAmf943.js.map +0 -1
- package/dist/ModelProperty-6llK4MTH.js.map +0 -1
- package/dist/cjs/getLatestVersionRow-CcaabxIW.js +0 -59
- package/dist/cjs/getLatestVersionRow-CcaabxIW.js.map +0 -1
- package/dist/cjs/getPublishPayload-CEP_e-Kv.js.map +0 -1
- package/dist/cjs/index-Cvvt0-5B.js.map +0 -1
- package/dist/cjs/index-DfGhF1dc.js.map +0 -1
- package/dist/generateId-BopUwD8F.js +0 -9
- package/dist/generateId-BopUwD8F.js.map +0 -1
- package/dist/getLatestVersionRow-72Atl9vB.js +0 -46
- package/dist/getLatestVersionRow-72Atl9vB.js.map +0 -1
- package/dist/getPublishPayload-76_KfB5Y.js.map +0 -1
- package/dist/index-5b3JsS55.js.map +0 -1
- package/dist/index-BpgD305l.js.map +0 -1
- package/dist/property-ByaiSyUK.js.map +0 -1
- package/dist/syncDbWithEas-BPap9Sru.js.map +0 -1
- package/dist/tabEvents-C6NXS6Jl.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var pluralize = require('pluralize');
|
|
4
|
-
var main_cjs = require('./index-
|
|
4
|
+
var main_cjs = require('./index-Dls7aMjr.js');
|
|
5
5
|
var drizzleOrm = require('drizzle-orm');
|
|
6
6
|
require('immer');
|
|
7
7
|
require('reflect-metadata');
|
|
@@ -70,11 +70,11 @@ const getPropertySchema = async (modelName, propertyName,
|
|
|
70
70
|
/** Which model is meant when several schemas define one named modelName (Model.id and/or schema). */
|
|
71
71
|
scope = {}) => {
|
|
72
72
|
// Dynamic import to break circular dependency
|
|
73
|
-
const modelMod = await Promise.resolve().then(function () { return require('./index-
|
|
73
|
+
const modelMod = await Promise.resolve().then(function () { return require('./index-Dls7aMjr.js'); }).then(function (n) { return n.Model$1; });
|
|
74
74
|
const { Model } = modelMod;
|
|
75
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./Schema-
|
|
75
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./Schema-BXhXdUsA.js'); });
|
|
76
76
|
const { Schema } = schemaMod;
|
|
77
|
-
const { resolveModelRecord } = await Promise.resolve().then(function () { return require('./index-
|
|
77
|
+
const { resolveModelRecord } = await Promise.resolve().then(function () { return require('./index-Dls7aMjr.js'); }).then(function (n) { return n.resolveModelRecord$1; });
|
|
78
78
|
const model = await Model.resolveAsync(modelName, scope);
|
|
79
79
|
if (!model) {
|
|
80
80
|
return undefined;
|
|
@@ -324,4 +324,4 @@ exports.isDataType = main_cjs.isDataType;
|
|
|
324
324
|
exports.normalizeDataType = main_cjs.normalizeDataType;
|
|
325
325
|
exports.normalizePropertyRecordSchema = main_cjs.normalizePropertyRecordSchema;
|
|
326
326
|
exports.getPropertySchema = getPropertySchema;
|
|
327
|
-
//# sourceMappingURL=property-
|
|
327
|
+
//# sourceMappingURL=property-ZerTWizX.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property-DbEPQ1m9.js","sources":["../../../src/helpers/property.ts"],"sourcesContent":["import { Static } from '@sinclair/typebox'\nimport { TProperty } from '@/Schema'\n// Dynamic import to break circular dependency: Model -> ... -> helpers/property -> Model\n// import { Model } from '@/Model/Model'\nimport pluralize from 'pluralize'\nimport { resolveStorageNameToSchemaName } from '@/helpers/metadataPropertyNames'\nimport { BaseDb } from '@/db/Db/BaseDb'\nimport { models as modelsTable, properties, PropertyType } from '@/seedSchema'\nimport { eq, and } from 'drizzle-orm'\nimport { modelPropertiesToObject } from '@/helpers/model'\n\n// Re-export everything from property/index.ts to make it available when importing from helpers/property\nexport * from './property/index'\n\n/**\n * Gets the propertyRecordSchema object for a given model and property name.\n * \n * The propertyRecordSchema is the property definition object that contains\n * information about the property's data type, storage configuration, and\n * relationship details (for Relation and List types).\n * \n * This function first checks the database for property definitions (which may\n * have been edited), then falls back to schema files. This ensures that\n * edited properties persist across page reloads.\n * \n * This function handles property names that end with 'Id' or 'Ids' by automatically\n * looking up the base property name in the schema (e.g., 'authorId' -> 'author',\n * 'tagIds' -> 'tags').\n * \n * @param modelName - The name of the model (e.g., 'Article', 'Author')\n * @param propertyName - The name of the property (e.g., 'title', 'author', 'authorId', 'tags', 'tagIds')\n * @returns The propertyRecordSchema object (TProperty with optional _propertyFileId) or undefined if not found\n * \n * @example\n * ```typescript\n * const schema = await getPropertySchema('Article', 'title')\n * // Returns: { dataType: 'Text', ... }\n * \n * const relationSchema = await getPropertySchema('Article', 'author')\n * // Returns: { dataType: 'Relation', ref: 'Author', ... }\n * \n * // Also works with Id/Ids suffixes\n * const relationSchemaById = await getPropertySchema('Article', 'authorId')\n * // Returns: { dataType: 'Relation', ref: 'Author', ... }\n * ```\n */\nexport const getPropertySchema = async (\n modelName: string,\n propertyName: string,\n /** Which model is meant when several schemas define one named modelName (Model.id and/or schema). */\n scope: { modelFileId?: string | null; schemaName?: string | null } = {},\n): Promise<(Static<typeof TProperty> & { _propertyFileId?: string }) | undefined> => {\n // Dynamic import to break circular dependency\n const modelMod = await import('../Model/Model')\n const { Model } = modelMod\n const schemaMod = await import('../Schema/Schema')\n const { Schema } = schemaMod\n const { resolveModelRecord } = await import('../db/read/resolveModelRecord')\n const model = await Model.resolveAsync(modelName, scope)\n\n if (!model) {\n return undefined\n }\n \n // Get the original schema from Schema instance context (has ref fields from schema file)\n // This is more reliable than modelPropertiesToObject which depends on ModelProperty instances\n let schema: { [propertyName: string]: any } = {}\n try {\n const schemaName = model.schemaName\n if (schemaName) {\n const schemaInstance = Schema.create(schemaName, {\n waitForReady: false,\n }) as import('@/Schema/Schema').Schema\n const schemaContext = schemaInstance.getService().getSnapshot().context\n if (schemaContext.models && schemaContext.models[modelName]) {\n // Get properties from Schema context (original schema file data)\n const modelDef = schemaContext.models[modelName]\n schema = modelDef.properties || {}\n }\n }\n } catch (error) {\n // Fall through to modelPropertiesToObject\n }\n \n // Fallback to modelPropertiesToObject if Schema context doesn't have the data\n const usingModelProperties = Object.keys(schema).length === 0\n if (usingModelProperties) {\n const properties = model.properties || []\n if (properties.length === 0) {\n return undefined\n }\n schema = modelPropertiesToObject(properties)\n }\n \n // Helper to resolve property name (handles Id/Ids suffixes)\n const resolvePropertyName = (propName: string): string | undefined => {\n // First, try direct lookup\n if (schema[propName]) {\n return propName\n }\n\n // List-of-relation storage name (e.g. authorIdentityIds) -> schema key (authors)\n const listSchemaKey = resolveStorageNameToSchemaName(schema, propName)\n if (listSchemaKey && schema[listSchemaKey]) {\n return listSchemaKey\n }\n\n // Handle properties ending with 'Id' or 'Ids'\n let propertyNameWithoutId: string | undefined\n \n if (propName.endsWith('Id')) {\n propertyNameWithoutId = propName.slice(0, -2)\n } else if (propName.endsWith('Ids')) {\n propertyNameWithoutId = propName.slice(0, -3)\n propertyNameWithoutId = pluralize(propertyNameWithoutId)\n }\n \n if (propertyNameWithoutId && schema[propertyNameWithoutId]) {\n return propertyNameWithoutId\n }\n \n return undefined\n }\n \n let resolvedPropertyName = resolvePropertyName(propertyName)\n if (!resolvedPropertyName && !usingModelProperties) {\n // A property added at runtime (ModelProperty.create) to a schema-file model isn't in the\n // Schema context. The schema file's definitions still win.\n const runtimeProperties = model.properties || []\n if (runtimeProperties.length > 0) {\n schema = { ...modelPropertiesToObject(runtimeProperties), ...schema }\n resolvedPropertyName = resolvePropertyName(propertyName)\n }\n // model.properties can lag behind the properties table (in Node it never follows rows added\n // after the model found its own), so also look for a row with this exact name below.\n if (!resolvedPropertyName) resolvedPropertyName = propertyName\n }\n if (!resolvedPropertyName) {\n return undefined\n }\n \n // Try to get property from database first (may have edited values)\n try {\n const db = BaseDb.getAppDb()\n if (db) {\n // Find the model in the database (the same row as `model`, not just any model with this name)\n const resolvedModelRecord = await resolveModelRecord(\n modelName,\n { modelFileId: model.id ?? scope.modelFileId, schemaName: model.schemaName ?? scope.schemaName },\n db,\n )\n const modelRecords = resolvedModelRecord ? [resolvedModelRecord] : []\n \n if (modelRecords.length > 0) {\n const modelRecord = modelRecords[0]\n \n // Find the property in the database by name\n let propertyRecords = await db\n .select()\n .from(properties)\n .where(\n and(\n eq(properties.name, resolvedPropertyName),\n eq(properties.modelId, modelRecord.id!),\n ),\n )\n .limit(1)\n \n // If not found by name, check for renamed properties (orphaned DB properties)\n if (propertyRecords.length === 0) {\n // Get all properties for this model\n const allDbProperties = await db\n .select()\n .from(properties)\n .where(eq(properties.modelId, modelRecord.id!))\n \n // Get all schema property names to identify orphaned properties\n const schemaPropertyNames = new Set(Object.keys(schema))\n \n // Get the schema property definition to match characteristics\n const schemaPropertyDef = schema[resolvedPropertyName]\n \n if (schemaPropertyDef) {\n // Find orphaned properties (don't match any schema property name) that match characteristics\n const orphanedProperties = allDbProperties.filter((p: PropertyType) => \n !schemaPropertyNames.has(p.name) && // Doesn't match any schema property name\n p.dataType === schemaPropertyDef.dataType // Same dataType\n )\n \n // If there's exactly one orphaned property with matching characteristics, it's likely the renamed property\n // We can also match by refModelId if it's a relation\n if (orphanedProperties.length > 0) {\n let matchedProperty = orphanedProperties[0]\n \n // If it's a relation, try to match by refModelId\n if (schemaPropertyDef.ref) {\n const refModelRecord = await resolveModelRecord(\n schemaPropertyDef.ref,\n { schemaName: model.schemaName },\n db,\n )\n \n if (refModelRecord) {\n const expectedRefModelId = refModelRecord.id\n const matchingByRef = orphanedProperties.find((p: PropertyType) => p.refModelId === expectedRefModelId)\n if (matchingByRef) {\n matchedProperty = matchingByRef\n }\n }\n } else {\n // For non-relation properties, prefer ones without refModelId\n const withoutRef = orphanedProperties.find((p: PropertyType) => p.refModelId === null)\n if (withoutRef) {\n matchedProperty = withoutRef\n }\n }\n \n propertyRecords = [matchedProperty]\n }\n }\n }\n \n if (propertyRecords.length > 0) {\n const propertyRecord = propertyRecords[0]\n \n // Get the base schema from file to merge with database values\n // Use the schema object created earlier, not model.schema (which doesn't exist)\n const schemaFromFile = schema[resolvedPropertyName]\n \n // Build property schema from database, merging with file schema for fields not in DB\n // Use the schema property name (resolvedPropertyName) even if DB has different name (renamed)\n const propertySchema: Static<typeof TProperty> & { _propertyFileId?: string; _dbId?: number } = {\n ...schemaFromFile, // Start with file schema (has all fields like storageType, etc.)\n id: propertyRecord.schemaFileId || propertyRecord.id?.toString(), // id should be schemaFileId (string), not database ID\n _dbId: propertyRecord.id, // Store database integer ID separately\n name: resolvedPropertyName, // Use schema name, not DB name (for renamed properties)\n dataType: propertyRecord.dataType as any,\n modelId: propertyRecord.modelId,\n modelName,\n refModelId: propertyRecord.refModelId || undefined,\n refValueType: (propertyRecord.refValueType as any) || undefined,\n required: (propertyRecord as { required?: boolean }).required ?? undefined,\n storageType: (propertyRecord.storageType as any) ?? schemaFromFile?.storageType,\n localStorageDir: propertyRecord.localStorageDir ?? schemaFromFile?.localStorageDir,\n filenameSuffix: propertyRecord.filenameSuffix ?? schemaFromFile?.filenameSuffix,\n // Include schemaFileId from database as _propertyFileId for ModelProperty.create()\n _propertyFileId: propertyRecord.schemaFileId || undefined,\n }\n \n // If refModelId is set, try to get the refModelName\n if (propertyRecord.refModelId) {\n const refModelRecords = await db\n .select()\n .from(modelsTable)\n .where(eq(modelsTable.id, propertyRecord.refModelId))\n .limit(1)\n \n if (refModelRecords.length > 0) {\n propertySchema.refModelName = refModelRecords[0].name\n propertySchema.ref = refModelRecords[0].name\n }\n } else if (schemaFromFile?.ref) {\n // If refModelId is not set but schema file has ref, resolve it from the database\n // This handles cases where the property was just created and refModelId hasn't been set yet\n propertySchema.ref = schemaFromFile.ref\n propertySchema.refModelName = schemaFromFile.ref\n \n // Try to resolve refModelId from the database using the model name\n try {\n const refModelRecord = await resolveModelRecord(\n schemaFromFile.ref,\n { schemaName: model.schemaName },\n db,\n )\n \n if (refModelRecord?.id) {\n propertySchema.refModelId = refModelRecord.id\n }\n } catch (error) {\n // Ignore errors - model might not exist yet\n }\n }\n \n return propertySchema\n }\n }\n }\n } catch (error) {\n // Database not available or error - fall through to schema file lookup\n }\n \n // Fall back to schema file lookup\n const schemaFromFile = schema[resolvedPropertyName]\n if (schemaFromFile) {\n const propertySchema: Static<typeof TProperty> & { _propertyFileId?: string } = { ...schemaFromFile, name: resolvedPropertyName }\n \n // If schema file has id as a string (propertyFileId), set it as _propertyFileId\n // This handles cases where the property hasn't been saved to the database yet\n if (typeof schemaFromFile.id === 'string') {\n propertySchema._propertyFileId = schemaFromFile.id\n }\n \n // If the schema file has ref but no refModelId, try to resolve it from the database\n if (schemaFromFile.ref && !propertySchema.refModelId) {\n try {\n const db = BaseDb.getAppDb()\n if (db) {\n const refModelRecord = await resolveModelRecord(\n schemaFromFile.ref,\n { schemaName: model.schemaName },\n db,\n )\n \n if (refModelRecord?.id) {\n propertySchema.refModelId = refModelRecord.id\n propertySchema.refModelName = schemaFromFile.ref\n }\n }\n } catch (error) {\n // Ignore errors - model might not exist yet or database not available\n }\n }\n \n return propertySchema\n }\n return undefined\n}\n"],"names":["modelPropertiesToObject","resolveStorageNameToSchemaName","BaseDb","properties","and","eq","modelsTable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA;AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BG;MACU,iBAAiB,GAAG,OAC/B,SAAiB,EACjB,YAAoB;AACpB;AACA,KAAA,GAAqE,EAAE,KACW;;AAElF,IAAA,MAAM,QAAQ,GAAG,MAAM,oDAAO,qBAAgB,8CAAC;AAC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;oBAClD;gBACF;YACF;YAAE,OAAO,KAAK,EAAE;;YAEhB;QACF;AAEA,QAAA,OAAO,cAAc;IACvB;AACA,IAAA,OAAO,SAAS;AAClB;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"property-ZerTWizX.js","sources":["../../../src/helpers/property.ts"],"sourcesContent":["import { Static } from '@sinclair/typebox'\nimport { TProperty } from '@/Schema'\n// Dynamic import to break circular dependency: Model -> ... -> helpers/property -> Model\n// import { Model } from '@/Model/Model'\nimport pluralize from 'pluralize'\nimport { resolveStorageNameToSchemaName } from '@/helpers/metadataPropertyNames'\nimport { BaseDb } from '@/db/Db/BaseDb'\nimport { models as modelsTable, properties, PropertyType } from '@/seedSchema'\nimport { eq, and } from 'drizzle-orm'\nimport { modelPropertiesToObject } from '@/helpers/model'\n\n// Re-export everything from property/index.ts to make it available when importing from helpers/property\nexport * from './property/index'\n\n/**\n * Gets the propertyRecordSchema object for a given model and property name.\n * \n * The propertyRecordSchema is the property definition object that contains\n * information about the property's data type, storage configuration, and\n * relationship details (for Relation and List types).\n * \n * This function first checks the database for property definitions (which may\n * have been edited), then falls back to schema files. This ensures that\n * edited properties persist across page reloads.\n * \n * This function handles property names that end with 'Id' or 'Ids' by automatically\n * looking up the base property name in the schema (e.g., 'authorId' -> 'author',\n * 'tagIds' -> 'tags').\n * \n * @param modelName - The name of the model (e.g., 'Article', 'Author')\n * @param propertyName - The name of the property (e.g., 'title', 'author', 'authorId', 'tags', 'tagIds')\n * @returns The propertyRecordSchema object (TProperty with optional _propertyFileId) or undefined if not found\n * \n * @example\n * ```typescript\n * const schema = await getPropertySchema('Article', 'title')\n * // Returns: { dataType: 'Text', ... }\n * \n * const relationSchema = await getPropertySchema('Article', 'author')\n * // Returns: { dataType: 'Relation', ref: 'Author', ... }\n * \n * // Also works with Id/Ids suffixes\n * const relationSchemaById = await getPropertySchema('Article', 'authorId')\n * // Returns: { dataType: 'Relation', ref: 'Author', ... }\n * ```\n */\nexport const getPropertySchema = async (\n modelName: string,\n propertyName: string,\n /** Which model is meant when several schemas define one named modelName (Model.id and/or schema). */\n scope: { modelFileId?: string | null; schemaName?: string | null } = {},\n): Promise<(Static<typeof TProperty> & { _propertyFileId?: string }) | undefined> => {\n // Dynamic import to break circular dependency\n const modelMod = await import('../Model/Model')\n const { Model } = modelMod\n const schemaMod = await import('../Schema/Schema')\n const { Schema } = schemaMod\n const { resolveModelRecord } = await import('../db/read/resolveModelRecord')\n const model = await Model.resolveAsync(modelName, scope)\n\n if (!model) {\n return undefined\n }\n \n // Get the original schema from Schema instance context (has ref fields from schema file)\n // This is more reliable than modelPropertiesToObject which depends on ModelProperty instances\n let schema: { [propertyName: string]: any } = {}\n try {\n const schemaName = model.schemaName\n if (schemaName) {\n const schemaInstance = Schema.create(schemaName, {\n waitForReady: false,\n }) as import('@/Schema/Schema').Schema\n const schemaContext = schemaInstance.getService().getSnapshot().context\n if (schemaContext.models && schemaContext.models[modelName]) {\n // Get properties from Schema context (original schema file data)\n const modelDef = schemaContext.models[modelName]\n schema = modelDef.properties || {}\n }\n }\n } catch (error) {\n // Fall through to modelPropertiesToObject\n }\n \n // Fallback to modelPropertiesToObject if Schema context doesn't have the data\n const usingModelProperties = Object.keys(schema).length === 0\n if (usingModelProperties) {\n const properties = model.properties || []\n if (properties.length === 0) {\n return undefined\n }\n schema = modelPropertiesToObject(properties)\n }\n \n // Helper to resolve property name (handles Id/Ids suffixes)\n const resolvePropertyName = (propName: string): string | undefined => {\n // First, try direct lookup\n if (schema[propName]) {\n return propName\n }\n\n // List-of-relation storage name (e.g. authorIdentityIds) -> schema key (authors)\n const listSchemaKey = resolveStorageNameToSchemaName(schema, propName)\n if (listSchemaKey && schema[listSchemaKey]) {\n return listSchemaKey\n }\n\n // Handle properties ending with 'Id' or 'Ids'\n let propertyNameWithoutId: string | undefined\n \n if (propName.endsWith('Id')) {\n propertyNameWithoutId = propName.slice(0, -2)\n } else if (propName.endsWith('Ids')) {\n propertyNameWithoutId = propName.slice(0, -3)\n propertyNameWithoutId = pluralize(propertyNameWithoutId)\n }\n \n if (propertyNameWithoutId && schema[propertyNameWithoutId]) {\n return propertyNameWithoutId\n }\n \n return undefined\n }\n \n let resolvedPropertyName = resolvePropertyName(propertyName)\n if (!resolvedPropertyName && !usingModelProperties) {\n // A property added at runtime (ModelProperty.create) to a schema-file model isn't in the\n // Schema context. The schema file's definitions still win.\n const runtimeProperties = model.properties || []\n if (runtimeProperties.length > 0) {\n schema = { ...modelPropertiesToObject(runtimeProperties), ...schema }\n resolvedPropertyName = resolvePropertyName(propertyName)\n }\n // model.properties can lag behind the properties table (in Node it never follows rows added\n // after the model found its own), so also look for a row with this exact name below.\n if (!resolvedPropertyName) resolvedPropertyName = propertyName\n }\n if (!resolvedPropertyName) {\n return undefined\n }\n \n // Try to get property from database first (may have edited values)\n try {\n const db = BaseDb.getAppDb()\n if (db) {\n // Find the model in the database (the same row as `model`, not just any model with this name)\n const resolvedModelRecord = await resolveModelRecord(\n modelName,\n { modelFileId: model.id ?? scope.modelFileId, schemaName: model.schemaName ?? scope.schemaName },\n db,\n )\n const modelRecords = resolvedModelRecord ? [resolvedModelRecord] : []\n \n if (modelRecords.length > 0) {\n const modelRecord = modelRecords[0]\n \n // Find the property in the database by name\n let propertyRecords = await db\n .select()\n .from(properties)\n .where(\n and(\n eq(properties.name, resolvedPropertyName),\n eq(properties.modelId, modelRecord.id!),\n ),\n )\n .limit(1)\n \n // If not found by name, check for renamed properties (orphaned DB properties)\n if (propertyRecords.length === 0) {\n // Get all properties for this model\n const allDbProperties = await db\n .select()\n .from(properties)\n .where(eq(properties.modelId, modelRecord.id!))\n \n // Get all schema property names to identify orphaned properties\n const schemaPropertyNames = new Set(Object.keys(schema))\n \n // Get the schema property definition to match characteristics\n const schemaPropertyDef = schema[resolvedPropertyName]\n \n if (schemaPropertyDef) {\n // Find orphaned properties (don't match any schema property name) that match characteristics\n const orphanedProperties = allDbProperties.filter((p: PropertyType) => \n !schemaPropertyNames.has(p.name) && // Doesn't match any schema property name\n p.dataType === schemaPropertyDef.dataType // Same dataType\n )\n \n // If there's exactly one orphaned property with matching characteristics, it's likely the renamed property\n // We can also match by refModelId if it's a relation\n if (orphanedProperties.length > 0) {\n let matchedProperty = orphanedProperties[0]\n \n // If it's a relation, try to match by refModelId\n if (schemaPropertyDef.ref) {\n const refModelRecord = await resolveModelRecord(\n schemaPropertyDef.ref,\n { schemaName: model.schemaName },\n db,\n )\n \n if (refModelRecord) {\n const expectedRefModelId = refModelRecord.id\n const matchingByRef = orphanedProperties.find((p: PropertyType) => p.refModelId === expectedRefModelId)\n if (matchingByRef) {\n matchedProperty = matchingByRef\n }\n }\n } else {\n // For non-relation properties, prefer ones without refModelId\n const withoutRef = orphanedProperties.find((p: PropertyType) => p.refModelId === null)\n if (withoutRef) {\n matchedProperty = withoutRef\n }\n }\n \n propertyRecords = [matchedProperty]\n }\n }\n }\n \n if (propertyRecords.length > 0) {\n const propertyRecord = propertyRecords[0]\n \n // Get the base schema from file to merge with database values\n // Use the schema object created earlier, not model.schema (which doesn't exist)\n const schemaFromFile = schema[resolvedPropertyName]\n \n // Build property schema from database, merging with file schema for fields not in DB\n // Use the schema property name (resolvedPropertyName) even if DB has different name (renamed)\n const propertySchema: Static<typeof TProperty> & { _propertyFileId?: string; _dbId?: number } = {\n ...schemaFromFile, // Start with file schema (has all fields like storageType, etc.)\n id: propertyRecord.schemaFileId || propertyRecord.id?.toString(), // id should be schemaFileId (string), not database ID\n _dbId: propertyRecord.id, // Store database integer ID separately\n name: resolvedPropertyName, // Use schema name, not DB name (for renamed properties)\n dataType: propertyRecord.dataType as any,\n modelId: propertyRecord.modelId,\n modelName,\n refModelId: propertyRecord.refModelId || undefined,\n refValueType: (propertyRecord.refValueType as any) || undefined,\n required: (propertyRecord as { required?: boolean }).required ?? undefined,\n storageType: (propertyRecord.storageType as any) ?? schemaFromFile?.storageType,\n localStorageDir: propertyRecord.localStorageDir ?? schemaFromFile?.localStorageDir,\n filenameSuffix: propertyRecord.filenameSuffix ?? schemaFromFile?.filenameSuffix,\n // Include schemaFileId from database as _propertyFileId for ModelProperty.create()\n _propertyFileId: propertyRecord.schemaFileId || undefined,\n }\n \n // If refModelId is set, try to get the refModelName\n if (propertyRecord.refModelId) {\n const refModelRecords = await db\n .select()\n .from(modelsTable)\n .where(eq(modelsTable.id, propertyRecord.refModelId))\n .limit(1)\n \n if (refModelRecords.length > 0) {\n propertySchema.refModelName = refModelRecords[0].name\n propertySchema.ref = refModelRecords[0].name\n }\n } else if (schemaFromFile?.ref) {\n // If refModelId is not set but schema file has ref, resolve it from the database\n // This handles cases where the property was just created and refModelId hasn't been set yet\n propertySchema.ref = schemaFromFile.ref\n propertySchema.refModelName = schemaFromFile.ref\n \n // Try to resolve refModelId from the database using the model name\n try {\n const refModelRecord = await resolveModelRecord(\n schemaFromFile.ref,\n { schemaName: model.schemaName },\n db,\n )\n \n if (refModelRecord?.id) {\n propertySchema.refModelId = refModelRecord.id\n }\n } catch (error) {\n // Ignore errors - model might not exist yet\n }\n }\n \n return propertySchema\n }\n }\n }\n } catch (error) {\n // Database not available or error - fall through to schema file lookup\n }\n \n // Fall back to schema file lookup\n const schemaFromFile = schema[resolvedPropertyName]\n if (schemaFromFile) {\n const propertySchema: Static<typeof TProperty> & { _propertyFileId?: string } = { ...schemaFromFile, name: resolvedPropertyName }\n \n // If schema file has id as a string (propertyFileId), set it as _propertyFileId\n // This handles cases where the property hasn't been saved to the database yet\n if (typeof schemaFromFile.id === 'string') {\n propertySchema._propertyFileId = schemaFromFile.id\n }\n \n // If the schema file has ref but no refModelId, try to resolve it from the database\n if (schemaFromFile.ref && !propertySchema.refModelId) {\n try {\n const db = BaseDb.getAppDb()\n if (db) {\n const refModelRecord = await resolveModelRecord(\n schemaFromFile.ref,\n { schemaName: model.schemaName },\n db,\n )\n \n if (refModelRecord?.id) {\n propertySchema.refModelId = refModelRecord.id\n propertySchema.refModelName = schemaFromFile.ref\n }\n }\n } catch (error) {\n // Ignore errors - model might not exist yet or database not available\n }\n }\n \n return propertySchema\n }\n return undefined\n}\n"],"names":["modelPropertiesToObject","resolveStorageNameToSchemaName","BaseDb","properties","and","eq","modelsTable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA;AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BG;MACU,iBAAiB,GAAG,OAC/B,SAAiB,EACjB,YAAoB;AACpB;AACA,KAAA,GAAqE,EAAE,KACW;;AAElF,IAAA,MAAM,QAAQ,GAAG,MAAM,oDAAO,qBAAgB,8CAAC;AAC/C,IAAA,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ;AAC1B,IAAA,MAAM,SAAS,GAAG,MAAM,oDAAO,sBAAkB,KAAC;AAClD,IAAA,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS;IAC5B,MAAM,EAAE,kBAAkB,EAAE,GAAG,MAAM,oDAAO,qBAA+B,2DAAC;IAC5E,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC;IAExD,IAAI,CAAC,KAAK,EAAE;AACV,QAAA,OAAO,SAAS;IAClB;;;IAIA,IAAI,MAAM,GAAoC,EAAE;AAChD,IAAA,IAAI;AACF,QAAA,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU;QACnC,IAAI,UAAU,EAAE;AACd,YAAA,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE;AAC/C,gBAAA,YAAY,EAAE,KAAK;AACpB,aAAA,CAAqC;YACtC,MAAM,aAAa,GAAG,cAAc,CAAC,UAAU,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO;YACvE,IAAI,aAAa,CAAC,MAAM,IAAI,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;;gBAE3D,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC;AAChD,gBAAA,MAAM,GAAG,Q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YAAA,IAAI;AACF,gBAAA,MAAM,EAAE,GAAGJ,eAAM,CAAC,QAAQ,EAAE;gBAC5B,IAAI,EAAE,EAAE;AACN,oBAAA,MAAM,cAAc,GAAG,MAAM,kBAAkB,CAC7C,cAAc,CAAC,GAAG,EAClB,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,EAChC,EAAE,CACH;AAED,oBAAA,IAAI,cAAc,EAAE,EAAE,EAAE;AACtB,wBAAA,cAAc,CAAC,UAAU,GAAG,cAAc,CAAC,EAAE;AAC7C,wBAAA,cAAc,CAAC,YAAY,GAAG,cAAc,CAAC,GAAG;oBAClD;gBACF;YACF;YAAE,OAAO,KAAK,EAAE;;YAEhB;QACF;AAEA,QAAA,OAAO,cAAc;IACvB;AACA,IAAA,OAAO,SAAS;AAClB;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var main_cjs = require('./index-
|
|
3
|
+
var main_cjs = require('./index-Dls7aMjr.js');
|
|
4
4
|
require('reflect-metadata');
|
|
5
|
-
var property = require('./property-
|
|
5
|
+
var property = require('./property-ZerTWizX.js');
|
|
6
6
|
var drizzleOrm = require('drizzle-orm');
|
|
7
7
|
var lodashEs = require('lodash-es');
|
|
8
8
|
require('pluralize');
|
|
@@ -304,7 +304,7 @@ function walksProperty(prop, forceFullSnapshot) {
|
|
|
304
304
|
return value != null && value !== '' && !(Array.isArray(value) && value.length === 0);
|
|
305
305
|
}
|
|
306
306
|
async function loadItem(seedLocalId) {
|
|
307
|
-
const { getItem } = await Promise.resolve().then(function () { return require('./getItem-
|
|
307
|
+
const { getItem } = await Promise.resolve().then(function () { return require('./getItem-CrwWYCkj.js'); });
|
|
308
308
|
try {
|
|
309
309
|
return (await getItem({ seedLocalId })) ?? undefined;
|
|
310
310
|
}
|
|
@@ -400,4 +400,4 @@ exports.isLivePublishedSeed = isLivePublishedSeed;
|
|
|
400
400
|
exports.isSeedRevoked = isSeedRevoked;
|
|
401
401
|
exports.isUnpublishedSeed = isUnpublishedSeed;
|
|
402
402
|
exports.relatedModelNameFromDef = relatedModelNameFromDef;
|
|
403
|
-
//# sourceMappingURL=publishDraftGraph-
|
|
403
|
+
//# sourceMappingURL=publishDraftGraph-CPOAcQFf.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publishDraftGraph-C38gf302.js","sources":["../../../src/helpers/getSegmentedItemProperties.ts","../../../src/db/read/resolveRelatedSeedRef.ts","../../../src/db/read/isSeedRevoked.ts","../../../src/db/read/publishDraftGraph.ts"],"sourcesContent":["import { UploadProperty } from '@/db/read/getPublishUploads'\nimport { IItem } from '@/interfaces'\nimport { ModelPropertyDataTypes, normalizeDataType } from '@/Schema'\nimport { getPropertySchema, TProperty } from '@/helpers/property'\nimport { getItemModelScope, resolveModelRecord, type ModelScope } from '@/db/read/resolveModelRecord'\nimport type { Static } from '@sinclair/typebox'\nimport { BaseDb } from '@/db/Db/BaseDb'\nimport { models, properties } from '@/seedSchema'\nimport { eq, and } from 'drizzle-orm'\nimport { camelCase, upperFirst } from 'lodash-es'\n\nconst matchesDataType = (\n actual: string | undefined,\n expected: ModelPropertyDataTypes | string,\n): boolean => normalizeDataType(actual) === expected\nasync function resolvePropertyDef(\n modelName: string,\n propertyName: string,\n scope: ModelScope,\n): Promise<{ dataType?: string; ref?: string; refValueType?: string; storageType?: string; localStorageDir?: string; filenameSuffix?: string; required?: boolean } | undefined> {\n let schema = await getPropertySchema(modelName, propertyName, scope)\n if (schema) return schema\n const db = BaseDb.getAppDb()\n if (!db) return undefined\n try {\n const normalizedModelName = upperFirst(camelCase(modelName))\n const modelRecord = await resolveModelRecord(normalizedModelName, scope, db)\n const modelRecords = modelRecord ? [modelRecord] : []\n if (modelRecords.length === 0 || !modelRecords[0].id) return undefined\n const propertyRecords = await db\n .select()\n .from(properties)\n .where(\n and(\n eq(properties.modelId, modelRecords[0].id),\n eq(properties.name, propertyName),\n ),\n )\n .limit(1)\n if (propertyRecords.length === 0) return undefined\n const propRecord = propertyRecords[0]\n let refModelName: string | undefined\n if (propRecord.refModelId != null) {\n const refModelRows = await db\n .select({ name: models.name })\n .from(models)\n .where(eq(models.id, propRecord.refModelId))\n .limit(1)\n refModelName = refModelRows[0]?.name ?? undefined\n }\n return {\n dataType: propRecord.dataType,\n ref: refModelName ?? undefined,\n refValueType: propRecord.refValueType || undefined,\n storageType: propRecord.storageType || undefined,\n localStorageDir: propRecord.localStorageDir || undefined,\n filenameSuffix: propRecord.filenameSuffix || undefined,\n required: propRecord.required ?? undefined,\n }\n } catch {\n return undefined\n }\n}\n\nexport const getSegmentedItemProperties = async (item: IItem<any>) => {\n const itemBasicProperties = []\n const itemRelationProperties = []\n const itemListProperties = []\n const itemUploadProperties: UploadProperty[] = []\n const itemImageProperties = []\n const itemStorageProperties = []\n let itemStorageTransactionProperty: UploadProperty | undefined\n let itemScope: ModelScope | undefined\n\n for (const itemProperty of item.properties) {\n let propertyDef = itemProperty.propertyDef\n // When propertyDef is missing (e.g. external app, Model not registered), resolve inline\n // so properties are not skipped and metadata attestations can be created\n if (!propertyDef && item.modelName) {\n itemScope ??= await getItemModelScope(item as any)\n const resolved = await resolvePropertyDef(item.modelName, itemProperty.propertyName, itemScope)\n if (resolved) {\n itemProperty.getService().send({ type: 'updateContext', propertyRecordSchema: resolved })\n propertyDef = resolved as Static<typeof TProperty>\n } else {\n // Last resort: Model and DB don't have schema. Use Text so property routes to\n // itemBasicProperties and can be attested (covers title, description, etc.)\n const fallbackDef = { dataType: 'Text' as const }\n itemProperty.getService().send({ type: 'updateContext', propertyRecordSchema: fallbackDef })\n propertyDef = fallbackDef as Static<typeof TProperty>\n }\n }\n if (!propertyDef) {\n continue\n }\n\n const isItemStorage =\n propertyDef.storageType &&\n propertyDef.storageType === 'ItemStorage'\n\n\n const isStorageTransaction =\n itemProperty.propertyName === 'storageTransactionId' ||\n itemProperty.propertyName === 'storage_transaction_id'\n\n const isStorageSeedType =\n matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.Image) ||\n matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.File) ||\n matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.Html) ||\n matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.Json) ||\n (matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.Relation) &&\n (matchesDataType(propertyDef.refValueType, ModelPropertyDataTypes.Image) ||\n matchesDataType(propertyDef.refValueType, ModelPropertyDataTypes.File) ||\n matchesDataType(propertyDef.refValueType, ModelPropertyDataTypes.Html) ||\n matchesDataType(propertyDef.refValueType, ModelPropertyDataTypes.Json)))\n\n if (isStorageSeedType) {\n itemImageProperties.push(itemProperty)\n if (matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.Relation)) {\n itemRelationProperties.push(itemProperty)\n }\n continue\n }\n\n if (matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.Relation)) {\n itemRelationProperties.push(itemProperty)\n continue\n }\n\n if (matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.List)) {\n // List-of-relations: ref present, goes to processListProperty\n // List-of-primitives: ref absent, treat as basic property\n const listRef =\n propertyDef.ref || (propertyDef as { refModelName?: string }).refModelName\n if (listRef) {\n itemListProperties.push(itemProperty)\n } else {\n itemBasicProperties.push(itemProperty)\n }\n continue\n }\n\n if (isItemStorage) {\n itemStorageProperties.push(itemProperty)\n continue\n }\n\n if (isStorageTransaction) {\n itemStorageTransactionProperty = { itemProperty, childProperties: [] }\n continue\n }\n\n itemBasicProperties.push(itemProperty)\n }\n\n if (itemStorageTransactionProperty && itemStorageProperties.length > 0) {\n itemStorageTransactionProperty.childProperties = itemStorageProperties\n }\n\n if (itemStorageTransactionProperty) {\n itemUploadProperties.push(itemStorageTransactionProperty)\n }\n\n return {\n itemBasicProperties,\n itemRelationProperties,\n itemListProperties,\n itemUploadProperties,\n itemImageProperties,\n }\n}\n","import { BaseDb } from '@/db/Db/BaseDb'\nimport { seeds, versions } from '@/seedSchema'\nimport { and, eq, isNotNull } from 'drizzle-orm'\nimport { ZERO_BYTES32 } from '@/helpers/constants'\nimport { isVersionRevoked } from './subqueries/liveVersion'\nimport { ModelPropertyDataTypes, normalizeDataType } from '@/helpers/property'\nimport type { IItem } from '@/interfaces'\n\nexport type RelatedSeedRow = {\n seedLocalId: string\n /** The seed's current uid (null while it was never published). */\n seedUid: string | null\n revokedAt: number | null\n type: string | null\n}\n\nconst selectSeed = {\n seedLocalId: seeds.localId,\n seedUid: seeds.uid,\n revokedAt: seeds.revokedAt,\n type: seeds.type,\n}\n\n/**\n * The local seed row a relation/list/image ref points at, by local id or uid. A uid that is no\n * seed's current uid can be the old uid of a seed that was unpublished and published again (a new\n * seed attestation, same local seed): its old version rows still record it, so it resolves to that\n * seed. Null when nothing local matches (e.g. a published uid with no local copy).\n */\nexport const findRelatedSeedRow = async ({\n seedLocalId,\n seedUid,\n}: {\n seedLocalId?: string\n seedUid?: string\n}): Promise<RelatedSeedRow | null> => {\n const appDb = BaseDb.getAppDb()\n if (!appDb) return null\n if (seedLocalId) {\n const [row] = await appDb.select(selectSeed).from(seeds).where(eq(seeds.localId, seedLocalId)).limit(1)\n if (row?.seedLocalId) return row as RelatedSeedRow\n }\n if (!seedUid || seedUid === ZERO_BYTES32) return null\n const [byUid] = await appDb.select(selectSeed).from(seeds).where(eq(seeds.uid, seedUid)).limit(1)\n if (byUid?.seedLocalId) return byUid as RelatedSeedRow\n const [version] = await appDb\n .select({ seedLocalId: versions.seedLocalId })\n .from(versions)\n .where(and(eq(versions.seedUid, seedUid), isNotNull(versions.seedLocalId)))\n .limit(1)\n if (!version?.seedLocalId) return null\n const [republished] = await appDb\n .select(selectSeed)\n .from(seeds)\n .where(eq(seeds.localId, version.seedLocalId))\n .limit(1)\n return republished?.seedLocalId ? (republished as RelatedSeedRow) : null\n}\n\n/** The seed is attested and its attestation is live. */\nexport const isLivePublishedSeed = (row: RelatedSeedRow | null): row is RelatedSeedRow & { seedUid: string } =>\n !!row?.seedUid && row.seedUid !== ZERO_BYTES32 && !isVersionRevoked(row.revokedAt)\n\n/** The seed was attested and that attestation was revoked (unpublished). */\nexport const isUnpublishedSeed = (row: RelatedSeedRow | null): row is RelatedSeedRow & { seedUid: string } =>\n !!row?.seedUid && row.seedUid !== ZERO_BYTES32 && isVersionRevoked(row.revokedAt)\n\n/** Model a relation/list/image property points at, from its definition. */\nexport function relatedModelNameFromDef(propertyDef: unknown): string | undefined {\n const def = propertyDef as { dataType?: string; ref?: string; refModelName?: string } | undefined\n if (!def) return undefined\n const dataType = normalizeDataType(def.dataType)\n if (dataType === ModelPropertyDataTypes.Image) return 'Image'\n if (dataType === ModelPropertyDataTypes.File) return 'File'\n if (dataType === ModelPropertyDataTypes.Html) return 'Html'\n return def.ref ?? def.refModelName\n}\n\n/**\n * Name of the item's Html property whose value is the Html seed `htmlSeedLocalId`: the property\n * that refers to the images embedded in that Html (htmlEmbeddedImageCoPublish rows).\n */\nexport function htmlPropertyNameForHtmlSeed(item: IItem<any>, htmlSeedLocalId: string): string {\n const want = htmlSeedLocalId.trim()\n for (const p of item.properties ?? []) {\n if (normalizeDataType(p.propertyDef?.dataType) !== ModelPropertyDataTypes.Html) continue\n const snap = p.getService().getSnapshot()\n const value = 'context' in snap ? (snap.context as { propertyValue?: unknown }).propertyValue : undefined\n if (typeof value === 'string' && value.trim() === want) return p.propertyName\n }\n return 'html'\n}\n","import { BaseDb } from '@/db/Db/BaseDb'\nimport { seeds } from '@/seedSchema'\nimport { eq } from 'drizzle-orm'\nimport { isVersionRevoked } from './subqueries/liveVersion'\n\n/**\n * True when the item's seed attestation was revoked (`seeds.revoked_at` set, by unpublish or EAS\n * sync). Such a seed can't take new versions: publishing again creates a new seed attestation\n * (see \"Republishing\" in docs/ATTESTATION_REVOCATION.md).\n */\nexport const isSeedRevoked = async (seedLocalId: string | undefined): Promise<boolean> => {\n if (!seedLocalId) return false\n const appDb = BaseDb.getAppDb()\n if (!appDb) return false\n const [row] = await appDb\n .select({ revokedAt: seeds.revokedAt })\n .from(seeds)\n .where(eq(seeds.localId, seedLocalId))\n .limit(1)\n return isVersionRevoked(row?.revokedAt)\n}\n","import { ZERO_BYTES32 } from '@/helpers/constants'\nimport { parseListPropertyValueFromStorage } from '@/helpers/listPropertyValueFromStorage'\nimport { getSegmentedItemProperties } from '@/helpers/getSegmentedItemProperties'\nimport {\n isPublishedSeedRef,\n normalizeRelationPropertyValue,\n resolveSeedIdsFromRefString,\n} from '@/helpers/relationSeedRef'\nimport type { IItem, IItemProperty } from '@/interfaces'\nimport { findRelatedSeedRow } from '@/db/read/resolveRelatedSeedRef'\nimport { isSeedRevoked } from '@/db/read/isSeedRevoked'\n\n/**\n * The draft items a publish of an item carries along, and how it walks to them.\n *\n * A publish attests the item and every draft item (no seed uid yet) reachable from it through\n * relation and list-of-relation properties, each with its full property set. Already-published\n * targets are referenced by their current uid and not walked into; revoked ones stop the publish\n * (RelatedItemUnpublishedError). getPublishPayload, getPublishUploads, getPublishUploadData (publish\n * package), summarizePublishWork and the Html-embedded image co-publish all walk this graph in the\n * same order: depth first, properties in item order (relations, then lists), list members in order.\n *\n * Cycles: an item can only attest the uid of a seed published before it in the same publish, so a\n * ref back to an item still being walked (an ancestor that gets a new seed in this publish) can't be\n * attested. Such a property is deferred: left out of this publish (it keeps no uid, so the next\n * publish of its item attests it, with the target's uid). For A ↔ B reached from A, A attests B's\n * uid and B's relation to A is deferred.\n */\n\n/** Relation properties that point at model items (not Image/File/Html/Json storage seeds). */\nexport function draftWalkProperties(segmented: {\n itemRelationProperties: IItemProperty<any>[]\n itemImageProperties: IItemProperty<any>[]\n itemListProperties: IItemProperty<any>[]\n}): { relationProperties: IItemProperty<any>[]; listProperties: IItemProperty<any>[] } {\n const storage = new Set(segmented.itemImageProperties)\n return {\n relationProperties: segmented.itemRelationProperties.filter((p) => !storage.has(p)),\n listProperties: segmented.itemListProperties,\n }\n}\n\nconst propertyContext = (prop: IItemProperty<any>): Record<string, unknown> | null => {\n const snapshot = prop.getService().getSnapshot()\n return snapshot && 'context' in snapshot\n ? ((snapshot as { context?: Record<string, unknown> }).context ?? null)\n : null\n}\n\n/** Seed refs held by a relation property (one) or a list property (each member). */\nexport function propertySeedRefs(prop: IItemProperty<any>, isList: boolean): string[] {\n const context = propertyContext(prop)\n if (!context) return []\n let value = context.propertyValue\n if (isList) {\n if (typeof value === 'string') value = parseListPropertyValueFromStorage(value)\n const arr = Array.isArray(value) ? value : value != null ? [value] : []\n return arr\n .map((v) =>\n v && typeof v === 'object'\n ? normalizeRelationPropertyValue(\n (v as { seedLocalId?: string; localId?: string }).seedLocalId ??\n (v as { localId?: string }).localId ??\n (v as { seedUid?: string }).seedUid ??\n (v as { uid?: string }).uid,\n )\n : normalizeRelationPropertyValue(v),\n )\n .filter((v): v is string => !!v)\n }\n const ref = normalizeRelationPropertyValue(value)\n return ref ? [ref] : []\n}\n\nconst isZeroUid = (uid: string | undefined | null): boolean => !uid || uid === ZERO_BYTES32\n\n/** The item gets a new seed attestation in this publish: a draft, or a revoked seed published again. */\nexport async function getsNewSeed(item: IItem<any>): Promise<boolean> {\n return isZeroUid(item.seedUid) || (await isSeedRevoked(item.seedLocalId))\n}\n\n/** Local seed id a ref points at (also for a republished seed's old uid), or undefined. */\nexport async function resolveRefSeedLocalId(ref: string): Promise<string | undefined> {\n const { seedLocalId, seedUid } = resolveSeedIdsFromRefString(ref)\n if (!seedLocalId && !seedUid) return undefined\n const row = await findRelatedSeedRow({ seedLocalId, seedUid })\n return row?.seedLocalId ?? seedLocalId\n}\n\nexport type PublishDraftGraphNode = {\n item: IItem<any>\n /** The relation or list property the walk first reached the item through. */\n via: IItemProperty<any>\n viaList: boolean\n}\n\nexport type PublishDraftGraph = {\n /** Draft items reachable from the root (root excluded), in the order the walk finishes them. */\n drafts: PublishDraftGraphNode[]\n /** Properties pointing back at an item still being walked; left out of this publish. */\n deferredProperties: Set<IItemProperty<any>>\n /** For each deferred property, the seeds (local ids) of its back references. */\n backReferences: Map<IItemProperty<any>, Set<string>>\n}\n\nexport type GetPublishDraftGraphOptions = {\n /** `new_version` / republish: properties that already have a uid are attested (and walked) again. */\n forceFullSnapshot?: boolean\n /**\n * Throw like getPublishUploads always did when a relation holds an invalid value or a local id\n * with no local item. Otherwise such refs are skipped (getPublishPayload reports them).\n */\n strict?: boolean\n}\n\n/** Would the publish attest this property (so walk its refs)? Same rule as getPublishPayload. */\nfunction walksProperty(prop: IItemProperty<any>, forceFullSnapshot: boolean): boolean {\n if (prop.uid && !forceFullSnapshot) return false\n const ctx = propertyContext(prop)\n const value = ctx?.propertyValue\n return value != null && value !== '' && !(Array.isArray(value) && value.length === 0)\n}\n\nasync function loadItem(seedLocalId: string): Promise<IItem<any> | undefined> {\n const { getItem } = await import('./getItem')\n try {\n return (await getItem({ seedLocalId })) ?? undefined\n } catch {\n return undefined\n }\n}\n\nexport async function getPublishDraftGraph(\n root: IItem<any>,\n options?: GetPublishDraftGraphOptions,\n): Promise<PublishDraftGraph> {\n const forceFullSnapshot = options?.forceFullSnapshot === true\n const strict = options?.strict === true\n const drafts: PublishDraftGraphNode[] = []\n const deferredProperties = new Set<IItemProperty<any>>()\n const backReferences = new Map<IItemProperty<any>, Set<string>>()\n const visited = new Set<string>([root.seedLocalId])\n const inProgress = new Set<string>()\n if (await getsNewSeed(root)) inProgress.add(root.seedLocalId)\n\n /** Draft target of a ref, or undefined (published, revoked, unknown). */\n const draftTarget = async (\n prop: IItemProperty<any>,\n ref: string,\n isList: boolean,\n ): Promise<{ seedLocalId: string; item?: IItem<any> } | undefined> => {\n const { seedLocalId, seedUid } = resolveSeedIdsFromRefString(ref)\n if (!seedLocalId && !seedUid) {\n if (strict && !isList) {\n throw new Error(`Invalid relation value for ${prop.propertyName}: expected local seed id or 0x uid`)\n }\n return undefined\n }\n const row = await findRelatedSeedRow({ seedLocalId, seedUid })\n const targetLocalId = row?.seedLocalId ?? seedLocalId\n if (!targetLocalId) return undefined\n // An item getting a new seed in this publish, still being walked (also the root when it is a\n // revoked seed published again): a back edge, whatever its current uid.\n if (inProgress.has(targetLocalId)) return { seedLocalId: targetLocalId }\n // Published (live or revoked): referenced by uid / reported, never walked into.\n if (row && !isZeroUid(row.seedUid)) return undefined\n if (visited.has(targetLocalId)) return { seedLocalId: targetLocalId }\n const item = await loadItem(targetLocalId)\n if (!item) {\n if (strict && !isList && !isPublishedSeedRef(ref)) {\n throw new Error(`No relatedItem found for ${prop.propertyName}`)\n }\n return undefined\n }\n if (!isZeroUid(item.seedUid)) return undefined\n return { seedLocalId: targetLocalId, item }\n }\n\n const visit = async (item: IItem<any>): Promise<void> => {\n const segmented = await getSegmentedItemProperties(item)\n const { relationProperties, listProperties } = draftWalkProperties(segmented)\n const walk = async (prop: IItemProperty<any>, isList: boolean) => {\n if (!walksProperty(prop, forceFullSnapshot)) return\n const targets: { seedLocalId: string; item?: IItem<any> }[] = []\n for (const ref of propertySeedRefs(prop, isList)) {\n const t = await draftTarget(prop, ref, isList)\n if (t) targets.push(t)\n }\n const back = targets.filter((t) => inProgress.has(t.seedLocalId)).map((t) => t.seedLocalId)\n if (back.length > 0) {\n deferredProperties.add(prop)\n backReferences.set(prop, new Set(back))\n }\n for (const t of targets) {\n if (!t.item || visited.has(t.seedLocalId)) continue\n visited.add(t.seedLocalId)\n inProgress.add(t.seedLocalId)\n await visit(t.item)\n inProgress.delete(t.seedLocalId)\n drafts.push({ item: t.item, via: prop, viaList: isList })\n }\n }\n for (const prop of relationProperties) await walk(prop, false)\n for (const prop of listProperties) await walk(prop, true)\n }\n\n await visit(root)\n return { drafts, deferredProperties, backReferences }\n}\n"],"names":["normalizeDataType","getPropertySchema","BaseDb","upperFirst","camelCase","resolveModelRecord","properties","and","eq","models","getItemModelScope","ModelPropertyDataTypes","seeds","ZERO_BYTES32","versions","isNotNull","isVersionRevoked","parseListPropertyValueFromStorage","normalizeRelationPropertyValue","resolveSeedIdsFromRefString","isPublishedSeedRef"],"mappings":";;;;;;;;;AAW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AE,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE;AACvD;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"publishDraftGraph-CPOAcQFf.js","sources":["../../../src/helpers/getSegmentedItemProperties.ts","../../../src/db/read/resolveRelatedSeedRef.ts","../../../src/db/read/isSeedRevoked.ts","../../../src/db/read/publishDraftGraph.ts"],"sourcesContent":["import { UploadProperty } from '@/db/read/getPublishUploads'\nimport { IItem } from '@/interfaces'\nimport { ModelPropertyDataTypes, normalizeDataType } from '@/Schema'\nimport { getPropertySchema, TProperty } from '@/helpers/property'\nimport { getItemModelScope, resolveModelRecord, type ModelScope } from '@/db/read/resolveModelRecord'\nimport type { Static } from '@sinclair/typebox'\nimport { BaseDb } from '@/db/Db/BaseDb'\nimport { models, properties } from '@/seedSchema'\nimport { eq, and } from 'drizzle-orm'\nimport { camelCase, upperFirst } from 'lodash-es'\n\nconst matchesDataType = (\n actual: string | undefined,\n expected: ModelPropertyDataTypes | string,\n): boolean => normalizeDataType(actual) === expected\nasync function resolvePropertyDef(\n modelName: string,\n propertyName: string,\n scope: ModelScope,\n): Promise<{ dataType?: string; ref?: string; refValueType?: string; storageType?: string; localStorageDir?: string; filenameSuffix?: string; required?: boolean } | undefined> {\n let schema = await getPropertySchema(modelName, propertyName, scope)\n if (schema) return schema\n const db = BaseDb.getAppDb()\n if (!db) return undefined\n try {\n const normalizedModelName = upperFirst(camelCase(modelName))\n const modelRecord = await resolveModelRecord(normalizedModelName, scope, db)\n const modelRecords = modelRecord ? [modelRecord] : []\n if (modelRecords.length === 0 || !modelRecords[0].id) return undefined\n const propertyRecords = await db\n .select()\n .from(properties)\n .where(\n and(\n eq(properties.modelId, modelRecords[0].id),\n eq(properties.name, propertyName),\n ),\n )\n .limit(1)\n if (propertyRecords.length === 0) return undefined\n const propRecord = propertyRecords[0]\n let refModelName: string | undefined\n if (propRecord.refModelId != null) {\n const refModelRows = await db\n .select({ name: models.name })\n .from(models)\n .where(eq(models.id, propRecord.refModelId))\n .limit(1)\n refModelName = refModelRows[0]?.name ?? undefined\n }\n return {\n dataType: propRecord.dataType,\n ref: refModelName ?? undefined,\n refValueType: propRecord.refValueType || undefined,\n storageType: propRecord.storageType || undefined,\n localStorageDir: propRecord.localStorageDir || undefined,\n filenameSuffix: propRecord.filenameSuffix || undefined,\n required: propRecord.required ?? undefined,\n }\n } catch {\n return undefined\n }\n}\n\nexport const getSegmentedItemProperties = async (item: IItem<any>) => {\n const itemBasicProperties = []\n const itemRelationProperties = []\n const itemListProperties = []\n const itemUploadProperties: UploadProperty[] = []\n const itemImageProperties = []\n const itemStorageProperties = []\n let itemStorageTransactionProperty: UploadProperty | undefined\n let itemScope: ModelScope | undefined\n\n for (const itemProperty of item.properties) {\n let propertyDef = itemProperty.propertyDef\n // When propertyDef is missing (e.g. external app, Model not registered), resolve inline\n // so properties are not skipped and metadata attestations can be created\n if (!propertyDef && item.modelName) {\n itemScope ??= await getItemModelScope(item as any)\n const resolved = await resolvePropertyDef(item.modelName, itemProperty.propertyName, itemScope)\n if (resolved) {\n itemProperty.getService().send({ type: 'updateContext', propertyRecordSchema: resolved })\n propertyDef = resolved as Static<typeof TProperty>\n } else {\n // Last resort: Model and DB don't have schema. Use Text so property routes to\n // itemBasicProperties and can be attested (covers title, description, etc.)\n const fallbackDef = { dataType: 'Text' as const }\n itemProperty.getService().send({ type: 'updateContext', propertyRecordSchema: fallbackDef })\n propertyDef = fallbackDef as Static<typeof TProperty>\n }\n }\n if (!propertyDef) {\n continue\n }\n\n const isItemStorage =\n propertyDef.storageType &&\n propertyDef.storageType === 'ItemStorage'\n\n\n const isStorageTransaction =\n itemProperty.propertyName === 'storageTransactionId' ||\n itemProperty.propertyName === 'storage_transaction_id'\n\n const isStorageSeedType =\n matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.Image) ||\n matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.File) ||\n matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.Html) ||\n matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.Json) ||\n (matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.Relation) &&\n (matchesDataType(propertyDef.refValueType, ModelPropertyDataTypes.Image) ||\n matchesDataType(propertyDef.refValueType, ModelPropertyDataTypes.File) ||\n matchesDataType(propertyDef.refValueType, ModelPropertyDataTypes.Html) ||\n matchesDataType(propertyDef.refValueType, ModelPropertyDataTypes.Json)))\n\n if (isStorageSeedType) {\n itemImageProperties.push(itemProperty)\n if (matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.Relation)) {\n itemRelationProperties.push(itemProperty)\n }\n continue\n }\n\n if (matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.Relation)) {\n itemRelationProperties.push(itemProperty)\n continue\n }\n\n if (matchesDataType(propertyDef.dataType, ModelPropertyDataTypes.List)) {\n // List-of-relations: ref present, goes to processListProperty\n // List-of-primitives: ref absent, treat as basic property\n const listRef =\n propertyDef.ref || (propertyDef as { refModelName?: string }).refModelName\n if (listRef) {\n itemListProperties.push(itemProperty)\n } else {\n itemBasicProperties.push(itemProperty)\n }\n continue\n }\n\n if (isItemStorage) {\n itemStorageProperties.push(itemProperty)\n continue\n }\n\n if (isStorageTransaction) {\n itemStorageTransactionProperty = { itemProperty, childProperties: [] }\n continue\n }\n\n itemBasicProperties.push(itemProperty)\n }\n\n if (itemStorageTransactionProperty && itemStorageProperties.length > 0) {\n itemStorageTransactionProperty.childProperties = itemStorageProperties\n }\n\n if (itemStorageTransactionProperty) {\n itemUploadProperties.push(itemStorageTransactionProperty)\n }\n\n return {\n itemBasicProperties,\n itemRelationProperties,\n itemListProperties,\n itemUploadProperties,\n itemImageProperties,\n }\n}\n","import { BaseDb } from '@/db/Db/BaseDb'\nimport { seeds, versions } from '@/seedSchema'\nimport { and, eq, isNotNull } from 'drizzle-orm'\nimport { ZERO_BYTES32 } from '@/helpers/constants'\nimport { isVersionRevoked } from './subqueries/liveVersion'\nimport { ModelPropertyDataTypes, normalizeDataType } from '@/helpers/property'\nimport type { IItem } from '@/interfaces'\n\nexport type RelatedSeedRow = {\n seedLocalId: string\n /** The seed's current uid (null while it was never published). */\n seedUid: string | null\n revokedAt: number | null\n type: string | null\n}\n\nconst selectSeed = {\n seedLocalId: seeds.localId,\n seedUid: seeds.uid,\n revokedAt: seeds.revokedAt,\n type: seeds.type,\n}\n\n/**\n * The local seed row a relation/list/image ref points at, by local id or uid. A uid that is no\n * seed's current uid can be the old uid of a seed that was unpublished and published again (a new\n * seed attestation, same local seed): its old version rows still record it, so it resolves to that\n * seed. Null when nothing local matches (e.g. a published uid with no local copy).\n */\nexport const findRelatedSeedRow = async ({\n seedLocalId,\n seedUid,\n}: {\n seedLocalId?: string\n seedUid?: string\n}): Promise<RelatedSeedRow | null> => {\n const appDb = BaseDb.getAppDb()\n if (!appDb) return null\n if (seedLocalId) {\n const [row] = await appDb.select(selectSeed).from(seeds).where(eq(seeds.localId, seedLocalId)).limit(1)\n if (row?.seedLocalId) return row as RelatedSeedRow\n }\n if (!seedUid || seedUid === ZERO_BYTES32) return null\n const [byUid] = await appDb.select(selectSeed).from(seeds).where(eq(seeds.uid, seedUid)).limit(1)\n if (byUid?.seedLocalId) return byUid as RelatedSeedRow\n const [version] = await appDb\n .select({ seedLocalId: versions.seedLocalId })\n .from(versions)\n .where(and(eq(versions.seedUid, seedUid), isNotNull(versions.seedLocalId)))\n .limit(1)\n if (!version?.seedLocalId) return null\n const [republished] = await appDb\n .select(selectSeed)\n .from(seeds)\n .where(eq(seeds.localId, version.seedLocalId))\n .limit(1)\n return republished?.seedLocalId ? (republished as RelatedSeedRow) : null\n}\n\n/** The seed is attested and its attestation is live. */\nexport const isLivePublishedSeed = (row: RelatedSeedRow | null): row is RelatedSeedRow & { seedUid: string } =>\n !!row?.seedUid && row.seedUid !== ZERO_BYTES32 && !isVersionRevoked(row.revokedAt)\n\n/** The seed was attested and that attestation was revoked (unpublished). */\nexport const isUnpublishedSeed = (row: RelatedSeedRow | null): row is RelatedSeedRow & { seedUid: string } =>\n !!row?.seedUid && row.seedUid !== ZERO_BYTES32 && isVersionRevoked(row.revokedAt)\n\n/** Model a relation/list/image property points at, from its definition. */\nexport function relatedModelNameFromDef(propertyDef: unknown): string | undefined {\n const def = propertyDef as { dataType?: string; ref?: string; refModelName?: string } | undefined\n if (!def) return undefined\n const dataType = normalizeDataType(def.dataType)\n if (dataType === ModelPropertyDataTypes.Image) return 'Image'\n if (dataType === ModelPropertyDataTypes.File) return 'File'\n if (dataType === ModelPropertyDataTypes.Html) return 'Html'\n return def.ref ?? def.refModelName\n}\n\n/**\n * Name of the item's Html property whose value is the Html seed `htmlSeedLocalId`: the property\n * that refers to the images embedded in that Html (htmlEmbeddedImageCoPublish rows).\n */\nexport function htmlPropertyNameForHtmlSeed(item: IItem<any>, htmlSeedLocalId: string): string {\n const want = htmlSeedLocalId.trim()\n for (const p of item.properties ?? []) {\n if (normalizeDataType(p.propertyDef?.dataType) !== ModelPropertyDataTypes.Html) continue\n const snap = p.getService().getSnapshot()\n const value = 'context' in snap ? (snap.context as { propertyValue?: unknown }).propertyValue : undefined\n if (typeof value === 'string' && value.trim() === want) return p.propertyName\n }\n return 'html'\n}\n","import { BaseDb } from '@/db/Db/BaseDb'\nimport { seeds } from '@/seedSchema'\nimport { eq } from 'drizzle-orm'\nimport { isVersionRevoked } from './subqueries/liveVersion'\n\n/**\n * True when the item's seed attestation was revoked (`seeds.revoked_at` set, by unpublish or EAS\n * sync). Such a seed can't take new versions: publishing again creates a new seed attestation\n * (see \"Republishing\" in docs/ATTESTATION_REVOCATION.md).\n */\nexport const isSeedRevoked = async (seedLocalId: string | undefined): Promise<boolean> => {\n if (!seedLocalId) return false\n const appDb = BaseDb.getAppDb()\n if (!appDb) return false\n const [row] = await appDb\n .select({ revokedAt: seeds.revokedAt })\n .from(seeds)\n .where(eq(seeds.localId, seedLocalId))\n .limit(1)\n return isVersionRevoked(row?.revokedAt)\n}\n","import { ZERO_BYTES32 } from '@/helpers/constants'\nimport { parseListPropertyValueFromStorage } from '@/helpers/listPropertyValueFromStorage'\nimport { getSegmentedItemProperties } from '@/helpers/getSegmentedItemProperties'\nimport {\n isPublishedSeedRef,\n normalizeRelationPropertyValue,\n resolveSeedIdsFromRefString,\n} from '@/helpers/relationSeedRef'\nimport type { IItem, IItemProperty } from '@/interfaces'\nimport { findRelatedSeedRow } from '@/db/read/resolveRelatedSeedRef'\nimport { isSeedRevoked } from '@/db/read/isSeedRevoked'\n\n/**\n * The draft items a publish of an item carries along, and how it walks to them.\n *\n * A publish attests the item and every draft item (no seed uid yet) reachable from it through\n * relation and list-of-relation properties, each with its full property set. Already-published\n * targets are referenced by their current uid and not walked into; revoked ones stop the publish\n * (RelatedItemUnpublishedError). getPublishPayload, getPublishUploads, getPublishUploadData (publish\n * package), summarizePublishWork and the Html-embedded image co-publish all walk this graph in the\n * same order: depth first, properties in item order (relations, then lists), list members in order.\n *\n * Cycles: an item can only attest the uid of a seed published before it in the same publish, so a\n * ref back to an item still being walked (an ancestor that gets a new seed in this publish) can't be\n * attested. Such a property is deferred: left out of this publish (it keeps no uid, so the next\n * publish of its item attests it, with the target's uid). For A ↔ B reached from A, A attests B's\n * uid and B's relation to A is deferred.\n */\n\n/** Relation properties that point at model items (not Image/File/Html/Json storage seeds). */\nexport function draftWalkProperties(segmented: {\n itemRelationProperties: IItemProperty<any>[]\n itemImageProperties: IItemProperty<any>[]\n itemListProperties: IItemProperty<any>[]\n}): { relationProperties: IItemProperty<any>[]; listProperties: IItemProperty<any>[] } {\n const storage = new Set(segmented.itemImageProperties)\n return {\n relationProperties: segmented.itemRelationProperties.filter((p) => !storage.has(p)),\n listProperties: segmented.itemListProperties,\n }\n}\n\nconst propertyContext = (prop: IItemProperty<any>): Record<string, unknown> | null => {\n const snapshot = prop.getService().getSnapshot()\n return snapshot && 'context' in snapshot\n ? ((snapshot as { context?: Record<string, unknown> }).context ?? null)\n : null\n}\n\n/** Seed refs held by a relation property (one) or a list property (each member). */\nexport function propertySeedRefs(prop: IItemProperty<any>, isList: boolean): string[] {\n const context = propertyContext(prop)\n if (!context) return []\n let value = context.propertyValue\n if (isList) {\n if (typeof value === 'string') value = parseListPropertyValueFromStorage(value)\n const arr = Array.isArray(value) ? value : value != null ? [value] : []\n return arr\n .map((v) =>\n v && typeof v === 'object'\n ? normalizeRelationPropertyValue(\n (v as { seedLocalId?: string; localId?: string }).seedLocalId ??\n (v as { localId?: string }).localId ??\n (v as { seedUid?: string }).seedUid ??\n (v as { uid?: string }).uid,\n )\n : normalizeRelationPropertyValue(v),\n )\n .filter((v): v is string => !!v)\n }\n const ref = normalizeRelationPropertyValue(value)\n return ref ? [ref] : []\n}\n\nconst isZeroUid = (uid: string | undefined | null): boolean => !uid || uid === ZERO_BYTES32\n\n/** The item gets a new seed attestation in this publish: a draft, or a revoked seed published again. */\nexport async function getsNewSeed(item: IItem<any>): Promise<boolean> {\n return isZeroUid(item.seedUid) || (await isSeedRevoked(item.seedLocalId))\n}\n\n/** Local seed id a ref points at (also for a republished seed's old uid), or undefined. */\nexport async function resolveRefSeedLocalId(ref: string): Promise<string | undefined> {\n const { seedLocalId, seedUid } = resolveSeedIdsFromRefString(ref)\n if (!seedLocalId && !seedUid) return undefined\n const row = await findRelatedSeedRow({ seedLocalId, seedUid })\n return row?.seedLocalId ?? seedLocalId\n}\n\nexport type PublishDraftGraphNode = {\n item: IItem<any>\n /** The relation or list property the walk first reached the item through. */\n via: IItemProperty<any>\n viaList: boolean\n}\n\nexport type PublishDraftGraph = {\n /** Draft items reachable from the root (root excluded), in the order the walk finishes them. */\n drafts: PublishDraftGraphNode[]\n /** Properties pointing back at an item still being walked; left out of this publish. */\n deferredProperties: Set<IItemProperty<any>>\n /** For each deferred property, the seeds (local ids) of its back references. */\n backReferences: Map<IItemProperty<any>, Set<string>>\n}\n\nexport type GetPublishDraftGraphOptions = {\n /** `new_version` / republish: properties that already have a uid are attested (and walked) again. */\n forceFullSnapshot?: boolean\n /**\n * Throw like getPublishUploads always did when a relation holds an invalid value or a local id\n * with no local item. Otherwise such refs are skipped (getPublishPayload reports them).\n */\n strict?: boolean\n}\n\n/** Would the publish attest this property (so walk its refs)? Same rule as getPublishPayload. */\nfunction walksProperty(prop: IItemProperty<any>, forceFullSnapshot: boolean): boolean {\n if (prop.uid && !forceFullSnapshot) return false\n const ctx = propertyContext(prop)\n const value = ctx?.propertyValue\n return value != null && value !== '' && !(Array.isArray(value) && value.length === 0)\n}\n\nasync function loadItem(seedLocalId: string): Promise<IItem<any> | undefined> {\n const { getItem } = await import('./getItem')\n try {\n return (await getItem({ seedLocalId })) ?? undefined\n } catch {\n return undefined\n }\n}\n\nexport async function getPublishDraftGraph(\n root: IItem<any>,\n options?: GetPublishDraftGraphOptions,\n): Promise<PublishDraftGraph> {\n const forceFullSnapshot = options?.forceFullSnapshot === true\n const strict = options?.strict === true\n const drafts: PublishDraftGraphNode[] = []\n const deferredProperties = new Set<IItemProperty<any>>()\n const backReferences = new Map<IItemProperty<any>, Set<string>>()\n const visited = new Set<string>([root.seedLocalId])\n const inProgress = new Set<string>()\n if (await getsNewSeed(root)) inProgress.add(root.seedLocalId)\n\n /** Draft target of a ref, or undefined (published, revoked, unknown). */\n const draftTarget = async (\n prop: IItemProperty<any>,\n ref: string,\n isList: boolean,\n ): Promise<{ seedLocalId: string; item?: IItem<any> } | undefined> => {\n const { seedLocalId, seedUid } = resolveSeedIdsFromRefString(ref)\n if (!seedLocalId && !seedUid) {\n if (strict && !isList) {\n throw new Error(`Invalid relation value for ${prop.propertyName}: expected local seed id or 0x uid`)\n }\n return undefined\n }\n const row = await findRelatedSeedRow({ seedLocalId, seedUid })\n const targetLocalId = row?.seedLocalId ?? seedLocalId\n if (!targetLocalId) return undefined\n // An item getting a new seed in this publish, still being walked (also the root when it is a\n // revoked seed published again): a back edge, whatever its current uid.\n if (inProgress.has(targetLocalId)) return { seedLocalId: targetLocalId }\n // Published (live or revoked): referenced by uid / reported, never walked into.\n if (row && !isZeroUid(row.seedUid)) return undefined\n if (visited.has(targetLocalId)) return { seedLocalId: targetLocalId }\n const item = await loadItem(targetLocalId)\n if (!item) {\n if (strict && !isList && !isPublishedSeedRef(ref)) {\n throw new Error(`No relatedItem found for ${prop.propertyName}`)\n }\n return undefined\n }\n if (!isZeroUid(item.seedUid)) return undefined\n return { seedLocalId: targetLocalId, item }\n }\n\n const visit = async (item: IItem<any>): Promise<void> => {\n const segmented = await getSegmentedItemProperties(item)\n const { relationProperties, listProperties } = draftWalkProperties(segmented)\n const walk = async (prop: IItemProperty<any>, isList: boolean) => {\n if (!walksProperty(prop, forceFullSnapshot)) return\n const targets: { seedLocalId: string; item?: IItem<any> }[] = []\n for (const ref of propertySeedRefs(prop, isList)) {\n const t = await draftTarget(prop, ref, isList)\n if (t) targets.push(t)\n }\n const back = targets.filter((t) => inProgress.has(t.seedLocalId)).map((t) => t.seedLocalId)\n if (back.length > 0) {\n deferredProperties.add(prop)\n backReferences.set(prop, new Set(back))\n }\n for (const t of targets) {\n if (!t.item || visited.has(t.seedLocalId)) continue\n visited.add(t.seedLocalId)\n inProgress.add(t.seedLocalId)\n await visit(t.item)\n inProgress.delete(t.seedLocalId)\n drafts.push({ item: t.item, via: prop, viaList: isList })\n }\n }\n for (const prop of relationProperties) await walk(prop, false)\n for (const prop of listProperties) await walk(prop, true)\n }\n\n await visit(root)\n return { drafts, deferredProperties, backReferences }\n}\n"],"names":["normalizeDataType","getPropertySchema","BaseDb","upperFirst","camelCase","resolveModelRecord","properties","and","eq","models","getItemModelScope","ModelPropertyDataTypes","seeds","ZERO_BYTES32","versions","isNotNull","isVersionRevoked","parseListPropertyValueFromStorage","normalizeRelationPropertyValue","resolveSeedIdsFromRefString","isPublishedSeedRef"],"mappings":";;;;;;;;;AAWA,MAAM,eAAe,GAAG,CACtB,MAA0B,EAC1B,QAAyC,KAC7BA,0BAAiB,CAAC,MAAM,CAAC,KAAK,QAAQ;AACpD,eAAe,kBAAkB,CAC/B,SAAiB,EACjB,YAAoB,EACpB,KAAiB,EAAA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
5
5
|
var debug = require('debug');
|
|
6
|
-
var main_cjs = require('./index-
|
|
6
|
+
var main_cjs = require('./index-Dls7aMjr.js');
|
|
7
7
|
require('immer');
|
|
8
8
|
require('reflect-metadata');
|
|
9
9
|
require('xstate');
|
|
@@ -113,4 +113,4 @@ const resetAmbiguousLegacyItemData = async () => {
|
|
|
113
113
|
|
|
114
114
|
exports.LEGACY_ITEM_MODEL_CHECK_KEY = LEGACY_ITEM_MODEL_CHECK_KEY;
|
|
115
115
|
exports.resetAmbiguousLegacyItemData = resetAmbiguousLegacyItemData;
|
|
116
|
-
//# sourceMappingURL=resetAmbiguousLegacyItemData-
|
|
116
|
+
//# sourceMappingURL=resetAmbiguousLegacyItemData-adDl4LcT.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resetAmbiguousLegacyItemData-
|
|
1
|
+
{"version":3,"file":"resetAmbiguousLegacyItemData-adDl4LcT.js","sources":["../../../src/db/resetAmbiguousLegacyItemData.ts"],"sourcesContent":["import { eq, isNotNull, isNull, and } from 'drizzle-orm'\nimport { toSnakeCase } from 'drizzle-orm/casing'\nimport debug from 'debug'\nimport { BaseDb } from '@/db/Db/BaseDb'\nimport {\n appState,\n arweaveL1FinalizeJobs,\n easSyncProcesses,\n htmlEmbeddedImageCoPublish,\n metadata,\n models,\n publishProcesses,\n schemas,\n seeds,\n uploadProcesses,\n modelSchemas,\n versions,\n} from '@/seedSchema'\n\nconst logger = debug('seedSdk:db:resetAmbiguousLegacyItemData')\n\n/** appState key recording that the one-time check after migration 0015 has run. */\nexport const LEGACY_ITEM_MODEL_CHECK_KEY = 'legacyItemModelCheck:v1'\n\n/**\n * One-time check after seeds.model_file_id was introduced (migration 0015). Seeds from before then\n * that couldn't be backfilled have no model; if their model name now exists in more than one schema\n * there is no way to tell which model they belong to. In that case the local item data (seeds,\n * versions, metadata and the jobs that reference them) is cleared, keeping schemas and models;\n * published items come back on the next EAS sync.\n *\n * Runs once (not on every start): EAS-synced seeds also lack model_file_id until\n * resolveModelForSyncedSeed exists, and re-checking would clear the DB after every sync.\n * TODO: replace the reset with a migration path once there is real user data at stake.\n *\n * @returns true if item data was cleared\n */\nexport const resetAmbiguousLegacyItemData = async (): Promise<boolean> => {\n const db = BaseDb.getAppDb()\n if (!db) return false\n\n const done = await db.select({ key: appState.key }).from(appState).where(eq(appState.key, LEGACY_ITEM_MODEL_CHECK_KEY)).limit(1)\n if (done.length > 0) return false\n\n const markDone = () =>\n db\n .insert(appState)\n .values({ key: LEGACY_ITEM_MODEL_CHECK_KEY, value: String(Date.now()), createdAt: Date.now(), updatedAt: Date.now() })\n .onConflictDoNothing()\n\n const legacyTypes = (await db\n .selectDistinct({ type: seeds.type })\n .from(seeds)\n .where(and(isNull(seeds.modelFileId), isNotNull(seeds.type)))) as { type: string }[]\n if (legacyTypes.length === 0) {\n await markDone()\n return false\n }\n\n // Which seed types (snake_case model names) map to models in more than one schema\n const linkedModels = (await db\n .select({ modelId: models.id, modelName: models.name, schemaName: schemas.name })\n .from(models)\n .innerJoin(modelSchemas, eq(models.id, modelSchemas.modelId))\n .innerJoin(schemas, eq(modelSchemas.schemaId, schemas.id))) as {\n modelId: number\n modelName: string\n schemaName: string\n }[]\n const byType = new Map<string, { modelIds: Set<number>; schemaNames: Set<string> }>()\n for (const row of linkedModels) {\n const type = toSnakeCase(row.modelName)\n const entry = byType.get(type) ?? { modelIds: new Set(), schemaNames: new Set() }\n entry.modelIds.add(row.modelId)\n entry.schemaNames.add(row.schemaName)\n byType.set(type, entry)\n }\n const ambiguous = legacyTypes\n .map(({ type }) => ({ type, entry: byType.get(type) }))\n .filter(({ entry }) => entry && entry.modelIds.size > 1)\n\n if (ambiguous.length === 0) {\n await markDone()\n return false\n }\n\n const details = ambiguous\n .map(({ type, entry }) => `\"${type}\" (schemas: ${[...entry!.schemaNames].sort().join(', ')})`)\n .join('; ')\n console.warn(\n `[seed-protocol] Clearing local item data: items created before this SDK version don't record ` +\n `which model they belong to, and these model names now exist in more than one schema: ${details}. ` +\n `Schemas and models are kept; published items will be restored by the next EAS sync.`,\n )\n logger(`Clearing item data for ambiguous legacy seed types: ${details}`)\n\n for (const table of [\n htmlEmbeddedImageCoPublish,\n arweaveL1FinalizeJobs,\n uploadProcesses,\n publishProcesses,\n easSyncProcesses,\n metadata,\n versions,\n seeds,\n ]) {\n await db.delete(table)\n }\n await markDone()\n return true\n}\n"],"names":["BaseDb","appState","eq","seeds","and","isNull","isNotNull","models","schemas","modelSchemas","toSnakeCase","htmlEmbeddedImageCoPublish","arweaveL1FinalizeJobs","uploadProcesses","publishProcesses","easSyncProcesses","metadata","versions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAM,MAAM,GAAG,KAAK,CAAC,yCAAyC,CAAC;AAE/D;AACO,MAAM,2BAA2B,GAAG;AAE3C;;;;;;;;;;;;AAYG;AACI,MAAM,4BAA4B,GAAG,YAA6B;AACvE,IAAA,MAAM,EAAE,GAAGA,eAAM,CAAC,QAAQ,EAAE;AAC5B,IAAA,IAAI,CAAC,EAAE;AAAE,QAAA,OAAO,KAAK;AAErB,IAAA,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,EAAEC,iBAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAACA,iBAAQ,CAAC,CAAC,KAAK,CAACC,aAAE,CAACD,iBAAQ,CAAC,GAAG,EAAE,2BAA2B,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAChI,IAAA,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;AAAE,QAAA,OAAO,KAAK;AAEjC,IAAA,MAAM,QAAQ,GAAG,MACf;SACG,MAAM,CAACA,iBAAQ;AACf,SAAA,MAAM,CAAC,EAAE,GAAG,EAAE,2BAA2B,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAA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ChB,IAAA,OAAO,IAAI;AACb;;;"}
|
package/dist/cjs/{resolveModelForSyncedSeed-CNYaLOir.js → resolveModelForSyncedSeed-DoNThPdL.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var debug = require('debug');
|
|
4
|
-
var main_cjs = require('./index-
|
|
4
|
+
var main_cjs = require('./index-Dls7aMjr.js');
|
|
5
5
|
|
|
6
6
|
const logger = debug('seedSdk:db:read:resolveModelForSyncedSeed');
|
|
7
7
|
/** Emitted when background work skips a seed whose model name exists in several schemas. */
|
|
@@ -46,4 +46,4 @@ const skipSeedOnAmbiguousModel = async (seed, context, work) => {
|
|
|
46
46
|
|
|
47
47
|
exports.resolveModelForSyncedSeed = resolveModelForSyncedSeed;
|
|
48
48
|
exports.skipSeedOnAmbiguousModel = skipSeedOnAmbiguousModel;
|
|
49
|
-
//# sourceMappingURL=resolveModelForSyncedSeed-
|
|
49
|
+
//# sourceMappingURL=resolveModelForSyncedSeed-DoNThPdL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveModelForSyncedSeed-
|
|
1
|
+
{"version":3,"file":"resolveModelForSyncedSeed-DoNThPdL.js","sources":["../../../src/db/read/resolveModelForSyncedSeed.ts"],"sourcesContent":["import debug from 'debug'\nimport { eventEmitter } from '@/eventBus'\nimport { AmbiguousModelError } from '@/Model/errors'\n\nconst logger = debug('seedSdk:db:read:resolveModelForSyncedSeed')\n\n/** Emitted when background work skips a seed whose model name exists in several schemas. */\nexport const MODEL_AMBIGUOUS_EVENT = 'model:ambiguous' as const\n\nexport type ModelAmbiguousEventPayload = {\n modelName: string\n schemaNames: string[]\n seedLocalId?: string\n seedUid?: string\n /** What was being done when the seed was skipped (e.g. 'easSync.metadata'). */\n context: string\n}\n\nexport type SyncedSeedInfo = {\n seedUid?: string | null\n seedLocalId?: string | null\n /** seeds.type as synced from EAS (the EAS schema name, i.e. snake_case model name). */\n modelType?: string | null\n /** EAS schema UID of the seed attestation. */\n schemaUid?: string | null\n}\n\n/**\n * Seam for matching an EAS-synced seed to a local model (its schemaFileId).\n *\n * EAS identifies a seed's model only by name (`bytes32 <model_name>`), so when several local schemas\n * define a model with that name the seed alone can't say which one it is. The plan is to match by\n * the seed's properties and metadata (see docs/EAS_SYNCED_SEED_MODEL_RESOLUTION.md).\n *\n * TODO(eas-synced-seed-model-resolution): not implemented yet. Returns undefined, so callers fall\n * back to the name, which throws AmbiguousModelError when the name is ambiguous.\n */\nexport const resolveModelForSyncedSeed = async (_seed: SyncedSeedInfo): Promise<string | undefined> => {\n return undefined\n}\n\n/**\n * Run background work for one seed; if it hits an ambiguous model name, log, emit\n * MODEL_AMBIGUOUS_EVENT and return undefined (skip) instead of failing the whole job. Loading the\n * item directly still throws, so the problem surfaces where the app touches it.\n */\nexport const skipSeedOnAmbiguousModel = async <T>(\n seed: { seedLocalId?: string | null; seedUid?: string | null },\n context: string,\n work: () => Promise<T>,\n): Promise<T | undefined> => {\n try {\n return await work()\n } catch (error) {\n if (!(error instanceof AmbiguousModelError)) throw error\n logger(`Skipping seed ${seed.seedLocalId ?? seed.seedUid} in ${context}: ${error.message}`)\n const payload: ModelAmbiguousEventPayload = {\n modelName: error.modelName,\n schemaNames: error.schemaNames,\n seedLocalId: seed.seedLocalId ?? undefined,\n seedUid: seed.seedUid ?? undefined,\n context,\n }\n eventEmitter.emit(MODEL_AMBIGUOUS_EVENT, payload)\n return undefined\n }\n}\n"],"names":["AmbiguousModelError","eventEmitter"],"mappings":";;;;;AAIA,MAAM,MAAM,GAAG,KAAK,CAAC,2CAA2C,CAAC;AAEjE;AACO,MAAM,qBAAqB,GAAG,iBAA0B;AAoB/D;;;;;;;;;AASG;MACU,yBAAyB,GAAG,OAAO,KAAqB,KAAiC;AACpG,IAAA,OAAO,SAAS;AAClB;AAEA;;;;AAIG;AACI,MAAM,wBAAwB,GAAG,OACtC,IAA8D,EAC9D,OAAe,EACf,IAAsB,KACI;AAC1B,IAAA,IAAI;QACF,OAAO,MAAM,IAAI,EAAE;IACrB;IAAE,OAAO,KAAK,EAAE;AACd,QAAA,IAAI,EAAE,KAAK,YAAYA,4BAAmB,CAAC;AAAE,YAAA,MAAM,KAAK;AACxD,QAAA,MAAM,CAAC,CAAA,cAAA,EAAiB,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,OAAO,CAAA,IAAA,EAAO,OAAO,CAAA,EAAA,EAAK,KAAK,CAAC,OAAO,CAAA,CAAE,CAAC;AAC3F,QAAA,MAAM,OAAO,GAA+B;YAC1C,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,WAAW,EAAE,KAAK,CAAC,WAAW;AAC9B,YAAA,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,SAAS;AAC1C,YAAA,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,SAAS;YAClC,OAAO;SACR;AACD,QAAAC,qBAAY,CAAC,IAAI,CAAC,qBAAqB,EAAE,OAAO,CAAC;AACjD,QAAA,OAAO,SAAS;IAClB;AACF;;;"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var main_cjs = require('./index-
|
|
4
|
-
var resolveModelForSyncedSeed = require('./resolveModelForSyncedSeed-
|
|
3
|
+
var main_cjs = require('./index-Dls7aMjr.js');
|
|
4
|
+
var resolveModelForSyncedSeed = require('./resolveModelForSyncedSeed-DoNThPdL.js');
|
|
5
5
|
var lodashEs = require('lodash-es');
|
|
6
6
|
var query = require('@seedprotocol/query');
|
|
7
7
|
var drizzleOrm = require('drizzle-orm');
|
|
8
8
|
var eas$1 = require('@seedprotocol/eas');
|
|
9
9
|
var pluralize = require('pluralize');
|
|
10
|
-
var eas = require('./eas-
|
|
10
|
+
var eas = require('./eas-C3CL0l7l.js');
|
|
11
11
|
require('immer');
|
|
12
12
|
require('reflect-metadata');
|
|
13
13
|
require('xstate');
|
|
@@ -39,7 +39,7 @@ require('@seedprotocol/eas/node');
|
|
|
39
39
|
const schemaStringToModelRecord = new Map();
|
|
40
40
|
const getModelSchemas = async () => {
|
|
41
41
|
// Dynamic import to break circular dependency
|
|
42
|
-
const modelMod = await Promise.resolve().then(function () { return require('./index-
|
|
42
|
+
const modelMod = await Promise.resolve().then(function () { return require('./index-Dls7aMjr.js'); }).then(function (n) { return n.Model$1; });
|
|
43
43
|
const { Model } = modelMod;
|
|
44
44
|
const allModels = await Model.all();
|
|
45
45
|
const modelRecords = [];
|
|
@@ -603,7 +603,7 @@ const resolveSyncedSeedModel = async (Model, modelType, seed) => {
|
|
|
603
603
|
const insertSyncedProperties = async ({ newProperties, itemSeeds, state, }) => {
|
|
604
604
|
const { seedUidToLocalId, seedUidToModelType, versionUidToLocalId, versionUidToSeedUid } = state;
|
|
605
605
|
// Dynamic import to break circular dependency
|
|
606
|
-
const modelMod = await Promise.resolve().then(function () { return require('./index-
|
|
606
|
+
const modelMod = await Promise.resolve().then(function () { return require('./index-Dls7aMjr.js'); }).then(function (n) { return n.Model$1; });
|
|
607
607
|
const { Model } = modelMod;
|
|
608
608
|
// Loads every model into Model's cache, where resolveSyncedSeedModel looks them up.
|
|
609
609
|
await Model.all();
|
|
@@ -870,7 +870,7 @@ const runSyncFromEas = async (options) => {
|
|
|
870
870
|
await getRelatedSeedsAndVersions(state);
|
|
871
871
|
main_cjs.scheduleBulkFilesDownloadFromEasSync(addresses);
|
|
872
872
|
try {
|
|
873
|
-
const itemMod = await Promise.resolve().then(function () { return require('./index-
|
|
873
|
+
const itemMod = await Promise.resolve().then(function () { return require('./index-Dls7aMjr.js'); }).then(function (n) { return n.Item$1; });
|
|
874
874
|
await itemMod.Item.rehydrateCachedItemsFromDbAfterEasSync();
|
|
875
875
|
}
|
|
876
876
|
catch (err) {
|
|
@@ -883,4 +883,4 @@ const runSyncFromEas = async (options) => {
|
|
|
883
883
|
exports.VERSION_INSERT_BATCH = VERSION_INSERT_BATCH;
|
|
884
884
|
exports.isSqlEscapedAttestationRaw = isSqlEscapedAttestationRaw;
|
|
885
885
|
exports.runSyncFromEas = runSyncFromEas;
|
|
886
|
-
//# sourceMappingURL=syncDbWithEas-
|
|
886
|
+
//# sourceMappingURL=syncDbWithEas-CYfPkus9.js.map
|