@autofleet/sadot 1.0.25 → 1.0.26
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/api/index.cjs +1 -1
- package/dist/api/index.cjs.map +1 -1
- package/dist/api/v1/definition/index.cjs +1 -1
- package/dist/api/v1/definition/index.cjs.map +1 -1
- package/dist/api/v1/errors.cjs +1 -1
- package/dist/api/v1/errors.cjs.map +1 -1
- package/dist/api/v1/index.cjs +1 -1
- package/dist/api/v1/index.cjs.map +1 -1
- package/dist/api/v1/validator/index.cjs +1 -1
- package/dist/api/v1/validator/index.cjs.map +1 -1
- package/dist/api/v1/validator/validations.d.ts +1 -0
- package/dist/errors/index.cjs +1 -1
- package/dist/errors/index.cjs.map +1 -1
- package/dist/events/index.cjs +1 -1
- package/dist/events/index.cjs.map +1 -1
- package/dist/hooks/hooks.cjs +1 -1
- package/dist/hooks/hooks.cjs.map +1 -1
- package/dist/models/CustomFieldDefinition.cjs +1 -1
- package/dist/models/CustomFieldDefinition.cjs.map +1 -1
- package/dist/models/CustomFieldDefinition.d.cts +2 -0
- package/dist/models/CustomFieldDefinition.d.ts +4 -0
- package/dist/models/CustomFieldDefinition.js +1 -1
- package/dist/models/CustomFieldEntries.cjs +1 -1
- package/dist/models/CustomFieldEntries.cjs.map +1 -1
- package/dist/models/CustomFieldEntries.d.ts +2 -0
- package/dist/models/CustomFieldEntries.js +1 -1
- package/dist/models/CustomFieldValue.cjs +1 -1
- package/dist/models/CustomFieldValue.cjs.map +1 -1
- package/dist/models/CustomFieldValue.d.cts +1 -0
- package/dist/models/CustomFieldValue.d.ts +3 -0
- package/dist/models/CustomFieldValue.js +1 -1
- package/dist/models/CustomValidator.cjs +1 -1
- package/dist/models/CustomValidator.cjs.map +1 -1
- package/dist/models/CustomValidator.d.ts +3 -0
- package/dist/models/CustomValidator.js +1 -1
- package/dist/models/index.cjs +1 -1
- package/dist/models/index.cjs.map +1 -1
- package/dist/models/index.d.cts +4 -0
- package/dist/models/index.d.ts +6 -0
- package/dist/models/tests/AssociatedTestModel.cjs +1 -1
- package/dist/models/tests/AssociatedTestModel.cjs.map +1 -1
- package/dist/models/tests/AssociatedTestModel.js +1 -1
- package/dist/models/tests/TestModel.cjs +1 -1
- package/dist/models/tests/TestModel.cjs.map +1 -1
- package/dist/models/tests/TestModel.js +1 -1
- package/dist/models/tests/contextAwareModels/ContextAwareTestModel.cjs +1 -1
- package/dist/models/tests/contextAwareModels/ContextAwareTestModel.cjs.map +1 -1
- package/dist/models/tests/contextAwareModels/ContextAwareTestModel.js +1 -1
- package/dist/models/tests/contextAwareModels/ContextTestModel.cjs +1 -1
- package/dist/models/tests/contextAwareModels/ContextTestModel.cjs.map +1 -1
- package/dist/models/tests/contextAwareModels/ContextTestModel.js +1 -1
- package/dist/repository/definition.cjs +1 -1
- package/dist/repository/definition.cjs.map +1 -1
- package/dist/scopes/filter.cjs +1 -1
- package/dist/scopes/filter.cjs.map +1 -1
- package/dist/types/index.d.cts +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/utils/constants/index.cjs +1 -1
- package/dist/utils/constants/index.cjs.map +1 -1
- package/dist/utils/db/index.cjs +1 -1
- package/dist/utils/db/index.cjs.map +1 -1
- package/dist/utils/helpers/index.cjs +1 -1
- package/dist/utils/helpers/index.cjs.map +1 -1
- package/dist/utils/init.cjs +1 -1
- package/dist/utils/init.cjs.map +1 -1
- package/dist/utils/logger/index.cjs +1 -1
- package/dist/utils/logger/index.cjs.map +1 -1
- package/dist/utils/validations/schema/validator-schema.cjs +1 -1
- package/dist/utils/validations/schema/validator-schema.cjs.map +1 -1
- package/package.json +1 -1
- /package/dist/_virtual/{_@oxc-project_runtime@0.94.0 → _@oxc-project_runtime@0.96.0}/helpers/decorate.cjs +0 -0
- /package/dist/_virtual/{_@oxc-project_runtime@0.94.0 → _@oxc-project_runtime@0.96.0}/helpers/decorate.js +0 -0
- /package/dist/_virtual/{_@oxc-project_runtime@0.94.0 → _@oxc-project_runtime@0.96.0}/helpers/decorateMetadata.cjs +0 -0
- /package/dist/_virtual/{_@oxc-project_runtime@0.94.0 → _@oxc-project_runtime@0.96.0}/helpers/decorateMetadata.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator-schema.cjs","names":["Ajv","BadRequest"],"sources":["../../../../src/utils/validations/schema/validator-schema.ts"],"sourcesContent":["import Ajv from 'ajv';\nimport addFormats from 'ajv-formats';\nimport { BadRequest } from '@autofleet/errors';\nimport logger from '../../logger';\nimport type { SchemaObject } from '../../../api/v1/validator/validations';\n\n// Instantiate Ajv for meta-validation\nconst metaValidator = new Ajv({\n allErrors: true,\n strict: false,\n strictTypes: false,\n $data: true, // Enable $data references\n});\naddFormats(metaValidator);\n\n/**\n * Schema for validating JSON Schema objects in custom validators\n * This is a meta-schema to ensure that custom validator schemas are valid Ajv schemas\n */\nconst validatorMetaSchema = {\n type: 'object',\n properties: {\n type: { type: 'string', enum: ['object'] },\n properties: {\n type: 'object',\n properties: {\n before: {\n type: 'object',\n properties: {\n type: { type: 'string', enum: ['object'] },\n properties: { type: 'object' },\n },\n },\n after: {\n type: 'object',\n properties: {\n type: { type: 'string', enum: ['object'] },\n properties: { type: 'object' },\n },\n },\n },\n },\n required: {\n type: 'array',\n items: { type: 'string' },\n },\n if: { type: 'object' },\n then: { type: 'object' },\n else: { type: 'object' },\n },\n required: ['type', 'properties'],\n};\n\n/**\n * Validates that a given schema is a valid Ajv schema\n * This function is used to validate schemas passed to custom validators\n *\n * @param schema The schema to validate\n * @returns true if valid, throws an error if invalid\n */\nexport const validateValidatorSchema = (schema: SchemaObject): boolean => {\n try {\n // First validate the schema structure\n const validateMetaSchema = metaValidator.compile(validatorMetaSchema);\n const isValidStructure = validateMetaSchema(schema);\n\n if (!isValidStructure) {\n const errorDetails = validateMetaSchema.errors?.map(err =>\n `${(err as unknown as { instancePath: string; }).instancePath || ''} ${(err as unknown as { message: string; }).message || 'Invalid schema structure'}`).join(', ');\n\n logger.error('Invalid validator schema structure', {\n errors: validateMetaSchema.errors,\n schema,\n });\n\n throw new BadRequest(\n [new Error(`Invalid validator schema structure: ${errorDetails}`)],\n ['Invalid validator schema structure'],\n );\n }\n\n // Then try to compile the schema with Ajv to verify it's a valid JSON Schema\n try {\n metaValidator.compile(schema);\n return true;\n } catch (compileError) {\n logger.error('Failed to compile validator schema', { error: compileError, schema });\n\n throw new BadRequest(\n [new Error(`Failed to compile validator schema: ${(compileError as Error).message}`)],\n ['Invalid validator schema'],\n );\n }\n } catch (error) {\n if (error instanceof BadRequest) {\n throw error;\n }\n\n logger.error('Error validating validator schema', { error, schema });\n throw new BadRequest(\n [new Error(`Error validating validator schema: ${(error as Error).message}`)],\n ['Invalid validator schema'],\n );\n }\n};\n\nexport default validateValidatorSchema;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"validator-schema.cjs","names":["Ajv","BadRequest"],"sources":["../../../../src/utils/validations/schema/validator-schema.ts"],"sourcesContent":["import Ajv from 'ajv';\nimport addFormats from 'ajv-formats';\nimport { BadRequest } from '@autofleet/errors';\nimport logger from '../../logger';\nimport type { SchemaObject } from '../../../api/v1/validator/validations';\n\n// Instantiate Ajv for meta-validation\nconst metaValidator = new Ajv({\n allErrors: true,\n strict: false,\n strictTypes: false,\n $data: true, // Enable $data references\n});\naddFormats(metaValidator);\n\n/**\n * Schema for validating JSON Schema objects in custom validators\n * This is a meta-schema to ensure that custom validator schemas are valid Ajv schemas\n */\nconst validatorMetaSchema = {\n type: 'object',\n properties: {\n type: { type: 'string', enum: ['object'] },\n properties: {\n type: 'object',\n properties: {\n before: {\n type: 'object',\n properties: {\n type: { type: 'string', enum: ['object'] },\n properties: { type: 'object' },\n },\n },\n after: {\n type: 'object',\n properties: {\n type: { type: 'string', enum: ['object'] },\n properties: { type: 'object' },\n },\n },\n },\n },\n required: {\n type: 'array',\n items: { type: 'string' },\n },\n if: { type: 'object' },\n then: { type: 'object' },\n else: { type: 'object' },\n },\n required: ['type', 'properties'],\n};\n\n/**\n * Validates that a given schema is a valid Ajv schema\n * This function is used to validate schemas passed to custom validators\n *\n * @param schema The schema to validate\n * @returns true if valid, throws an error if invalid\n */\nexport const validateValidatorSchema = (schema: SchemaObject): boolean => {\n try {\n // First validate the schema structure\n const validateMetaSchema = metaValidator.compile(validatorMetaSchema);\n const isValidStructure = validateMetaSchema(schema);\n\n if (!isValidStructure) {\n const errorDetails = validateMetaSchema.errors?.map(err =>\n `${(err as unknown as { instancePath: string; }).instancePath || ''} ${(err as unknown as { message: string; }).message || 'Invalid schema structure'}`).join(', ');\n\n logger.error('Invalid validator schema structure', {\n errors: validateMetaSchema.errors,\n schema,\n });\n\n throw new BadRequest(\n [new Error(`Invalid validator schema structure: ${errorDetails}`)],\n ['Invalid validator schema structure'],\n );\n }\n\n // Then try to compile the schema with Ajv to verify it's a valid JSON Schema\n try {\n metaValidator.compile(schema);\n return true;\n } catch (compileError) {\n logger.error('Failed to compile validator schema', { error: compileError, schema });\n\n throw new BadRequest(\n [new Error(`Failed to compile validator schema: ${(compileError as Error).message}`)],\n ['Invalid validator schema'],\n );\n }\n } catch (error) {\n if (error instanceof BadRequest) {\n throw error;\n }\n\n logger.error('Error validating validator schema', { error, schema });\n throw new BadRequest(\n [new Error(`Error validating validator schema: ${(error as Error).message}`)],\n ['Invalid validator schema'],\n );\n }\n};\n\nexport default validateValidatorSchema;\n"],"mappings":"6MAOA,MAAM,EAAgB,IAAIA,EAAAA,QAAI,CAC5B,UAAW,GACX,OAAQ,GACR,YAAa,GACb,MAAO,GACR,CAAC,eACS,EAAc,CAMzB,MAAM,EAAsB,CAC1B,KAAM,SACN,WAAY,CACV,KAAM,CAAE,KAAM,SAAU,KAAM,CAAC,SAAS,CAAE,CAC1C,WAAY,CACV,KAAM,SACN,WAAY,CACV,OAAQ,CACN,KAAM,SACN,WAAY,CACV,KAAM,CAAE,KAAM,SAAU,KAAM,CAAC,SAAS,CAAE,CAC1C,WAAY,CAAE,KAAM,SAAU,CAC/B,CACF,CACD,MAAO,CACL,KAAM,SACN,WAAY,CACV,KAAM,CAAE,KAAM,SAAU,KAAM,CAAC,SAAS,CAAE,CAC1C,WAAY,CAAE,KAAM,SAAU,CAC/B,CACF,CACF,CACF,CACD,SAAU,CACR,KAAM,QACN,MAAO,CAAE,KAAM,SAAU,CAC1B,CACD,GAAI,CAAE,KAAM,SAAU,CACtB,KAAM,CAAE,KAAM,SAAU,CACxB,KAAM,CAAE,KAAM,SAAU,CACzB,CACD,SAAU,CAAC,OAAQ,aAAa,CACjC,CASY,EAA2B,GAAkC,CACxE,GAAI,CAEF,IAAM,EAAqB,EAAc,QAAQ,EAAoB,CAGrE,GAAI,CAFqB,EAAmB,EAAO,CAE5B,CACrB,IAAM,EAAe,EAAmB,QAAQ,IAAI,GAClD,GAAI,EAA6C,cAAgB,GAAG,GAAI,EAAwC,SAAW,6BAA6B,CAAC,KAAK,KAAK,CAOrK,MALA,EAAA,QAAO,MAAM,qCAAsC,CACjD,OAAQ,EAAmB,OAC3B,SACD,CAAC,CAEI,IAAIC,EAAAA,WACR,CAAK,MAAM,uCAAuC,IAAe,CAAC,CAClE,CAAC,qCAAqC,CACvC,CAIH,GAAI,CAEF,OADA,EAAc,QAAQ,EAAO,CACtB,SACA,EAAc,CAGrB,MAFA,EAAA,QAAO,MAAM,qCAAsC,CAAE,MAAO,EAAc,SAAQ,CAAC,CAE7E,IAAIA,EAAAA,WACR,CAAK,MAAM,uCAAwC,EAAuB,UAAU,CAAC,CACrF,CAAC,2BAA2B,CAC7B,QAEI,EAAO,CAMd,MALI,aAAiBA,EAAAA,WACb,GAGR,EAAA,QAAO,MAAM,oCAAqC,CAAE,QAAO,SAAQ,CAAC,CAC9D,IAAIA,EAAAA,WACR,CAAK,MAAM,sCAAuC,EAAgB,UAAU,CAAC,CAC7E,CAAC,2BAA2B,CAC7B"}
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|