@revisium/schema-toolkit 0.4.1 → 0.5.0

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.
@@ -563,6 +563,37 @@ function convertJsonPathToSchemaPath(jsonPath) {
563
563
  }
564
564
  return schemaPath;
565
565
  }
566
+ function convertSchemaPathToJsonPath(schemaPath) {
567
+ if (schemaPath === "") {
568
+ return "";
569
+ }
570
+ const cleanPath = schemaPath.startsWith("/") ? schemaPath.slice(1) : schemaPath;
571
+ if (cleanPath === "") {
572
+ return "";
573
+ }
574
+ const segments = cleanPath.split("/");
575
+ let result = "";
576
+ let i = 0;
577
+ while (i < segments.length) {
578
+ const segment = segments[i];
579
+ if (segment === "properties") {
580
+ i++;
581
+ if (i < segments.length) {
582
+ const propertyName = segments[i];
583
+ if (propertyName) {
584
+ if (result) {
585
+ result += ".";
586
+ }
587
+ result += propertyName;
588
+ }
589
+ }
590
+ } else if (segment === "items") {
591
+ result += "[*]";
592
+ }
593
+ i++;
594
+ }
595
+ return result;
596
+ }
566
597
 
567
598
  // src/lib/getJsonValueByPath.ts
568
599
  var getJsonValueStoreByPath = (root, path) => {
@@ -694,6 +725,6 @@ var SchemaTable = class {
694
725
  }
695
726
  };
696
727
 
697
- export { SchemaTable, VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE, applyAddPatch, applyMovePatch, applyRemovePatch, applyReplacePatch, convertJsonPathToSchemaPath, createJsonObjectSchemaStore, createJsonSchemaStore, createPrimitiveStoreBySchema, deepEqual, getDBJsonPathByJsonSchemaStore, getForeignKeyPatchesFromSchema, getForeignKeysFromSchema, getForeignKeysFromValue, getInvalidFieldNamesInSchema, getJsonSchemaStoreByPath, getJsonValueStoreByPath, getParentForPath, getPathByStore, getValueByPath, hasPath, parsePath, pluginRefs, replaceForeignKeyValue, resolveRefs, saveSharedFields, setValueByPath, traverseStore, traverseValue, validateJsonFieldName };
698
- //# sourceMappingURL=chunk-LMFIZGIO.js.map
699
- //# sourceMappingURL=chunk-LMFIZGIO.js.map
728
+ export { SchemaTable, VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE, applyAddPatch, applyMovePatch, applyRemovePatch, applyReplacePatch, convertJsonPathToSchemaPath, convertSchemaPathToJsonPath, createJsonObjectSchemaStore, createJsonSchemaStore, createPrimitiveStoreBySchema, deepEqual, getDBJsonPathByJsonSchemaStore, getForeignKeyPatchesFromSchema, getForeignKeysFromSchema, getForeignKeysFromValue, getInvalidFieldNamesInSchema, getJsonSchemaStoreByPath, getJsonValueStoreByPath, getParentForPath, getPathByStore, getValueByPath, hasPath, parsePath, pluginRefs, replaceForeignKeyValue, resolveRefs, saveSharedFields, setValueByPath, traverseStore, traverseValue, validateJsonFieldName };
729
+ //# sourceMappingURL=chunk-7LKKRGZG.js.map
730
+ //# sourceMappingURL=chunk-7LKKRGZG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/createJsonSchemaStore.ts","../src/lib/getJsonSchemaStoreByPath.ts","../src/lib/getParentForPath.ts","../src/lib/validateJsonFieldName.ts","../src/lib/applyPatches.ts","../src/lib/getDBJsonPathByJsonSchemaStore.ts","../src/lib/getPathByStore.ts","../src/lib/traverseStore.ts","../src/lib/getForeignKeyPatchesFromSchema.ts","../src/lib/getForeignKeysFromSchema.ts","../src/lib/traverseValue.ts","../src/lib/getForeignKeysFromValue.ts","../src/lib/getInvalidFieldNamesInSchema.ts","../src/lib/json-path-utils.ts","../src/lib/getJsonValueByPath.ts","../src/lib/replaceForeignKeyValue.ts","../src/lib/resolveRefs.ts","../src/lib/schema-table.ts"],"names":["obj"],"mappings":";;;;AAkBO,IAAM,qBAAA,GAAwB,CACnC,MAAA,EACA,IAAA,GAAiB,EAAC,KACE;AACpB,EAAA,IAAI,UAAU,MAAA,EAAQ;AACpB,IAAA,MAAM,SAAA,GAAoC,IAAA,CAAK,MAAA,CAAO,IAAI,CAAA;AAE1D,IAAA,IAAI,CAAC,SAAA,EAAW;AACd,MAAA,M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C,EAAA,EAAI,IAAI,CAAA,MAAO;AAAA,MACzC,EAAA;AAAA,MACA,IAAA,EAAM,KAAK,aAAA;AAAc,KAC3B,CAAE,CAAA;AAAA,EACJ;AAAA,EAEQ,YAAY,SAAA,EAAkC;AACpD,IAAA,MAAM,cAAA,GAAiB,iBAAA,CAAkB,IAAA,CAAK,KAAA,EAAO,SAAS,CAAA;AAE9D,IAAA,IAAI,cAAA,EAAgB;AAClB,MAAA,KAAA,MAAW,CAAC,KAAA,EAAO,GAAG,CAAA,IAAK,KAAK,IAAA,EAAM;AACpC,QAAA,MAAM,YAAA,GAAe,cAAA;AAAA,UACnB,IAAI,aAAA,EAAc;AAAA,UAClB,SAAA,CAAU;AAAA,SACZ;AAEA,QAAA,MAAM,OAAA,GAAU,oBAAA,CAAqB,SAAA,EAAW,KAAA,EAAO,YAAY,CAAA;AACnE,QAAA,IAAA,CAAK,IAAA,CAAK,GAAA,CAAI,KAAA,EAAO,OAAO,CAAA;AAAA,MAC9B;AAAA,IACF;AAEA,IAAA,IAAA,CAAK,KAAA,GAAQ,SAAA;AAAA,EACf;AACF","file":"chunk-7LKKRGZG.js","sourcesContent":["import {\n JsonObjectSchema,\n JsonSchema,\n JsonSchemaPrimitives,\n JsonSchemaTypeName,\n} from '../types/schema.types.js';\nimport { JsonArrayStore } from '../model/schema/json-array.store.js';\nimport { JsonBooleanStore } from '../model/schema/json-boolean.store.js';\nimport { JsonNumberStore } from '../model/schema/json-number.store.js';\nimport { JsonStringStore } from '../model/schema/json-string.store.js';\nimport { JsonObjectStore } from '../model/schema/json-object.store.js';\nimport {\n JsonSchemaStore,\n JsonSchemaStorePrimitives,\n} from '../model/schema/json-schema.store.js';\n\nexport type RefsType = Record<string, JsonSchema>;\n\nexport const createJsonSchemaStore = (\n schema: JsonSchema,\n refs: RefsType = {},\n): JsonSchemaStore => {\n if ('$ref' in schema) {\n const refSchema: JsonSchema | undefined = refs[schema.$ref];\n\n if (!refSchema) {\n throw new Error(`Not found schema for $ref=\"${schema.$ref}\"`);\n }\n\n const refStore = createJsonSchemaStore(refSchema, refs);\n saveSharedFields(refStore, schema);\n refStore.$ref = schema.$ref;\n return refStore;\n } else if (schema.type === JsonSchemaTypeName.Object) {\n const objectStore = createJsonObjectSchemaStore(schema, refs);\n saveSharedFields(objectStore, schema);\n\n return objectStore;\n } else if (schema.type === JsonSchemaTypeName.Array) {\n const itemsStore = createJsonSchemaStore(schema.items, refs);\n const arrayStore = new JsonArrayStore(itemsStore);\n saveSharedFields(arrayStore, schema);\n\n return arrayStore;\n } else {\n const primitivesStore = createPrimitiveStoreBySchema(schema);\n saveSharedFields(primitivesStore, schema);\n primitivesStore.readOnly = schema.readOnly;\n\n return primitivesStore;\n }\n};\n\nexport const createJsonObjectSchemaStore = (\n value: JsonObjectSchema,\n refs: RefsType,\n): JsonObjectStore => {\n const store = new JsonObjectStore();\n\n for (const requiredField of value.required) {\n if (!value.properties[requiredField]) {\n throw new Error(\n `Not found required field \"${requiredField}\" in \"properties\"`,\n );\n }\n }\n\n Object.entries(value.properties).forEach(([name, item]) => {\n store.addPropertyWithStore(name, createJsonSchemaStore(item, refs));\n });\n\n return store;\n};\n\nexport const createPrimitiveStoreBySchema = (\n schema: JsonSchemaPrimitives,\n): JsonSchemaStorePrimitives => {\n if (schema.type === JsonSchemaTypeName.String) {\n const stringStore = new JsonStringStore();\n stringStore.foreignKey = schema.foreignKey;\n stringStore.format = schema.format;\n stringStore.enum = schema.enum;\n stringStore.contentMediaType = schema.contentMediaType;\n stringStore.pattern = schema.pattern;\n return stringStore;\n } else if (schema.type === JsonSchemaTypeName.Number) {\n return new JsonNumberStore();\n } else if (schema.type === JsonSchemaTypeName.Boolean) {\n return new JsonBooleanStore();\n } else {\n throw new Error('this type is not allowed');\n }\n};\n\nexport const saveSharedFields = (\n store: JsonSchemaStore,\n schema: JsonSchema,\n) => {\n store.title = schema.title;\n store.description = schema.description;\n store.deprecated = schema.deprecated;\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\n\nexport const getJsonSchemaStoreByPath = (\n store: JsonSchemaStore,\n path: string,\n): JsonSchemaStore => {\n if (path === '') {\n return store;\n }\n\n if (path === '/') {\n throw new Error(\n 'invalid root path, need to use path=\"\" instead of path=\"/\"',\n );\n }\n\n const tokens = path.split('/');\n tokens.shift();\n\n let currentStore = store;\n\n let currentToken = tokens.shift();\n let currentPath = '';\n\n while (currentToken) {\n if (currentStore.type === JsonSchemaTypeName.Object) {\n if (currentToken !== 'properties') {\n throw new Error(\n `Expected \"${currentPath}/properties/*\" instead of ${currentPath}/${currentToken}/*`,\n );\n }\n\n currentPath = `${currentPath}/${currentToken}`;\n\n currentToken = tokens.shift();\n\n if (!currentToken) {\n throw new Error(`Expected property name after \"${currentPath}\"`);\n }\n\n const foundCurrentStore = currentStore.getProperty(currentToken);\n\n if (!foundCurrentStore) {\n throw new Error(`Not found \"${currentToken}\" in \"${currentPath}\"`);\n }\n\n currentStore = foundCurrentStore;\n currentPath = `${currentPath}/${currentToken}`;\n\n currentToken = tokens.shift();\n } else if (currentStore.type === JsonSchemaTypeName.Array) {\n if (currentToken !== 'items') {\n throw new Error(\n `Expected \"${currentPath}/items/*\" instead of ${currentPath}/${currentToken}/*`,\n );\n }\n\n currentPath = `${currentPath}/${currentToken}`;\n\n currentStore = currentStore.items;\n\n currentToken = tokens.shift();\n } else {\n throw new Error(`Unexpected \"${currentToken}\" in \"${currentPath}\"`);\n }\n }\n\n return currentStore;\n};\n","export const getParentForPath = (\n path: string,\n): { parentPath: string; field: string } => {\n if (path === '' || path === '/') {\n throw new Error('Invalid path');\n }\n\n const tokens = path.split('/');\n tokens.shift();\n\n let currentToken = tokens.shift();\n\n let parentPath = '';\n let field = '';\n\n while (currentToken) {\n if (currentToken === 'properties') {\n currentToken = tokens.shift();\n\n if (!currentToken) {\n throw new Error('Invalid path');\n }\n\n field = currentToken;\n\n currentToken = tokens.shift();\n\n if (currentToken) {\n parentPath = `${parentPath}/properties/${field}`;\n }\n } else if (currentToken === 'items') {\n field = currentToken;\n\n currentToken = tokens.shift();\n\n if (currentToken && !['items', 'properties'].includes(currentToken)) {\n throw new Error('Invalid path');\n } else if (currentToken) {\n parentPath = `${parentPath}/items`;\n }\n } else {\n throw new Error('Invalid path');\n }\n }\n\n return {\n parentPath: parentPath,\n field,\n };\n};\n","const maxLength = 64;\n\nexport const VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE = `It must contain between 1 and ${maxLength} characters, start with a letter or underscore (_), cannot start with two underscores (__), and can only include letters (a-z, A-Z), numbers (0-9), hyphens (-), and underscores (_).`;\n\nconst validPattern = /^(?!__)[a-zA-Z_][a-zA-Z0-9-_]*$/;\n\nexport const validateJsonFieldName = (id: string) => {\n const isInvalid =\n id.length < 1 || id.length > maxLength || !validPattern.test(id);\n\n return !isInvalid;\n};\n","import { JsonSchema, JsonSchemaTypeName } from '../types/schema.types.js';\nimport {\n JsonPatchAdd,\n JsonPatchMove,\n JsonPatchRemove,\n JsonPatchReplace,\n} from '../types/json-patch.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\nimport { createJsonSchemaStore } from './createJsonSchemaStore.js';\nimport { getJsonSchemaStoreByPath } from './getJsonSchemaStoreByPath.js';\nimport { getParentForPath } from './getParentForPath.js';\nimport {\n VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE,\n validateJsonFieldName,\n} from './validateJsonFieldName.js';\n\nexport const applyReplacePatch = (\n store: JsonSchemaStore,\n patch: JsonPatchReplace,\n refs: Record<string, JsonSchema> = {},\n): JsonSchemaStore => {\n const patchStore = createJsonSchemaStore(patch.value, refs);\n const foundStore = getJsonSchemaStoreByPath(store, patch.path);\n\n const parent = foundStore.parent;\n\n if (!parent) {\n return patchStore;\n }\n\n if (parent.type === JsonSchemaTypeName.Object) {\n parent.migratePropertyWithStore(foundStore.name, patchStore);\n } else if (parent.type === JsonSchemaTypeName.Array) {\n parent.migrateItems(patchStore);\n } else {\n throw new Error('Invalid parent');\n }\n\n return store;\n};\n\nexport const applyRemovePatch = (\n rootStore: JsonSchemaStore,\n patch: JsonPatchRemove,\n): void => {\n const foundStore = getJsonSchemaStoreByPath(rootStore, patch.path);\n const parent = foundStore.parent;\n\n if (!parent) {\n throw new Error('Parent does not exist');\n }\n\n if (parent.type !== JsonSchemaTypeName.Object) {\n throw new Error('Cannot remove from non-object');\n }\n\n parent.removeProperty(foundStore.name);\n};\n\nexport const applyAddPatch = (\n rootStore: JsonSchemaStore,\n patch: JsonPatchAdd,\n refs: Record<string, JsonSchema> = {},\n): void => {\n const patchStore = createJsonSchemaStore(patch.value, refs);\n\n const { parentPath, field } = getParentForPath(patch.path);\n const foundParent = getJsonSchemaStoreByPath(rootStore, parentPath);\n\n if (!foundParent) {\n throw new Error('Parent does not exist');\n }\n\n if (foundParent.type !== JsonSchemaTypeName.Object) {\n throw new Error('Cannot add to non-object');\n }\n\n if (foundParent.getProperty(field)) {\n throw new Error(`Field \"${field}\" already exists in parent`);\n }\n\n foundParent.addPropertyWithStore(field, patchStore);\n};\n\nexport const applyMovePatch = (\n store: JsonSchemaStore,\n patch: JsonPatchMove,\n): void => {\n const { parentPath: fromParentPath, field: fromField } = getParentForPath(\n patch.from,\n );\n const { parentPath: toParentPath, field: toField } = getParentForPath(\n patch.path,\n );\n\n const foundFromParent = getJsonSchemaStoreByPath(store, fromParentPath);\n const foundToParent = getJsonSchemaStoreByPath(store, toParentPath);\n\n const isValidToField = validateJsonFieldName(toField);\n\n if (!isValidToField) {\n throw new Error(\n `Invalid name: ${toField}. ${VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE}`,\n );\n }\n\n if (!foundFromParent || !foundToParent) {\n throw new Error('Cannot move from or to non-existent parent');\n }\n\n if (foundFromParent.type !== JsonSchemaTypeName.Object) {\n throw new Error('Cannot move from non-object parent');\n }\n\n const foundFromField = getJsonSchemaStoreByPath(store, patch.from);\n\n const isMovedPropertyInSameParentPatch =\n foundFromParent === foundToParent &&\n foundFromParent.type === JsonSchemaTypeName.Object &&\n foundFromParent.getProperty(fromField);\n\n if (isMovedPropertyInSameParentPatch) {\n return foundFromParent.changeName(fromField, toField);\n }\n\n if (foundToParent.type === JsonSchemaTypeName.Object) {\n if (foundToParent.getProperty(toField)) {\n foundToParent.removeProperty(toField);\n }\n foundToParent.addPropertyWithStore(toField, foundFromField);\n foundFromParent.removeProperty(fromField);\n return;\n }\n\n if (foundToParent.type === JsonSchemaTypeName.Array) {\n foundFromParent.removeProperty(fromField);\n foundToParent.replaceItems(foundFromField);\n\n return;\n }\n throw new Error('Invalid type of \"to\" parent');\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\n\nexport const getDBJsonPathByJsonSchemaStore = (\n store: JsonSchemaStore,\n): string => {\n let node = store;\n\n let path = '';\n\n while (node.parent) {\n if (node.parent.type === JsonSchemaTypeName.Object) {\n path = `.${node.name}${path}`;\n } else if (node.parent.type === JsonSchemaTypeName.Array) {\n path = `[*]${path}`;\n }\n\n node = node.parent;\n }\n\n if (!path) {\n return '$';\n }\n\n return `$${path}`;\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\n\nexport const getPathByStore = (store: JsonSchemaStore): string => {\n let node = store;\n\n let path = '';\n\n while (node.parent) {\n if (node.parent.type === JsonSchemaTypeName.Object) {\n path = `/properties/${node.name}${path}`;\n } else if (node.parent.type === JsonSchemaTypeName.Array) {\n path = `/items${path}`;\n }\n\n node = node.parent;\n }\n\n if (!path) {\n return '/';\n }\n\n return `${path}`;\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\n\nexport const traverseStore = (\n store: JsonSchemaStore,\n callback: (node: JsonSchemaStore) => void,\n) => {\n callback(store);\n\n if (store.type === JsonSchemaTypeName.Object) {\n Object.values(store.properties).forEach((item) => {\n traverseStore(item, callback);\n });\n } else if (store.type === JsonSchemaTypeName.Array) {\n traverseStore(store.items, callback);\n }\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonPatch, JsonPatchReplace } from '../types/json-patch.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\nimport { getPathByStore } from './getPathByStore.js';\nimport { traverseStore } from './traverseStore.js';\n\nexport const getForeignKeyPatchesFromSchema = (\n store: JsonSchemaStore,\n options: { tableId: string; nextTableId: string },\n) => {\n const stores: JsonPatch[] = [];\n\n traverseStore(store, (item) => {\n if (\n item.type === JsonSchemaTypeName.String &&\n item.foreignKey === options.tableId\n ) {\n item.foreignKey = options.nextTableId;\n\n const patch: JsonPatchReplace = {\n op: 'replace',\n path: getPathByStore(item),\n value: item.getPlainSchema(),\n };\n\n stores.push(patch);\n }\n });\n\n return stores;\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\nimport { traverseStore } from './traverseStore.js';\n\nexport const getForeignKeysFromSchema = (store: JsonSchemaStore): string[] => {\n const foreignKeys = new Set<string>();\n\n traverseStore(store, (item) => {\n if (item.type === JsonSchemaTypeName.String && item.foreignKey) {\n foreignKeys.add(item.foreignKey);\n }\n });\n\n return [...foreignKeys].sort((a, b) => a.localeCompare(b));\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonValueStore } from '../model/value/json-value.store.js';\n\nexport const traverseValue = (\n store: JsonValueStore,\n callback: (node: JsonValueStore) => void,\n) => {\n callback(store);\n\n if (store.type === JsonSchemaTypeName.Object) {\n Object.values(store.value).forEach((item) => {\n traverseValue(item, callback);\n });\n } else if (store.type === JsonSchemaTypeName.Array) {\n store.value.forEach((itemValue) => {\n traverseValue(itemValue, callback);\n });\n }\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonValueStore } from '../model/value/json-value.store.js';\nimport { traverseValue } from './traverseValue.js';\n\nexport type GetForeignKeysFromValueType = {\n tableId: string;\n rowIds: string[];\n};\n\nexport const getForeignKeysFromValue = (\n value: JsonValueStore,\n): GetForeignKeysFromValueType[] => {\n const foreignKeys = new Map<string, Set<string>>();\n\n traverseValue(value, (item) => {\n if (item.type === JsonSchemaTypeName.String && item.foreignKey) {\n let tableForeignKey = foreignKeys.get(item.foreignKey);\n\n if (!tableForeignKey) {\n tableForeignKey = new Set<string>();\n foreignKeys.set(item.foreignKey, tableForeignKey);\n }\n\n tableForeignKey.add(item.getPlainValue());\n }\n });\n\n return [...foreignKeys].map(([tableId, rowIds]) => ({\n tableId,\n rowIds: [...rowIds].sort((a, b) => a.localeCompare(b)),\n }));\n};\n","import { JsonSchema, JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\nimport { createJsonSchemaStore } from './createJsonSchemaStore.js';\nimport { traverseStore } from './traverseStore.js';\nimport { validateJsonFieldName } from './validateJsonFieldName.js';\n\nexport const getInvalidFieldNamesInSchema = (\n schema: JsonSchema,\n refs: Record<string, JsonSchema> = {},\n) => {\n const schemaStore = createJsonSchemaStore(schema, refs);\n\n const invalidFields: JsonSchemaStore[] = [];\n\n traverseStore(schemaStore, (item) => {\n if (item.parent?.type === JsonSchemaTypeName.Object) {\n if (!validateJsonFieldName(item.name)) {\n invalidFields.push(item);\n }\n }\n });\n\n return invalidFields;\n};\n","import { JsonArray, JsonObject, JsonValue } from '../types';\n\nfunction parsePathSegments(path: string): (string | number)[] {\n const segments: (string | number)[] = [];\n const regex = /([^.[\\]]+)|\\[(\\d+)]/g;\n let match: RegExpExecArray | null;\n\n while ((match = regex.exec(path))) {\n if (match[1] !== undefined) {\n segments.push(match[1]);\n } else if (match[2] !== undefined) {\n segments.push(Number(match[2]));\n }\n }\n\n return segments;\n}\n\n/**\n * Parse path string into segments\n *\n * @param path - Path string (e.g., \"title\", \"address.city\", \"tags[0]\", \"users[0].name\")\n * @returns Array of segments (strings and numbers)\n *\n * @example\n * parsePath(\"title\") // [\"title\"]\n * parsePath(\"address.city\") // [\"address\", \"city\"]\n * parsePath(\"tags[0]\") // [\"tags\", 0]\n * parsePath(\"users[0].name\") // [\"users\", 0, \"name\"]\n * parsePath(\"matrix[0][1]\") // [\"matrix\", 0, 1]\n */\nexport function parsePath(path: string): (string | number)[] {\n if (!path) {\n return [];\n }\n\n return parsePathSegments(path);\n}\n\n/**\n * Get value by path from plain JavaScript object\n *\n * @param obj - Object to navigate\n * @param path - Path string (e.g., \"address.city\", \"tags[0]\")\n * @returns Value at path, or undefined if path doesn't exist\n *\n * @example\n * const obj = { address: { city: \"Moscow\" }, tags: [\"a\", \"b\"] };\n * getValueByPath(obj, \"address.city\") // \"Moscow\"\n * getValueByPath(obj, \"tags[1]\") // \"b\"\n * getValueByPath(obj, \"nonexistent\") // undefined\n */\nexport function getValueByPath(\n obj: JsonValue | undefined,\n path: string,\n): JsonValue | undefined {\n if (!path) {\n return obj;\n }\n\n const segments = parsePath(path);\n let current: JsonValue | undefined = obj;\n\n for (const segment of segments) {\n if (current == null) {\n return undefined;\n }\n\n if (typeof segment === 'number') {\n if (!Array.isArray(current)) {\n return undefined;\n }\n current = current[segment];\n } else {\n if (typeof current !== 'object') {\n return undefined;\n }\n current = (current as JsonObject)[segment];\n }\n }\n\n return current;\n}\n\n/**\n * Set value by path in plain JavaScript object\n * Creates intermediate objects/arrays as needed\n *\n * @param obj - Object to modify\n * @param path - Path string (e.g., \"address.city\", \"tags[0]\")\n * @param value - Value to set\n *\n * @example\n * const obj = {};\n * setValueByPath(obj, \"address.city\", \"London\");\n * // obj is now { address: { city: \"London\" } }\n *\n * setValueByPath(obj, \"tags[0]\", \"first\");\n * // obj is now { address: { city: \"London\" }, tags: [\"first\"] }\n */\nexport function setValueByPath(\n obj: JsonValue,\n path: string,\n value: JsonValue,\n): void {\n if (!path) {\n throw new Error('Cannot set root value');\n }\n\n const segments = parsePath(path);\n let current: JsonValue | undefined = obj;\n\n for (let i = 0; i < segments.length - 1; i++) {\n const segment = segments[i] as string | number;\n const nextSegment = segments[i + 1];\n\n if (typeof segment === 'number') {\n if (!Array.isArray(current)) {\n throw new TypeError(\n `Cannot set array index on non-array at segment ${i}`,\n );\n }\n\n const arr: JsonArray = current;\n\n if (segment > arr.length) {\n throw new Error(\n `Cannot create sparse array: index ${segment} is out of bounds (array length: ${arr.length}) at segment ${i}`,\n );\n }\n\n if (arr[segment] == null) {\n arr[segment] = typeof nextSegment === 'number' ? [] : {};\n }\n\n current = arr[segment];\n } else if (typeof segment === 'string') {\n if (\n current == null ||\n typeof current !== 'object' ||\n Array.isArray(current)\n ) {\n throw new Error(`Cannot set property on non-object at segment ${i}`);\n }\n\n const obj: JsonObject = current;\n if (obj[segment] == null) {\n obj[segment] = typeof nextSegment === 'number' ? [] : {};\n }\n\n current = obj[segment];\n }\n }\n\n const lastSegment = segments[segments.length - 1] as string | number;\n\n if (typeof lastSegment === 'number') {\n if (!Array.isArray(current)) {\n throw new TypeError(\n `Cannot set array index on non-array at segment ${segments.length - 1}`,\n );\n }\n\n const arr: JsonArray = current;\n\n if (lastSegment > arr.length) {\n throw new Error(\n `Cannot create sparse array: index ${lastSegment} is out of bounds (array length: ${arr.length})`,\n );\n }\n\n arr[lastSegment] = value;\n } else if (typeof lastSegment === 'string') {\n if (\n current == null ||\n typeof current !== 'object' ||\n Array.isArray(current)\n ) {\n throw new Error(\n `Cannot set property on non-object at segment ${segments.length - 1}`,\n );\n }\n (current as JsonObject)[lastSegment] = value;\n }\n}\n\n/**\n * Check if path exists in object\n *\n * @param obj - Object to check\n * @param path - Path string (e.g., \"address.city\", \"tags[0]\")\n * @returns true if path exists and value is not undefined\n *\n * @example\n * const obj = { address: { city: \"Moscow\" } };\n * hasPath(obj, \"address.city\") // true\n * hasPath(obj, \"address.country\") // false\n */\nexport function hasPath(obj: JsonValue, path: string): boolean {\n const value = getValueByPath(obj, path);\n return value !== undefined;\n}\n\n/**\n * Deep equality comparison for plain JavaScript values\n * Handles objects, arrays, primitives, null, undefined\n *\n * @param a - First value\n * @param b - Second value\n * @returns true if values are deeply equal\n *\n * @example\n * deepEqual({ a: 1, b: 2 }, { a: 1, b: 2 }) // true\n * deepEqual([1, 2, 3], [1, 2, 3]) // true\n * deepEqual({ a: 1 }, { a: 2 }) // false\n * deepEqual(null, null) // true\n * deepEqual(undefined, undefined) // true\n */\nexport function deepEqual(a: unknown, b: unknown): boolean {\n if (a === b) {\n return true;\n }\n\n if (a === null && b === null) {\n return true;\n }\n\n if (a === undefined && b === undefined) {\n return true;\n }\n\n if (a == null || b == null) {\n return false;\n }\n\n if (typeof a !== typeof b) {\n return false;\n }\n\n if (typeof a !== 'object') {\n return false;\n }\n\n if (Array.isArray(a) && Array.isArray(b)) {\n const arrA = a as JsonArray;\n const arrB = b as JsonArray;\n if (arrA.length !== arrB.length) {\n return false;\n }\n for (let i = 0; i < arrA.length; i++) {\n const itemA = arrA[i];\n const itemB = arrB[i];\n\n if (itemA !== undefined && itemB !== undefined) {\n if (itemA === null && itemB === null) {\n continue;\n }\n if (!deepEqual(itemA, itemB)) {\n return false;\n }\n } else if (itemA !== itemB) {\n return false;\n }\n }\n return true;\n }\n\n if (Array.isArray(a) || Array.isArray(b)) {\n return false;\n }\n\n const objA = a as JsonObject;\n const objB = b as JsonObject;\n const keysA = Object.keys(objA);\n const keysB = Object.keys(objB);\n\n if (keysA.length !== keysB.length) {\n return false;\n }\n\n for (const key of keysA) {\n if (!keysB.includes(key)) {\n return false;\n }\n const valA = objA[key];\n const valB = objB[key];\n\n if (valA !== undefined && valB !== undefined) {\n if (valA === null && valB === null) {\n continue;\n }\n if (!deepEqual(valA, valB)) {\n return false;\n }\n } else if (valA !== valB) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Convert simplified JSON path to JSON Schema path\n *\n * @param jsonPath - JSON path string (e.g., \"title\", \"address.city\", \"tags[0]\", \"users[0].name\")\n * @returns JSON Schema path string\n *\n * @example\n * convertJsonPathToSchemaPath(\"title\") // \"/properties/title\"\n * convertJsonPathToSchemaPath(\"address.city\") // \"/properties/address/properties/city\"\n * convertJsonPathToSchemaPath(\"tags[0]\") // \"/properties/tags/items\"\n * convertJsonPathToSchemaPath(\"users[0].name\") // \"/properties/users/items/properties/name\"\n * convertJsonPathToSchemaPath(\"\") // \"\"\n */\nexport function convertJsonPathToSchemaPath(jsonPath: string): string {\n if (jsonPath === '') {\n return '';\n }\n\n const segments = parsePathSegments(jsonPath);\n\n let schemaPath = '';\n for (const segment of segments) {\n if (typeof segment === 'number') {\n schemaPath += '/items';\n } else {\n schemaPath += `/properties/${segment}`;\n }\n }\n\n return schemaPath;\n}\n\nexport function convertSchemaPathToJsonPath(schemaPath: string): string {\n if (schemaPath === '') {\n return '';\n }\n\n const cleanPath = schemaPath.startsWith('/') ? schemaPath.slice(1) : schemaPath;\n\n if (cleanPath === '') {\n return '';\n }\n\n const segments = cleanPath.split('/');\n let result = '';\n\n let i = 0;\n while (i < segments.length) {\n const segment = segments[i];\n\n if (segment === 'properties') {\n i++;\n if (i < segments.length) {\n const propertyName = segments[i];\n if (propertyName) {\n if (result) {\n result += '.';\n }\n result += propertyName;\n }\n }\n } else if (segment === 'items') {\n result += '[*]';\n }\n\n i++;\n }\n\n return result;\n}\n","import { JsonArrayValueStore } from '../model/value/json-array-value.store.js';\nimport { JsonObjectValueStore } from '../model/value/json-object-value.store.js';\nimport { JsonValueStore } from '../model/value/json-value.store.js';\nimport { parsePath } from './json-path-utils.js';\n\nexport const getJsonValueStoreByPath = (\n root: JsonValueStore,\n path: string,\n): JsonValueStore => {\n if (!path) {\n return root;\n }\n\n const segments = parsePath(path);\n\n let current: JsonValueStore = root;\n\n for (const seg of segments) {\n if (current instanceof JsonObjectValueStore) {\n const next = current.value[String(seg)];\n if (!next) {\n throw new Error(`Path not found at segment \"${seg}\"`);\n }\n current = next;\n } else if (current instanceof JsonArrayValueStore) {\n if (typeof seg !== 'number') {\n throw new Error(`Invalid array index \"${seg}\"`);\n }\n const next = current.value[seg];\n if (!next) {\n throw new Error(`Path not found at segment \"${seg}\"`);\n }\n current = next;\n } else {\n throw new Error(`Cannot navigate into primitive at segment \"${seg}\"`);\n }\n }\n\n return current;\n};\n\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonValueStore } from '../model/value/json-value.store.js';\nimport { traverseValue } from './traverseValue.js';\n\nexport type ReplaceForeignKeyValueOptions = {\n valueStore: JsonValueStore;\n foreignKey: string;\n value: string;\n nextValue: string;\n};\n\nexport const replaceForeignKeyValue = (\n options: ReplaceForeignKeyValueOptions,\n) => {\n let wasUpdated = false;\n\n traverseValue(options.valueStore, (item) => {\n if (\n item.type === JsonSchemaTypeName.String &&\n item.foreignKey === options.foreignKey &&\n item.value === options.value\n ) {\n item.value = options.nextValue;\n wasUpdated = true;\n }\n });\n\n return wasUpdated;\n};\n","import { SystemSchemaIds } from '../consts/system-schema-ids.js';\nimport { createJsonSchemaStore } from './createJsonSchemaStore.js';\nimport {\n fileSchema,\n rowCreatedAtSchema,\n rowCreatedIdSchema,\n rowHashSchema,\n rowPublishedAtSchema,\n rowSchemaHashSchema,\n rowUpdatedAtSchema,\n rowVersionIdSchema,\n rowIdSchema,\n} from '../plugins/index.js';\nimport { JsonSchema } from '../types/schema.types.js';\n\nexport const pluginRefs: Readonly<Record<string, JsonSchema>> = {\n [SystemSchemaIds.RowId]: rowIdSchema,\n [SystemSchemaIds.RowVersionId]: rowVersionIdSchema,\n [SystemSchemaIds.RowCreatedId]: rowCreatedIdSchema,\n [SystemSchemaIds.RowCreatedAt]: rowCreatedAtSchema,\n [SystemSchemaIds.RowPublishedAt]: rowPublishedAtSchema,\n [SystemSchemaIds.RowUpdatedAt]: rowUpdatedAtSchema,\n [SystemSchemaIds.RowHash]: rowHashSchema,\n [SystemSchemaIds.RowSchemaHash]: rowSchemaHashSchema,\n [SystemSchemaIds.File]: fileSchema,\n};\n\nexport const resolveRefs = (schema: JsonSchema) => {\n const store = createJsonSchemaStore(schema, pluginRefs);\n return store.getPlainSchema({ skip$Ref: true });\n};\n","import { JsonSchema } from '../types/schema.types.js';\nimport { JsonValue } from '../types/json.types.js';\nimport { JsonPatch } from '../types/json-patch.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\nimport { JsonValueStore } from '../model/value/json-value.store.js';\nimport { getTransformation } from '../model/value/value-transformation.js';\nimport { createJsonSchemaStore } from './createJsonSchemaStore.js';\nimport { createJsonValueStore } from './createJsonValueStore.js';\nimport {\n applyAddPatch,\n applyMovePatch,\n applyRemovePatch,\n applyReplacePatch,\n} from './applyPatches.js';\n\nexport class SchemaTable {\n private readonly rows = new Map<string, JsonValueStore>();\n private store: JsonSchemaStore;\n\n constructor(\n schema: JsonSchema,\n private readonly refs: Record<string, JsonSchema> = {},\n ) {\n this.store = createJsonSchemaStore(schema, refs);\n }\n\n public applyPatches(patches: JsonPatch[]): void {\n patches.forEach((patch) => {\n switch (patch.op) {\n case 'replace': {\n const nextStore = applyReplacePatch(this.store, patch, this.refs);\n if (nextStore !== this.store) {\n this.migrateRows(nextStore);\n }\n break;\n }\n case 'remove': {\n applyRemovePatch(this.store, patch);\n break;\n }\n case 'add': {\n applyAddPatch(this.store, patch, this.refs);\n break;\n }\n case 'move': {\n applyMovePatch(this.store, patch);\n break;\n }\n default:\n throw new Error(`Unsupported patch operation`);\n }\n });\n }\n\n public getSchema(): JsonSchema {\n return this.store.getPlainSchema();\n }\n\n public addRow(rowId: string, data: JsonValue) {\n const row = createJsonValueStore(this.store, rowId, data);\n\n this.rows.set(rowId, row);\n }\n\n public getRow(id: string): JsonValue {\n const row = this.rows.get(id);\n\n if (!row) {\n throw new Error('Invalid id');\n }\n\n return row.getPlainValue();\n }\n\n public getRows(): { id: string; data: JsonValue }[] {\n return [...this.rows].map(([id, data]) => ({\n id,\n data: data.getPlainValue(),\n }));\n }\n\n private migrateRows(nextStore: JsonSchemaStore): void {\n const transformation = getTransformation(this.store, nextStore);\n\n if (transformation) {\n for (const [rowId, row] of this.rows) {\n const rawNextValue = transformation(\n row.getPlainValue(),\n nextStore.default,\n ) as JsonValue;\n\n const nextRow = createJsonValueStore(nextStore, rowId, rawNextValue);\n this.rows.set(rowId, nextRow);\n }\n }\n\n this.store = nextStore;\n }\n}\n"]}
@@ -565,6 +565,37 @@ function convertJsonPathToSchemaPath(jsonPath) {
565
565
  }
