@seedprotocol/sdk 0.4.3 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -348
- package/dist/{ArweaveClient-CleX_4Gw.js → ArweaveClient-CgWK-JgT.js} +8 -8
- package/dist/{ArweaveClient-CleX_4Gw.js.map → ArweaveClient-CgWK-JgT.js.map} +1 -1
- package/dist/{ArweaveClient-BvJ1FhQ5.js → ArweaveClient-WcG8CZAE.js} +8 -8
- package/dist/{ArweaveClient-BvJ1FhQ5.js.map → ArweaveClient-WcG8CZAE.js.map} +1 -1
- package/dist/{Db-DX08SxS9.js → Db-DjFdIdR9.js} +9 -16
- package/dist/{Db-DX08SxS9.js.map → Db-DjFdIdR9.js.map} +1 -1
- package/dist/{Db-BPnO1-_p.js → Db-DjofXdeU.js} +9 -9
- package/dist/{Db-BPnO1-_p.js.map → Db-DjofXdeU.js.map} +1 -1
- package/dist/{EasClient-BwhUcPjY.js → EasClient-Aojewp6P.js} +8 -8
- package/dist/{EasClient-CJSs38Db.js.map → EasClient-Aojewp6P.js.map} +1 -1
- package/dist/{EasClient-CJSs38Db.js → EasClient-BVFXp2O6.js} +8 -8
- package/dist/{EasClient-BwhUcPjY.js.map → EasClient-BVFXp2O6.js.map} +1 -1
- package/dist/{FileManager-B1tdLMsX.js → FileManager-C9zr4AJe.js} +8 -8
- package/dist/{FileManager-B1tdLMsX.js.map → FileManager-C9zr4AJe.js.map} +1 -1
- package/dist/{FileManager-Ct91ZhOE.js → FileManager-CxGJLw5C.js} +8 -8
- package/dist/{FileManager-Ct91ZhOE.js.map → FileManager-CxGJLw5C.js.map} +1 -1
- package/dist/Item/Item.d.ts +28 -7
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/service/actors/runPublish.d.ts +5 -0
- package/dist/Item/service/actors/runPublish.d.ts.map +1 -0
- package/dist/Item/service/itemMachineSingle.d.ts +10 -5
- package/dist/Item/service/itemMachineSingle.d.ts.map +1 -1
- package/dist/ItemProperty/ItemProperty.d.ts +30 -5
- package/dist/ItemProperty/ItemProperty.d.ts.map +1 -1
- package/dist/ItemProperty/service/actors/loadOrCreateProperty.d.ts.map +1 -1
- package/dist/ItemProperty/service/propertyMachine.d.ts +10 -10
- package/dist/ItemProperty/service/propertyMachine.d.ts.map +1 -1
- package/dist/Model/Model.d.ts +27 -20
- package/dist/Model/Model.d.ts.map +1 -1
- package/dist/Model/index.d.ts +1 -1
- package/dist/Model/service/actors/createModelProperties.d.ts.map +1 -1
- package/dist/Model/service/actors/loadOrCreateModel.d.ts.map +1 -1
- package/dist/Model/service/actors/validateModel.d.ts.map +1 -1
- package/dist/Model/service/modelMachine.d.ts +18 -3
- package/dist/Model/service/modelMachine.d.ts.map +1 -1
- package/dist/ModelProperty/ModelProperty.d.ts +25 -2
- package/dist/ModelProperty/ModelProperty.d.ts.map +1 -1
- package/dist/ModelProperty/service/actors/compareAndMarkDraft.d.ts.map +1 -1
- package/dist/ModelProperty/service/actors/saveToSchema.d.ts.map +1 -1
- package/dist/ModelProperty/service/actors/validateProperty.d.ts.map +1 -1
- package/dist/ModelProperty/service/modelPropertyMachine.d.ts +17 -3
- package/dist/ModelProperty/service/modelPropertyMachine.d.ts.map +1 -1
- package/dist/{ModelProperty-Cr3BmgkC.js → ModelProperty-CGdkocQ8.js} +349 -817
- package/dist/ModelProperty-CGdkocQ8.js.map +1 -0
- package/dist/{PathResolver-DJdxE_OK.js → PathResolver-CX6GHoTS.js} +8 -8
- package/dist/{PathResolver-DJdxE_OK.js.map → PathResolver-CX6GHoTS.js.map} +1 -1
- package/dist/{PathResolver-BErmcZqP.js → PathResolver-z_WX47_o.js} +8 -8
- package/dist/{PathResolver-BErmcZqP.js.map → PathResolver-z_WX47_o.js.map} +1 -1
- package/dist/{QueryClient-DIu9c-w6.js → QueryClient-ByKPdRmE.js} +8 -8
- package/dist/{QueryClient-DIu9c-w6.js.map → QueryClient-ByKPdRmE.js.map} +1 -1
- package/dist/{QueryClient-D2mv63gP.js → QueryClient-Cb1iJO-x.js} +8 -8
- package/dist/{QueryClient-D2mv63gP.js.map → QueryClient-Cb1iJO-x.js.map} +1 -1
- package/dist/Schema/Schema.d.ts +24 -3
- package/dist/Schema/Schema.d.ts.map +1 -1
- package/dist/Schema/service/actors/checkExistingSchema.d.ts.map +1 -1
- package/dist/Schema/service/actors/createPropertyInstances.d.ts.map +1 -1
- package/dist/Schema/service/actors/loadOrCreateSchema.d.ts.map +1 -1
- package/dist/Schema/service/actors/verifyPropertyInstancesInCache.d.ts.map +1 -1
- package/dist/Schema/service/actors/writeModelsToDb.d.ts.map +1 -1
- package/dist/Schema/service/actors/writePropertiesToDb.d.ts.map +1 -1
- package/dist/Schema/service/actors/writeSchemaToDb.d.ts.map +1 -1
- package/dist/Schema/service/addModelsMachine.d.ts.map +1 -1
- package/dist/Schema/service/schemaMachine.d.ts +17 -3
- package/dist/Schema/service/schemaMachine.d.ts.map +1 -1
- package/dist/{Schema-DeKabJ0T.js → Schema-D1eqDHyt.js} +995 -186
- package/dist/Schema-D1eqDHyt.js.map +1 -0
- package/dist/{SchemaValidationService-cTlURuDt.js → SchemaValidationService-DyttFaV_.js} +7 -7
- package/dist/{SchemaValidationService-cTlURuDt.js.map → SchemaValidationService-DyttFaV_.js.map} +1 -1
- package/dist/browser/db/Db.d.ts.map +1 -1
- package/dist/browser/react/SeedProvider.d.ts +30 -0
- package/dist/browser/react/SeedProvider.d.ts.map +1 -0
- package/dist/browser/react/index.d.ts +4 -1
- package/dist/browser/react/index.d.ts.map +1 -1
- package/dist/browser/react/item.d.ts +10 -6
- package/dist/browser/react/item.d.ts.map +1 -1
- package/dist/browser/react/itemProperty.d.ts +37 -1
- package/dist/browser/react/itemProperty.d.ts.map +1 -1
- package/dist/browser/react/liveQuery.d.ts.map +1 -1
- package/dist/browser/react/model.d.ts +21 -7
- package/dist/browser/react/model.d.ts.map +1 -1
- package/dist/browser/react/modelProperty.d.ts +23 -0
- package/dist/browser/react/modelProperty.d.ts.map +1 -1
- package/dist/browser/react/queryClient.d.ts +28 -0
- package/dist/browser/react/queryClient.d.ts.map +1 -0
- package/dist/browser/react/schema.d.ts +8 -0
- package/dist/browser/react/schema.d.ts.map +1 -1
- package/dist/browser/react/trash.d.ts +5 -2
- package/dist/browser/react/trash.d.ts.map +1 -1
- package/dist/cjs/{ModelProperty-MkN5Rmx7.js → ModelProperty-BeJvgKMw.js} +377 -477
- package/dist/cjs/ModelProperty-BeJvgKMw.js.map +1 -0
- package/dist/cjs/{Schema-B5cr_JVK.js → Schema-CVs9J6eP.js} +709 -263
- package/dist/cjs/Schema-CVs9J6eP.js.map +1 -0
- package/dist/cjs/{SchemaValidationService-BgIzc3-r.js → SchemaValidationService-CDKcVRFQ.js} +4 -4
- package/dist/cjs/{SchemaValidationService-BgIzc3-r.js.map → SchemaValidationService-CDKcVRFQ.js.map} +1 -1
- package/dist/cjs/{getItem-CVJJPky2.js → getItem-B5RYPvrG.js} +4 -4
- package/dist/cjs/{getItem-CVJJPky2.js.map → getItem-B5RYPvrG.js.map} +1 -1
- package/dist/cjs/{getPublishPayload-DbOc3WA-.js → getPublishPayload-BD1qRob1.js} +26 -11
- package/dist/cjs/getPublishPayload-BD1qRob1.js.map +1 -0
- package/dist/cjs/{getPublishUploads-NzioLz-3.js → getPublishUploads-CnC9aYxs.js} +5 -5
- package/dist/cjs/getPublishUploads-CnC9aYxs.js.map +1 -0
- package/dist/cjs/{getSegmentedItemProperties-BsaklLwI.js → getSegmentedItemProperties-B_njnntx.js} +2 -2
- package/dist/cjs/{getSegmentedItemProperties-BsaklLwI.js.map → getSegmentedItemProperties-B_njnntx.js.map} +1 -1
- package/dist/cjs/{index-BmIVfqGN.js → index-BeKPbbk0.js} +12715 -12384
- package/dist/cjs/index-BeKPbbk0.js.map +1 -0
- package/dist/cjs/{index-C_0angRB.js → index-Dnywap_P.js} +4 -4
- package/dist/cjs/index-Dnywap_P.js.map +1 -0
- package/dist/client/actors/platformClassesInit.d.ts.map +1 -1
- package/dist/client/actors/processSchemaFiles.d.ts.map +1 -1
- package/dist/client/actors/saveAppState.d.ts.map +1 -1
- package/dist/db/read/getItemData.d.ts.map +1 -1
- package/dist/db/read/getItems.d.ts.map +1 -1
- package/dist/db/read/getModelPropertiesData.d.ts +19 -0
- package/dist/db/read/getModelPropertiesData.d.ts.map +1 -0
- package/dist/db/read/getModelsData.d.ts +15 -0
- package/dist/db/read/getModelsData.d.ts.map +1 -0
- package/dist/db/read/getPublishPayload.d.ts.map +1 -1
- package/dist/db/read/getPublishUploads.d.ts +1 -7
- package/dist/db/read/getPublishUploads.d.ts.map +1 -1
- package/dist/db/read/getSchemaUidForModel.d.ts.map +1 -1
- package/dist/db/write/updateSeedUid.d.ts +7 -0
- package/dist/db/write/updateSeedUid.d.ts.map +1 -0
- package/dist/eas.d.ts.map +1 -1
- package/dist/events/item/index.d.ts.map +1 -1
- package/dist/events/item/syncDbWithEas.d.ts.map +1 -1
- package/dist/{getItem-CcttmUY_.js → getItem-BB5HBCbK.js} +8 -8
- package/dist/{getItem-CcttmUY_.js.map → getItem-BB5HBCbK.js.map} +1 -1
- package/dist/{getPublishPayload-NFpqbd_H.js → getPublishPayload-uLm0AqN_.js} +29 -14
- package/dist/getPublishPayload-uLm0AqN_.js.map +1 -0
- package/dist/{getPublishUploads-Cpb9vgwE.js → getPublishUploads-Dc-HqhO8.js} +9 -9
- package/dist/getPublishUploads-Dc-HqhO8.js.map +1 -0
- package/dist/{getSegmentedItemProperties-DiyQPMgI.js → getSegmentedItemProperties-BrIqFNfD.js} +2 -2
- package/dist/{getSegmentedItemProperties-DiyQPMgI.js.map → getSegmentedItemProperties-BrIqFNfD.js.map} +1 -1
- package/dist/helpers/db.d.ts +12 -0
- package/dist/helpers/db.d.ts.map +1 -1
- package/dist/helpers/entity/entityDestroy.d.ts +41 -0
- package/dist/helpers/entity/entityDestroy.d.ts.map +1 -0
- package/dist/helpers/entity/index.d.ts +1 -0
- package/dist/helpers/entity/index.d.ts.map +1 -1
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/property/index.d.ts +12 -12
- package/dist/helpers/property/index.d.ts.map +1 -1
- package/dist/helpers/reactiveProxy.d.ts.map +1 -1
- package/dist/helpers/schema.d.ts.map +1 -1
- package/dist/helpers/updateSchema.d.ts +9 -0
- package/dist/helpers/updateSchema.d.ts.map +1 -1
- package/dist/helpers/waitForEntityIdle.d.ts +2 -2
- package/dist/helpers/waitForEntityIdle.d.ts.map +1 -1
- package/dist/imports/json.d.ts.map +1 -1
- package/dist/{index-r45w9hEq.js → index-2FcQHgKp.js} +2 -2
- package/dist/index-2FcQHgKp.js.map +1 -0
- package/dist/{json-I3vJhXo8.js → index-DPll6EAp.js} +12450 -12121
- package/dist/index-DPll6EAp.js.map +1 -0
- package/dist/{index-CRuq6HVi.js → index-LEY0Og1p.js} +9 -9
- package/dist/index-LEY0Og1p.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/interfaces/IItem.d.ts +2 -0
- package/dist/interfaces/IItem.d.ts.map +1 -1
- package/dist/interfaces/IItemProperty.d.ts +1 -0
- package/dist/interfaces/IItemProperty.d.ts.map +1 -1
- package/dist/main.cjs +3 -3
- package/dist/main.js +999 -1033
- package/dist/main.js.map +1 -1
- package/dist/node.js +16 -16
- package/dist/node.js.map +1 -1
- package/dist/{property-Dy09KTxg.js → property-B15X7jLX.js} +7 -5
- package/dist/property-B15X7jLX.js.map +1 -0
- package/dist/{queries-LZYSuhtz.js → queries-BPDSpiEX.js} +2 -2
- package/dist/{queries-LZYSuhtz.js.map → queries-BPDSpiEX.js.map} +1 -1
- package/dist/services/write/actors/validateEntity.d.ts.map +1 -1
- package/dist/services/write/actors/writeToDatabase.d.ts.map +1 -1
- package/dist/services/write/writeProcessMachine.d.ts +1 -1
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/item.d.ts +12 -0
- package/dist/types/item.d.ts.map +1 -1
- package/dist/types/property.d.ts +6 -0
- package/dist/types/property.d.ts.map +1 -1
- package/dist/types/publish.d.ts +9 -0
- package/dist/types/publish.d.ts.map +1 -0
- package/package.json +12 -4
- package/dist/ModelProperty-Cr3BmgkC.js.map +0 -1
- package/dist/Schema-DeKabJ0T.js.map +0 -1
- package/dist/cjs/ModelProperty-MkN5Rmx7.js.map +0 -1
- package/dist/cjs/Schema-B5cr_JVK.js.map +0 -1
- package/dist/cjs/getPublishPayload-DbOc3WA-.js.map +0 -1
- package/dist/cjs/getPublishUploads-NzioLz-3.js.map +0 -1
- package/dist/cjs/index-BmIVfqGN.js.map +0 -1
- package/dist/cjs/index-C_0angRB.js.map +0 -1
- package/dist/events/item/publish.d.ts +0 -7
- package/dist/events/item/publish.d.ts.map +0 -1
- package/dist/getPublishPayload-NFpqbd_H.js.map +0 -1
- package/dist/getPublishUploads-Cpb9vgwE.js.map +0 -1
- package/dist/index-CRuq6HVi.js.map +0 -1
- package/dist/index-r45w9hEq.js.map +0 -1
- package/dist/json-I3vJhXo8.js.map +0 -1
- package/dist/property-Dy09KTxg.js.map +0 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { Value } from '@sinclair/typebox/value';
|
|
2
2
|
import 'reflect-metadata';
|
|
3
|
-
import { a as ModelPropertyDataTypes, T as TPropertyDataType, c as TProperty } from './
|
|
3
|
+
import { a as ModelPropertyDataTypes, T as TPropertyDataType, c as TProperty } from './index-DPll6EAp.js';
|
|
4
4
|
import 'pluralize';
|
|
5
5
|
import 'drizzle-orm';
|
|
6
6
|
import { Type } from '@sinclair/typebox';
|
|
7
7
|
import debug from 'debug';
|
|
8
8
|
import 'xstate';
|
|
9
|
+
import 'drizzle-orm/sqlite-core';
|
|
10
|
+
import 'nanoid';
|
|
11
|
+
import 'nanoid-dictionary';
|
|
12
|
+
import 'ethers';
|
|
9
13
|
import 'rxjs';
|
|
10
14
|
import 'lodash-es';
|
|
11
15
|
import 'drizzle-orm/casing';
|
|
12
|
-
import 'arweave';
|
|
13
16
|
import 'eventemitter3';
|
|
14
|
-
import '
|
|
15
|
-
import 'ethers';
|
|
16
|
-
import 'nanoid';
|
|
17
|
-
import 'nanoid-dictionary';
|
|
17
|
+
import 'arweave';
|
|
18
18
|
|
|
19
19
|
const logger = debug('seedSdk:schema:validation');
|
|
20
20
|
/**
|
|
@@ -560,4 +560,4 @@ class SchemaValidationService {
|
|
|
560
560
|
}
|
|
561
561
|
|
|
562
562
|
export { SchemaValidationService };
|
|
563
|
-
//# sourceMappingURL=SchemaValidationService-
|
|
563
|
+
//# sourceMappingURL=SchemaValidationService-DyttFaV_.js.map
|
package/dist/{SchemaValidationService-cTlURuDt.js.map → SchemaValidationService-DyttFaV_.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaValidationService-cTlURuDt.js","sources":["../src/Schema/service/validation/SchemaValidationService.ts"],"sourcesContent":["import { Value } from '@sinclair/typebox/value'\nimport { TProperty } from '@/Schema'\nimport { ModelPropertyDataTypes, TPropertyDataType } from '@/helpers/property'\nimport { ValidationResult, ValidationError, ValidationRules } from '@/Schema/validation'\nimport { SchemaMachineContext } from '../schemaMachine'\nimport { ModelPropertyMachineContext } from '@/ModelProperty/service/modelPropertyMachine'\nimport { ModelMachineContext } from '@/Model/service/modelMachine'\nimport { Type, TSchema, TUnion, TLiteral } from '@sinclair/typebox'\nimport debug from 'debug'\n\nconst logger = debug('seedSdk:schema:validation')\n\n/**\n * Service for validating schemas, models, and properties using TypeBox\n */\nexport class SchemaValidationService {\n /**\n * Enhance TypeBox error message with expected values for union/literal types\n */\n private enhanceErrorMessage(\n error: any,\n schema: TSchema,\n fieldPath: string\n ): string {\n const originalMessage = error.message || 'Validation failed'\n \n // Handle Union type errors (like TPropertyDataType)\n if (error.type === 'Union' || originalMessage.includes('union')) {\n const expectedValues = this.extractExpectedValues(schema, fieldPath)\n if (expectedValues.length > 0) {\n return `Expected one of: ${expectedValues.join(', ')}. Received: ${JSON.stringify(error.value)}`\n }\n }\n \n // Handle Literal type errors\n if (error.type === 'Literal') {\n const expectedValue = this.extractLiteralValue(schema, fieldPath)\n if (expectedValue !== undefined) {\n return `Expected: ${JSON.stringify(expectedValue)}. Received: ${JSON.stringify(error.value)}`\n }\n }\n \n // Return enhanced message with value info if available\n if (error.value !== undefined) {\n return `${originalMessage}. Received: ${JSON.stringify(error.value)}`\n }\n \n return originalMessage\n }\n\n /**\n * Extract expected values from a schema for a given field path\n */\n private extractExpectedValues(schema: TSchema | null, fieldPath: string): string[] {\n try {\n // Handle TProperty schema - check if this is the dataType field\n if (fieldPath === '/dataType' || fieldPath.endsWith('/dataType')) {\n // Return all ModelPropertyDataTypes enum values\n return Object.values(ModelPropertyDataTypes) as string[]\n }\n \n // Handle TStorageType\n if (fieldPath === '/storageType' || fieldPath.endsWith('/storageType')) {\n return ['ItemStorage', 'PropertyStorage']\n }\n \n // If we have a schema, try to extract from it\n if (!schema) {\n return []\n }\n \n // Try to extract from TypeBox Union type using the schema directly\n const schemaObj = schema as any\n const kind = schemaObj[Symbol.for('TypeBox.Kind')]\n \n if (kind === 'Union') {\n const union = schemaObj as TUnion<any>\n const anyOf = union.anyOf || []\n const values: string[] = []\n \n for (const item of anyOf) {\n const itemKind = item?.[Symbol.for('TypeBox.Kind')]\n if (itemKind === 'Literal') {\n const literal = item as TLiteral<any>\n if (literal.const !== undefined) {\n values.push(String(literal.const))\n }\n }\n }\n \n if (values.length > 0) {\n return values\n }\n }\n \n // Fallback: try to extract from JSON schema format\n if (typeof schema === 'object' && 'anyOf' in schema) {\n const union = schema as any\n if (Array.isArray(union.anyOf)) {\n return union.anyOf\n .map((item: any) => {\n if (item.const !== undefined) return String(item.const)\n if (item.enum && Array.isArray(item.enum)) return item.enum.map(String)\n return null\n })\n .filter((val: any) => val !== null)\n .flat()\n .map(String)\n }\n }\n } catch (error) {\n logger('Error extracting expected values:', error)\n }\n \n return []\n }\n\n /**\n * Extract literal value from a schema\n */\n private extractLiteralValue(schema: TSchema, fieldPath: string): any {\n try {\n if (schema && typeof schema === 'object') {\n const schemaObj = schema as any\n if (schemaObj[Symbol.for('TypeBox.Kind')] === 'Literal') {\n return (schemaObj as TLiteral<any>).const\n }\n if (schemaObj.const !== undefined) {\n return schemaObj.const\n }\n }\n } catch (error) {\n logger('Error extracting literal value:', error)\n }\n \n return undefined\n }\n\n /**\n * Get the schema for a specific field path\n */\n private getSchemaForField(schema: TSchema, fieldPath: string): TSchema | null {\n try {\n if (!schema || typeof schema !== 'object') return null\n \n // Remove leading slash\n const path = fieldPath.replace(/^\\//, '')\n if (!path) return schema\n \n const schemaObj = schema as any\n const kind = schemaObj[Symbol.for('TypeBox.Kind')]\n \n // For TProperty (Object type), check properties\n if (kind === 'Object') {\n const properties = schemaObj.properties\n if (properties && properties[path]) {\n return properties[path]\n }\n }\n \n // Special handling for known fields - return the actual schema\n if (path === 'dataType') {\n return TPropertyDataType as TSchema\n }\n \n // Fallback: check if schema has the property\n if (path in schemaObj) {\n return schemaObj[path]\n }\n } catch (error) {\n logger('Error getting schema for field:', error)\n }\n \n return null\n }\n\n /**\n * Validate a property structure against TProperty schema\n */\n validatePropertyStructure(\n property: ModelPropertyMachineContext\n ): ValidationResult {\n try {\n const isValid = Value.Check(TProperty, property)\n \n const errors: ValidationError[] = []\n \n if (!isValid) {\n const typeBoxErrors = [...Value.Errors(TProperty, property)]\n errors.push(...typeBoxErrors.map(err => {\n const fieldPath = err.path || 'unknown'\n const fieldSchema = this.getSchemaForField(TProperty, fieldPath)\n const enhancedMessage = this.enhanceErrorMessage(err, fieldSchema || TProperty, fieldPath)\n \n return {\n field: fieldPath,\n message: enhancedMessage,\n code: String(err.type || 'validation_error'),\n severity: 'error' as const,\n }\n }))\n }\n \n // Validate that Relation and List properties have a ref defined\n if (property.dataType === ModelPropertyDataTypes.Relation || property.dataType === ModelPropertyDataTypes.List) {\n const hasRef = property.ref && property.ref.trim() !== ''\n const hasRefModelName = property.refModelName && property.refModelName.trim() !== ''\n const hasRefModelId = property.refModelId !== undefined && property.refModelId !== null\n \n if (!hasRef && !hasRefModelName && !hasRefModelId) {\n errors.push({\n field: 'ref',\n message: `Property with dataType \"${property.dataType}\" requires either a \"ref\", \"refModelName\", or \"refModelId\" field to be defined`,\n code: 'missing_ref',\n severity: 'error' as const,\n })\n }\n \n // For Relation type, prefer having refModelId when ref/refModelName is provided\n // This is a warning, not an error, as refModelId can be resolved asynchronously\n if (property.dataType === ModelPropertyDataTypes.Relation && (hasRef || hasRefModelName) && !hasRefModelId) {\n // This is acceptable - refModelId will be resolved asynchronously\n // We don't add an error here, just log for debugging\n logger(`Property \"${property.name}\" has ref/refModelName but no refModelId - will be resolved asynchronously`)\n }\n }\n \n return {\n isValid: errors.length === 0,\n errors,\n }\n } catch (error) {\n logger('Error validating property structure:', error)\n return {\n isValid: false,\n errors: [{\n field: 'property',\n message: error instanceof Error ? error.message : 'Unknown validation error',\n code: 'validation_exception',\n severity: 'error' as const,\n }],\n }\n }\n }\n\n /**\n * Validate a property value against its validation rules\n */\n validatePropertyValue(\n value: any,\n dataType: ModelPropertyDataTypes,\n validationRules?: ValidationRules\n ): ValidationResult {\n const errors: ValidationError[] = []\n const warnings: ValidationError[] = []\n\n try {\n // Build base TypeBox schema from dataType\n let schema: TSchema = this.getBaseSchemaForDataType(dataType)\n\n // Apply validation rules\n if (validationRules) {\n schema = this.applyValidationRules(schema, dataType, validationRules)\n }\n\n // Validate using TypeBox\n const isValid = Value.Check(schema, value)\n \n if (!isValid) {\n const typeBoxErrors = [...Value.Errors(schema, value)]\n errors.push(...typeBoxErrors.map(err => {\n const fieldPath = err.path || 'value'\n const enhancedMessage = this.enhanceErrorMessage(err, schema, fieldPath)\n \n return {\n field: fieldPath,\n message: enhancedMessage,\n code: String(err.type || 'value_validation_error'),\n severity: 'error' as const,\n }\n }))\n }\n\n // Additional custom validations\n if (validationRules) {\n const customErrors = this.validateCustomRules(value, validationRules)\n errors.push(...customErrors)\n }\n\n return {\n isValid: errors.length === 0,\n errors,\n warnings: warnings.length > 0 ? warnings : undefined,\n }\n } catch (error) {\n logger('Error validating property value:', error)\n return {\n isValid: false,\n errors: [{\n field: 'value',\n message: error instanceof Error ? error.message : 'Unknown validation error',\n code: 'validation_exception',\n severity: 'error' as const,\n }],\n }\n }\n }\n\n /**\n * Validate a specific property within a schema\n */\n validateProperty(\n schema: SchemaMachineContext,\n modelName: string,\n propertyName: string,\n propertyData?: ModelPropertyMachineContext\n ): ValidationResult {\n const errors: ValidationError[] = []\n\n // Check if model exists\n if (!schema.models || !schema.models[modelName]) {\n errors.push({\n field: 'model',\n message: `Model \"${modelName}\" not found in schema`,\n code: 'model_not_found',\n severity: 'error' as const,\n })\n return { isValid: false, errors }\n }\n\n const model = schema.models[modelName]\n\n // Check if property exists in model\n // If the property name has changed (renamed), check if the original name exists\n let propertyDefinition = model.properties?.[propertyName]\n let actualPropertyName = propertyName\n \n if (!propertyDefinition && propertyData?._originalValues?.name) {\n const originalName = propertyData._originalValues.name\n // If the current name differs from the original, check if original exists\n if (originalName !== propertyName && model.properties?.[originalName]) {\n propertyDefinition = model.properties[originalName]\n actualPropertyName = originalName\n // Property is being renamed, which is allowed - continue validation\n }\n }\n \n if (!propertyDefinition) {\n errors.push({\n field: 'property',\n message: `Property \"${propertyName}\" not found in model \"${modelName}\"`,\n code: 'property_not_found',\n severity: 'error' as const,\n })\n return { isValid: false, errors }\n }\n\n // If propertyData is provided, validate its structure\n if (propertyData) {\n const structureResult = this.validatePropertyStructure(propertyData)\n errors.push(...structureResult.errors)\n }\n\n // Validate property definition structure\n if (!propertyDefinition.type) {\n errors.push({\n field: 'property.type',\n message: 'Property type is required',\n code: 'missing_type',\n severity: 'error' as const,\n })\n }\n\n // Validate Relation and List properties have a ref/model defined\n if (propertyDefinition.type === 'Relation' || propertyDefinition.type === 'List') {\n if (!propertyDefinition.model || propertyDefinition.model.trim() === '') {\n errors.push({\n field: 'property.model',\n message: `Property with type \"${propertyDefinition.type}\" requires a \"model\" field to be defined`,\n code: 'missing_ref',\n severity: 'error' as const,\n })\n } else if (!schema.models[propertyDefinition.model]) {\n errors.push({\n field: 'property.model',\n message: `Referenced model \"${propertyDefinition.model}\" not found in schema`,\n code: 'invalid_reference',\n severity: 'error' as const,\n })\n }\n }\n\n return {\n isValid: errors.length === 0,\n errors,\n }\n }\n\n /**\n * Validate model structure (basic structure checks)\n */\n validateModelStructure(\n model: ModelMachineContext & { properties?: { [key: string]: any } }\n ): ValidationResult {\n const errors: ValidationError[] = []\n\n // Validate model name\n if (!model.modelName || model.modelName.trim() === '') {\n errors.push({\n field: 'modelName',\n message: 'Model name is required',\n code: 'missing_model_name',\n severity: 'error' as const,\n })\n }\n\n // Validate schema name\n if (!model.schemaName || model.schemaName.trim() === '') {\n errors.push({\n field: 'schemaName',\n message: 'Schema name is required',\n code: 'missing_schema_name',\n severity: 'error' as const,\n })\n }\n\n // Validate properties is an object\n if (model.properties && typeof model.properties !== 'object') {\n errors.push({\n field: 'properties',\n message: 'Properties must be an object',\n code: 'invalid_properties',\n severity: 'error' as const,\n })\n }\n\n return {\n isValid: errors.length === 0,\n errors,\n }\n }\n\n /**\n * Validate a model against a schema WITHOUT requiring it to be in the schema's context\n * This allows validation before registration, preventing update loops\n */\n validateModelAgainstSchema(\n schema: SchemaMachineContext,\n modelName: string,\n modelData: ModelMachineContext & { properties?: { [key: string]: any } }\n ): ValidationResult {\n const errors: ValidationError[] = []\n\n // Create a temporary schema context that includes this model for validation purposes\n // This allows validateProperty to work without actually adding the model to the real schema\n const tempSchemaContext: SchemaMachineContext = {\n ...schema,\n models: {\n ...schema.models,\n [modelName]: {\n properties: modelData.properties || {},\n },\n },\n }\n\n // Use validateModel which now works because the model is in the temp context\n return this.validateModel(tempSchemaContext, modelName, modelData)\n }\n\n /**\n * Validate a model within a schema (requires model to already be in schema context)\n */\n validateModel(\n schema: SchemaMachineContext,\n modelName: string,\n modelData?: ModelMachineContext\n ): ValidationResult {\n const errors: ValidationError[] = []\n\n if (!schema.models || !schema.models[modelName]) {\n errors.push({\n field: 'model',\n message: `Model \"${modelName}\" not found in schema`,\n code: 'model_not_found',\n severity: 'error' as const,\n })\n return { isValid: false, errors }\n }\n\n const model = schema.models[modelName]\n\n // Validate all properties in the model\n if (model.properties) {\n for (const [propertyName, propertyDef] of Object.entries(model.properties)) {\n const propertyResult = this.validateProperty(schema, modelName, propertyName)\n if (!propertyResult.isValid) {\n errors.push(...propertyResult.errors.map(err => ({\n ...err,\n field: `${modelName}.${propertyName}.${err.field}`,\n })))\n }\n }\n }\n\n return {\n isValid: errors.length === 0,\n errors,\n }\n }\n\n /**\n * Validate entire schema\n */\n validateSchema(schema: SchemaMachineContext): ValidationResult {\n const errors: ValidationError[] = []\n\n // Validate schema name\n if (!schema.schemaName || schema.schemaName.trim() === '') {\n errors.push({\n field: 'schemaName',\n message: 'Schema name is required',\n code: 'missing_schema_name',\n severity: 'error' as const,\n })\n }\n\n // Validate metadata\n if (!schema.metadata) {\n errors.push({\n field: 'metadata',\n message: 'Schema metadata is required',\n code: 'missing_metadata',\n severity: 'error' as const,\n })\n } else {\n if (!schema.metadata.name || schema.metadata.name.trim() === '') {\n errors.push({\n field: 'metadata.name',\n message: 'Schema metadata name is required',\n code: 'missing_metadata_name',\n severity: 'error' as const,\n })\n }\n }\n\n // Validate models if they exist\n if (schema.models && Object.keys(schema.models).length > 0) {\n // Validate each model\n for (const modelName of Object.keys(schema.models)) {\n const modelResult = this.validateModel(schema, modelName)\n if (!modelResult.isValid) {\n errors.push(...modelResult.errors)\n }\n }\n }\n\n return {\n isValid: errors.length === 0,\n errors,\n }\n }\n\n /**\n * Get base TypeBox schema for a data type\n */\n private getBaseSchemaForDataType(dataType: ModelPropertyDataTypes): TSchema {\n switch (dataType) {\n case ModelPropertyDataTypes.Text:\n case ModelPropertyDataTypes.Html:\n return Type.String()\n case ModelPropertyDataTypes.Number:\n return Type.Number()\n case ModelPropertyDataTypes.Boolean:\n return Type.Boolean()\n case ModelPropertyDataTypes.Date:\n return Type.String({ format: 'date-time' })\n case ModelPropertyDataTypes.Json:\n return Type.Any()\n case ModelPropertyDataTypes.List:\n return Type.Array(Type.Any())\n case ModelPropertyDataTypes.Relation:\n case ModelPropertyDataTypes.Image:\n case ModelPropertyDataTypes.File:\n return Type.Union([Type.String(), Type.Null()])\n default:\n return Type.Any()\n }\n }\n\n /**\n * Apply validation rules to a TypeBox schema\n */\n private applyValidationRules(\n schema: TSchema,\n dataType: ModelPropertyDataTypes,\n rules: ValidationRules\n ): TSchema {\n let result = schema\n\n // Apply pattern (regex) for strings\n if (rules.pattern && (dataType === ModelPropertyDataTypes.Text || dataType === ModelPropertyDataTypes.Html)) {\n try {\n const regex = new RegExp(rules.pattern)\n result = Type.RegExp(regex)\n } catch (error) {\n logger('Invalid regex pattern:', rules.pattern, error)\n }\n }\n\n // Apply minLength/maxLength for strings\n if (dataType === ModelPropertyDataTypes.Text || dataType === ModelPropertyDataTypes.Html) {\n const stringSchema = Type.String()\n if (rules.minLength !== undefined) {\n result = Type.String({ minLength: rules.minLength })\n }\n if (rules.maxLength !== undefined) {\n if (rules.minLength !== undefined) {\n result = Type.String({ minLength: rules.minLength, maxLength: rules.maxLength })\n } else {\n result = Type.String({ maxLength: rules.maxLength })\n }\n }\n }\n\n // Apply enum\n if (rules.enum && Array.isArray(rules.enum) && rules.enum.length > 0) {\n result = Type.Union(rules.enum.map(val => Type.Literal(val)))\n }\n\n return result\n }\n\n /**\n * Validate custom validation rules\n */\n private validateCustomRules(\n value: any,\n rules: ValidationRules\n ): ValidationError[] {\n const errors: ValidationError[] = []\n\n // Custom validator reference (would need to be implemented based on your needs)\n if (rules.custom) {\n // TODO: Implement custom validator lookup and execution\n logger('Custom validator not yet implemented:', rules.custom)\n }\n\n return errors\n }\n}\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAUA,MAAM,MAAM,GAAG,KAAK,CAAC,2BAA2B,CAAC;AAEjD;;AAEG;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,MAAM;IACf;AAEA;;AAEG;IACK,mBAAmB,CACzB,KAAU,EACV,KAAsB,EAAA;QAEtB,MAAM,MAAM,GAAsB,EAAE;;AAGpC,QAAA,IAAI,KAAK,CAAC,MAAM,EAAE;;AAEhB,YAAA,MAAM,CAAC,uCAAuC,EAAE,KAAK,CAAC,MAAM,CAAC;QAC/D;AAEA,QAAA,OAAO,MAAM;IACf;AACD;;;;"}
|
|
1
|
+
{"version":3,"file":"SchemaValidationService-DyttFaV_.js","sources":["../src/Schema/service/validation/SchemaValidationService.ts"],"sourcesContent":["import { Value } from '@sinclair/typebox/value'\nimport { TProperty } from '@/Schema'\nimport { ModelPropertyDataTypes, TPropertyDataType } from '@/helpers/property'\nimport { ValidationResult, ValidationError, ValidationRules } from '@/Schema/validation'\nimport { SchemaMachineContext } from '../schemaMachine'\nimport { ModelPropertyMachineContext } from '@/ModelProperty/service/modelPropertyMachine'\nimport { ModelMachineContext } from '@/Model/service/modelMachine'\nimport { Type, TSchema, TUnion, TLiteral } from '@sinclair/typebox'\nimport debug from 'debug'\n\nconst logger = debug('seedSdk:schema:validation')\n\n/**\n * Service for validating schemas, models, and properties using TypeBox\n */\nexport class SchemaValidationService {\n /**\n * Enhance TypeBox error message with expected values for union/literal types\n */\n private enhanceErrorMessage(\n error: any,\n schema: TSchema,\n fieldPath: string\n ): string {\n const originalMessage = error.message || 'Validation failed'\n \n // Handle Union type errors (like TPropertyDataType)\n if (error.type === 'Union' || originalMessage.includes('union')) {\n const expectedValues = this.extractExpectedValues(schema, fieldPath)\n if (expectedValues.length > 0) {\n return `Expected one of: ${expectedValues.join(', ')}. Received: ${JSON.stringify(error.value)}`\n }\n }\n \n // Handle Literal type errors\n if (error.type === 'Literal') {\n const expectedValue = this.extractLiteralValue(schema, fieldPath)\n if (expectedValue !== undefined) {\n return `Expected: ${JSON.stringify(expectedValue)}. Received: ${JSON.stringify(error.value)}`\n }\n }\n \n // Return enhanced message with value info if available\n if (error.value !== undefined) {\n return `${originalMessage}. Received: ${JSON.stringify(error.value)}`\n }\n \n return originalMessage\n }\n\n /**\n * Extract expected values from a schema for a given field path\n */\n private extractExpectedValues(schema: TSchema | null, fieldPath: string): string[] {\n try {\n // Handle TProperty schema - check if this is the dataType field\n if (fieldPath === '/dataType' || fieldPath.endsWith('/dataType')) {\n // Return all ModelPropertyDataTypes enum values\n return Object.values(ModelPropertyDataTypes) as string[]\n }\n \n // Handle TStorageType\n if (fieldPath === '/storageType' || fieldPath.endsWith('/storageType')) {\n return ['ItemStorage', 'PropertyStorage']\n }\n \n // If we have a schema, try to extract from it\n if (!schema) {\n return []\n }\n \n // Try to extract from TypeBox Union type using the schema directly\n const schemaObj = schema as any\n const kind = schemaObj[Symbol.for('TypeBox.Kind')]\n \n if (kind === 'Union') {\n const union = schemaObj as TUnion<any>\n const anyOf = union.anyOf || []\n const values: string[] = []\n \n for (const item of anyOf) {\n const itemKind = item?.[Symbol.for('TypeBox.Kind')]\n if (itemKind === 'Literal') {\n const literal = item as TLiteral<any>\n if (literal.const !== undefined) {\n values.push(String(literal.const))\n }\n }\n }\n \n if (values.length > 0) {\n return values\n }\n }\n \n // Fallback: try to extract from JSON schema format\n if (typeof schema === 'object' && 'anyOf' in schema) {\n const union = schema as any\n if (Array.isArray(union.anyOf)) {\n return union.anyOf\n .map((item: any) => {\n if (item.const !== undefined) return String(item.const)\n if (item.enum && Array.isArray(item.enum)) return item.enum.map(String)\n return null\n })\n .filter((val: any) => val !== null)\n .flat()\n .map(String)\n }\n }\n } catch (error) {\n logger('Error extracting expected values:', error)\n }\n \n return []\n }\n\n /**\n * Extract literal value from a schema\n */\n private extractLiteralValue(schema: TSchema, fieldPath: string): any {\n try {\n if (schema && typeof schema === 'object') {\n const schemaObj = schema as any\n if (schemaObj[Symbol.for('TypeBox.Kind')] === 'Literal') {\n return (schemaObj as TLiteral<any>).const\n }\n if (schemaObj.const !== undefined) {\n return schemaObj.const\n }\n }\n } catch (error) {\n logger('Error extracting literal value:', error)\n }\n \n return undefined\n }\n\n /**\n * Get the schema for a specific field path\n */\n private getSchemaForField(schema: TSchema, fieldPath: string): TSchema | null {\n try {\n if (!schema || typeof schema !== 'object') return null\n \n // Remove leading slash\n const path = fieldPath.replace(/^\\//, '')\n if (!path) return schema\n \n const schemaObj = schema as any\n const kind = schemaObj[Symbol.for('TypeBox.Kind')]\n \n // For TProperty (Object type), check properties\n if (kind === 'Object') {\n const properties = schemaObj.properties\n if (properties && properties[path]) {\n return properties[path]\n }\n }\n \n // Special handling for known fields - return the actual schema\n if (path === 'dataType') {\n return TPropertyDataType as TSchema\n }\n \n // Fallback: check if schema has the property\n if (path in schemaObj) {\n return schemaObj[path]\n }\n } catch (error) {\n logger('Error getting schema for field:', error)\n }\n \n return null\n }\n\n /**\n * Validate a property structure against TProperty schema\n */\n validatePropertyStructure(\n property: ModelPropertyMachineContext\n ): ValidationResult {\n try {\n const isValid = Value.Check(TProperty, property)\n \n const errors: ValidationError[] = []\n \n if (!isValid) {\n const typeBoxErrors = [...Value.Errors(TProperty, property)]\n errors.push(...typeBoxErrors.map(err => {\n const fieldPath = err.path || 'unknown'\n const fieldSchema = this.getSchemaForField(TProperty, fieldPath)\n const enhancedMessage = this.enhanceErrorMessage(err, fieldSchema || TProperty, fieldPath)\n \n return {\n field: fieldPath,\n message: enhancedMessage,\n code: String(err.type || 'validation_error'),\n severity: 'error' as const,\n }\n }))\n }\n \n // Validate that Relation and List properties have a ref defined\n if (property.dataType === ModelPropertyDataTypes.Relation || property.dataType === ModelPropertyDataTypes.List) {\n const hasRef = property.ref && property.ref.trim() !== ''\n const hasRefModelName = property.refModelName && property.refModelName.trim() !== ''\n const hasRefModelId = property.refModelId !== undefined && property.refModelId !== null\n \n if (!hasRef && !hasRefModelName && !hasRefModelId) {\n errors.push({\n field: 'ref',\n message: `Property with dataType \"${property.dataType}\" requires either a \"ref\", \"refModelName\", or \"refModelId\" field to be defined`,\n code: 'missing_ref',\n severity: 'error' as const,\n })\n }\n \n // For Relation type, prefer having refModelId when ref/refModelName is provided\n // This is a warning, not an error, as refModelId can be resolved asynchronously\n if (property.dataType === ModelPropertyDataTypes.Relation && (hasRef || hasRefModelName) && !hasRefModelId) {\n // This is acceptable - refModelId will be resolved asynchronously\n // We don't add an error here, just log for debugging\n logger(`Property \"${property.name}\" has ref/refModelName but no refModelId - will be resolved asynchronously`)\n }\n }\n \n return {\n isValid: errors.length === 0,\n errors,\n }\n } catch (error) {\n logger('Error validating property structure:', error)\n return {\n isValid: false,\n errors: [{\n field: 'property',\n message: error instanceof Error ? error.message : 'Unknown validation error',\n code: 'validation_exception',\n severity: 'error' as const,\n }],\n }\n }\n }\n\n /**\n * Validate a property value against its validation rules\n */\n validatePropertyValue(\n value: any,\n dataType: ModelPropertyDataTypes,\n validationRules?: ValidationRules\n ): ValidationResult {\n const errors: ValidationError[] = []\n const warnings: ValidationError[] = []\n\n try {\n // Build base TypeBox schema from dataType\n let schema: TSchema = this.getBaseSchemaForDataType(dataType)\n\n // Apply validation rules\n if (validationRules) {\n schema = this.applyValidationRules(schema, dataType, validationRules)\n }\n\n // Validate using TypeBox\n const isValid = Value.Check(schema, value)\n \n if (!isValid) {\n const typeBoxErrors = [...Value.Errors(schema, value)]\n errors.push(...typeBoxErrors.map(err => {\n const fieldPath = err.path || 'value'\n const enhancedMessage = this.enhanceErrorMessage(err, schema, fieldPath)\n \n return {\n field: fieldPath,\n message: enhancedMessage,\n code: String(err.type || 'value_validation_error'),\n severity: 'error' as const,\n }\n }))\n }\n\n // Additional custom validations\n if (validationRules) {\n const customErrors = this.validateCustomRules(value, validationRules)\n errors.push(...customErrors)\n }\n\n return {\n isValid: errors.length === 0,\n errors,\n warnings: warnings.length > 0 ? warnings : undefined,\n }\n } catch (error) {\n logger('Error validating property value:', error)\n return {\n isValid: false,\n errors: [{\n field: 'value',\n message: error instanceof Error ? error.message : 'Unknown validation error',\n code: 'validation_exception',\n severity: 'error' as const,\n }],\n }\n }\n }\n\n /**\n * Validate a specific property within a schema\n */\n validateProperty(\n schema: SchemaMachineContext,\n modelName: string,\n propertyName: string,\n propertyData?: ModelPropertyMachineContext\n ): ValidationResult {\n const errors: ValidationError[] = []\n\n // Check if model exists\n if (!schema.models || !schema.models[modelName]) {\n errors.push({\n field: 'model',\n message: `Model \"${modelName}\" not found in schema`,\n code: 'model_not_found',\n severity: 'error' as const,\n })\n return { isValid: false, errors }\n }\n\n const model = schema.models[modelName]\n\n // Check if property exists in model\n // If the property name has changed (renamed), check if the original name exists\n let propertyDefinition = model.properties?.[propertyName]\n let actualPropertyName = propertyName\n \n if (!propertyDefinition && propertyData?._originalValues?.name) {\n const originalName = propertyData._originalValues.name\n // If the current name differs from the original, check if original exists\n if (originalName !== propertyName && model.properties?.[originalName]) {\n propertyDefinition = model.properties[originalName]\n actualPropertyName = originalName\n // Property is being renamed, which is allowed - continue validation\n }\n }\n \n if (!propertyDefinition) {\n errors.push({\n field: 'property',\n message: `Property \"${propertyName}\" not found in model \"${modelName}\"`,\n code: 'property_not_found',\n severity: 'error' as const,\n })\n return { isValid: false, errors }\n }\n\n // If propertyData is provided, validate its structure\n if (propertyData) {\n const structureResult = this.validatePropertyStructure(propertyData)\n errors.push(...structureResult.errors)\n }\n\n // Validate property definition structure\n if (!propertyDefinition.type) {\n errors.push({\n field: 'property.type',\n message: 'Property type is required',\n code: 'missing_type',\n severity: 'error' as const,\n })\n }\n\n // Validate Relation and List properties have a ref/model defined\n if (propertyDefinition.type === 'Relation' || propertyDefinition.type === 'List') {\n if (!propertyDefinition.model || propertyDefinition.model.trim() === '') {\n errors.push({\n field: 'property.model',\n message: `Property with type \"${propertyDefinition.type}\" requires a \"model\" field to be defined`,\n code: 'missing_ref',\n severity: 'error' as const,\n })\n } else if (!schema.models[propertyDefinition.model]) {\n errors.push({\n field: 'property.model',\n message: `Referenced model \"${propertyDefinition.model}\" not found in schema`,\n code: 'invalid_reference',\n severity: 'error' as const,\n })\n }\n }\n\n return {\n isValid: errors.length === 0,\n errors,\n }\n }\n\n /**\n * Validate model structure (basic structure checks)\n */\n validateModelStructure(\n model: ModelMachineContext & { properties?: { [key: string]: any } }\n ): ValidationResult {\n const errors: ValidationError[] = []\n\n // Validate model name\n if (!model.modelName || model.modelName.trim() === '') {\n errors.push({\n field: 'modelName',\n message: 'Model name is required',\n code: 'missing_model_name',\n severity: 'error' as const,\n })\n }\n\n // Validate schema name\n if (!model.schemaName || model.schemaName.trim() === '') {\n errors.push({\n field: 'schemaName',\n message: 'Schema name is required',\n code: 'missing_schema_name',\n severity: 'error' as const,\n })\n }\n\n // Validate properties is an object\n if (model.properties && typeof model.properties !== 'object') {\n errors.push({\n field: 'properties',\n message: 'Properties must be an object',\n code: 'invalid_properties',\n severity: 'error' as const,\n })\n }\n\n return {\n isValid: errors.length === 0,\n errors,\n }\n }\n\n /**\n * Validate a model against a schema WITHOUT requiring it to be in the schema's context\n * This allows validation before registration, preventing update loops\n */\n validateModelAgainstSchema(\n schema: SchemaMachineContext,\n modelName: string,\n modelData: ModelMachineContext & { properties?: { [key: string]: any } }\n ): ValidationResult {\n const errors: ValidationError[] = []\n\n // Create a temporary schema context that includes this model for validation purposes\n // This allows validateProperty to work without actually adding the model to the real schema\n const tempSchemaContext: SchemaMachineContext = {\n ...schema,\n models: {\n ...schema.models,\n [modelName]: {\n properties: modelData.properties || {},\n },\n },\n }\n\n // Use validateModel which now works because the model is in the temp context\n return this.validateModel(tempSchemaContext, modelName, modelData)\n }\n\n /**\n * Validate a model within a schema (requires model to already be in schema context)\n */\n validateModel(\n schema: SchemaMachineContext,\n modelName: string,\n modelData?: ModelMachineContext\n ): ValidationResult {\n const errors: ValidationError[] = []\n\n if (!schema.models || !schema.models[modelName]) {\n errors.push({\n field: 'model',\n message: `Model \"${modelName}\" not found in schema`,\n code: 'model_not_found',\n severity: 'error' as const,\n })\n return { isValid: false, errors }\n }\n\n const model = schema.models[modelName]\n\n // Validate all properties in the model\n if (model.properties) {\n for (const [propertyName, propertyDef] of Object.entries(model.properties)) {\n const propertyResult = this.validateProperty(schema, modelName, propertyName)\n if (!propertyResult.isValid) {\n errors.push(...propertyResult.errors.map(err => ({\n ...err,\n field: `${modelName}.${propertyName}.${err.field}`,\n })))\n }\n }\n }\n\n return {\n isValid: errors.length === 0,\n errors,\n }\n }\n\n /**\n * Validate entire schema\n */\n validateSchema(schema: SchemaMachineContext): ValidationResult {\n const errors: ValidationError[] = []\n\n // Validate schema name\n if (!schema.schemaName || schema.schemaName.trim() === '') {\n errors.push({\n field: 'schemaName',\n message: 'Schema name is required',\n code: 'missing_schema_name',\n severity: 'error' as const,\n })\n }\n\n // Validate metadata\n if (!schema.metadata) {\n errors.push({\n field: 'metadata',\n message: 'Schema metadata is required',\n code: 'missing_metadata',\n severity: 'error' as const,\n })\n } else {\n if (!schema.metadata.name || schema.metadata.name.trim() === '') {\n errors.push({\n field: 'metadata.name',\n message: 'Schema metadata name is required',\n code: 'missing_metadata_name',\n severity: 'error' as const,\n })\n }\n }\n\n // Validate models if they exist\n if (schema.models && Object.keys(schema.models).length > 0) {\n // Validate each model\n for (const modelName of Object.keys(schema.models)) {\n const modelResult = this.validateModel(schema, modelName)\n if (!modelResult.isValid) {\n errors.push(...modelResult.errors)\n }\n }\n }\n\n return {\n isValid: errors.length === 0,\n errors,\n }\n }\n\n /**\n * Get base TypeBox schema for a data type\n */\n private getBaseSchemaForDataType(dataType: ModelPropertyDataTypes): TSchema {\n switch (dataType) {\n case ModelPropertyDataTypes.Text:\n case ModelPropertyDataTypes.Html:\n return Type.String()\n case ModelPropertyDataTypes.Number:\n return Type.Number()\n case ModelPropertyDataTypes.Boolean:\n return Type.Boolean()\n case ModelPropertyDataTypes.Date:\n return Type.String({ format: 'date-time' })\n case ModelPropertyDataTypes.Json:\n return Type.Any()\n case ModelPropertyDataTypes.List:\n return Type.Array(Type.Any())\n case ModelPropertyDataTypes.Relation:\n case ModelPropertyDataTypes.Image:\n case ModelPropertyDataTypes.File:\n return Type.Union([Type.String(), Type.Null()])\n default:\n return Type.Any()\n }\n }\n\n /**\n * Apply validation rules to a TypeBox schema\n */\n private applyValidationRules(\n schema: TSchema,\n dataType: ModelPropertyDataTypes,\n rules: ValidationRules\n ): TSchema {\n let result = schema\n\n // Apply pattern (regex) for strings\n if (rules.pattern && (dataType === ModelPropertyDataTypes.Text || dataType === ModelPropertyDataTypes.Html)) {\n try {\n const regex = new RegExp(rules.pattern)\n result = Type.RegExp(regex)\n } catch (error) {\n logger('Invalid regex pattern:', rules.pattern, error)\n }\n }\n\n // Apply minLength/maxLength for strings\n if (dataType === ModelPropertyDataTypes.Text || dataType === ModelPropertyDataTypes.Html) {\n const stringSchema = Type.String()\n if (rules.minLength !== undefined) {\n result = Type.String({ minLength: rules.minLength })\n }\n if (rules.maxLength !== undefined) {\n if (rules.minLength !== undefined) {\n result = Type.String({ minLength: rules.minLength, maxLength: rules.maxLength })\n } else {\n result = Type.String({ maxLength: rules.maxLength })\n }\n }\n }\n\n // Apply enum\n if (rules.enum && Array.isArray(rules.enum) && rules.enum.length > 0) {\n result = Type.Union(rules.enum.map(val => Type.Literal(val)))\n }\n\n return result\n }\n\n /**\n * Validate custom validation rules\n */\n private validateCustomRules(\n value: any,\n rules: ValidationRules\n ): ValidationError[] {\n const errors: ValidationError[] = []\n\n // Custom validator reference (would need to be implemented based on your needs)\n if (rules.custom) {\n // TODO: Implement custom validator lookup and execution\n logger('Custom validator not yet implemented:', rules.custom)\n }\n\n return errors\n }\n}\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAUA,MAAM,MAAM,GAAG,KAAK,CAAC,2BAA2B,CAAC;AAEjD;;AAEG;MACU,uBAAuB,CAAA;AAClC;;AAEG;AACK,IAAA,mBAAmB,CACzB,KAAU,EACV,MAAe,EACf,SAAiB,EAAA;AAEjB,QAAA,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,IAAI,mBAAmB;;AAG5D,QAAA,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,eAAe,CAAC,QAAQ,CAAC,OAAO,CAAC,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G,GAAG,GAC/B,UAAU,CAAC,CAAC,EAAE,CAAC;CAuDnB;AAED,OAAO,EAAE,EAAE,EAAE,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
import type { QueryClient } from '@tanstack/react-query';
|
|
3
|
+
export type SeedProviderProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/** Optional: use your own QueryClient. If not provided, a default client with Seed options is created. */
|
|
6
|
+
queryClient?: QueryClient;
|
|
7
|
+
/** Optional: ref to receive the QueryClient instance (e.g. for tests). */
|
|
8
|
+
queryClientRef?: React.MutableRefObject<QueryClient | null>;
|
|
9
|
+
};
|
|
10
|
+
declare global {
|
|
11
|
+
interface Window {
|
|
12
|
+
__SEED_INVALIDATE_ITEM_PROPERTIES__?: ((canonicalId: string) => void) | null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Invalidates and refetches the item-properties query for an item.
|
|
17
|
+
* Call this after updating an ItemProperty (e.g. after save()) so useItemProperties
|
|
18
|
+
* refetches and the UI updates. Returns a Promise that resolves when the refetch has completed (if available).
|
|
19
|
+
*/
|
|
20
|
+
export declare function invalidateItemPropertiesForItem(canonicalId: string): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Provider that supplies a React Query client to Seed list hooks (useSchemas, useItems, useModels, etc.)
|
|
23
|
+
* so results are cached and shared across components. Wrap your app (or the subtree that uses Seed hooks)
|
|
24
|
+
* after calling client.init().
|
|
25
|
+
*
|
|
26
|
+
* - No props: uses an internal QueryClient with Seed defaults.
|
|
27
|
+
* - queryClient prop: use your own client (e.g. merge getSeedQueryDefaultOptions when creating it).
|
|
28
|
+
*/
|
|
29
|
+
export declare function SeedProvider({ children, queryClient: queryClientProp, queryClientRef }: SeedProviderProps): React.JSX.Element;
|
|
30
|
+
//# sourceMappingURL=SeedProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SeedProvider.d.ts","sourceRoot":"","sources":["../../../src/browser/react/SeedProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAAsB,MAAM,OAAO,CAAA;AAEjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAIxD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,SAAS,CAAA;IACnB,0GAA0G;IAC1G,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,0EAA0E;IAC1E,cAAc,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;CAC5D,CAAA;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,mCAAmC,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,IAAI,CAAA;KAC7E;CACF;AAKD;;;;GAIG;AACH,wBAAgB,+BAA+B,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMlF;AA+BD;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,cAAc,EAAE,EAAE,iBAAiB,qBAuBzG"}
|
|
@@ -5,6 +5,9 @@ export * from './db';
|
|
|
5
5
|
export * from './schema';
|
|
6
6
|
export * from './modelProperty';
|
|
7
7
|
export { useDeleteItem } from './trash';
|
|
8
|
-
export { useModels, useModel } from './model';
|
|
8
|
+
export { useModels, useModel, useCreateModel, useDestroyModel } from './model';
|
|
9
9
|
export { useLiveQuery } from './liveQuery';
|
|
10
|
+
export { SeedProvider, invalidateItemPropertiesForItem } from './SeedProvider';
|
|
11
|
+
export type { SeedProviderProps } from './SeedProvider';
|
|
12
|
+
export { createSeedQueryClient, getSeedQueryDefaultOptions, mergeSeedQueryDefaults, } from './queryClient';
|
|
10
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/browser/react/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,MAAM,CAAA;AACpB,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/browser/react/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,MAAM,CAAA;AACpB,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,+BAA+B,EAAE,MAAM,gBAAgB,CAAA;AAC9E,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,eAAe,CAAA"}
|
|
@@ -24,14 +24,18 @@ type UseItemsProps = {
|
|
|
24
24
|
};
|
|
25
25
|
type UseItems = (props: UseItemsProps) => UseItemsReturn;
|
|
26
26
|
export declare const useItems: UseItems;
|
|
27
|
-
export
|
|
28
|
-
createItem: (modelName: string, itemData?: Record<string, any>) => Promise<
|
|
29
|
-
|
|
27
|
+
export type UseCreateItemReturn = {
|
|
28
|
+
createItem: (modelName: string, itemData?: Record<string, any>) => Promise<Item<any> | undefined>;
|
|
29
|
+
isLoading: boolean;
|
|
30
|
+
error: Error | null;
|
|
31
|
+
resetError: () => void;
|
|
30
32
|
};
|
|
31
|
-
|
|
33
|
+
export declare const useCreateItem: () => UseCreateItemReturn;
|
|
32
34
|
type UsePublishItemReturn = {
|
|
33
|
-
publishItem: (item: Item<any> | undefined
|
|
34
|
-
|
|
35
|
+
publishItem: (item: Item<any> | undefined) => void;
|
|
36
|
+
isLoading: boolean;
|
|
37
|
+
error: Error | null;
|
|
38
|
+
resetError: () => void;
|
|
35
39
|
};
|
|
36
40
|
export declare const usePublishItem: () => UsePublishItemReturn;
|
|
37
41
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../../src/browser/react/item.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../../src/browser/react/item.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAGlC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAYpC,KAAK,aAAa,CAAC,CAAC,SAAS,WAAW,CAAC,CAAC,CAAC,IAAI;IAC7C,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;IAC1B,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;CACpB,CAAA;AAED,KAAK,YAAY,GAAG;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,KAAK,OAAO,GAAG,CAAC,CAAC,SAAS,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,KAAK,aAAa,CAAC,CAAC,CAAC,CAAA;AAElF,eAAO,MAAM,OAAO,EAAE,OA6IrB,CAAA;AAED,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,CAAA;IACnB,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;CACpB,CAAA;AAED,KAAK,aAAa,GAAG;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,KAAK,QAAQ,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK,cAAc,CAAA;AAKxD,eAAO,MAAM,QAAQ,EAAE,QAqHtB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,CAAA;IACjG,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,UAAU,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,aAAa,QAAO,mBAyChC,CAAA;AAED,KAAK,oBAAoB,GAAG;IAC1B,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS,KAAK,IAAI,CAAA;IAClD,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,UAAU,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,cAAc,QAAO,oBAsDjC,CAAA"}
|
|
@@ -8,13 +8,17 @@ type UseItemPropertyReturn = {
|
|
|
8
8
|
* Hook to get a specific ItemProperty instance
|
|
9
9
|
* Can be called in multiple ways:
|
|
10
10
|
* 1. With seedLocalId/seedUid and propertyName: useItemProperty({ seedLocalId, propertyName }) or useItemProperty({ seedUid, propertyName })
|
|
11
|
-
* 2. With itemId and propertyName: useItemProperty(itemId, propertyName)
|
|
11
|
+
* 2. With itemId and propertyName: useItemProperty(itemId, propertyName) or useItemProperty({ itemId, propertyName })
|
|
12
12
|
*
|
|
13
13
|
* @overload
|
|
14
14
|
* @param props - Object with seedLocalId or seedUid, and propertyName
|
|
15
15
|
* @returns Object with property, isLoading, and error
|
|
16
16
|
*
|
|
17
17
|
* @overload
|
|
18
|
+
* @param props - Object with itemId and propertyName
|
|
19
|
+
* @returns Object with property, isLoading, and error
|
|
20
|
+
*
|
|
21
|
+
* @overload
|
|
18
22
|
* @param itemId - The item ID (seedLocalId or seedUid)
|
|
19
23
|
* @param propertyName - The name of the property
|
|
20
24
|
* @returns Object with property, isLoading, and error
|
|
@@ -24,6 +28,10 @@ export declare function useItemProperty(props: {
|
|
|
24
28
|
seedUid?: string;
|
|
25
29
|
propertyName: string;
|
|
26
30
|
}): UseItemPropertyReturn;
|
|
31
|
+
export declare function useItemProperty(props: {
|
|
32
|
+
itemId?: string;
|
|
33
|
+
propertyName: string;
|
|
34
|
+
}): UseItemPropertyReturn;
|
|
27
35
|
export declare function useItemProperty(itemId: string, propertyName: string): UseItemPropertyReturn;
|
|
28
36
|
type UseItemPropertiesReturn = {
|
|
29
37
|
properties: IItemProperty[];
|
|
@@ -53,5 +61,33 @@ export declare function useItemProperties(props: {
|
|
|
53
61
|
seedUid?: string;
|
|
54
62
|
}): UseItemPropertiesReturn;
|
|
55
63
|
export declare function useItemProperties(itemId: string): UseItemPropertiesReturn;
|
|
64
|
+
export type UseCreateItemPropertyProps = {
|
|
65
|
+
seedLocalId?: string;
|
|
66
|
+
seedUid?: string;
|
|
67
|
+
propertyName: string;
|
|
68
|
+
modelName: string;
|
|
69
|
+
propertyValue?: any;
|
|
70
|
+
versionLocalId?: string;
|
|
71
|
+
versionUid?: string;
|
|
72
|
+
[key: string]: any;
|
|
73
|
+
};
|
|
74
|
+
export type UseCreateItemPropertyReturn = {
|
|
75
|
+
create: (props: UseCreateItemPropertyProps) => IItemProperty | undefined;
|
|
76
|
+
isLoading: boolean;
|
|
77
|
+
error: Error | null;
|
|
78
|
+
resetError: () => void;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Hook to create an ItemProperty with loading and error state.
|
|
82
|
+
* create(props) creates a new property instance for an item; provide seedLocalId or seedUid, propertyName, and modelName.
|
|
83
|
+
*/
|
|
84
|
+
export declare const useCreateItemProperty: () => UseCreateItemPropertyReturn;
|
|
85
|
+
export type UseDestroyItemPropertyReturn = {
|
|
86
|
+
destroy: (itemProperty: IItemProperty) => Promise<void>;
|
|
87
|
+
isLoading: boolean;
|
|
88
|
+
error: Error | null;
|
|
89
|
+
resetError: () => void;
|
|
90
|
+
};
|
|
91
|
+
export declare const useDestroyItemProperty: () => UseDestroyItemPropertyReturn;
|
|
56
92
|
export {};
|
|
57
93
|
//# sourceMappingURL=itemProperty.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"itemProperty.d.ts","sourceRoot":"","sources":["../../../src/browser/react/itemProperty.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"itemProperty.d.ts","sourceRoot":"","sources":["../../../src/browser/react/itemProperty.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAgB5C,KAAK,qBAAqB,GAAG;IAC3B,QAAQ,EAAE,aAAa,GAAG,SAAS,CAAA;IACnC,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;CACpB,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE;IACrC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,E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H,eAAO,MAAM,qBAAqB,QAAO,2BAsDxC,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG;IACzC,OAAO,EAAE,CAAC,YAAY,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACvD,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,UAAU,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,sBAAsB,QAAO,4BA8CzC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"liveQuery.d.ts","sourceRoot":"","sources":["../../../src/browser/react/liveQuery.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,KAAK,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC,GAAG,GAAG,GAAG,IAAI,GAAG,SAAS,GAClD,CAAC,EAAE,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"liveQuery.d.ts","sourceRoot":"","sources":["../../../src/browser/react/liveQuery.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,KAAK,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC,GAAG,GAAG,GAAG,IAAI,GAAG,SAAS,GAClD,CAAC,EAAE,GAAG,SAAS,CAoEjB"}
|
|
@@ -6,13 +6,6 @@ type UseModelsResult = {
|
|
|
6
6
|
};
|
|
7
7
|
type UseModelsParams = string | null | undefined;
|
|
8
8
|
type UseModels = (schemaId: UseModelsParams) => UseModelsResult;
|
|
9
|
-
/**
|
|
10
|
-
* Hook to get all Model instances for a specific schema
|
|
11
|
-
* Uses useLiveQuery to watch for changes in the models table and automatically
|
|
12
|
-
* updates the returned Model instances when changes occur.
|
|
13
|
-
* @param schemaId - The schema ID (schema file ID) or schema name to get models from
|
|
14
|
-
* @returns Array of Model instances belonging to the schema
|
|
15
|
-
*/
|
|
16
9
|
export declare const useModels: UseModels;
|
|
17
10
|
type UseModelResult = {
|
|
18
11
|
model: Model | undefined;
|
|
@@ -30,5 +23,26 @@ type UseModelResult = {
|
|
|
30
23
|
* @returns Object with model, isLoading, and error
|
|
31
24
|
*/
|
|
32
25
|
export declare const useModel: (schemaIdOrModelId: string | null | undefined, modelName?: string | null | undefined) => UseModelResult;
|
|
26
|
+
export type UseCreateModelOptions = {
|
|
27
|
+
modelFileId?: string;
|
|
28
|
+
properties?: {
|
|
29
|
+
[propertyName: string]: any;
|
|
30
|
+
};
|
|
31
|
+
registerWithSchema?: boolean;
|
|
32
|
+
};
|
|
33
|
+
export type UseCreateModelReturn = {
|
|
34
|
+
create: (schemaName: string, modelName: string, options?: UseCreateModelOptions) => Model;
|
|
35
|
+
isLoading: boolean;
|
|
36
|
+
error: Error | null;
|
|
37
|
+
resetError: () => void;
|
|
38
|
+
};
|
|
39
|
+
export declare const useCreateModel: () => UseCreateModelReturn;
|
|
40
|
+
export type UseDestroyModelReturn = {
|
|
41
|
+
destroy: (model: Model) => Promise<void>;
|
|
42
|
+
isLoading: boolean;
|
|
43
|
+
error: Error | null;
|
|
44
|
+
resetError: () => void;
|
|
45
|
+
};
|
|
46
|
+
export declare const useDestroyModel: () => UseDestroyModelReturn;
|
|
33
47
|
export {};
|
|
34
48
|
//# sourceMappingURL=model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/browser/react/model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/browser/react/model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAWrC,KAAK,eAAe,GAAG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AAE,OAAO,CAAA;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,UAAU,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,eAAe,QAAO,qBA4ClC,CAAA"}
|
|
@@ -55,5 +55,28 @@ export declare function useModelProperty(schemaId: string, modelName: string, pr
|
|
|
55
55
|
isLoading: boolean;
|
|
56
56
|
error: Error | null;
|
|
57
57
|
};
|
|
58
|
+
export type UseCreateModelPropertyOptions = {
|
|
59
|
+
name: string;
|
|
60
|
+
dataType: string;
|
|
61
|
+
[key: string]: any;
|
|
62
|
+
};
|
|
63
|
+
export type UseCreateModelPropertyReturn = {
|
|
64
|
+
create: (schemaId: string, modelName: string, property: UseCreateModelPropertyOptions) => ModelProperty;
|
|
65
|
+
isLoading: boolean;
|
|
66
|
+
error: Error | null;
|
|
67
|
+
resetError: () => void;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Hook to create a ModelProperty with loading and error state.
|
|
71
|
+
* create(schemaId, modelName, property) creates a new property on the model.
|
|
72
|
+
*/
|
|
73
|
+
export declare const useCreateModelProperty: () => UseCreateModelPropertyReturn;
|
|
74
|
+
export type UseDestroyModelPropertyReturn = {
|
|
75
|
+
destroy: (modelProperty: ModelProperty) => Promise<void>;
|
|
76
|
+
isLoading: boolean;
|
|
77
|
+
error: Error | null;
|
|
78
|
+
resetError: () => void;
|
|
79
|
+
};
|
|
80
|
+
export declare const useDestroyModelProperty: () => UseDestroyModelPropertyReturn;
|
|
58
81
|
export {};
|
|
59
82
|
//# sourceMappingURL=modelProperty.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modelProperty.d.ts","sourceRoot":"","sources":["../../../src/browser/react/modelProperty.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"modelProperty.d.ts","sourceRoot":"","sources":["../../../src/browser/react/modelProperty.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,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B,QAAQ,EAAE,6BAA6B,KACpC,aAAa,CAAA;IAClB,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,UAAU,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,QAAO,4BA2DzC,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG;IAC1C,OAAO,EAAE,CAAC,aAAa,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACxD,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,UAAU,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,uBAAuB,QAAO,6BA4C1C,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type QueryClient, type DefaultOptions, type QueryClientConfig } from '@tanstack/react-query';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the default options used by Seed for list-query caching.
|
|
4
|
+
* Use this when building your own QueryClient so Seed hooks get consistent behavior.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getSeedQueryDefaultOptions(): DefaultOptions;
|
|
7
|
+
/**
|
|
8
|
+
* Merges Seed's default query options with your existing default options.
|
|
9
|
+
* Your options take precedence over Seed's. Use when constructing your own QueryClient:
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const client = new QueryClient({
|
|
14
|
+
* defaultOptions: mergeSeedQueryDefaults({
|
|
15
|
+
* queries: { gcTime: 1000 * 60 * 60 },
|
|
16
|
+
* }),
|
|
17
|
+
* })
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function mergeSeedQueryDefaults(userOptions?: Partial<DefaultOptions> | null): DefaultOptions;
|
|
21
|
+
/**
|
|
22
|
+
* Creates a QueryClient configured with Seed's default options.
|
|
23
|
+
* Use this when you want to provide your own QueryClientProvider but still use Seed's defaults.
|
|
24
|
+
*
|
|
25
|
+
* @param overrides - Optional config to merge with Seed defaults (e.g. defaultOptions, logger).
|
|
26
|
+
*/
|
|
27
|
+
export declare function createSeedQueryClient(overrides?: Partial<QueryClientConfig>): QueryClient;
|
|
28
|
+
//# sourceMappingURL=queryClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queryClient.d.ts","sourceRoot":"","sources":["../../../src/browser/react/queryClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,cAAc,EAEnB,KAAK,iBAAiB,EAEvB,MAAM,uBAAuB,CAAA;AAU9B;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,cAAc,CAE3D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,GAC3C,cAAc,CAahB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,WAAW,CASzF"}
|
|
@@ -22,7 +22,15 @@ export declare const useCreateSchema: () => {
|
|
|
22
22
|
createSchema: (schemaName: string) => Schema;
|
|
23
23
|
isLoading: boolean;
|
|
24
24
|
error: Error | null;
|
|
25
|
+
resetError: () => void;
|
|
25
26
|
};
|
|
27
|
+
export type UseDestroySchemaReturn = {
|
|
28
|
+
destroy: (schema: Schema) => Promise<void>;
|
|
29
|
+
isLoading: boolean;
|
|
30
|
+
error: Error | null;
|
|
31
|
+
resetError: () => void;
|
|
32
|
+
};
|
|
33
|
+
export declare const useDestroySchema: () => UseDestroySchemaReturn;
|
|
26
34
|
export declare const useAllSchemaVersions: () => Schema[] | null | undefined;
|
|
27
35
|
/**
|
|
28
36
|
* Hook to get the internal Seed Protocol schema (SDK-only schema)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/browser/react/schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/browser/react/schema.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAaxC;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,GAAI,kBAAkB,MAAM,GAAG,IAAI,GAAG,SAAS;;;;CAsFpE,CAAA;AAID,eAAO,MAAM,UAAU;;;WA4EE,KAAK,GAAG,IAAI;CAEpC,CAAA;AAED,eAAO,MAAM,eAAe;+BAOoB,MAAM;;;;CAoCrD,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1C,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,UAAU,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,gBAAgB,QAAO,sBA4CnC,CAAA;AAED,eAAO,MAAM,oBAAoB,mCA2EhC,CAAA;AAKD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB;;;;CAEjC,CAAA"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Item } from '@/Item/Item';
|
|
2
|
-
export
|
|
2
|
+
export type UseDeleteItemReturn = {
|
|
3
3
|
deleteItem: (item: Item<any>) => Promise<void>;
|
|
4
|
-
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
error: Error | null;
|
|
6
|
+
resetError: () => void;
|
|
5
7
|
};
|
|
8
|
+
export declare const useDeleteItem: () => UseDeleteItemReturn;
|
|
6
9
|
//# sourceMappingURL=trash.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trash.d.ts","sourceRoot":"","sources":["../../../src/browser/react/trash.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"trash.d.ts","sourceRoot":"","sources":["../../../src/browser/react/trash.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAElC,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9C,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,UAAU,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,aAAa,QAAO,mBA4ChC,CAAA"}
|