566
566
  return schemaPath;
567
567
  }
568
+ function convertSchemaPathToJsonPath(schemaPath) {
569
+ if (schemaPath === "") {
570
+ return "";
571
+ }
572
+ const cleanPath = schemaPath.startsWith("/") ? schemaPath.slice(1) : schemaPath;
573
+ if (cleanPath === "") {
574
+ return "";
575
+ }
576
+ const segments = cleanPath.split("/");
577
+ let result = "";
578
+ let i = 0;
579
+ while (i < segments.length) {
580
+ const segment = segments[i];
581
+ if (segment === "properties") {
582
+ i++;
583
+ if (i < segments.length) {
584
+ const propertyName = segments[i];
585
+ if (propertyName) {
586
+ if (result) {
587
+ result += ".";
588
+ }
589
+ result += propertyName;
590
+ }
591
+ }
592
+ } else if (segment === "items") {
593
+ result += "[*]";
594
+ }
595
+ i++;
596
+ }
597
+ return result;
598
+ }
568
599
 
569
600
  // src/lib/getJsonValueByPath.ts
570
601
  var getJsonValueStoreByPath = (root, path) => {
@@ -703,6 +734,7 @@ exports.applyMovePatch = applyMovePatch;
703
734
  exports.applyRemovePatch = applyRemovePatch;
704
735
  exports.applyReplacePatch = applyReplacePatch;
705
736
  exports.convertJsonPathToSchemaPath = convertJsonPathToSchemaPath;
737
+ exports.convertSchemaPathToJsonPath = convertSchemaPathToJsonPath;
706
738
  exports.createJsonObjectSchemaStore = createJsonObjectSchemaStore;
707
739
  exports.createJsonSchemaStore = createJsonSchemaStore;
708
740
  exports.createPrimitiveStoreBySchema = createPrimitiveStoreBySchema;
@@ -727,5 +759,5 @@ exports.setValueByPath = setValueByPath;
727
759
  exports.traverseStore = traverseStore;
728
760
  exports.traverseValue = traverseValue;
729
761
  exports.validateJsonFieldName = validateJsonFieldName;
730
- //# sourceMappingURL=chunk-HC4VM256.cjs.map
731
- //# sourceMappingURL=chunk-HC4VM256.cjs.map
762
+ //# sourceMappingURL=chunk-EJAKPKHS.cjs.map
763
+ //# sourceMappingURL=chunk-EJAKPKHS.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/createJsonSchemaStore.ts","../src/lib/getJsonSchemaStoreByPath.ts","../src/lib/getParentForPath.ts","../src/lib/validateJsonFieldName.ts","../src/lib/applyPatches.ts","../src/lib/getDBJsonPathByJsonSchemaStore.ts","../src/lib/getPathByStore.ts","../src/lib/traverseStore.ts","../src/lib/getForeignKeyPatchesFromSchema.ts","../src/lib/getForeignKeysFromSchema.ts","../src/lib/traverseValue.ts","../src/lib/getForeignKeysFromValue.ts","../src/lib/getInvalidFieldNamesInSchema.ts","../src/lib/json-path-utils.ts","../src/lib/getJsonValueByPath.ts","../src/lib/replaceForeignKeyValue.ts","../src/lib/resolveRefs.ts","../src/lib/schema-table.ts"],"names":["JsonArrayStore","JsonObjectStore","JsonStringStore","JsonNumberStore","JsonBooleanStore","obj","JsonObjectValueStore","JsonArrayValueStore","rowIdSchema","rowVersionIdSchema","rowCreatedIdSchema","rowCreatedAtSchema","rowPublishedAtSchema","rowUpdatedAtSchema","rowHashSchema","rowSchemaHashSchema","fileSchema","createJsonValueStore","getTransformation"],"mappings":";;;;;;AAkBO,IAAM,qBAAA,GAAwB,CACnC,MAAA,EACA,IAAA,GAAiB,EAAC,KACE;AACpB,EAAA,IAAI,UAAU,MAAA,EAAQ;AACpB,IAAA,MAAM,SAAA,GAAoC,IAAA,CAAK,MAAA,CAAO,IAAI,CAAA;AAE1D,IAAA,IAAI,CAAC,SAAA,EAAW;AACd,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,2BAAA,EAA8B,MAAA,CAAO,IAAI,CAAA,CAAA,CAAG,CAAA;AAAA,IAC9D;AAEA,IAAA,MAAM,QAAA,GAAW,qBAAA,CAAsB,SAAA,EAAW,IAAI,CAAA;AACtD,IA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EAAkC;AACpD,IAAA,MAAM,cAAA,GAAiBC,mCAAA,CAAkB,IAAA,CAAK,KAAA,EAAO,SAAS,CAAA;AAE9D,IAAA,IAAI,cAAA,EAAgB;AAClB,MAAA,KAAA,MAAW,CAAC,KAAA,EAAO,GAAG,CAAA,IAAK,KAAK,IAAA,EAAM;AACpC,QAAA,MAAM,YAAA,GAAe,cAAA;AAAA,UACnB,IAAI,aAAA,EAAc;AAAA,UAClB,SAAA,CAAU;AAAA,SACZ;AAEA,QAAA,MAAM,OAAA,GAAUD,sCAAA,CAAqB,SAAA,EAAW,KAAA,EAAO,YAAY,CAAA;AACnE,QAAA,IAAA,CAAK,IAAA,CAAK,GAAA,CAAI,KAAA,EAAO,OAAO,CAAA;AAAA,MAC9B;AAAA,IACF;AAEA,IAAA,IAAA,CAAK,KAAA,GAAQ,SAAA;AAAA,EACf;AACF","file":"chunk-EJAKPKHS.cjs","sourcesContent":["import {\n JsonObjectSchema,\n JsonSchema,\n JsonSchemaPrimitives,\n JsonSchemaTypeName,\n} from '../types/schema.types.js';\nimport { JsonArrayStore } from '../model/schema/json-array.store.js';\nimport { JsonBooleanStore } from '../model/schema/json-boolean.store.js';\nimport { JsonNumberStore } from '../model/schema/json-number.store.js';\nimport { JsonStringStore } from '../model/schema/json-string.store.js';\nimport { JsonObjectStore } from '../model/schema/json-object.store.js';\nimport {\n JsonSchemaStore,\n JsonSchemaStorePrimitives,\n} from '../model/schema/json-schema.store.js';\n\nexport type RefsType = Record<string, JsonSchema>;\n\nexport const createJsonSchemaStore = (\n schema: JsonSchema,\n refs: RefsType = {},\n): JsonSchemaStore => {\n if ('$ref' in schema) {\n const refSchema: JsonSchema | undefined = refs[schema.$ref];\n\n if (!refSchema) {\n throw new Error(`Not found schema for $ref=\"${schema.$ref}\"`);\n }\n\n const refStore = createJsonSchemaStore(refSchema, refs);\n saveSharedFields(refStore, schema);\n refStore.$ref = schema.$ref;\n return refStore;\n } else if (schema.type === JsonSchemaTypeName.Object) {\n const objectStore = createJsonObjectSchemaStore(schema, refs);\n saveSharedFields(objectStore, schema);\n\n return objectStore;\n } else if (schema.type === JsonSchemaTypeName.Array) {\n const itemsStore = createJsonSchemaStore(schema.items, refs);\n const arrayStore = new JsonArrayStore(itemsStore);\n saveSharedFields(arrayStore, schema);\n\n return arrayStore;\n } else {\n const primitivesStore = createPrimitiveStoreBySchema(schema);\n saveSharedFields(primitivesStore, schema);\n primitivesStore.readOnly = schema.readOnly;\n\n return primitivesStore;\n }\n};\n\nexport const createJsonObjectSchemaStore = (\n value: JsonObjectSchema,\n refs: RefsType,\n): JsonObjectStore => {\n const store = new JsonObjectStore();\n\n for (const requiredField of value.required) {\n if (!value.properties[requiredField]) {\n throw new Error(\n `Not found required field \"${requiredField}\" in \"properties\"`,\n );\n }\n }\n\n Object.entries(value.properties).forEach(([name, item]) => {\n store.addPropertyWithStore(name, createJsonSchemaStore(item, refs));\n });\n\n return store;\n};\n\nexport const createPrimitiveStoreBySchema = (\n schema: JsonSchemaPrimitives,\n): JsonSchemaStorePrimitives => {\n if (schema.type === JsonSchemaTypeName.String) {\n const stringStore = new JsonStringStore();\n stringStore.foreignKey = schema.foreignKey;\n stringStore.format = schema.format;\n stringStore.enum = schema.enum;\n stringStore.contentMediaType = schema.contentMediaType;\n stringStore.pattern = schema.pattern;\n return stringStore;\n } else if (schema.type === JsonSchemaTypeName.Number) {\n return new JsonNumberStore();\n } else if (schema.type === JsonSchemaTypeName.Boolean) {\n return new JsonBooleanStore();\n } else {\n throw new Error('this type is not allowed');\n }\n};\n\nexport const saveSharedFields = (\n store: JsonSchemaStore,\n schema: JsonSchema,\n) => {\n store.title = schema.title;\n store.description = schema.description;\n store.deprecated = schema.deprecated;\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\n\nexport const getJsonSchemaStoreByPath = (\n store: JsonSchemaStore,\n path: string,\n): JsonSchemaStore => {\n if (path === '') {\n return store;\n }\n\n if (path === '/') {\n throw new Error(\n 'invalid root path, need to use path=\"\" instead of path=\"/\"',\n );\n }\n\n const tokens = path.split('/');\n tokens.shift();\n\n let currentStore = store;\n\n let currentToken = tokens.shift();\n let currentPath = '';\n\n while (currentToken) {\n if (currentStore.type === JsonSchemaTypeName.Object) {\n if (currentToken !== 'properties') {\n throw new Error(\n `Expected \"${currentPath}/properties/*\" instead of ${currentPath}/${currentToken}/*`,\n );\n }\n\n currentPath = `${currentPath}/${currentToken}`;\n\n currentToken = tokens.shift();\n\n if (!currentToken) {\n throw new Error(`Expected property name after \"${currentPath}\"`);\n }\n\n const foundCurrentStore = currentStore.getProperty(currentToken);\n\n if (!foundCurrentStore) {\n throw new Error(`Not found \"${currentToken}\" in \"${currentPath}\"`);\n }\n\n currentStore = foundCurrentStore;\n currentPath = `${currentPath}/${currentToken}`;\n\n currentToken = tokens.shift();\n } else if (currentStore.type === JsonSchemaTypeName.Array) {\n if (currentToken !== 'items') {\n throw new Error(\n `Expected \"${currentPath}/items/*\" instead of ${currentPath}/${currentToken}/*`,\n );\n }\n\n currentPath = `${currentPath}/${currentToken}`;\n\n currentStore = currentStore.items;\n\n currentToken = tokens.shift();\n } else {\n throw new Error(`Unexpected \"${currentToken}\" in \"${currentPath}\"`);\n }\n }\n\n return currentStore;\n};\n","export const getParentForPath = (\n path: string,\n): { parentPath: string; field: string } => {\n if (path === '' || path === '/') {\n throw new Error('Invalid path');\n }\n\n const tokens = path.split('/');\n tokens.shift();\n\n let currentToken = tokens.shift();\n\n let parentPath = '';\n let field = '';\n\n while (currentToken) {\n if (currentToken === 'properties') {\n currentToken = tokens.shift();\n\n if (!currentToken) {\n throw new Error('Invalid path');\n }\n\n field = currentToken;\n\n currentToken = tokens.shift();\n\n if (currentToken) {\n parentPath = `${parentPath}/properties/${field}`;\n }\n } else if (currentToken === 'items') {\n field = currentToken;\n\n currentToken = tokens.shift();\n\n if (currentToken && !['items', 'properties'].includes(currentToken)) {\n throw new Error('Invalid path');\n } else if (currentToken) {\n parentPath = `${parentPath}/items`;\n }\n } else {\n throw new Error('Invalid path');\n }\n }\n\n return {\n parentPath: parentPath,\n field,\n };\n};\n","const maxLength = 64;\n\nexport const VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE = `It must contain between 1 and ${maxLength} characters, start with a letter or underscore (_), cannot start with two underscores (__), and can only include letters (a-z, A-Z), numbers (0-9), hyphens (-), and underscores (_).`;\n\nconst validPattern = /^(?!__)[a-zA-Z_][a-zA-Z0-9-_]*$/;\n\nexport const validateJsonFieldName = (id: string) => {\n const isInvalid =\n id.length < 1 || id.length > maxLength || !validPattern.test(id);\n\n return !isInvalid;\n};\n","import { JsonSchema, JsonSchemaTypeName } from '../types/schema.types.js';\nimport {\n JsonPatchAdd,\n JsonPatchMove,\n JsonPatchRemove,\n JsonPatchReplace,\n} from '../types/json-patch.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\nimport { createJsonSchemaStore } from './createJsonSchemaStore.js';\nimport { getJsonSchemaStoreByPath } from './getJsonSchemaStoreByPath.js';\nimport { getParentForPath } from './getParentForPath.js';\nimport {\n VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE,\n validateJsonFieldName,\n} from './validateJsonFieldName.js';\n\nexport const applyReplacePatch = (\n store: JsonSchemaStore,\n patch: JsonPatchReplace,\n refs: Record<string, JsonSchema> = {},\n): JsonSchemaStore => {\n const patchStore = createJsonSchemaStore(patch.value, refs);\n const foundStore = getJsonSchemaStoreByPath(store, patch.path);\n\n const parent = foundStore.parent;\n\n if (!parent) {\n return patchStore;\n }\n\n if (parent.type === JsonSchemaTypeName.Object) {\n parent.migratePropertyWithStore(foundStore.name, patchStore);\n } else if (parent.type === JsonSchemaTypeName.Array) {\n parent.migrateItems(patchStore);\n } else {\n throw new Error('Invalid parent');\n }\n\n return store;\n};\n\nexport const applyRemovePatch = (\n rootStore: JsonSchemaStore,\n patch: JsonPatchRemove,\n): void => {\n const foundStore = getJsonSchemaStoreByPath(rootStore, patch.path);\n const parent = foundStore.parent;\n\n if (!parent) {\n throw new Error('Parent does not exist');\n }\n\n if (parent.type !== JsonSchemaTypeName.Object) {\n throw new Error('Cannot remove from non-object');\n }\n\n parent.removeProperty(foundStore.name);\n};\n\nexport const applyAddPatch = (\n rootStore: JsonSchemaStore,\n patch: JsonPatchAdd,\n refs: Record<string, JsonSchema> = {},\n): void => {\n const patchStore = createJsonSchemaStore(patch.value, refs);\n\n const { parentPath, field } = getParentForPath(patch.path);\n const foundParent = getJsonSchemaStoreByPath(rootStore, parentPath);\n\n if (!foundParent) {\n throw new Error('Parent does not exist');\n }\n\n if (foundParent.type !== JsonSchemaTypeName.Object) {\n throw new Error('Cannot add to non-object');\n }\n\n if (foundParent.getProperty(field)) {\n throw new Error(`Field \"${field}\" already exists in parent`);\n }\n\n foundParent.addPropertyWithStore(field, patchStore);\n};\n\nexport const applyMovePatch = (\n store: JsonSchemaStore,\n patch: JsonPatchMove,\n): void => {\n const { parentPath: fromParentPath, field: fromField } = getParentForPath(\n patch.from,\n );\n const { parentPath: toParentPath, field: toField } = getParentForPath(\n patch.path,\n );\n\n const foundFromParent = getJsonSchemaStoreByPath(store, fromParentPath);\n const foundToParent = getJsonSchemaStoreByPath(store, toParentPath);\n\n const isValidToField = validateJsonFieldName(toField);\n\n if (!isValidToField) {\n throw new Error(\n `Invalid name: ${toField}. ${VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE}`,\n );\n }\n\n if (!foundFromParent || !foundToParent) {\n throw new Error('Cannot move from or to non-existent parent');\n }\n\n if (foundFromParent.type !== JsonSchemaTypeName.Object) {\n throw new Error('Cannot move from non-object parent');\n }\n\n const foundFromField = getJsonSchemaStoreByPath(store, patch.from);\n\n const isMovedPropertyInSameParentPatch =\n foundFromParent === foundToParent &&\n foundFromParent.type === JsonSchemaTypeName.Object &&\n foundFromParent.getProperty(fromField);\n\n if (isMovedPropertyInSameParentPatch) {\n return foundFromParent.changeName(fromField, toField);\n }\n\n if (foundToParent.type === JsonSchemaTypeName.Object) {\n if (foundToParent.getProperty(toField)) {\n foundToParent.removeProperty(toField);\n }\n foundToParent.addPropertyWithStore(toField, foundFromField);\n foundFromParent.removeProperty(fromField);\n return;\n }\n\n if (foundToParent.type === JsonSchemaTypeName.Array) {\n foundFromParent.removeProperty(fromField);\n foundToParent.replaceItems(foundFromField);\n\n return;\n }\n throw new Error('Invalid type of \"to\" parent');\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\n\nexport const getDBJsonPathByJsonSchemaStore = (\n store: JsonSchemaStore,\n): string => {\n let node = store;\n\n let path = '';\n\n while (node.parent) {\n if (node.parent.type === JsonSchemaTypeName.Object) {\n path = `.${node.name}${path}`;\n } else if (node.parent.type === JsonSchemaTypeName.Array) {\n path = `[*]${path}`;\n }\n\n node = node.parent;\n }\n\n if (!path) {\n return '$';\n }\n\n return `$${path}`;\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\n\nexport const getPathByStore = (store: JsonSchemaStore): string => {\n let node = store;\n\n let path = '';\n\n while (node.parent) {\n if (node.parent.type === JsonSchemaTypeName.Object) {\n path = `/properties/${node.name}${path}`;\n } else if (node.parent.type === JsonSchemaTypeName.Array) {\n path = `/items${path}`;\n }\n\n node = node.parent;\n }\n\n if (!path) {\n return '/';\n }\n\n return `${path}`;\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\n\nexport const traverseStore = (\n store: JsonSchemaStore,\n callback: (node: JsonSchemaStore) => void,\n) => {\n callback(store);\n\n if (store.type === JsonSchemaTypeName.Object) {\n Object.values(store.properties).forEach((item) => {\n traverseStore(item, callback);\n });\n } else if (store.type === JsonSchemaTypeName.Array) {\n traverseStore(store.items, callback);\n }\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonPatch, JsonPatchReplace } from '../types/json-patch.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\nimport { getPathByStore } from './getPathByStore.js';\nimport { traverseStore } from './traverseStore.js';\n\nexport const getForeignKeyPatchesFromSchema = (\n store: JsonSchemaStore,\n options: { tableId: string; nextTableId: string },\n) => {\n const stores: JsonPatch[] = [];\n\n traverseStore(store, (item) => {\n if (\n item.type === JsonSchemaTypeName.String &&\n item.foreignKey === options.tableId\n ) {\n item.foreignKey = options.nextTableId;\n\n const patch: JsonPatchReplace = {\n op: 'replace',\n path: getPathByStore(item),\n value: item.getPlainSchema(),\n };\n\n stores.push(patch);\n }\n });\n\n return stores;\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\nimport { traverseStore } from './traverseStore.js';\n\nexport const getForeignKeysFromSchema = (store: JsonSchemaStore): string[] => {\n const foreignKeys = new Set<string>();\n\n traverseStore(store, (item) => {\n if (item.type === JsonSchemaTypeName.String && item.foreignKey) {\n foreignKeys.add(item.foreignKey);\n }\n });\n\n return [...foreignKeys].sort((a, b) => a.localeCompare(b));\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonValueStore } from '../model/value/json-value.store.js';\n\nexport const traverseValue = (\n store: JsonValueStore,\n callback: (node: JsonValueStore) => void,\n) => {\n callback(store);\n\n if (store.type === JsonSchemaTypeName.Object) {\n Object.values(store.value).forEach((item) => {\n traverseValue(item, callback);\n });\n } else if (store.type === JsonSchemaTypeName.Array) {\n store.value.forEach((itemValue) => {\n traverseValue(itemValue, callback);\n });\n }\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonValueStore } from '../model/value/json-value.store.js';\nimport { traverseValue } from './traverseValue.js';\n\nexport type GetForeignKeysFromValueType = {\n tableId: string;\n rowIds: string[];\n};\n\nexport const getForeignKeysFromValue = (\n value: JsonValueStore,\n): GetForeignKeysFromValueType[] => {\n const foreignKeys = new Map<string, Set<string>>();\n\n traverseValue(value, (item) => {\n if (item.type === JsonSchemaTypeName.String && item.foreignKey) {\n let tableForeignKey = foreignKeys.get(item.foreignKey);\n\n if (!tableForeignKey) {\n tableForeignKey = new Set<string>();\n foreignKeys.set(item.foreignKey, tableForeignKey);\n }\n\n tableForeignKey.add(item.getPlainValue());\n }\n });\n\n return [...foreignKeys].map(([tableId, rowIds]) => ({\n tableId,\n rowIds: [...rowIds].sort((a, b) => a.localeCompare(b)),\n }));\n};\n","import { JsonSchema, JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\nimport { createJsonSchemaStore } from './createJsonSchemaStore.js';\nimport { traverseStore } from './traverseStore.js';\nimport { validateJsonFieldName } from './validateJsonFieldName.js';\n\nexport const getInvalidFieldNamesInSchema = (\n schema: JsonSchema,\n refs: Record<string, JsonSchema> = {},\n) => {\n const schemaStore = createJsonSchemaStore(schema, refs);\n\n const invalidFields: JsonSchemaStore[] = [];\n\n traverseStore(schemaStore, (item) => {\n if (item.parent?.type === JsonSchemaTypeName.Object) {\n if (!validateJsonFieldName(item.name)) {\n invalidFields.push(item);\n }\n }\n });\n\n return invalidFields;\n};\n","import { JsonArray, JsonObject, JsonValue } from '../types';\n\nfunction parsePathSegments(path: string): (string | number)[] {\n const segments: (string | number)[] = [];\n const regex = /([^.[\\]]+)|\\[(\\d+)]/g;\n let match: RegExpExecArray | null;\n\n while ((match = regex.exec(path))) {\n if (match[1] !== undefined) {\n segments.push(match[1]);\n } else if (match[2] !== undefined) {\n segments.push(Number(match[2]));\n }\n }\n\n return segments;\n}\n\n/**\n * Parse path string into segments\n *\n * @param path - Path string (e.g., \"title\", \"address.city\", \"tags[0]\", \"users[0].name\")\n * @returns Array of segments (strings and numbers)\n *\n * @example\n * parsePath(\"title\") // [\"title\"]\n * parsePath(\"address.city\") // [\"address\", \"city\"]\n * parsePath(\"tags[0]\") // [\"tags\", 0]\n * parsePath(\"users[0].name\") // [\"users\", 0, \"name\"]\n * parsePath(\"matrix[0][1]\") // [\"matrix\", 0, 1]\n */\nexport function parsePath(path: string): (string | number)[] {\n if (!path) {\n return [];\n }\n\n return parsePathSegments(path);\n}\n\n/**\n * Get value by path from plain JavaScript object\n *\n * @param obj - Object to navigate\n * @param path - Path string (e.g., \"address.city\", \"tags[0]\")\n * @returns Value at path, or undefined if path doesn't exist\n *\n * @example\n * const obj = { address: { city: \"Moscow\" }, tags: [\"a\", \"b\"] };\n * getValueByPath(obj, \"address.city\") // \"Moscow\"\n * getValueByPath(obj, \"tags[1]\") // \"b\"\n * getValueByPath(obj, \"nonexistent\") // undefined\n */\nexport function getValueByPath(\n obj: JsonValue | undefined,\n path: string,\n): JsonValue | undefined {\n if (!path) {\n return obj;\n }\n\n const segments = parsePath(path);\n let current: JsonValue | undefined = obj;\n\n for (const segment of segments) {\n if (current == null) {\n return undefined;\n }\n\n if (typeof segment === 'number') {\n if (!Array.isArray(current)) {\n return undefined;\n }\n current = current[segment];\n } else {\n if (typeof current !== 'object') {\n return undefined;\n }\n current = (current as JsonObject)[segment];\n }\n }\n\n return current;\n}\n\n/**\n * Set value by path in plain JavaScript object\n * Creates intermediate objects/arrays as needed\n *\n * @param obj - Object to modify\n * @param path - Path string (e.g., \"address.city\", \"tags[0]\")\n * @param value - Value to set\n *\n * @example\n * const obj = {};\n * setValueByPath(obj, \"address.city\", \"London\");\n * // obj is now { address: { city: \"London\" } }\n *\n * setValueByPath(obj, \"tags[0]\", \"first\");\n * // obj is now { address: { city: \"London\" }, tags: [\"first\"] }\n */\nexport function setValueByPath(\n obj: JsonValue,\n path: string,\n value: JsonValue,\n): void {\n if (!path) {\n throw new Error('Cannot set root value');\n }\n\n const segments = parsePath(path);\n let current: JsonValue | undefined = obj;\n\n for (let i = 0; i < segments.length - 1; i++) {\n const segment = segments[i] as string | number;\n const nextSegment = segments[i + 1];\n\n if (typeof segment === 'number') {\n if (!Array.isArray(current)) {\n throw new TypeError(\n `Cannot set array index on non-array at segment ${i}`,\n );\n }\n\n const arr: JsonArray = current;\n\n if (segment > arr.length) {\n throw new Error(\n `Cannot create sparse array: index ${segment} is out of bounds (array length: ${arr.length}) at segment ${i}`,\n );\n }\n\n if (arr[segment] == null) {\n arr[segment] = typeof nextSegment === 'number' ? [] : {};\n }\n\n current = arr[segment];\n } else if (typeof segment === 'string') {\n if (\n current == null ||\n typeof current !== 'object' ||\n Array.isArray(current)\n ) {\n throw new Error(`Cannot set property on non-object at segment ${i}`);\n }\n\n const obj: JsonObject = current;\n if (obj[segment] == null) {\n obj[segment] = typeof nextSegment === 'number' ? [] : {};\n }\n\n current = obj[segment];\n }\n }\n\n const lastSegment = segments[segments.length - 1] as string | number;\n\n if (typeof lastSegment === 'number') {\n if (!Array.isArray(current)) {\n throw new TypeError(\n `Cannot set array index on non-array at segment ${segments.length - 1}`,\n );\n }\n\n const arr: JsonArray = current;\n\n if (lastSegment > arr.length) {\n throw new Error(\n `Cannot create sparse array: index ${lastSegment} is out of bounds (array length: ${arr.length})`,\n );\n }\n\n arr[lastSegment] = value;\n } else if (typeof lastSegment === 'string') {\n if (\n current == null ||\n typeof current !== 'object' ||\n Array.isArray(current)\n ) {\n throw new Error(\n `Cannot set property on non-object at segment ${segments.length - 1}`,\n );\n }\n (current as JsonObject)[lastSegment] = value;\n }\n}\n\n/**\n * Check if path exists in object\n *\n * @param obj - Object to check\n * @param path - Path string (e.g., \"address.city\", \"tags[0]\")\n * @returns true if path exists and value is not undefined\n *\n * @example\n * const obj = { address: { city: \"Moscow\" } };\n * hasPath(obj, \"address.city\") // true\n * hasPath(obj, \"address.country\") // false\n */\nexport function hasPath(obj: JsonValue, path: string): boolean {\n const value = getValueByPath(obj, path);\n return value !== undefined;\n}\n\n/**\n * Deep equality comparison for plain JavaScript values\n * Handles objects, arrays, primitives, null, undefined\n *\n * @param a - First value\n * @param b - Second value\n * @returns true if values are deeply equal\n *\n * @example\n * deepEqual({ a: 1, b: 2 }, { a: 1, b: 2 }) // true\n * deepEqual([1, 2, 3], [1, 2, 3]) // true\n * deepEqual({ a: 1 }, { a: 2 }) // false\n * deepEqual(null, null) // true\n * deepEqual(undefined, undefined) // true\n */\nexport function deepEqual(a: unknown, b: unknown): boolean {\n if (a === b) {\n return true;\n }\n\n if (a === null && b === null) {\n return true;\n }\n\n if (a === undefined && b === undefined) {\n return true;\n }\n\n if (a == null || b == null) {\n return false;\n }\n\n if (typeof a !== typeof b) {\n return false;\n }\n\n if (typeof a !== 'object') {\n return false;\n }\n\n if (Array.isArray(a) && Array.isArray(b)) {\n const arrA = a as JsonArray;\n const arrB = b as JsonArray;\n if (arrA.length !== arrB.length) {\n return false;\n }\n for (let i = 0; i < arrA.length; i++) {\n const itemA = arrA[i];\n const itemB = arrB[i];\n\n if (itemA !== undefined && itemB !== undefined) {\n if (itemA === null && itemB === null) {\n continue;\n }\n if (!deepEqual(itemA, itemB)) {\n return false;\n }\n } else if (itemA !== itemB) {\n return false;\n }\n }\n return true;\n }\n\n if (Array.isArray(a) || Array.isArray(b)) {\n return false;\n }\n\n const objA = a as JsonObject;\n const objB = b as JsonObject;\n const keysA = Object.keys(objA);\n const keysB = Object.keys(objB);\n\n if (keysA.length !== keysB.length) {\n return false;\n }\n\n for (const key of keysA) {\n if (!keysB.includes(key)) {\n return false;\n }\n const valA = objA[key];\n const valB = objB[key];\n\n if (valA !== undefined && valB !== undefined) {\n if (valA === null && valB === null) {\n continue;\n }\n if (!deepEqual(valA, valB)) {\n return false;\n }\n } else if (valA !== valB) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Convert simplified JSON path to JSON Schema path\n *\n * @param jsonPath - JSON path string (e.g., \"title\", \"address.city\", \"tags[0]\", \"users[0].name\")\n * @returns JSON Schema path string\n *\n * @example\n * convertJsonPathToSchemaPath(\"title\") // \"/properties/title\"\n * convertJsonPathToSchemaPath(\"address.city\") // \"/properties/address/properties/city\"\n * convertJsonPathToSchemaPath(\"tags[0]\") // \"/properties/tags/items\"\n * convertJsonPathToSchemaPath(\"users[0].name\") // \"/properties/users/items/properties/name\"\n * convertJsonPathToSchemaPath(\"\") // \"\"\n */\nexport function convertJsonPathToSchemaPath(jsonPath: string): string {\n if (jsonPath === '') {\n return '';\n }\n\n const segments = parsePathSegments(jsonPath);\n\n let schemaPath = '';\n for (const segment of segments) {\n if (typeof segment === 'number') {\n schemaPath += '/items';\n } else {\n schemaPath += `/properties/${segment}`;\n }\n }\n\n return schemaPath;\n}\n\nexport function convertSchemaPathToJsonPath(schemaPath: string): string {\n if (schemaPath === '') {\n return '';\n }\n\n const cleanPath = schemaPath.startsWith('/') ? schemaPath.slice(1) : schemaPath;\n\n if (cleanPath === '') {\n return '';\n }\n\n const segments = cleanPath.split('/');\n let result = '';\n\n let i = 0;\n while (i < segments.length) {\n const segment = segments[i];\n\n if (segment === 'properties') {\n i++;\n if (i < segments.length) {\n const propertyName = segments[i];\n if (propertyName) {\n if (result) {\n result += '.';\n }\n result += propertyName;\n }\n }\n } else if (segment === 'items') {\n result += '[*]';\n }\n\n i++;\n }\n\n return result;\n}\n","import { JsonArrayValueStore } from '../model/value/json-array-value.store.js';\nimport { JsonObjectValueStore } from '../model/value/json-object-value.store.js';\nimport { JsonValueStore } from '../model/value/json-value.store.js';\nimport { parsePath } from './json-path-utils.js';\n\nexport const getJsonValueStoreByPath = (\n root: JsonValueStore,\n path: string,\n): JsonValueStore => {\n if (!path) {\n return root;\n }\n\n const segments = parsePath(path);\n\n let current: JsonValueStore = root;\n\n for (const seg of segments) {\n if (current instanceof JsonObjectValueStore) {\n const next = current.value[String(seg)];\n if (!next) {\n throw new Error(`Path not found at segment \"${seg}\"`);\n }\n current = next;\n } else if (current instanceof JsonArrayValueStore) {\n if (typeof seg !== 'number') {\n throw new Error(`Invalid array index \"${seg}\"`);\n }\n const next = current.value[seg];\n if (!next) {\n throw new Error(`Path not found at segment \"${seg}\"`);\n }\n current = next;\n } else {\n throw new Error(`Cannot navigate into primitive at segment \"${seg}\"`);\n }\n }\n\n return current;\n};\n\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonValueStore } from '../model/value/json-value.store.js';\nimport { traverseValue } from './traverseValue.js';\n\nexport type ReplaceForeignKeyValueOptions = {\n valueStore: JsonValueStore;\n foreignKey: string;\n value: string;\n nextValue: string;\n};\n\nexport const replaceForeignKeyValue = (\n options: ReplaceForeignKeyValueOptions,\n) => {\n let wasUpdated = false;\n\n traverseValue(options.valueStore, (item) => {\n if (\n item.type === JsonSchemaTypeName.String &&\n item.foreignKey === options.foreignKey &&\n item.value === options.value\n ) {\n item.value = options.nextValue;\n wasUpdated = true;\n }\n });\n\n return wasUpdated;\n};\n","import { SystemSchemaIds } from '../consts/system-schema-ids.js';\nimport { createJsonSchemaStore } from './createJsonSchemaStore.js';\nimport {\n fileSchema,\n rowCreatedAtSchema,\n rowCreatedIdSchema,\n rowHashSchema,\n rowPublishedAtSchema,\n rowSchemaHashSchema,\n rowUpdatedAtSchema,\n rowVersionIdSchema,\n rowIdSchema,\n} from '../plugins/index.js';\nimport { JsonSchema } from '../types/schema.types.js';\n\nexport const pluginRefs: Readonly<Record<string, JsonSchema>> = {\n [SystemSchemaIds.RowId]: rowIdSchema,\n [SystemSchemaIds.RowVersionId]: rowVersionIdSchema,\n [SystemSchemaIds.RowCreatedId]: rowCreatedIdSchema,\n [SystemSchemaIds.RowCreatedAt]: rowCreatedAtSchema,\n [SystemSchemaIds.RowPublishedAt]: rowPublishedAtSchema,\n [SystemSchemaIds.RowUpdatedAt]: rowUpdatedAtSchema,\n [SystemSchemaIds.RowHash]: rowHashSchema,\n [SystemSchemaIds.RowSchemaHash]: rowSchemaHashSchema,\n [SystemSchemaIds.File]: fileSchema,\n};\n\nexport const resolveRefs = (schema: JsonSchema) => {\n const store = createJsonSchemaStore(schema, pluginRefs);\n return store.getPlainSchema({ skip$Ref: true });\n};\n","import { JsonSchema } from '../types/schema.types.js';\nimport { JsonValue } from '../types/json.types.js';\nimport { JsonPatch } from '../types/json-patch.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\nimport { JsonValueStore } from '../model/value/json-value.store.js';\nimport { getTransformation } from '../model/value/value-transformation.js';\nimport { createJsonSchemaStore } from './createJsonSchemaStore.js';\nimport { createJsonValueStore } from './createJsonValueStore.js';\nimport {\n applyAddPatch,\n applyMovePatch,\n applyRemovePatch,\n applyReplacePatch,\n} from './applyPatches.js';\n\nexport class SchemaTable {\n private readonly rows = new Map<string, JsonValueStore>();\n private store: JsonSchemaStore;\n\n constructor(\n schema: JsonSchema,\n private readonly refs: Record<string, JsonSchema> = {},\n ) {\n this.store = createJsonSchemaStore(schema, refs);\n }\n\n public applyPatches(patches: JsonPatch[]): void {\n patches.forEach((patch) => {\n switch (patch.op) {\n case 'replace': {\n const nextStore = applyReplacePatch(this.store, patch, this.refs);\n if (nextStore !== this.store) {\n this.migrateRows(nextStore);\n }\n break;\n }\n case 'remove': {\n applyRemovePatch(this.store, patch);\n break;\n }\n case 'add': {\n applyAddPatch(this.store, patch, this.refs);\n break;\n }\n case 'move': {\n applyMovePatch(this.store, patch);\n break;\n }\n default:\n throw new Error(`Unsupported patch operation`);\n }\n });\n }\n\n public getSchema(): JsonSchema {\n return this.store.getPlainSchema();\n }\n\n public addRow(rowId: string, data: JsonValue) {\n const row = createJsonValueStore(this.store, rowId, data);\n\n this.rows.set(rowId, row);\n }\n\n public getRow(id: string): JsonValue {\n const row = this.rows.get(id);\n\n if (!row) {\n throw new Error('Invalid id');\n }\n\n return row.getPlainValue();\n }\n\n public getRows(): { id: string; data: JsonValue }[] {\n return [...this.rows].map(([id, data]) => ({\n id,\n data: data.getPlainValue(),\n }));\n }\n\n private migrateRows(nextStore: JsonSchemaStore): void {\n const transformation = getTransformation(this.store, nextStore);\n\n if (transformation) {\n for (const [rowId, row] of this.rows) {\n const rawNextValue = transformation(\n row.getPlainValue(),\n nextStore.default,\n ) as JsonValue;\n\n const nextRow = createJsonValueStore(nextStore, rowId, rawNextValue);\n this.rows.set(rowId, nextRow);\n }\n }\n\n this.store = nextStore;\n }\n}\n"]}
package/dist/index.cjs CHANGED
@@ -4,7 +4,7 @@ require('./chunk-FD57PCAC.cjs');
4
4
  var chunkEJYILFAK_cjs = require('./chunk-EJYILFAK.cjs');
5
5
  var chunkIPL2CGVA_cjs = require('./chunk-IPL2CGVA.cjs');
6
6
  require('./chunk-ODCH3PP2.cjs');
7
- var chunkHC4VM256_cjs = require('./chunk-HC4VM256.cjs');
7
+ var chunkEJAKPKHS_cjs = require('./chunk-EJAKPKHS.cjs');
8
8
  var chunkEGC32GPY_cjs = require('./chunk-EGC32GPY.cjs');
9
9
  var chunkXNFSFT7T_cjs = require('./chunk-XNFSFT7T.cjs');
10
10
  var chunkJLIZ7QT2_cjs = require('./chunk-JLIZ7QT2.cjs');
@@ -59,127 +59,131 @@ Object.defineProperty(exports, "CustomSchemeKeywords", {
59
59
  });
60
60
  Object.defineProperty(exports, "SchemaTable", {
61
61
  enumerable: true,
62
- get: function () { return chunkHC4VM256_cjs.SchemaTable; }
62
+ get: function () { return chunkEJAKPKHS_cjs.SchemaTable; }
63
63
  });
64
64
  Object.defineProperty(exports, "VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE", {
65
65
  enumerable: true,
66
- get: function () { return chunkHC4VM256_cjs.VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE; }
66
+ get: function () { return chunkEJAKPKHS_cjs.VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE; }
67
67
  });
68
68
  Object.defineProperty(exports, "applyAddPatch", {
69
69
  enumerable: true,
70
- get: function () { return chunkHC4VM256_cjs.applyAddPatch; }
70
+ get: function () { return chunkEJAKPKHS_cjs.applyAddPatch; }
71
71
  });
72
72
  Object.defineProperty(exports, "applyMovePatch", {
73
73
  enumerable: true,
74
- get: function () { return chunkHC4VM256_cjs.applyMovePatch; }
74
+ get: function () { return chunkEJAKPKHS_cjs.applyMovePatch; }
75
75
  });
76
76
  Object.defineProperty(exports, "applyRemovePatch", {
77
77
  enumerable: true,
78
- get: function () { return chunkHC4VM256_cjs.applyRemovePatch; }
78
+ get: function () { return chunkEJAKPKHS_cjs.applyRemovePatch; }
79
79
  });
80
80
  Object.defineProperty(exports, "applyReplacePatch", {
81
81
  enumerable: true,
82
- get: function () { return chunkHC4VM256_cjs.applyReplacePatch; }
82
+ get: function () { return chunkEJAKPKHS_cjs.applyReplacePatch; }
83
83
  });
84
84
  Object.defineProperty(exports, "convertJsonPathToSchemaPath", {
85
85
  enumerable: true,
86
- get: function () { return chunkHC4VM256_cjs.convertJsonPathToSchemaPath; }
86
+ get: function () { return chunkEJAKPKHS_cjs.convertJsonPathToSchemaPath; }
87
+ });
88
+ Object.defineProperty(exports, "convertSchemaPathToJsonPath", {
89
+ enumerable: true,
90
+ get: function () { return chunkEJAKPKHS_cjs.convertSchemaPathToJsonPath; }
87
91
  });
88
92
  Object.defineProperty(exports, "createJsonObjectSchemaStore", {
89
93
  enumerable: true,
90
- get: function () { return chunkHC4VM256_cjs.createJsonObjectSchemaStore; }
94
+ get: function () { return chunkEJAKPKHS_cjs.createJsonObjectSchemaStore; }
91
95
  });
92
96
  Object.defineProperty(exports, "createJsonSchemaStore", {
93
97
  enumerable: true,
94
- get: function () { return chunkHC4VM256_cjs.createJsonSchemaStore; }
98
+ get: function () { return chunkEJAKPKHS_cjs.createJsonSchemaStore; }
95
99
  });
96
100
  Object.defineProperty(exports, "createPrimitiveStoreBySchema", {
97
101
  enumerable: true,
98
- get: function () { return chunkHC4VM256_cjs.createPrimitiveStoreBySchema; }
102
+ get: function () { return chunkEJAKPKHS_cjs.createPrimitiveStoreBySchema; }
99
103
  });
100
104
  Object.defineProperty(exports, "deepEqual", {
101
105
  enumerable: true,
102
- get: function () { return chunkHC4VM256_cjs.deepEqual; }
106
+ get: function () { return chunkEJAKPKHS_cjs.deepEqual; }
103
107
  });
104
108
  Object.defineProperty(exports, "getDBJsonPathByJsonSchemaStore", {
105
109
  enumerable: true,
106
- get: function () { return chunkHC4VM256_cjs.getDBJsonPathByJsonSchemaStore; }
110
+ get: function () { return chunkEJAKPKHS_cjs.getDBJsonPathByJsonSchemaStore; }
107
111
  });
108
112
  Object.defineProperty(exports, "getForeignKeyPatchesFromSchema", {
109
113
  enumerable: true,
110
- get: function () { return chunkHC4VM256_cjs.getForeignKeyPatchesFromSchema; }
114
+ get: function () { return chunkEJAKPKHS_cjs.getForeignKeyPatchesFromSchema; }
111
115
  });
112
116
  Object.defineProperty(exports, "getForeignKeysFromSchema", {
113
117
  enumerable: true,
114
- get: function () { return chunkHC4VM256_cjs.getForeignKeysFromSchema; }
118
+ get: function () { return chunkEJAKPKHS_cjs.getForeignKeysFromSchema; }
115
119
  });
116
120
  Object.defineProperty(exports, "getForeignKeysFromValue", {
117
121
  enumerable: true,
118
- get: function () { return chunkHC4VM256_cjs.getForeignKeysFromValue; }
122
+ get: function () { return chunkEJAKPKHS_cjs.getForeignKeysFromValue; }
119
123
  });
120
124
  Object.defineProperty(exports, "getInvalidFieldNamesInSchema", {
121
125
  enumerable: true,
122
- get: function () { return chunkHC4VM256_cjs.getInvalidFieldNamesInSchema; }
126
+ get: function () { return chunkEJAKPKHS_cjs.getInvalidFieldNamesInSchema; }
123
127
  });
124
128
  Object.defineProperty(exports, "getJsonSchemaStoreByPath", {
125
129
  enumerable: true,
126
- get: function () { return chunkHC4VM256_cjs.getJsonSchemaStoreByPath; }
130
+ get: function () { return chunkEJAKPKHS_cjs.getJsonSchemaStoreByPath; }
127
131
  });
128
132
  Object.defineProperty(exports, "getJsonValueStoreByPath", {
129
133
  enumerable: true,
130
- get: function () { return chunkHC4VM256_cjs.getJsonValueStoreByPath; }
134
+ get: function () { return chunkEJAKPKHS_cjs.getJsonValueStoreByPath; }
131
135
  });
132
136
  Object.defineProperty(exports, "getParentForPath", {
133
137
  enumerable: true,
134
- get: function () { return chunkHC4VM256_cjs.getParentForPath; }
138
+ get: function () { return chunkEJAKPKHS_cjs.getParentForPath; }
135
139
  });
136
140
  Object.defineProperty(exports, "getPathByStore", {
137
141
  enumerable: true,
138
- get: function () { return chunkHC4VM256_cjs.getPathByStore; }
142
+ get: function () { return chunkEJAKPKHS_cjs.getPathByStore; }
139
143
  });
140
144
  Object.defineProperty(exports, "getValueByPath", {
141
145
  enumerable: true,
142
- get: function () { return chunkHC4VM256_cjs.getValueByPath; }
146
+ get: function () { return chunkEJAKPKHS_cjs.getValueByPath; }
143
147
  });
144
148
  Object.defineProperty(exports, "hasPath", {
145
149
  enumerable: true,
146
- get: function () { return chunkHC4VM256_cjs.hasPath; }
150
+ get: function () { return chunkEJAKPKHS_cjs.hasPath; }
147
151
  });
148
152
  Object.defineProperty(exports, "parsePath", {
149
153
  enumerable: true,
150
- get: function () { return chunkHC4VM256_cjs.parsePath; }
154
+ get: function () { return chunkEJAKPKHS_cjs.parsePath; }
151
155
  });
152
156
  Object.defineProperty(exports, "pluginRefs", {
153
157
  enumerable: true,
154
- get: function () { return chunkHC4VM256_cjs.pluginRefs; }
158
+ get: function () { return chunkEJAKPKHS_cjs.pluginRefs; }
155
159
  });
156
160
  Object.defineProperty(exports, "replaceForeignKeyValue", {
157
161
  enumerable: true,
158
- get: function () { return chunkHC4VM256_cjs.replaceForeignKeyValue; }
162
+ get: function () { return chunkEJAKPKHS_cjs.replaceForeignKeyValue; }
159
163
  });
160
164
  Object.defineProperty(exports, "resolveRefs", {
161
165
  enumerable: true,
162
- get: function () { return chunkHC4VM256_cjs.resolveRefs; }
166
+ get: function () { return chunkEJAKPKHS_cjs.resolveRefs; }
163
167
  });
164
168
  Object.defineProperty(exports, "saveSharedFields", {
165
169
  enumerable: true,
166
- get: function () { return chunkHC4VM256_cjs.saveSharedFields; }
170
+ get: function () { return chunkEJAKPKHS_cjs.saveSharedFields; }
167
171
  });
168
172
  Object.defineProperty(exports, "setValueByPath", {
169
173
  enumerable: true,
170
- get: function () { return chunkHC4VM256_cjs.setValueByPath; }
174
+ get: function () { return chunkEJAKPKHS_cjs.setValueByPath; }
171
175
  });
172
176
  Object.defineProperty(exports, "traverseStore", {
173
177
  enumerable: true,
174
- get: function () { return chunkHC4VM256_cjs.traverseStore; }
178
+ get: function () { return chunkEJAKPKHS_cjs.traverseStore; }
175
179
  });
176
180
  Object.defineProperty(exports, "traverseValue", {
177
181
  enumerable: true,
178
- get: function () { return chunkHC4VM256_cjs.traverseValue; }
182
+ get: function () { return chunkEJAKPKHS_cjs.traverseValue; }
179
183
  });
180
184
  Object.defineProperty(exports, "validateJsonFieldName", {
181
185
  enumerable: true,
182
- get: function () { return chunkHC4VM256_cjs.validateJsonFieldName; }
186
+ get: function () { return chunkEJAKPKHS_cjs.validateJsonFieldName; }
183
187
  });
184
188
  Object.defineProperty(exports, "ajvFileSchema", {
185
189
  enumerable: true,
package/dist/index.d.cts CHANGED
@@ -7,7 +7,7 @@ export { getAddPatch, getArraySchema, getBooleanSchema, getMovePatch, getNumberS
7
7
  export { CustomSchemeKeywords } from './consts/index.cjs';
8
8
  export { A as AddedPropertyEvent, C as ChangeNameEvent, f as JsonArrayStore, m as JsonArrayValueStore, b as JsonBooleanStore, k as JsonBooleanValueStore, a as JsonNumberStore, j as JsonNumberValueStore, c as JsonObjectStore, l as JsonObjectValueStore, h as JsonSchemaStore, g as JsonSchemaStorePrimitives, J as JsonStringStore, i as JsonStringValueStore, p as JsonValueStore, o as JsonValueStoreParent, n as JsonValueStorePrimitives, d as MigrateItemsEvent, M as MigratePropertyEvent, R as RemovedPropertyEvent, e as ReplaceItemsEvent } from './json-string.store-BNF1Y93E.cjs';
9
9
  export { equal, fromArrayToObject, fromArrayTransformation, fromBooleanToNumber, fromBooleanToString, fromNumberToBoolean, fromNumberToString, fromObjectToArray, fromObjectToPrimitive, fromPrimitiveToObject, fromStringToBoolean, fromStringToNumber, getTransformation, toArrayTransformation } from './model/index.cjs';
10
- export { GetForeignKeysFromValueType, RefsType, ReplaceForeignKeyValueOptions, SchemaTable, VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE, addSharedFieldsFromState, applyAddPatch, applyMovePatch, applyRemovePatch, applyReplacePatch, convertJsonPathToSchemaPath, createJsonArrayValueStore, createJsonObjectSchemaStore, createJsonObjectValueStore, createJsonSchemaStore, createJsonValueStore, createPrimitiveStoreBySchema, createPrimitiveValueStore, deepEqual, getDBJsonPathByJsonSchemaStore, getForeignKeyPatchesFromSchema, getForeignKeysFromSchema, getForeignKeysFromValue, getInvalidFieldNamesInSchema, getJsonSchemaStoreByPath, getJsonValueStoreByPath, getParentForPath, getPathByStore, getValueByPath, hasPath, parsePath, pluginRefs, replaceForeignKeyValue, resolveRefs, saveSharedFields, setValueByPath, traverseStore, traverseValue, validateJsonFieldName } from './lib/index.cjs';
10
+ export { GetForeignKeysFromValueType, RefsType, ReplaceForeignKeyValueOptions, SchemaTable, VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE, addSharedFieldsFromState, applyAddPatch, applyMovePatch, applyRemovePatch, applyReplacePatch, convertJsonPathToSchemaPath, convertSchemaPathToJsonPath, createJsonArrayValueStore, createJsonObjectSchemaStore, createJsonObjectValueStore, createJsonSchemaStore, createJsonValueStore, createPrimitiveStoreBySchema, createPrimitiveValueStore, deepEqual, getDBJsonPathByJsonSchemaStore, getForeignKeyPatchesFromSchema, getForeignKeysFromSchema, getForeignKeysFromValue, getInvalidFieldNamesInSchema, getJsonSchemaStoreByPath, getJsonValueStoreByPath, getParentForPath, getPathByStore, getValueByPath, hasPath, parsePath, pluginRefs, replaceForeignKeyValue, resolveRefs, saveSharedFields, setValueByPath, traverseStore, traverseValue, validateJsonFieldName } from './lib/index.cjs';
11
11
  export { arrayMetaSchema, baseStringFields, booleanMetaSchema, historyPatchesSchema, jsonPatchSchema, metaSchema, noForeignKeyStringMetaSchema, notForeignKeyMetaSchema, numberMetaSchema, objectMetaSchema, refMetaSchema, sharedFields, stringMetaSchema, tableMigrationsSchema } from './validation-schemas/index.cjs';
12
12
  export { S as SystemSchemaIds } from './system-schema-ids-B-2xMN-1.cjs';
13
13
  import 'node:events';
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export { getAddPatch, getArraySchema, getBooleanSchema, getMovePatch, getNumberS
7
7
  export { CustomSchemeKeywords } from './consts/index.js';
8
8
  export { A as AddedPropertyEvent, C as ChangeNameEvent, f as JsonArrayStore, m as JsonArrayValueStore, b as JsonBooleanStore, k as JsonBooleanValueStore, a as JsonNumberStore, j as JsonNumberValueStore, c as JsonObjectStore, l as JsonObjectValueStore, h as JsonSchemaStore, g as JsonSchemaStorePrimitives, J as JsonStringStore, i as JsonStringValueStore, p as JsonValueStore, o as JsonValueStoreParent, n as JsonValueStorePrimitives, d as MigrateItemsEvent, M as MigratePropertyEvent, R as RemovedPropertyEvent, e as ReplaceItemsEvent } from './json-string.store-qHcWNv07.js';
9
9
  export { equal, fromArrayToObject, fromArrayTransformation, fromBooleanToNumber, fromBooleanToString, fromNumberToBoolean, fromNumberToString, fromObjectToArray, fromObjectToPrimitive, fromPrimitiveToObject, fromStringToBoolean, fromStringToNumber, getTransformation, toArrayTransformation } from './model/index.js';
10
- export { GetForeignKeysFromValueType, RefsType, ReplaceForeignKeyValueOptions, SchemaTable, VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE, addSharedFieldsFromState, applyAddPatch, applyMovePatch, applyRemovePatch, applyReplacePatch, convertJsonPathToSchemaPath, createJsonArrayValueStore, createJsonObjectSchemaStore, createJsonObjectValueStore, createJsonSchemaStore, createJsonValueStore, createPrimitiveStoreBySchema, createPrimitiveValueStore, deepEqual, getDBJsonPathByJsonSchemaStore, getForeignKeyPatchesFromSchema, getForeignKeysFromSchema, getForeignKeysFromValue, getInvalidFieldNamesInSchema, getJsonSchemaStoreByPath, getJsonValueStoreByPath, getParentForPath, getPathByStore, getValueByPath, hasPath, parsePath, pluginRefs, replaceForeignKeyValue, resolveRefs, saveSharedFields, setValueByPath, traverseStore, traverseValue, validateJsonFieldName } from './lib/index.js';
10
+ export { GetForeignKeysFromValueType, RefsType, ReplaceForeignKeyValueOptions, SchemaTable, VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE, addSharedFieldsFromState, applyAddPatch, applyMovePatch, applyRemovePatch, applyReplacePatch, convertJsonPathToSchemaPath, convertSchemaPathToJsonPath, createJsonArrayValueStore, createJsonObjectSchemaStore, createJsonObjectValueStore, createJsonSchemaStore, createJsonValueStore, createPrimitiveStoreBySchema, createPrimitiveValueStore, deepEqual, getDBJsonPathByJsonSchemaStore, getForeignKeyPatchesFromSchema, getForeignKeysFromSchema, getForeignKeysFromValue, getInvalidFieldNamesInSchema, getJsonSchemaStoreByPath, getJsonValueStoreByPath, getParentForPath, getPathByStore, getValueByPath, hasPath, parsePath, pluginRefs, replaceForeignKeyValue, resolveRefs, saveSharedFields, setValueByPath, traverseStore, traverseValue, validateJsonFieldName } from './lib/index.js';
11
11
  export { arrayMetaSchema, baseStringFields, booleanMetaSchema, historyPatchesSchema, jsonPatchSchema, metaSchema, noForeignKeyStringMetaSchema, notForeignKeyMetaSchema, numberMetaSchema, objectMetaSchema, refMetaSchema, sharedFields, stringMetaSchema, tableMigrationsSchema } from './validation-schemas/index.js';
12
12
  export { S as SystemSchemaIds } from './system-schema-ids-B-2xMN-1.js';
13
13
  import 'node:events';
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import './chunk-DEPJRTVT.js';
2
2
  export { getAddPatch, getArraySchema, getBooleanSchema, getMovePatch, getNumberSchema, getObjectSchema, getRefSchema, getRemovePatch, getReplacePatch, getStringSchema } from './chunk-AORPUIKD.js';
3
3
  export { CustomSchemeKeywords } from './chunk-5VDDLW7U.js';
4
4
  import './chunk-H7W4QNMA.js';
5
- export { SchemaTable, VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE, applyAddPatch, applyMovePatch, applyRemovePatch, applyReplacePatch, convertJsonPathToSchemaPath, createJsonObjectSchemaStore, createJsonSchemaStore, createPrimitiveStoreBySchema, deepEqual, getDBJsonPathByJsonSchemaStore, getForeignKeyPatchesFromSchema, getForeignKeysFromSchema, getForeignKeysFromValue, getInvalidFieldNamesInSchema, getJsonSchemaStoreByPath, getJsonValueStoreByPath, getParentForPath, getPathByStore, getValueByPath, hasPath, parsePath, pluginRefs, replaceForeignKeyValue, resolveRefs, saveSharedFields, setValueByPath, traverseStore, traverseValue, validateJsonFieldName } from './chunk-LMFIZGIO.js';
5
+ export { SchemaTable, VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE, applyAddPatch, applyMovePatch, applyRemovePatch, applyReplacePatch, convertJsonPathToSchemaPath, convertSchemaPathToJsonPath, createJsonObjectSchemaStore, createJsonSchemaStore, createPrimitiveStoreBySchema, deepEqual, getDBJsonPathByJsonSchemaStore, getForeignKeyPatchesFromSchema, getForeignKeysFromSchema, getForeignKeysFromValue, getInvalidFieldNamesInSchema, getJsonSchemaStoreByPath, getJsonValueStoreByPath, getParentForPath, getPathByStore, getValueByPath, hasPath, parsePath, pluginRefs, replaceForeignKeyValue, resolveRefs, saveSharedFields, setValueByPath, traverseStore, traverseValue, validateJsonFieldName } from './chunk-7LKKRGZG.js';
6
6
  export { ajvFileSchema, ajvRowCreatedAtSchema, ajvRowCreatedIdSchema, ajvRowHashSchema, ajvRowIdSchema, ajvRowPublishedAtSchema, ajvRowSchemaHashSchema, ajvRowUpdatedAtSchema, ajvRowVersionIdSchema, fileSchema, rowCreatedAtSchema, rowCreatedIdSchema, rowHashSchema, rowIdSchema, rowPublishedAtSchema, rowSchemaHashSchema, rowUpdatedAtSchema, rowVersionIdSchema } from './chunk-LLHQWDAR.js';
7
7
  export { SystemSchemaIds } from './chunk-Q2UOTIMG.js';
8
8
  export { JsonArrayStore, JsonArrayValueStore, JsonBooleanStore, JsonBooleanValueStore, JsonNumberStore, JsonNumberValueStore, JsonObjectStore, JsonObjectValueStore, JsonStringStore, JsonStringValueStore, addSharedFieldsFromState, createJsonArrayValueStore, createJsonObjectValueStore, createJsonValueStore, createPrimitiveValueStore, equal, fromArrayToObject, fromArrayTransformation, fromBooleanToNumber, fromBooleanToString, fromNumberToBoolean, fromNumberToString, fromObjectToArray, fromObjectToPrimitive, fromPrimitiveToObject, fromStringToBoolean, fromStringToNumber, getTransformation, toArrayTransformation } from './chunk-WCFA4226.js';
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkHC4VM256_cjs = require('../chunk-HC4VM256.cjs');
3
+ var chunkEJAKPKHS_cjs = require('../chunk-EJAKPKHS.cjs');
4
4
  require('../chunk-EGC32GPY.cjs');
5
5
  require('../chunk-XNFSFT7T.cjs');
6
6
  var chunkJLIZ7QT2_cjs = require('../chunk-JLIZ7QT2.cjs');
@@ -10,127 +10,131 @@ require('../chunk-V2SSSD5X.cjs');
10
10
 
11
11
  Object.defineProperty(exports, "SchemaTable", {
12
12
  enumerable: true,
13
- get: function () { return chunkHC4VM256_cjs.SchemaTable; }
13
+ get: function () { return chunkEJAKPKHS_cjs.SchemaTable; }
14
14
  });
15
15
  Object.defineProperty(exports, "VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE", {
16
16
  enumerable: true,
17
- get: function () { return chunkHC4VM256_cjs.VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE; }
17
+ get: function () { return chunkEJAKPKHS_cjs.VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE; }
18
18
  });
19
19
  Object.defineProperty(exports, "applyAddPatch", {
20
20
  enumerable: true,
21
- get: function () { return chunkHC4VM256_cjs.applyAddPatch; }
21
+ get: function () { return chunkEJAKPKHS_cjs.applyAddPatch; }
22
22
  });
23
23
  Object.defineProperty(exports, "applyMovePatch", {
24
24
  enumerable: true,
25
- get: function () { return chunkHC4VM256_cjs.applyMovePatch; }
25
+ get: function () { return chunkEJAKPKHS_cjs.applyMovePatch; }
26
26
  });
27
27
  Object.defineProperty(exports, "applyRemovePatch", {
28
28
  enumerable: true,
29
- get: function () { return chunkHC4VM256_cjs.applyRemovePatch; }
29
+ get: function () { return chunkEJAKPKHS_cjs.applyRemovePatch; }
30
30
  });
31
31
  Object.defineProperty(exports, "applyReplacePatch", {
32
32
  enumerable: true,
33
- get: function () { return chunkHC4VM256_cjs.applyReplacePatch; }
33
+ get: function () { return chunkEJAKPKHS_cjs.applyReplacePatch; }
34
34
  });
35
35
  Object.defineProperty(exports, "convertJsonPathToSchemaPath", {
36
36
  enumerable: true,
37
- get: function () { return chunkHC4VM256_cjs.convertJsonPathToSchemaPath; }
37
+ get: function () { return chunkEJAKPKHS_cjs.convertJsonPathToSchemaPath; }
38
+ });
39
+ Object.defineProperty(exports, "convertSchemaPathToJsonPath", {
40
+ enumerable: true,
41
+ get: function () { return chunkEJAKPKHS_cjs.convertSchemaPathToJsonPath; }
38
42
  });
39
43
  Object.defineProperty(exports, "createJsonObjectSchemaStore", {
40
44
  enumerable: true,
41
- get: function () { return chunkHC4VM256_cjs.createJsonObjectSchemaStore; }
45
+ get: function () { return chunkEJAKPKHS_cjs.createJsonObjectSchemaStore; }
42
46
  });
43
47
  Object.defineProperty(exports, "createJsonSchemaStore", {
44
48
  enumerable: true,
45
- get: function () { return chunkHC4VM256_cjs.createJsonSchemaStore; }
49
+ get: function () { return chunkEJAKPKHS_cjs.createJsonSchemaStore; }
46
50
  });
47
51
  Object.defineProperty(exports, "createPrimitiveStoreBySchema", {
48
52
  enumerable: true,
49
- get: function () { return chunkHC4VM256_cjs.createPrimitiveStoreBySchema; }
53
+ get: function () { return chunkEJAKPKHS_cjs.createPrimitiveStoreBySchema; }
50
54
  });
51
55
  Object.defineProperty(exports, "deepEqual", {
52
56
  enumerable: true,
53
- get: function () { return chunkHC4VM256_cjs.deepEqual; }
57
+ get: function () { return chunkEJAKPKHS_cjs.deepEqual; }
54
58
  });
55
59
  Object.defineProperty(exports, "getDBJsonPathByJsonSchemaStore", {
56
60
  enumerable: true,
57
- get: function () { return chunkHC4VM256_cjs.getDBJsonPathByJsonSchemaStore; }
61
+ get: function () { return chunkEJAKPKHS_cjs.getDBJsonPathByJsonSchemaStore; }
58
62
  });
59
63
  Object.defineProperty(exports, "getForeignKeyPatchesFromSchema", {
60
64
  enumerable: true,
61
- get: function () { return chunkHC4VM256_cjs.getForeignKeyPatchesFromSchema; }
65
+ get: function () { return chunkEJAKPKHS_cjs.getForeignKeyPatchesFromSchema; }
62
66
  });
63
67
  Object.defineProperty(exports, "getForeignKeysFromSchema", {
64
68
  enumerable: true,
65
- get: function () { return chunkHC4VM256_cjs.getForeignKeysFromSchema; }
69
+ get: function () { return chunkEJAKPKHS_cjs.getForeignKeysFromSchema; }
66
70
  });
67
71
  Object.defineProperty(exports, "getForeignKeysFromValue", {
68
72
  enumerable: true,
69
- get: function () { return chunkHC4VM256_cjs.getForeignKeysFromValue; }
73
+ get: function () { return chunkEJAKPKHS_cjs.getForeignKeysFromValue; }
70
74
  });
71
75
  Object.defineProperty(exports, "getInvalidFieldNamesInSchema", {
72
76
  enumerable: true,
73
- get: function () { return chunkHC4VM256_cjs.getInvalidFieldNamesInSchema; }
77
+ get: function () { return chunkEJAKPKHS_cjs.getInvalidFieldNamesInSchema; }
74
78
  });
75
79
  Object.defineProperty(exports, "getJsonSchemaStoreByPath", {
76
80
  enumerable: true,
77
- get: function () { return chunkHC4VM256_cjs.getJsonSchemaStoreByPath; }
81
+ get: function () { return chunkEJAKPKHS_cjs.getJsonSchemaStoreByPath; }
78
82
  });
79
83
  Object.defineProperty(exports, "getJsonValueStoreByPath", {
80
84
  enumerable: true,
81
- get: function () { return chunkHC4VM256_cjs.getJsonValueStoreByPath; }
85
+ get: function () { return chunkEJAKPKHS_cjs.getJsonValueStoreByPath; }
82
86
  });
83
87
  Object.defineProperty(exports, "getParentForPath", {
84
88
  enumerable: true,
85
- get: function () { return chunkHC4VM256_cjs.getParentForPath; }
89
+ get: function () { return chunkEJAKPKHS_cjs.getParentForPath; }
86
90
  });
87
91
  Object.defineProperty(exports, "getPathByStore", {
88
92
  enumerable: true,
89
- get: function () { return chunkHC4VM256_cjs.getPathByStore; }
93
+ get: function () { return chunkEJAKPKHS_cjs.getPathByStore; }
90
94
  });
91
95
  Object.defineProperty(exports, "getValueByPath", {
92
96
  enumerable: true,
93
- get: function () { return chunkHC4VM256_cjs.getValueByPath; }
97
+ get: function () { return chunkEJAKPKHS_cjs.getValueByPath; }
94
98
  });
95
99
  Object.defineProperty(exports, "hasPath", {
96
100
  enumerable: true,
97
- get: function () { return chunkHC4VM256_cjs.hasPath; }
101
+ get: function () { return chunkEJAKPKHS_cjs.hasPath; }
98
102
  });
99
103
  Object.defineProperty(exports, "parsePath", {
100
104
  enumerable: true,
101
- get: function () { return chunkHC4VM256_cjs.parsePath; }
105
+ get: function () { return chunkEJAKPKHS_cjs.parsePath; }
102
106
  });
103
107
  Object.defineProperty(exports, "pluginRefs", {
104
108
  enumerable: true,
105
- get: function () { return chunkHC4VM256_cjs.pluginRefs; }
109
+ get: function () { return chunkEJAKPKHS_cjs.pluginRefs; }
106
110
  });
107
111
  Object.defineProperty(exports, "replaceForeignKeyValue", {
108
112
  enumerable: true,
109
- get: function () { return chunkHC4VM256_cjs.replaceForeignKeyValue; }
113
+ get: function () { return chunkEJAKPKHS_cjs.replaceForeignKeyValue; }
110
114
  });
111
115
  Object.defineProperty(exports, "resolveRefs", {
112
116
  enumerable: true,
113
- get: function () { return chunkHC4VM256_cjs.resolveRefs; }
117
+ get: function () { return chunkEJAKPKHS_cjs.resolveRefs; }
114
118
  });
115
119
  Object.defineProperty(exports, "saveSharedFields", {
116
120
  enumerable: true,
117
- get: function () { return chunkHC4VM256_cjs.saveSharedFields; }
121
+ get: function () { return chunkEJAKPKHS_cjs.saveSharedFields; }
118
122
  });
119
123
  Object.defineProperty(exports, "setValueByPath", {
120
124
  enumerable: true,
121
- get: function () { return chunkHC4VM256_cjs.setValueByPath; }
125
+ get: function () { return chunkEJAKPKHS_cjs.setValueByPath; }
122
126
  });
123
127
  Object.defineProperty(exports, "traverseStore", {
124
128
  enumerable: true,
125
- get: function () { return chunkHC4VM256_cjs.traverseStore; }
129
+ get: function () { return chunkEJAKPKHS_cjs.traverseStore; }
126
130
  });
127
131
  Object.defineProperty(exports, "traverseValue", {
128
132
  enumerable: true,
129
- get: function () { return chunkHC4VM256_cjs.traverseValue; }
133
+ get: function () { return chunkEJAKPKHS_cjs.traverseValue; }
130
134
  });
131
135
  Object.defineProperty(exports, "validateJsonFieldName", {
132
136
  enumerable: true,
133
- get: function () { return chunkHC4VM256_cjs.validateJsonFieldName; }
137
+ get: function () { return chunkEJAKPKHS_cjs.validateJsonFieldName; }
134
138
  });
135
139
  Object.defineProperty(exports, "addSharedFieldsFromState", {
136
140
  enumerable: true,
@@ -58,6 +58,7 @@ declare function setValueByPath(obj: JsonValue, path: string, value: JsonValue):
58
58
  declare function hasPath(obj: JsonValue, path: string): boolean;
59
59
  declare function deepEqual(a: unknown, b: unknown): boolean;
60
60
  declare function convertJsonPathToSchemaPath(jsonPath: string): string;
61
+ declare function convertSchemaPathToJsonPath(schemaPath: string): string;
61
62
 
62
63
  declare const getPathByStore: (store: JsonSchemaStore) => string;
63
64
 
@@ -95,4 +96,4 @@ declare const traverseValue: (store: JsonValueStore, callback: (node: JsonValueS
95
96
  declare const VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE = "It must contain between 1 and 64 characters, start with a letter or underscore (_), cannot start with two underscores (__), and can only include letters (a-z, A-Z), numbers (0-9), hyphens (-), and underscores (_).";
96
97
  declare const validateJsonFieldName: (id: string) => boolean;
97
98
 
98
- export { type GetForeignKeysFromValueType, type RefsType, type ReplaceForeignKeyValueOptions, SchemaTable, VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE, addSharedFieldsFromState, applyAddPatch, applyMovePatch, applyRemovePatch, applyReplacePatch, convertJsonPathToSchemaPath, createJsonArrayValueStore, createJsonObjectSchemaStore, createJsonObjectValueStore, createJsonSchemaStore, createJsonValueStore, createPrimitiveStoreBySchema, createPrimitiveValueStore, deepEqual, getDBJsonPathByJsonSchemaStore, getForeignKeyPatchesFromSchema, getForeignKeysFromSchema, getForeignKeysFromValue, getInvalidFieldNamesInSchema, getJsonSchemaStoreByPath, getJsonValueStoreByPath, getParentForPath, getPathByStore, getValueByPath, hasPath, parsePath, pluginRefs, replaceForeignKeyValue, resolveRefs, saveSharedFields, setValueByPath, traverseStore, traverseValue, validateJsonFieldName };
99
+ export { type GetForeignKeysFromValueType, type RefsType, type ReplaceForeignKeyValueOptions, SchemaTable, VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE, addSharedFieldsFromState, applyAddPatch, applyMovePatch, applyRemovePatch, applyReplacePatch, convertJsonPathToSchemaPath, convertSchemaPathToJsonPath, createJsonArrayValueStore, createJsonObjectSchemaStore, createJsonObjectValueStore, createJsonSchemaStore, createJsonValueStore, createPrimitiveStoreBySchema, createPrimitiveValueStore, deepEqual, getDBJsonPathByJsonSchemaStore, getForeignKeyPatchesFromSchema, getForeignKeysFromSchema, getForeignKeysFromValue, getInvalidFieldNamesInSchema, getJsonSchemaStoreByPath, getJsonValueStoreByPath, getParentForPath, getPathByStore, getValueByPath, hasPath, parsePath, pluginRefs, replaceForeignKeyValue, resolveRefs, saveSharedFields, setValueByPath, traverseStore, traverseValue, validateJsonFieldName };
@@ -58,6 +58,7 @@ declare function setValueByPath(obj: JsonValue, path: string, value: JsonValue):
58
58
  declare function hasPath(obj: JsonValue, path: string): boolean;
59
59
  declare function deepEqual(a: unknown, b: unknown): boolean;
60
60
  declare function convertJsonPathToSchemaPath(jsonPath: string): string;
61
+ declare function convertSchemaPathToJsonPath(schemaPath: string): string;
61
62
 
62
63
  declare const getPathByStore: (store: JsonSchemaStore) => string;
63
64
 
@@ -95,4 +96,4 @@ declare const traverseValue: (store: JsonValueStore, callback: (node: JsonValueS
95
96
  declare const VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE = "It must contain between 1 and 64 characters, start with a letter or underscore (_), cannot start with two underscores (__), and can only include letters (a-z, A-Z), numbers (0-9), hyphens (-), and underscores (_).";
96
97
  declare const validateJsonFieldName: (id: string) => boolean;
97
98
 
98
- export { type GetForeignKeysFromValueType, type RefsType, type ReplaceForeignKeyValueOptions, SchemaTable, VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE, addSharedFieldsFromState, applyAddPatch, applyMovePatch, applyRemovePatch, applyReplacePatch, convertJsonPathToSchemaPath, createJsonArrayValueStore, createJsonObjectSchemaStore, createJsonObjectValueStore, createJsonSchemaStore, createJsonValueStore, createPrimitiveStoreBySchema, createPrimitiveValueStore, deepEqual, getDBJsonPathByJsonSchemaStore, getForeignKeyPatchesFromSchema, getForeignKeysFromSchema, getForeignKeysFromValue, getInvalidFieldNamesInSchema, getJsonSchemaStoreByPath, getJsonValueStoreByPath, getParentForPath, getPathByStore, getValueByPath, hasPath, parsePath, pluginRefs, replaceForeignKeyValue, resolveRefs, saveSharedFields, setValueByPath, traverseStore, traverseValue, validateJsonFieldName };
99
+ export { type GetForeignKeysFromValueType, type RefsType, type ReplaceForeignKeyValueOptions, SchemaTable, VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE, addSharedFieldsFromState, applyAddPatch, applyMovePatch, applyRemovePatch, applyReplacePatch, convertJsonPathToSchemaPath, convertSchemaPathToJsonPath, createJsonArrayValueStore, createJsonObjectSchemaStore, createJsonObjectValueStore, createJsonSchemaStore, createJsonValueStore, createPrimitiveStoreBySchema, createPrimitiveValueStore, deepEqual, getDBJsonPathByJsonSchemaStore, getForeignKeyPatchesFromSchema, getForeignKeysFromSchema, getForeignKeysFromValue, getInvalidFieldNamesInSchema, getJsonSchemaStoreByPath, getJsonValueStoreByPath, getParentForPath, getPathByStore, getValueByPath, hasPath, parsePath, pluginRefs, replaceForeignKeyValue, resolveRefs, saveSharedFields, setValueByPath, traverseStore, traverseValue, validateJsonFieldName };
package/dist/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { SchemaTable, VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE, applyAddPatch, applyMovePatch, applyRemovePatch, applyReplacePatch, convertJsonPathToSchemaPath, createJsonObjectSchemaStore, createJsonSchemaStore, createPrimitiveStoreBySchema, deepEqual, getDBJsonPathByJsonSchemaStore, getForeignKeyPatchesFromSchema, getForeignKeysFromSchema, getForeignKeysFromValue, getInvalidFieldNamesInSchema, getJsonSchemaStoreByPath, getJsonValueStoreByPath, getParentForPath, getPathByStore, getValueByPath, hasPath, parsePath, pluginRefs, replaceForeignKeyValue, resolveRefs, saveSharedFields, setValueByPath, traverseStore, traverseValue, validateJsonFieldName } from '../chunk-LMFIZGIO.js';
1
+ export { SchemaTable, VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE, applyAddPatch, applyMovePatch, applyRemovePatch, applyReplacePatch, convertJsonPathToSchemaPath, convertSchemaPathToJsonPath, createJsonObjectSchemaStore, createJsonSchemaStore, createPrimitiveStoreBySchema, deepEqual, getDBJsonPathByJsonSchemaStore, getForeignKeyPatchesFromSchema, getForeignKeysFromSchema, getForeignKeysFromValue, getInvalidFieldNamesInSchema, getJsonSchemaStoreByPath, getJsonValueStoreByPath, getParentForPath, getPathByStore, getValueByPath, hasPath, parsePath, pluginRefs, replaceForeignKeyValue, resolveRefs, saveSharedFields, setValueByPath, traverseStore, traverseValue, validateJsonFieldName } from '../chunk-7LKKRGZG.js';
2
2
  import '../chunk-LLHQWDAR.js';
3
3
  import '../chunk-Q2UOTIMG.js';
4
4
  export { addSharedFieldsFromState, createJsonArrayValueStore, createJsonObjectValueStore, createJsonValueStore, createPrimitiveValueStore } from '../chunk-WCFA4226.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revisium/schema-toolkit",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Universal schema toolkit with TypeScript types and utilities for JSON Schema manipulation",
5
5
  "keywords": [
6
6
  "json-schema",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/createJsonSchemaStore.ts","../src/lib/getJsonSchemaStoreByPath.ts","../src/lib/getParentForPath.ts","../src/lib/validateJsonFieldName.ts","../src/lib/applyPatches.ts","../src/lib/getDBJsonPathByJsonSchemaStore.ts","../src/lib/getPathByStore.ts","../src/lib/traverseStore.ts","../src/lib/getForeignKeyPatchesFromSchema.ts","../src/lib/getForeignKeysFromSchema.ts","../src/lib/traverseValue.ts","../src/lib/getForeignKeysFromValue.ts","../src/lib/getInvalidFieldNamesInSchema.ts","../src/lib/json-path-utils.ts","../src/lib/getJsonValueByPath.ts","../src/lib/replaceForeignKeyValue.ts","../src/lib/resolveRefs.ts","../src/lib/schema-table.ts"],"names":["JsonArrayStore","JsonObjectStore","JsonStringStore","JsonNumberStore","JsonBooleanStore","obj","JsonObjectValueStore","JsonArrayValueStore","rowIdSchema","rowVersionIdSchema","rowCreatedIdSchema","rowCreatedAtSchema","rowPublishedAtSchema","rowUpdatedAtSchema","rowHashSchema","rowSchemaHashSchema","fileSchema","createJsonValueStore","getTransformation"],"mappings":";;;;;;AAkBO,IAAM,qBAAA,GAAwB,CACnC,MAAA,EACA,IAAA,GAAiB,EAAC,KACE;AACpB,EAAA,IAAI,UAAU,MAAA,EAAQ;AACpB,IAAA,MAAM,SAAA,GAAoC,IAAA,CAAK,MAAA,CAAO,IAAI,CAAA;AAE1D,IAAA,IAAI,CAAC,SAAA,EAAW;AACd,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,2BAAA,EAA8B,MAAA,CAAO,IAAI,CAAA,CAAA,CAAG,CAAA;AAAA,IAC9D;AAEA,IAAA,MAAM,QAAA,GAAW,qBAAA,CAAsB,SAAA,EAAW,IAAI,CAAA;AACtD,IAAA,gBAAA,CAAiB,UAAU,MAAM,CAAA;AACjC,IAAA,QAAA,CAAS,OAAO,MAAA,CAAO,IAAA;AACvB,IAAA,OAAO,QAAA;AAAA,EACT,CAAA,MAAA,IAAW,OAAO,IAAA,KAAA,QAAA,eAAoC;AACpD,IAAA,MAAM,WAAA,GAAc,2BAAA,CAA4B,MAAA,EAAQ,IAAI,CAAA;AAC5D,IAAA,gBAAA,CAAiB,aAAa,MAAM,CAAA;AAEpC,IAAA,OAAO,WAAA;AAAA,EACT,CAAA,MAAA,IAAW,OAAO,IAAA,KAAA,OAAA,cAAmC;AACnD,IAAA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AAA,MAAW,CAAC,KAAA,EAAO,GAAG,CAAA,IAAK,KAAK,IAAA,EAAM;AACpC,QAAA,MAAM,YAAA,GAAe,cAAA;AAAA,UACnB,IAAI,aAAA,EAAc;AAAA,UAClB,SAAA,CAAU;AAAA,SACZ;AAEA,QAAA,MAAM,OAAA,GAAUD,sCAAA,CAAqB,SAAA,EAAW,KAAA,EAAO,YAAY,CAAA;AACnE,QAAA,IAAA,CAAK,IAAA,CAAK,GAAA,CAAI,KAAA,EAAO,OAAO,CAAA;AAAA,MAC9B;AAAA,IACF;AAEA,IAAA,IAAA,CAAK,KAAA,GAAQ,SAAA;AAAA,EACf;AACF","file":"chunk-HC4VM256.cjs","sourcesContent":["import {\n JsonObjectSchema,\n JsonSchema,\n JsonSchemaPrimitives,\n JsonSchemaTypeName,\n} from '../types/schema.types.js';\nimport { JsonArrayStore } from '../model/schema/json-array.store.js';\nimport { JsonBooleanStore } from '../model/schema/json-boolean.store.js';\nimport { JsonNumberStore } from '../model/schema/json-number.store.js';\nimport { JsonStringStore } from '../model/schema/json-string.store.js';\nimport { JsonObjectStore } from '../model/schema/json-object.store.js';\nimport {\n JsonSchemaStore,\n JsonSchemaStorePrimitives,\n} from '../model/schema/json-schema.store.js';\n\nexport type RefsType = Record<string, JsonSchema>;\n\nexport const createJsonSchemaStore = (\n schema: JsonSchema,\n refs: RefsType = {},\n): JsonSchemaStore => {\n if ('$ref' in schema) {\n const refSchema: JsonSchema | undefined = refs[schema.$ref];\n\n if (!refSchema) {\n throw new Error(`Not found schema for $ref=\"${schema.$ref}\"`);\n }\n\n const refStore = createJsonSchemaStore(refSchema, refs);\n saveSharedFields(refStore, schema);\n refStore.$ref = schema.$ref;\n return refStore;\n } else if (schema.type === JsonSchemaTypeName.Object) {\n const objectStore = createJsonObjectSchemaStore(schema, refs);\n saveSharedFields(objectStore, schema);\n\n return objectStore;\n } else if (schema.type === JsonSchemaTypeName.Array) {\n const itemsStore = createJsonSchemaStore(schema.items, refs);\n const arrayStore = new JsonArrayStore(itemsStore);\n saveSharedFields(arrayStore, schema);\n\n return arrayStore;\n } else {\n const primitivesStore = createPrimitiveStoreBySchema(schema);\n saveSharedFields(primitivesStore, schema);\n primitivesStore.readOnly = schema.readOnly;\n\n return primitivesStore;\n }\n};\n\nexport const createJsonObjectSchemaStore = (\n value: JsonObjectSchema,\n refs: RefsType,\n): JsonObjectStore => {\n const store = new JsonObjectStore();\n\n for (const requiredField of value.required) {\n if (!value.properties[requiredField]) {\n throw new Error(\n `Not found required field \"${requiredField}\" in \"properties\"`,\n );\n }\n }\n\n Object.entries(value.properties).forEach(([name, item]) => {\n store.addPropertyWithStore(name, createJsonSchemaStore(item, refs));\n });\n\n return store;\n};\n\nexport const createPrimitiveStoreBySchema = (\n schema: JsonSchemaPrimitives,\n): JsonSchemaStorePrimitives => {\n if (schema.type === JsonSchemaTypeName.String) {\n const stringStore = new JsonStringStore();\n stringStore.foreignKey = schema.foreignKey;\n stringStore.format = schema.format;\n stringStore.enum = schema.enum;\n stringStore.contentMediaType = schema.contentMediaType;\n stringStore.pattern = schema.pattern;\n return stringStore;\n } else if (schema.type === JsonSchemaTypeName.Number) {\n return new JsonNumberStore();\n } else if (schema.type === JsonSchemaTypeName.Boolean) {\n return new JsonBooleanStore();\n } else {\n throw new Error('this type is not allowed');\n }\n};\n\nexport const saveSharedFields = (\n store: JsonSchemaStore,\n schema: JsonSchema,\n) => {\n store.title = schema.title;\n store.description = schema.description;\n store.deprecated = schema.deprecated;\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\n\nexport const getJsonSchemaStoreByPath = (\n store: JsonSchemaStore,\n path: string,\n): JsonSchemaStore => {\n if (path === '') {\n return store;\n }\n\n if (path === '/') {\n throw new Error(\n 'invalid root path, need to use path=\"\" instead of path=\"/\"',\n );\n }\n\n const tokens = path.split('/');\n tokens.shift();\n\n let currentStore = store;\n\n let currentToken = tokens.shift();\n let currentPath = '';\n\n while (currentToken) {\n if (currentStore.type === JsonSchemaTypeName.Object) {\n if (currentToken !== 'properties') {\n throw new Error(\n `Expected \"${currentPath}/properties/*\" instead of ${currentPath}/${currentToken}/*`,\n );\n }\n\n currentPath = `${currentPath}/${currentToken}`;\n\n currentToken = tokens.shift();\n\n if (!currentToken) {\n throw new Error(`Expected property name after \"${currentPath}\"`);\n }\n\n const foundCurrentStore = currentStore.getProperty(currentToken);\n\n if (!foundCurrentStore) {\n throw new Error(`Not found \"${currentToken}\" in \"${currentPath}\"`);\n }\n\n currentStore = foundCurrentStore;\n currentPath = `${currentPath}/${currentToken}`;\n\n currentToken = tokens.shift();\n } else if (currentStore.type === JsonSchemaTypeName.Array) {\n if (currentToken !== 'items') {\n throw new Error(\n `Expected \"${currentPath}/items/*\" instead of ${currentPath}/${currentToken}/*`,\n );\n }\n\n currentPath = `${currentPath}/${currentToken}`;\n\n currentStore = currentStore.items;\n\n currentToken = tokens.shift();\n } else {\n throw new Error(`Unexpected \"${currentToken}\" in \"${currentPath}\"`);\n }\n }\n\n return currentStore;\n};\n","export const getParentForPath = (\n path: string,\n): { parentPath: string; field: string } => {\n if (path === '' || path === '/') {\n throw new Error('Invalid path');\n }\n\n const tokens = path.split('/');\n tokens.shift();\n\n let currentToken = tokens.shift();\n\n let parentPath = '';\n let field = '';\n\n while (currentToken) {\n if (currentToken === 'properties') {\n currentToken = tokens.shift();\n\n if (!currentToken) {\n throw new Error('Invalid path');\n }\n\n field = currentToken;\n\n currentToken = tokens.shift();\n\n if (currentToken) {\n parentPath = `${parentPath}/properties/${field}`;\n }\n } else if (currentToken === 'items') {\n field = currentToken;\n\n currentToken = tokens.shift();\n\n if (currentToken && !['items', 'properties'].includes(currentToken)) {\n throw new Error('Invalid path');\n } else if (currentToken) {\n parentPath = `${parentPath}/items`;\n }\n } else {\n throw new Error('Invalid path');\n }\n }\n\n return {\n parentPath: parentPath,\n field,\n };\n};\n","const maxLength = 64;\n\nexport const VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE = `It must contain between 1 and ${maxLength} characters, start with a letter or underscore (_), cannot start with two underscores (__), and can only include letters (a-z, A-Z), numbers (0-9), hyphens (-), and underscores (_).`;\n\nconst validPattern = /^(?!__)[a-zA-Z_][a-zA-Z0-9-_]*$/;\n\nexport const validateJsonFieldName = (id: string) => {\n const isInvalid =\n id.length < 1 || id.length > maxLength || !validPattern.test(id);\n\n return !isInvalid;\n};\n","import { JsonSchema, JsonSchemaTypeName } from '../types/schema.types.js';\nimport {\n JsonPatchAdd,\n JsonPatchMove,\n JsonPatchRemove,\n JsonPatchReplace,\n} from '../types/json-patch.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\nimport { createJsonSchemaStore } from './createJsonSchemaStore.js';\nimport { getJsonSchemaStoreByPath } from './getJsonSchemaStoreByPath.js';\nimport { getParentForPath } from './getParentForPath.js';\nimport {\n VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE,\n validateJsonFieldName,\n} from './validateJsonFieldName.js';\n\nexport const applyReplacePatch = (\n store: JsonSchemaStore,\n patch: JsonPatchReplace,\n refs: Record<string, JsonSchema> = {},\n): JsonSchemaStore => {\n const patchStore = createJsonSchemaStore(patch.value, refs);\n const foundStore = getJsonSchemaStoreByPath(store, patch.path);\n\n const parent = foundStore.parent;\n\n if (!parent) {\n return patchStore;\n }\n\n if (parent.type === JsonSchemaTypeName.Object) {\n parent.migratePropertyWithStore(foundStore.name, patchStore);\n } else if (parent.type === JsonSchemaTypeName.Array) {\n parent.migrateItems(patchStore);\n } else {\n throw new Error('Invalid parent');\n }\n\n return store;\n};\n\nexport const applyRemovePatch = (\n rootStore: JsonSchemaStore,\n patch: JsonPatchRemove,\n): void => {\n const foundStore = getJsonSchemaStoreByPath(rootStore, patch.path);\n const parent = foundStore.parent;\n\n if (!parent) {\n throw new Error('Parent does not exist');\n }\n\n if (parent.type !== JsonSchemaTypeName.Object) {\n throw new Error('Cannot remove from non-object');\n }\n\n parent.removeProperty(foundStore.name);\n};\n\nexport const applyAddPatch = (\n rootStore: JsonSchemaStore,\n patch: JsonPatchAdd,\n refs: Record<string, JsonSchema> = {},\n): void => {\n const patchStore = createJsonSchemaStore(patch.value, refs);\n\n const { parentPath, field } = getParentForPath(patch.path);\n const foundParent = getJsonSchemaStoreByPath(rootStore, parentPath);\n\n if (!foundParent) {\n throw new Error('Parent does not exist');\n }\n\n if (foundParent.type !== JsonSchemaTypeName.Object) {\n throw new Error('Cannot add to non-object');\n }\n\n if (foundParent.getProperty(field)) {\n throw new Error(`Field \"${field}\" already exists in parent`);\n }\n\n foundParent.addPropertyWithStore(field, patchStore);\n};\n\nexport const applyMovePatch = (\n store: JsonSchemaStore,\n patch: JsonPatchMove,\n): void => {\n const { parentPath: fromParentPath, field: fromField } = getParentForPath(\n patch.from,\n );\n const { parentPath: toParentPath, field: toField } = getParentForPath(\n patch.path,\n );\n\n const foundFromParent = getJsonSchemaStoreByPath(store, fromParentPath);\n const foundToParent = getJsonSchemaStoreByPath(store, toParentPath);\n\n const isValidToField = validateJsonFieldName(toField);\n\n if (!isValidToField) {\n throw new Error(\n `Invalid name: ${toField}. ${VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE}`,\n );\n }\n\n if (!foundFromParent || !foundToParent) {\n throw new Error('Cannot move from or to non-existent parent');\n }\n\n if (foundFromParent.type !== JsonSchemaTypeName.Object) {\n throw new Error('Cannot move from non-object parent');\n }\n\n const foundFromField = getJsonSchemaStoreByPath(store, patch.from);\n\n const isMovedPropertyInSameParentPatch =\n foundFromParent === foundToParent &&\n foundFromParent.type === JsonSchemaTypeName.Object &&\n foundFromParent.getProperty(fromField);\n\n if (isMovedPropertyInSameParentPatch) {\n return foundFromParent.changeName(fromField, toField);\n }\n\n if (foundToParent.type === JsonSchemaTypeName.Object) {\n if (foundToParent.getProperty(toField)) {\n foundToParent.removeProperty(toField);\n }\n foundToParent.addPropertyWithStore(toField, foundFromField);\n foundFromParent.removeProperty(fromField);\n return;\n }\n\n if (foundToParent.type === JsonSchemaTypeName.Array) {\n foundFromParent.removeProperty(fromField);\n foundToParent.replaceItems(foundFromField);\n\n return;\n }\n throw new Error('Invalid type of \"to\" parent');\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\n\nexport const getDBJsonPathByJsonSchemaStore = (\n store: JsonSchemaStore,\n): string => {\n let node = store;\n\n let path = '';\n\n while (node.parent) {\n if (node.parent.type === JsonSchemaTypeName.Object) {\n path = `.${node.name}${path}`;\n } else if (node.parent.type === JsonSchemaTypeName.Array) {\n path = `[*]${path}`;\n }\n\n node = node.parent;\n }\n\n if (!path) {\n return '$';\n }\n\n return `$${path}`;\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\n\nexport const getPathByStore = (store: JsonSchemaStore): string => {\n let node = store;\n\n let path = '';\n\n while (node.parent) {\n if (node.parent.type === JsonSchemaTypeName.Object) {\n path = `/properties/${node.name}${path}`;\n } else if (node.parent.type === JsonSchemaTypeName.Array) {\n path = `/items${path}`;\n }\n\n node = node.parent;\n }\n\n if (!path) {\n return '/';\n }\n\n return `${path}`;\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\n\nexport const traverseStore = (\n store: JsonSchemaStore,\n callback: (node: JsonSchemaStore) => void,\n) => {\n callback(store);\n\n if (store.type === JsonSchemaTypeName.Object) {\n Object.values(store.properties).forEach((item) => {\n traverseStore(item, callback);\n });\n } else if (store.type === JsonSchemaTypeName.Array) {\n traverseStore(store.items, callback);\n }\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonPatch, JsonPatchReplace } from '../types/json-patch.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\nimport { getPathByStore } from './getPathByStore.js';\nimport { traverseStore } from './traverseStore.js';\n\nexport const getForeignKeyPatchesFromSchema = (\n store: JsonSchemaStore,\n options: { tableId: string; nextTableId: string },\n) => {\n const stores: JsonPatch[] = [];\n\n traverseStore(store, (item) => {\n if (\n item.type === JsonSchemaTypeName.String &&\n item.foreignKey === options.tableId\n ) {\n item.foreignKey = options.nextTableId;\n\n const patch: JsonPatchReplace = {\n op: 'replace',\n path: getPathByStore(item),\n value: item.getPlainSchema(),\n };\n\n stores.push(patch);\n }\n });\n\n return stores;\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\nimport { traverseStore } from './traverseStore.js';\n\nexport const getForeignKeysFromSchema = (store: JsonSchemaStore): string[] => {\n const foreignKeys = new Set<string>();\n\n traverseStore(store, (item) => {\n if (item.type === JsonSchemaTypeName.String && item.foreignKey) {\n foreignKeys.add(item.foreignKey);\n }\n });\n\n return [...foreignKeys].sort((a, b) => a.localeCompare(b));\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonValueStore } from '../model/value/json-value.store.js';\n\nexport const traverseValue = (\n store: JsonValueStore,\n callback: (node: JsonValueStore) => void,\n) => {\n callback(store);\n\n if (store.type === JsonSchemaTypeName.Object) {\n Object.values(store.value).forEach((item) => {\n traverseValue(item, callback);\n });\n } else if (store.type === JsonSchemaTypeName.Array) {\n store.value.forEach((itemValue) => {\n traverseValue(itemValue, callback);\n });\n }\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonValueStore } from '../model/value/json-value.store.js';\nimport { traverseValue } from './traverseValue.js';\n\nexport type GetForeignKeysFromValueType = {\n tableId: string;\n rowIds: string[];\n};\n\nexport const getForeignKeysFromValue = (\n value: JsonValueStore,\n): GetForeignKeysFromValueType[] => {\n const foreignKeys = new Map<string, Set<string>>();\n\n traverseValue(value, (item) => {\n if (item.type === JsonSchemaTypeName.String && item.foreignKey) {\n let tableForeignKey = foreignKeys.get(item.foreignKey);\n\n if (!tableForeignKey) {\n tableForeignKey = new Set<string>();\n foreignKeys.set(item.foreignKey, tableForeignKey);\n }\n\n tableForeignKey.add(item.getPlainValue());\n }\n });\n\n return [...foreignKeys].map(([tableId, rowIds]) => ({\n tableId,\n rowIds: [...rowIds].sort((a, b) => a.localeCompare(b)),\n }));\n};\n","import { JsonSchema, JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\nimport { createJsonSchemaStore } from './createJsonSchemaStore.js';\nimport { traverseStore } from './traverseStore.js';\nimport { validateJsonFieldName } from './validateJsonFieldName.js';\n\nexport const getInvalidFieldNamesInSchema = (\n schema: JsonSchema,\n refs: Record<string, JsonSchema> = {},\n) => {\n const schemaStore = createJsonSchemaStore(schema, refs);\n\n const invalidFields: JsonSchemaStore[] = [];\n\n traverseStore(schemaStore, (item) => {\n if (item.parent?.type === JsonSchemaTypeName.Object) {\n if (!validateJsonFieldName(item.name)) {\n invalidFields.push(item);\n }\n }\n });\n\n return invalidFields;\n};\n","import { JsonArray, JsonObject, JsonValue } from '../types';\n\nfunction parsePathSegments(path: string): (string | number)[] {\n const segments: (string | number)[] = [];\n const regex = /([^.[\\]]+)|\\[(\\d+)]/g;\n let match: RegExpExecArray | null;\n\n while ((match = regex.exec(path))) {\n if (match[1] !== undefined) {\n segments.push(match[1]);\n } else if (match[2] !== undefined) {\n segments.push(Number(match[2]));\n }\n }\n\n return segments;\n}\n\n/**\n * Parse path string into segments\n *\n * @param path - Path string (e.g., \"title\", \"address.city\", \"tags[0]\", \"users[0].name\")\n * @returns Array of segments (strings and numbers)\n *\n * @example\n * parsePath(\"title\") // [\"title\"]\n * parsePath(\"address.city\") // [\"address\", \"city\"]\n * parsePath(\"tags[0]\") // [\"tags\", 0]\n * parsePath(\"users[0].name\") // [\"users\", 0, \"name\"]\n * parsePath(\"matrix[0][1]\") // [\"matrix\", 0, 1]\n */\nexport function parsePath(path: string): (string | number)[] {\n if (!path) {\n return [];\n }\n\n return parsePathSegments(path);\n}\n\n/**\n * Get value by path from plain JavaScript object\n *\n * @param obj - Object to navigate\n * @param path - Path string (e.g., \"address.city\", \"tags[0]\")\n * @returns Value at path, or undefined if path doesn't exist\n *\n * @example\n * const obj = { address: { city: \"Moscow\" }, tags: [\"a\", \"b\"] };\n * getValueByPath(obj, \"address.city\") // \"Moscow\"\n * getValueByPath(obj, \"tags[1]\") // \"b\"\n * getValueByPath(obj, \"nonexistent\") // undefined\n */\nexport function getValueByPath(\n obj: JsonValue | undefined,\n path: string,\n): JsonValue | undefined {\n if (!path) {\n return obj;\n }\n\n const segments = parsePath(path);\n let current: JsonValue | undefined = obj;\n\n for (const segment of segments) {\n if (current == null) {\n return undefined;\n }\n\n if (typeof segment === 'number') {\n if (!Array.isArray(current)) {\n return undefined;\n }\n current = current[segment];\n } else {\n if (typeof current !== 'object') {\n return undefined;\n }\n current = (current as JsonObject)[segment];\n }\n }\n\n return current;\n}\n\n/**\n * Set value by path in plain JavaScript object\n * Creates intermediate objects/arrays as needed\n *\n * @param obj - Object to modify\n * @param path - Path string (e.g., \"address.city\", \"tags[0]\")\n * @param value - Value to set\n *\n * @example\n * const obj = {};\n * setValueByPath(obj, \"address.city\", \"London\");\n * // obj is now { address: { city: \"London\" } }\n *\n * setValueByPath(obj, \"tags[0]\", \"first\");\n * // obj is now { address: { city: \"London\" }, tags: [\"first\"] }\n */\nexport function setValueByPath(\n obj: JsonValue,\n path: string,\n value: JsonValue,\n): void {\n if (!path) {\n throw new Error('Cannot set root value');\n }\n\n const segments = parsePath(path);\n let current: JsonValue | undefined = obj;\n\n for (let i = 0; i < segments.length - 1; i++) {\n const segment = segments[i] as string | number;\n const nextSegment = segments[i + 1];\n\n if (typeof segment === 'number') {\n if (!Array.isArray(current)) {\n throw new TypeError(\n `Cannot set array index on non-array at segment ${i}`,\n );\n }\n\n const arr: JsonArray = current;\n\n if (segment > arr.length) {\n throw new Error(\n `Cannot create sparse array: index ${segment} is out of bounds (array length: ${arr.length}) at segment ${i}`,\n );\n }\n\n if (arr[segment] == null) {\n arr[segment] = typeof nextSegment === 'number' ? [] : {};\n }\n\n current = arr[segment];\n } else if (typeof segment === 'string') {\n if (\n current == null ||\n typeof current !== 'object' ||\n Array.isArray(current)\n ) {\n throw new Error(`Cannot set property on non-object at segment ${i}`);\n }\n\n const obj: JsonObject = current;\n if (obj[segment] == null) {\n obj[segment] = typeof nextSegment === 'number' ? [] : {};\n }\n\n current = obj[segment];\n }\n }\n\n const lastSegment = segments[segments.length - 1] as string | number;\n\n if (typeof lastSegment === 'number') {\n if (!Array.isArray(current)) {\n throw new TypeError(\n `Cannot set array index on non-array at segment ${segments.length - 1}`,\n );\n }\n\n const arr: JsonArray = current;\n\n if (lastSegment > arr.length) {\n throw new Error(\n `Cannot create sparse array: index ${lastSegment} is out of bounds (array length: ${arr.length})`,\n );\n }\n\n arr[lastSegment] = value;\n } else if (typeof lastSegment === 'string') {\n if (\n current == null ||\n typeof current !== 'object' ||\n Array.isArray(current)\n ) {\n throw new Error(\n `Cannot set property on non-object at segment ${segments.length - 1}`,\n );\n }\n (current as JsonObject)[lastSegment] = value;\n }\n}\n\n/**\n * Check if path exists in object\n *\n * @param obj - Object to check\n * @param path - Path string (e.g., \"address.city\", \"tags[0]\")\n * @returns true if path exists and value is not undefined\n *\n * @example\n * const obj = { address: { city: \"Moscow\" } };\n * hasPath(obj, \"address.city\") // true\n * hasPath(obj, \"address.country\") // false\n */\nexport function hasPath(obj: JsonValue, path: string): boolean {\n const value = getValueByPath(obj, path);\n return value !== undefined;\n}\n\n/**\n * Deep equality comparison for plain JavaScript values\n * Handles objects, arrays, primitives, null, undefined\n *\n * @param a - First value\n * @param b - Second value\n * @returns true if values are deeply equal\n *\n * @example\n * deepEqual({ a: 1, b: 2 }, { a: 1, b: 2 }) // true\n * deepEqual([1, 2, 3], [1, 2, 3]) // true\n * deepEqual({ a: 1 }, { a: 2 }) // false\n * deepEqual(null, null) // true\n * deepEqual(undefined, undefined) // true\n */\nexport function deepEqual(a: unknown, b: unknown): boolean {\n if (a === b) {\n return true;\n }\n\n if (a === null && b === null) {\n return true;\n }\n\n if (a === undefined && b === undefined) {\n return true;\n }\n\n if (a == null || b == null) {\n return false;\n }\n\n if (typeof a !== typeof b) {\n return false;\n }\n\n if (typeof a !== 'object') {\n return false;\n }\n\n if (Array.isArray(a) && Array.isArray(b)) {\n const arrA = a as JsonArray;\n const arrB = b as JsonArray;\n if (arrA.length !== arrB.length) {\n return false;\n }\n for (let i = 0; i < arrA.length; i++) {\n const itemA = arrA[i];\n const itemB = arrB[i];\n\n if (itemA !== undefined && itemB !== undefined) {\n if (itemA === null && itemB === null) {\n continue;\n }\n if (!deepEqual(itemA, itemB)) {\n return false;\n }\n } else if (itemA !== itemB) {\n return false;\n }\n }\n return true;\n }\n\n if (Array.isArray(a) || Array.isArray(b)) {\n return false;\n }\n\n const objA = a as JsonObject;\n const objB = b as JsonObject;\n const keysA = Object.keys(objA);\n const keysB = Object.keys(objB);\n\n if (keysA.length !== keysB.length) {\n return false;\n }\n\n for (const key of keysA) {\n if (!keysB.includes(key)) {\n return false;\n }\n const valA = objA[key];\n const valB = objB[key];\n\n if (valA !== undefined && valB !== undefined) {\n if (valA === null && valB === null) {\n continue;\n }\n if (!deepEqual(valA, valB)) {\n return false;\n }\n } else if (valA !== valB) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Convert simplified JSON path to JSON Schema path\n *\n * @param jsonPath - JSON path string (e.g., \"title\", \"address.city\", \"tags[0]\", \"users[0].name\")\n * @returns JSON Schema path string\n *\n * @example\n * convertJsonPathToSchemaPath(\"title\") // \"/properties/title\"\n * convertJsonPathToSchemaPath(\"address.city\") // \"/properties/address/properties/city\"\n * convertJsonPathToSchemaPath(\"tags[0]\") // \"/properties/tags/items\"\n * convertJsonPathToSchemaPath(\"users[0].name\") // \"/properties/users/items/properties/name\"\n * convertJsonPathToSchemaPath(\"\") // \"\"\n */\nexport function convertJsonPathToSchemaPath(jsonPath: string): string {\n if (jsonPath === '') {\n return '';\n }\n\n const segments = parsePathSegments(jsonPath);\n\n let schemaPath = '';\n for (const segment of segments) {\n if (typeof segment === 'number') {\n schemaPath += '/items';\n } else {\n schemaPath += `/properties/${segment}`;\n }\n }\n\n return schemaPath;\n}\n","import { JsonArrayValueStore } from '../model/value/json-array-value.store.js';\nimport { JsonObjectValueStore } from '../model/value/json-object-value.store.js';\nimport { JsonValueStore } from '../model/value/json-value.store.js';\nimport { parsePath } from './json-path-utils.js';\n\nexport const getJsonValueStoreByPath = (\n root: JsonValueStore,\n path: string,\n): JsonValueStore => {\n if (!path) {\n return root;\n }\n\n const segments = parsePath(path);\n\n let current: JsonValueStore = root;\n\n for (const seg of segments) {\n if (current instanceof JsonObjectValueStore) {\n const next = current.value[String(seg)];\n if (!next) {\n throw new Error(`Path not found at segment \"${seg}\"`);\n }\n current = next;\n } else if (current instanceof JsonArrayValueStore) {\n if (typeof seg !== 'number') {\n throw new Error(`Invalid array index \"${seg}\"`);\n }\n const next = current.value[seg];\n if (!next) {\n throw new Error(`Path not found at segment \"${seg}\"`);\n }\n current = next;\n } else {\n throw new Error(`Cannot navigate into primitive at segment \"${seg}\"`);\n }\n }\n\n return current;\n};\n\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonValueStore } from '../model/value/json-value.store.js';\nimport { traverseValue } from './traverseValue.js';\n\nexport type ReplaceForeignKeyValueOptions = {\n valueStore: JsonValueStore;\n foreignKey: string;\n value: string;\n nextValue: string;\n};\n\nexport const replaceForeignKeyValue = (\n options: ReplaceForeignKeyValueOptions,\n) => {\n let wasUpdated = false;\n\n traverseValue(options.valueStore, (item) => {\n if (\n item.type === JsonSchemaTypeName.String &&\n item.foreignKey === options.foreignKey &&\n item.value === options.value\n ) {\n item.value = options.nextValue;\n wasUpdated = true;\n }\n });\n\n return wasUpdated;\n};\n","import { SystemSchemaIds } from '../consts/system-schema-ids.js';\nimport { createJsonSchemaStore } from './createJsonSchemaStore.js';\nimport {\n fileSchema,\n rowCreatedAtSchema,\n rowCreatedIdSchema,\n rowHashSchema,\n rowPublishedAtSchema,\n rowSchemaHashSchema,\n rowUpdatedAtSchema,\n rowVersionIdSchema,\n rowIdSchema,\n} from '../plugins/index.js';\nimport { JsonSchema } from '../types/schema.types.js';\n\nexport const pluginRefs: Readonly<Record<string, JsonSchema>> = {\n [SystemSchemaIds.RowId]: rowIdSchema,\n [SystemSchemaIds.RowVersionId]: rowVersionIdSchema,\n [SystemSchemaIds.RowCreatedId]: rowCreatedIdSchema,\n [SystemSchemaIds.RowCreatedAt]: rowCreatedAtSchema,\n [SystemSchemaIds.RowPublishedAt]: rowPublishedAtSchema,\n [SystemSchemaIds.RowUpdatedAt]: rowUpdatedAtSchema,\n [SystemSchemaIds.RowHash]: rowHashSchema,\n [SystemSchemaIds.RowSchemaHash]: rowSchemaHashSchema,\n [SystemSchemaIds.File]: fileSchema,\n};\n\nexport const resolveRefs = (schema: JsonSchema) => {\n const store = createJsonSchemaStore(schema, pluginRefs);\n return store.getPlainSchema({ skip$Ref: true });\n};\n","import { JsonSchema } from '../types/schema.types.js';\nimport { JsonValue } from '../types/json.types.js';\nimport { JsonPatch } from '../types/json-patch.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\nimport { JsonValueStore } from '../model/value/json-value.store.js';\nimport { getTransformation } from '../model/value/value-transformation.js';\nimport { createJsonSchemaStore } from './createJsonSchemaStore.js';\nimport { createJsonValueStore } from './createJsonValueStore.js';\nimport {\n applyAddPatch,\n applyMovePatch,\n applyRemovePatch,\n applyReplacePatch,\n} from './applyPatches.js';\n\nexport class SchemaTable {\n private readonly rows = new Map<string, JsonValueStore>();\n private store: JsonSchemaStore;\n\n constructor(\n schema: JsonSchema,\n private readonly refs: Record<string, JsonSchema> = {},\n ) {\n this.store = createJsonSchemaStore(schema, refs);\n }\n\n public applyPatches(patches: JsonPatch[]): void {\n patches.forEach((patch) => {\n switch (patch.op) {\n case 'replace': {\n const nextStore = applyReplacePatch(this.store, patch, this.refs);\n if (nextStore !== this.store) {\n this.migrateRows(nextStore);\n }\n break;\n }\n case 'remove': {\n applyRemovePatch(this.store, patch);\n break;\n }\n case 'add': {\n applyAddPatch(this.store, patch, this.refs);\n break;\n }\n case 'move': {\n applyMovePatch(this.store, patch);\n break;\n }\n default:\n throw new Error(`Unsupported patch operation`);\n }\n });\n }\n\n public getSchema(): JsonSchema {\n return this.store.getPlainSchema();\n }\n\n public addRow(rowId: string, data: JsonValue) {\n const row = createJsonValueStore(this.store, rowId, data);\n\n this.rows.set(rowId, row);\n }\n\n public getRow(id: string): JsonValue {\n const row = this.rows.get(id);\n\n if (!row) {\n throw new Error('Invalid id');\n }\n\n return row.getPlainValue();\n }\n\n public getRows(): { id: string; data: JsonValue }[] {\n return [...this.rows].map(([id, data]) => ({\n id,\n data: data.getPlainValue(),\n }));\n }\n\n private migrateRows(nextStore: JsonSchemaStore): void {\n const transformation = getTransformation(this.store, nextStore);\n\n if (transformation) {\n for (const [rowId, row] of this.rows) {\n const rawNextValue = transformation(\n row.getPlainValue(),\n nextStore.default,\n ) as JsonValue;\n\n const nextRow = createJsonValueStore(nextStore, rowId, rawNextValue);\n this.rows.set(rowId, nextRow);\n }\n }\n\n this.store = nextStore;\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/createJsonSchemaStore.ts","../src/lib/getJsonSchemaStoreByPath.ts","../src/lib/getParentForPath.ts","../src/lib/validateJsonFieldName.ts","../src/lib/applyPatches.ts","../src/lib/getDBJsonPathByJsonSchemaStore.ts","../src/lib/getPathByStore.ts","../src/lib/traverseStore.ts","../src/lib/getForeignKeyPatchesFromSchema.ts","../src/lib/getForeignKeysFromSchema.ts","../src/lib/traverseValue.ts","../src/lib/getForeignKeysFromValue.ts","../src/lib/getInvalidFieldNamesInSchema.ts","../src/lib/json-path-utils.ts","../src/lib/getJsonValueByPath.ts","../src/lib/replaceForeignKeyValue.ts","../src/lib/resolveRefs.ts","../src/lib/schema-table.ts"],"names":["obj"],"mappings":";;;;AAkBO,IAAM,qBAAA,GAAw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ema.types.js';\nimport { JsonArrayStore } from '../model/schema/json-array.store.js';\nimport { JsonBooleanStore } from '../model/schema/json-boolean.store.js';\nimport { JsonNumberStore } from '../model/schema/json-number.store.js';\nimport { JsonStringStore } from '../model/schema/json-string.store.js';\nimport { JsonObjectStore } from '../model/schema/json-object.store.js';\nimport {\n JsonSchemaStore,\n JsonSchemaStorePrimitives,\n} from '../model/schema/json-schema.store.js';\n\nexport type RefsType = Record<string, JsonSchema>;\n\nexport const createJsonSchemaStore = (\n schema: JsonSchema,\n refs: RefsType = {},\n): JsonSchemaStore => {\n if ('$ref' in schema) {\n const refSchema: JsonSchema | undefined = refs[schema.$ref];\n\n if (!refSchema) {\n throw new Error(`Not found schema for $ref=\"${schema.$ref}\"`);\n }\n\n const refStore = createJsonSchemaStore(refSchema, refs);\n saveSharedFields(refStore, schema);\n refStore.$ref = schema.$ref;\n return refStore;\n } else if (schema.type === JsonSchemaTypeName.Object) {\n const objectStore = createJsonObjectSchemaStore(schema, refs);\n saveSharedFields(objectStore, schema);\n\n return objectStore;\n } else if (schema.type === JsonSchemaTypeName.Array) {\n const itemsStore = createJsonSchemaStore(schema.items, refs);\n const arrayStore = new JsonArrayStore(itemsStore);\n saveSharedFields(arrayStore, schema);\n\n return arrayStore;\n } else {\n const primitivesStore = createPrimitiveStoreBySchema(schema);\n saveSharedFields(primitivesStore, schema);\n primitivesStore.readOnly = schema.readOnly;\n\n return primitivesStore;\n }\n};\n\nexport const createJsonObjectSchemaStore = (\n value: JsonObjectSchema,\n refs: RefsType,\n): JsonObjectStore => {\n const store = new JsonObjectStore();\n\n for (const requiredField of value.required) {\n if (!value.properties[requiredField]) {\n throw new Error(\n `Not found required field \"${requiredField}\" in \"properties\"`,\n );\n }\n }\n\n Object.entries(value.properties).forEach(([name, item]) => {\n store.addPropertyWithStore(name, createJsonSchemaStore(item, refs));\n });\n\n return store;\n};\n\nexport const createPrimitiveStoreBySchema = (\n schema: JsonSchemaPrimitives,\n): JsonSchemaStorePrimitives => {\n if (schema.type === JsonSchemaTypeName.String) {\n const stringStore = new JsonStringStore();\n stringStore.foreignKey = schema.foreignKey;\n stringStore.format = schema.format;\n stringStore.enum = schema.enum;\n stringStore.contentMediaType = schema.contentMediaType;\n stringStore.pattern = schema.pattern;\n return stringStore;\n } else if (schema.type === JsonSchemaTypeName.Number) {\n return new JsonNumberStore();\n } else if (schema.type === JsonSchemaTypeName.Boolean) {\n return new JsonBooleanStore();\n } else {\n throw new Error('this type is not allowed');\n }\n};\n\nexport const saveSharedFields = (\n store: JsonSchemaStore,\n schema: JsonSchema,\n) => {\n store.title = schema.title;\n store.description = schema.description;\n store.deprecated = schema.deprecated;\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\n\nexport const getJsonSchemaStoreByPath = (\n store: JsonSchemaStore,\n path: string,\n): JsonSchemaStore => {\n if (path === '') {\n return store;\n }\n\n if (path === '/') {\n throw new Error(\n 'invalid root path, need to use path=\"\" instead of path=\"/\"',\n );\n }\n\n const tokens = path.split('/');\n tokens.shift();\n\n let currentStore = store;\n\n let currentToken = tokens.shift();\n let currentPath = '';\n\n while (currentToken) {\n if (currentStore.type === JsonSchemaTypeName.Object) {\n if (currentToken !== 'properties') {\n throw new Error(\n `Expected \"${currentPath}/properties/*\" instead of ${currentPath}/${currentToken}/*`,\n );\n }\n\n currentPath = `${currentPath}/${currentToken}`;\n\n currentToken = tokens.shift();\n\n if (!currentToken) {\n throw new Error(`Expected property name after \"${currentPath}\"`);\n }\n\n const foundCurrentStore = currentStore.getProperty(currentToken);\n\n if (!foundCurrentStore) {\n throw new Error(`Not found \"${currentToken}\" in \"${currentPath}\"`);\n }\n\n currentStore = foundCurrentStore;\n currentPath = `${currentPath}/${currentToken}`;\n\n currentToken = tokens.shift();\n } else if (currentStore.type === JsonSchemaTypeName.Array) {\n if (currentToken !== 'items') {\n throw new Error(\n `Expected \"${currentPath}/items/*\" instead of ${currentPath}/${currentToken}/*`,\n );\n }\n\n currentPath = `${currentPath}/${currentToken}`;\n\n currentStore = currentStore.items;\n\n currentToken = tokens.shift();\n } else {\n throw new Error(`Unexpected \"${currentToken}\" in \"${currentPath}\"`);\n }\n }\n\n return currentStore;\n};\n","export const getParentForPath = (\n path: string,\n): { parentPath: string; field: string } => {\n if (path === '' || path === '/') {\n throw new Error('Invalid path');\n }\n\n const tokens = path.split('/');\n tokens.shift();\n\n let currentToken = tokens.shift();\n\n let parentPath = '';\n let field = '';\n\n while (currentToken) {\n if (currentToken === 'properties') {\n currentToken = tokens.shift();\n\n if (!currentToken) {\n throw new Error('Invalid path');\n }\n\n field = currentToken;\n\n currentToken = tokens.shift();\n\n if (currentToken) {\n parentPath = `${parentPath}/properties/${field}`;\n }\n } else if (currentToken === 'items') {\n field = currentToken;\n\n currentToken = tokens.shift();\n\n if (currentToken && !['items', 'properties'].includes(currentToken)) {\n throw new Error('Invalid path');\n } else if (currentToken) {\n parentPath = `${parentPath}/items`;\n }\n } else {\n throw new Error('Invalid path');\n }\n }\n\n return {\n parentPath: parentPath,\n field,\n };\n};\n","const maxLength = 64;\n\nexport const VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE = `It must contain between 1 and ${maxLength} characters, start with a letter or underscore (_), cannot start with two underscores (__), and can only include letters (a-z, A-Z), numbers (0-9), hyphens (-), and underscores (_).`;\n\nconst validPattern = /^(?!__)[a-zA-Z_][a-zA-Z0-9-_]*$/;\n\nexport const validateJsonFieldName = (id: string) => {\n const isInvalid =\n id.length < 1 || id.length > maxLength || !validPattern.test(id);\n\n return !isInvalid;\n};\n","import { JsonSchema, JsonSchemaTypeName } from '../types/schema.types.js';\nimport {\n JsonPatchAdd,\n JsonPatchMove,\n JsonPatchRemove,\n JsonPatchReplace,\n} from '../types/json-patch.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\nimport { createJsonSchemaStore } from './createJsonSchemaStore.js';\nimport { getJsonSchemaStoreByPath } from './getJsonSchemaStoreByPath.js';\nimport { getParentForPath } from './getParentForPath.js';\nimport {\n VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE,\n validateJsonFieldName,\n} from './validateJsonFieldName.js';\n\nexport const applyReplacePatch = (\n store: JsonSchemaStore,\n patch: JsonPatchReplace,\n refs: Record<string, JsonSchema> = {},\n): JsonSchemaStore => {\n const patchStore = createJsonSchemaStore(patch.value, refs);\n const foundStore = getJsonSchemaStoreByPath(store, patch.path);\n\n const parent = foundStore.parent;\n\n if (!parent) {\n return patchStore;\n }\n\n if (parent.type === JsonSchemaTypeName.Object) {\n parent.migratePropertyWithStore(foundStore.name, patchStore);\n } else if (parent.type === JsonSchemaTypeName.Array) {\n parent.migrateItems(patchStore);\n } else {\n throw new Error('Invalid parent');\n }\n\n return store;\n};\n\nexport const applyRemovePatch = (\n rootStore: JsonSchemaStore,\n patch: JsonPatchRemove,\n): void => {\n const foundStore = getJsonSchemaStoreByPath(rootStore, patch.path);\n const parent = foundStore.parent;\n\n if (!parent) {\n throw new Error('Parent does not exist');\n }\n\n if (parent.type !== JsonSchemaTypeName.Object) {\n throw new Error('Cannot remove from non-object');\n }\n\n parent.removeProperty(foundStore.name);\n};\n\nexport const applyAddPatch = (\n rootStore: JsonSchemaStore,\n patch: JsonPatchAdd,\n refs: Record<string, JsonSchema> = {},\n): void => {\n const patchStore = createJsonSchemaStore(patch.value, refs);\n\n const { parentPath, field } = getParentForPath(patch.path);\n const foundParent = getJsonSchemaStoreByPath(rootStore, parentPath);\n\n if (!foundParent) {\n throw new Error('Parent does not exist');\n }\n\n if (foundParent.type !== JsonSchemaTypeName.Object) {\n throw new Error('Cannot add to non-object');\n }\n\n if (foundParent.getProperty(field)) {\n throw new Error(`Field \"${field}\" already exists in parent`);\n }\n\n foundParent.addPropertyWithStore(field, patchStore);\n};\n\nexport const applyMovePatch = (\n store: JsonSchemaStore,\n patch: JsonPatchMove,\n): void => {\n const { parentPath: fromParentPath, field: fromField } = getParentForPath(\n patch.from,\n );\n const { parentPath: toParentPath, field: toField } = getParentForPath(\n patch.path,\n );\n\n const foundFromParent = getJsonSchemaStoreByPath(store, fromParentPath);\n const foundToParent = getJsonSchemaStoreByPath(store, toParentPath);\n\n const isValidToField = validateJsonFieldName(toField);\n\n if (!isValidToField) {\n throw new Error(\n `Invalid name: ${toField}. ${VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE}`,\n );\n }\n\n if (!foundFromParent || !foundToParent) {\n throw new Error('Cannot move from or to non-existent parent');\n }\n\n if (foundFromParent.type !== JsonSchemaTypeName.Object) {\n throw new Error('Cannot move from non-object parent');\n }\n\n const foundFromField = getJsonSchemaStoreByPath(store, patch.from);\n\n const isMovedPropertyInSameParentPatch =\n foundFromParent === foundToParent &&\n foundFromParent.type === JsonSchemaTypeName.Object &&\n foundFromParent.getProperty(fromField);\n\n if (isMovedPropertyInSameParentPatch) {\n return foundFromParent.changeName(fromField, toField);\n }\n\n if (foundToParent.type === JsonSchemaTypeName.Object) {\n if (foundToParent.getProperty(toField)) {\n foundToParent.removeProperty(toField);\n }\n foundToParent.addPropertyWithStore(toField, foundFromField);\n foundFromParent.removeProperty(fromField);\n return;\n }\n\n if (foundToParent.type === JsonSchemaTypeName.Array) {\n foundFromParent.removeProperty(fromField);\n foundToParent.replaceItems(foundFromField);\n\n return;\n }\n throw new Error('Invalid type of \"to\" parent');\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\n\nexport const getDBJsonPathByJsonSchemaStore = (\n store: JsonSchemaStore,\n): string => {\n let node = store;\n\n let path = '';\n\n while (node.parent) {\n if (node.parent.type === JsonSchemaTypeName.Object) {\n path = `.${node.name}${path}`;\n } else if (node.parent.type === JsonSchemaTypeName.Array) {\n path = `[*]${path}`;\n }\n\n node = node.parent;\n }\n\n if (!path) {\n return '$';\n }\n\n return `$${path}`;\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\n\nexport const getPathByStore = (store: JsonSchemaStore): string => {\n let node = store;\n\n let path = '';\n\n while (node.parent) {\n if (node.parent.type === JsonSchemaTypeName.Object) {\n path = `/properties/${node.name}${path}`;\n } else if (node.parent.type === JsonSchemaTypeName.Array) {\n path = `/items${path}`;\n }\n\n node = node.parent;\n }\n\n if (!path) {\n return '/';\n }\n\n return `${path}`;\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\n\nexport const traverseStore = (\n store: JsonSchemaStore,\n callback: (node: JsonSchemaStore) => void,\n) => {\n callback(store);\n\n if (store.type === JsonSchemaTypeName.Object) {\n Object.values(store.properties).forEach((item) => {\n traverseStore(item, callback);\n });\n } else if (store.type === JsonSchemaTypeName.Array) {\n traverseStore(store.items, callback);\n }\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonPatch, JsonPatchReplace } from '../types/json-patch.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\nimport { getPathByStore } from './getPathByStore.js';\nimport { traverseStore } from './traverseStore.js';\n\nexport const getForeignKeyPatchesFromSchema = (\n store: JsonSchemaStore,\n options: { tableId: string; nextTableId: string },\n) => {\n const stores: JsonPatch[] = [];\n\n traverseStore(store, (item) => {\n if (\n item.type === JsonSchemaTypeName.String &&\n item.foreignKey === options.tableId\n ) {\n item.foreignKey = options.nextTableId;\n\n const patch: JsonPatchReplace = {\n op: 'replace',\n path: getPathByStore(item),\n value: item.getPlainSchema(),\n };\n\n stores.push(patch);\n }\n });\n\n return stores;\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\nimport { traverseStore } from './traverseStore.js';\n\nexport const getForeignKeysFromSchema = (store: JsonSchemaStore): string[] => {\n const foreignKeys = new Set<string>();\n\n traverseStore(store, (item) => {\n if (item.type === JsonSchemaTypeName.String && item.foreignKey) {\n foreignKeys.add(item.foreignKey);\n }\n });\n\n return [...foreignKeys].sort((a, b) => a.localeCompare(b));\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonValueStore } from '../model/value/json-value.store.js';\n\nexport const traverseValue = (\n store: JsonValueStore,\n callback: (node: JsonValueStore) => void,\n) => {\n callback(store);\n\n if (store.type === JsonSchemaTypeName.Object) {\n Object.values(store.value).forEach((item) => {\n traverseValue(item, callback);\n });\n } else if (store.type === JsonSchemaTypeName.Array) {\n store.value.forEach((itemValue) => {\n traverseValue(itemValue, callback);\n });\n }\n};\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonValueStore } from '../model/value/json-value.store.js';\nimport { traverseValue } from './traverseValue.js';\n\nexport type GetForeignKeysFromValueType = {\n tableId: string;\n rowIds: string[];\n};\n\nexport const getForeignKeysFromValue = (\n value: JsonValueStore,\n): GetForeignKeysFromValueType[] => {\n const foreignKeys = new Map<string, Set<string>>();\n\n traverseValue(value, (item) => {\n if (item.type === JsonSchemaTypeName.String && item.foreignKey) {\n let tableForeignKey = foreignKeys.get(item.foreignKey);\n\n if (!tableForeignKey) {\n tableForeignKey = new Set<string>();\n foreignKeys.set(item.foreignKey, tableForeignKey);\n }\n\n tableForeignKey.add(item.getPlainValue());\n }\n });\n\n return [...foreignKeys].map(([tableId, rowIds]) => ({\n tableId,\n rowIds: [...rowIds].sort((a, b) => a.localeCompare(b)),\n }));\n};\n","import { JsonSchema, JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\nimport { createJsonSchemaStore } from './createJsonSchemaStore.js';\nimport { traverseStore } from './traverseStore.js';\nimport { validateJsonFieldName } from './validateJsonFieldName.js';\n\nexport const getInvalidFieldNamesInSchema = (\n schema: JsonSchema,\n refs: Record<string, JsonSchema> = {},\n) => {\n const schemaStore = createJsonSchemaStore(schema, refs);\n\n const invalidFields: JsonSchemaStore[] = [];\n\n traverseStore(schemaStore, (item) => {\n if (item.parent?.type === JsonSchemaTypeName.Object) {\n if (!validateJsonFieldName(item.name)) {\n invalidFields.push(item);\n }\n }\n });\n\n return invalidFields;\n};\n","import { JsonArray, JsonObject, JsonValue } from '../types';\n\nfunction parsePathSegments(path: string): (string | number)[] {\n const segments: (string | number)[] = [];\n const regex = /([^.[\\]]+)|\\[(\\d+)]/g;\n let match: RegExpExecArray | null;\n\n while ((match = regex.exec(path))) {\n if (match[1] !== undefined) {\n segments.push(match[1]);\n } else if (match[2] !== undefined) {\n segments.push(Number(match[2]));\n }\n }\n\n return segments;\n}\n\n/**\n * Parse path string into segments\n *\n * @param path - Path string (e.g., \"title\", \"address.city\", \"tags[0]\", \"users[0].name\")\n * @returns Array of segments (strings and numbers)\n *\n * @example\n * parsePath(\"title\") // [\"title\"]\n * parsePath(\"address.city\") // [\"address\", \"city\"]\n * parsePath(\"tags[0]\") // [\"tags\", 0]\n * parsePath(\"users[0].name\") // [\"users\", 0, \"name\"]\n * parsePath(\"matrix[0][1]\") // [\"matrix\", 0, 1]\n */\nexport function parsePath(path: string): (string | number)[] {\n if (!path) {\n return [];\n }\n\n return parsePathSegments(path);\n}\n\n/**\n * Get value by path from plain JavaScript object\n *\n * @param obj - Object to navigate\n * @param path - Path string (e.g., \"address.city\", \"tags[0]\")\n * @returns Value at path, or undefined if path doesn't exist\n *\n * @example\n * const obj = { address: { city: \"Moscow\" }, tags: [\"a\", \"b\"] };\n * getValueByPath(obj, \"address.city\") // \"Moscow\"\n * getValueByPath(obj, \"tags[1]\") // \"b\"\n * getValueByPath(obj, \"nonexistent\") // undefined\n */\nexport function getValueByPath(\n obj: JsonValue | undefined,\n path: string,\n): JsonValue | undefined {\n if (!path) {\n return obj;\n }\n\n const segments = parsePath(path);\n let current: JsonValue | undefined = obj;\n\n for (const segment of segments) {\n if (current == null) {\n return undefined;\n }\n\n if (typeof segment === 'number') {\n if (!Array.isArray(current)) {\n return undefined;\n }\n current = current[segment];\n } else {\n if (typeof current !== 'object') {\n return undefined;\n }\n current = (current as JsonObject)[segment];\n }\n }\n\n return current;\n}\n\n/**\n * Set value by path in plain JavaScript object\n * Creates intermediate objects/arrays as needed\n *\n * @param obj - Object to modify\n * @param path - Path string (e.g., \"address.city\", \"tags[0]\")\n * @param value - Value to set\n *\n * @example\n * const obj = {};\n * setValueByPath(obj, \"address.city\", \"London\");\n * // obj is now { address: { city: \"London\" } }\n *\n * setValueByPath(obj, \"tags[0]\", \"first\");\n * // obj is now { address: { city: \"London\" }, tags: [\"first\"] }\n */\nexport function setValueByPath(\n obj: JsonValue,\n path: string,\n value: JsonValue,\n): void {\n if (!path) {\n throw new Error('Cannot set root value');\n }\n\n const segments = parsePath(path);\n let current: JsonValue | undefined = obj;\n\n for (let i = 0; i < segments.length - 1; i++) {\n const segment = segments[i] as string | number;\n const nextSegment = segments[i + 1];\n\n if (typeof segment === 'number') {\n if (!Array.isArray(current)) {\n throw new TypeError(\n `Cannot set array index on non-array at segment ${i}`,\n );\n }\n\n const arr: JsonArray = current;\n\n if (segment > arr.length) {\n throw new Error(\n `Cannot create sparse array: index ${segment} is out of bounds (array length: ${arr.length}) at segment ${i}`,\n );\n }\n\n if (arr[segment] == null) {\n arr[segment] = typeof nextSegment === 'number' ? [] : {};\n }\n\n current = arr[segment];\n } else if (typeof segment === 'string') {\n if (\n current == null ||\n typeof current !== 'object' ||\n Array.isArray(current)\n ) {\n throw new Error(`Cannot set property on non-object at segment ${i}`);\n }\n\n const obj: JsonObject = current;\n if (obj[segment] == null) {\n obj[segment] = typeof nextSegment === 'number' ? [] : {};\n }\n\n current = obj[segment];\n }\n }\n\n const lastSegment = segments[segments.length - 1] as string | number;\n\n if (typeof lastSegment === 'number') {\n if (!Array.isArray(current)) {\n throw new TypeError(\n `Cannot set array index on non-array at segment ${segments.length - 1}`,\n );\n }\n\n const arr: JsonArray = current;\n\n if (lastSegment > arr.length) {\n throw new Error(\n `Cannot create sparse array: index ${lastSegment} is out of bounds (array length: ${arr.length})`,\n );\n }\n\n arr[lastSegment] = value;\n } else if (typeof lastSegment === 'string') {\n if (\n current == null ||\n typeof current !== 'object' ||\n Array.isArray(current)\n ) {\n throw new Error(\n `Cannot set property on non-object at segment ${segments.length - 1}`,\n );\n }\n (current as JsonObject)[lastSegment] = value;\n }\n}\n\n/**\n * Check if path exists in object\n *\n * @param obj - Object to check\n * @param path - Path string (e.g., \"address.city\", \"tags[0]\")\n * @returns true if path exists and value is not undefined\n *\n * @example\n * const obj = { address: { city: \"Moscow\" } };\n * hasPath(obj, \"address.city\") // true\n * hasPath(obj, \"address.country\") // false\n */\nexport function hasPath(obj: JsonValue, path: string): boolean {\n const value = getValueByPath(obj, path);\n return value !== undefined;\n}\n\n/**\n * Deep equality comparison for plain JavaScript values\n * Handles objects, arrays, primitives, null, undefined\n *\n * @param a - First value\n * @param b - Second value\n * @returns true if values are deeply equal\n *\n * @example\n * deepEqual({ a: 1, b: 2 }, { a: 1, b: 2 }) // true\n * deepEqual([1, 2, 3], [1, 2, 3]) // true\n * deepEqual({ a: 1 }, { a: 2 }) // false\n * deepEqual(null, null) // true\n * deepEqual(undefined, undefined) // true\n */\nexport function deepEqual(a: unknown, b: unknown): boolean {\n if (a === b) {\n return true;\n }\n\n if (a === null && b === null) {\n return true;\n }\n\n if (a === undefined && b === undefined) {\n return true;\n }\n\n if (a == null || b == null) {\n return false;\n }\n\n if (typeof a !== typeof b) {\n return false;\n }\n\n if (typeof a !== 'object') {\n return false;\n }\n\n if (Array.isArray(a) && Array.isArray(b)) {\n const arrA = a as JsonArray;\n const arrB = b as JsonArray;\n if (arrA.length !== arrB.length) {\n return false;\n }\n for (let i = 0; i < arrA.length; i++) {\n const itemA = arrA[i];\n const itemB = arrB[i];\n\n if (itemA !== undefined && itemB !== undefined) {\n if (itemA === null && itemB === null) {\n continue;\n }\n if (!deepEqual(itemA, itemB)) {\n return false;\n }\n } else if (itemA !== itemB) {\n return false;\n }\n }\n return true;\n }\n\n if (Array.isArray(a) || Array.isArray(b)) {\n return false;\n }\n\n const objA = a as JsonObject;\n const objB = b as JsonObject;\n const keysA = Object.keys(objA);\n const keysB = Object.keys(objB);\n\n if (keysA.length !== keysB.length) {\n return false;\n }\n\n for (const key of keysA) {\n if (!keysB.includes(key)) {\n return false;\n }\n const valA = objA[key];\n const valB = objB[key];\n\n if (valA !== undefined && valB !== undefined) {\n if (valA === null && valB === null) {\n continue;\n }\n if (!deepEqual(valA, valB)) {\n return false;\n }\n } else if (valA !== valB) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Convert simplified JSON path to JSON Schema path\n *\n * @param jsonPath - JSON path string (e.g., \"title\", \"address.city\", \"tags[0]\", \"users[0].name\")\n * @returns JSON Schema path string\n *\n * @example\n * convertJsonPathToSchemaPath(\"title\") // \"/properties/title\"\n * convertJsonPathToSchemaPath(\"address.city\") // \"/properties/address/properties/city\"\n * convertJsonPathToSchemaPath(\"tags[0]\") // \"/properties/tags/items\"\n * convertJsonPathToSchemaPath(\"users[0].name\") // \"/properties/users/items/properties/name\"\n * convertJsonPathToSchemaPath(\"\") // \"\"\n */\nexport function convertJsonPathToSchemaPath(jsonPath: string): string {\n if (jsonPath === '') {\n return '';\n }\n\n const segments = parsePathSegments(jsonPath);\n\n let schemaPath = '';\n for (const segment of segments) {\n if (typeof segment === 'number') {\n schemaPath += '/items';\n } else {\n schemaPath += `/properties/${segment}`;\n }\n }\n\n return schemaPath;\n}\n","import { JsonArrayValueStore } from '../model/value/json-array-value.store.js';\nimport { JsonObjectValueStore } from '../model/value/json-object-value.store.js';\nimport { JsonValueStore } from '../model/value/json-value.store.js';\nimport { parsePath } from './json-path-utils.js';\n\nexport const getJsonValueStoreByPath = (\n root: JsonValueStore,\n path: string,\n): JsonValueStore => {\n if (!path) {\n return root;\n }\n\n const segments = parsePath(path);\n\n let current: JsonValueStore = root;\n\n for (const seg of segments) {\n if (current instanceof JsonObjectValueStore) {\n const next = current.value[String(seg)];\n if (!next) {\n throw new Error(`Path not found at segment \"${seg}\"`);\n }\n current = next;\n } else if (current instanceof JsonArrayValueStore) {\n if (typeof seg !== 'number') {\n throw new Error(`Invalid array index \"${seg}\"`);\n }\n const next = current.value[seg];\n if (!next) {\n throw new Error(`Path not found at segment \"${seg}\"`);\n }\n current = next;\n } else {\n throw new Error(`Cannot navigate into primitive at segment \"${seg}\"`);\n }\n }\n\n return current;\n};\n\n","import { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonValueStore } from '../model/value/json-value.store.js';\nimport { traverseValue } from './traverseValue.js';\n\nexport type ReplaceForeignKeyValueOptions = {\n valueStore: JsonValueStore;\n foreignKey: string;\n value: string;\n nextValue: string;\n};\n\nexport const replaceForeignKeyValue = (\n options: ReplaceForeignKeyValueOptions,\n) => {\n let wasUpdated = false;\n\n traverseValue(options.valueStore, (item) => {\n if (\n item.type === JsonSchemaTypeName.String &&\n item.foreignKey === options.foreignKey &&\n item.value === options.value\n ) {\n item.value = options.nextValue;\n wasUpdated = true;\n }\n });\n\n return wasUpdated;\n};\n","import { SystemSchemaIds } from '../consts/system-schema-ids.js';\nimport { createJsonSchemaStore } from './createJsonSchemaStore.js';\nimport {\n fileSchema,\n rowCreatedAtSchema,\n rowCreatedIdSchema,\n rowHashSchema,\n rowPublishedAtSchema,\n rowSchemaHashSchema,\n rowUpdatedAtSchema,\n rowVersionIdSchema,\n rowIdSchema,\n} from '../plugins/index.js';\nimport { JsonSchema } from '../types/schema.types.js';\n\nexport const pluginRefs: Readonly<Record<string, JsonSchema>> = {\n [SystemSchemaIds.RowId]: rowIdSchema,\n [SystemSchemaIds.RowVersionId]: rowVersionIdSchema,\n [SystemSchemaIds.RowCreatedId]: rowCreatedIdSchema,\n [SystemSchemaIds.RowCreatedAt]: rowCreatedAtSchema,\n [SystemSchemaIds.RowPublishedAt]: rowPublishedAtSchema,\n [SystemSchemaIds.RowUpdatedAt]: rowUpdatedAtSchema,\n [SystemSchemaIds.RowHash]: rowHashSchema,\n [SystemSchemaIds.RowSchemaHash]: rowSchemaHashSchema,\n [SystemSchemaIds.File]: fileSchema,\n};\n\nexport const resolveRefs = (schema: JsonSchema) => {\n const store = createJsonSchemaStore(schema, pluginRefs);\n return store.getPlainSchema({ skip$Ref: true });\n};\n","import { JsonSchema } from '../types/schema.types.js';\nimport { JsonValue } from '../types/json.types.js';\nimport { JsonPatch } from '../types/json-patch.types.js';\nimport { JsonSchemaStore } from '../model/schema/json-schema.store.js';\nimport { JsonValueStore } from '../model/value/json-value.store.js';\nimport { getTransformation } from '../model/value/value-transformation.js';\nimport { createJsonSchemaStore } from './createJsonSchemaStore.js';\nimport { createJsonValueStore } from './createJsonValueStore.js';\nimport {\n applyAddPatch,\n applyMovePatch,\n applyRemovePatch,\n applyReplacePatch,\n} from './applyPatches.js';\n\nexport class SchemaTable {\n private readonly rows = new Map<string, JsonValueStore>();\n private store: JsonSchemaStore;\n\n constructor(\n schema: JsonSchema,\n private readonly refs: Record<string, JsonSchema> = {},\n ) {\n this.store = createJsonSchemaStore(schema, refs);\n }\n\n public applyPatches(patches: JsonPatch[]): void {\n patches.forEach((patch) => {\n switch (patch.op) {\n case 'replace': {\n const nextStore = applyReplacePatch(this.store, patch, this.refs);\n if (nextStore !== this.store) {\n this.migrateRows(nextStore);\n }\n break;\n }\n case 'remove': {\n applyRemovePatch(this.store, patch);\n break;\n }\n case 'add': {\n applyAddPatch(this.store, patch, this.refs);\n break;\n }\n case 'move': {\n applyMovePatch(this.store, patch);\n break;\n }\n default:\n throw new Error(`Unsupported patch operation`);\n }\n });\n }\n\n public getSchema(): JsonSchema {\n return this.store.getPlainSchema();\n }\n\n public addRow(rowId: string, data: JsonValue) {\n const row = createJsonValueStore(this.store, rowId, data);\n\n this.rows.set(rowId, row);\n }\n\n public getRow(id: string): JsonValue {\n const row = this.rows.get(id);\n\n if (!row) {\n throw new Error('Invalid id');\n }\n\n return row.getPlainValue();\n }\n\n public getRows(): { id: string; data: JsonValue }[] {\n return [...this.rows].map(([id, data]) => ({\n id,\n data: data.getPlainValue(),\n }));\n }\n\n private migrateRows(nextStore: JsonSchemaStore): void {\n const transformation = getTransformation(this.store, nextStore);\n\n if (transformation) {\n for (const [rowId, row] of this.rows) {\n const rawNextValue = transformation(\n row.getPlainValue(),\n nextStore.default,\n ) as JsonValue;\n\n const nextRow = createJsonValueStore(nextStore, rowId, rawNextValue);\n this.rows.set(rowId, nextRow);\n }\n }\n\n this.store = nextStore;\n }\n}\n"]}