@revisium/schema-toolkit 0.9.0 → 0.11.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.
Files changed (59) hide show
  1. package/dist/{chunk-DFL3HJ4Y.js → chunk-4BIANIHT.js} +10 -5
  2. package/dist/chunk-4BIANIHT.js.map +1 -0
  3. package/dist/{chunk-V2SSSD5X.cjs → chunk-B22UU3JK.cjs} +2 -2
  4. package/dist/chunk-B22UU3JK.cjs.map +1 -0
  5. package/dist/{chunk-WCFA4226.js → chunk-HY4VE7H2.js} +11 -5
  6. package/dist/chunk-HY4VE7H2.js.map +1 -0
  7. package/dist/{chunk-ZXLLJAMQ.js → chunk-L5MLJEC7.js} +2 -2
  8. package/dist/chunk-L5MLJEC7.js.map +1 -0
  9. package/dist/{chunk-VGTHMWJJ.cjs → chunk-T7VRK5OQ.cjs} +34 -6
  10. package/dist/chunk-T7VRK5OQ.cjs.map +1 -0
  11. package/dist/{chunk-JLIZ7QT2.cjs → chunk-TMWPWGUN.cjs} +11 -5
  12. package/dist/chunk-TMWPWGUN.cjs.map +1 -0
  13. package/dist/{chunk-QAIYSZIR.cjs → chunk-UJBE43WI.cjs} +18 -13
  14. package/dist/chunk-UJBE43WI.cjs.map +1 -0
  15. package/dist/{chunk-ASXCDIN2.js → chunk-UM4JZEOH.js} +33 -7
  16. package/dist/chunk-UM4JZEOH.js.map +1 -0
  17. package/dist/index.cjs +89 -81
  18. package/dist/index.d.cts +4 -4
  19. package/dist/index.d.ts +4 -4
  20. package/dist/index.js +4 -4
  21. package/dist/{json-patch.types-DiJBqfxV.d.ts → json-patch.types-CYt9TCu3.d.ts} +1 -1
  22. package/dist/{json-patch.types-lByaF-OL.d.cts → json-patch.types-DUcWbQRY.d.cts} +1 -1
  23. package/dist/{json-string.store-BNF1Y93E.d.cts → json-string.store-CcZ197KO.d.cts} +4 -1
  24. package/dist/{json-string.store-qHcWNv07.d.ts → json-string.store-DckDcMVN.d.ts} +4 -1
  25. package/dist/lib/index.cjs +41 -41
  26. package/dist/lib/index.d.cts +3 -3
  27. package/dist/lib/index.d.ts +3 -3
  28. package/dist/lib/index.js +3 -3
  29. package/dist/mocks/index.cjs +1 -1
  30. package/dist/mocks/index.d.cts +2 -2
  31. package/dist/mocks/index.d.ts +2 -2
  32. package/dist/mocks/index.js +1 -1
  33. package/dist/model/index.cjs +26 -26
  34. package/dist/model/index.d.cts +3 -3
  35. package/dist/model/index.d.ts +3 -3
  36. package/dist/model/index.js +2 -2
  37. package/dist/plugins/index.cjs +1 -1
  38. package/dist/plugins/index.d.cts +9 -1
  39. package/dist/plugins/index.d.ts +9 -1
  40. package/dist/plugins/index.js +1 -1
  41. package/dist/{schema.types-Q3MYTp8z.d.cts → schema.types-CLHMJmkJ.d.cts} +8 -1
  42. package/dist/{schema.types-Q3MYTp8z.d.ts → schema.types-CLHMJmkJ.d.ts} +8 -1
  43. package/dist/types/index.cjs +2 -2
  44. package/dist/types/index.d.cts +4 -4
  45. package/dist/types/index.d.ts +4 -4
  46. package/dist/types/index.js +1 -1
  47. package/dist/validation-schemas/index.cjs +23 -15
  48. package/dist/validation-schemas/index.d.cts +3 -1
  49. package/dist/validation-schemas/index.d.ts +3 -1
  50. package/dist/validation-schemas/index.js +1 -1
  51. package/package.json +1 -1
  52. package/dist/chunk-ASXCDIN2.js.map +0 -1
  53. package/dist/chunk-DFL3HJ4Y.js.map +0 -1
  54. package/dist/chunk-JLIZ7QT2.cjs.map +0 -1
  55. package/dist/chunk-QAIYSZIR.cjs.map +0 -1
  56. package/dist/chunk-V2SSSD5X.cjs.map +0 -1
  57. package/dist/chunk-VGTHMWJJ.cjs.map +0 -1
  58. package/dist/chunk-WCFA4226.js.map +0 -1
  59. package/dist/chunk-ZXLLJAMQ.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { fileSchema, rowSchemaHashSchema, rowHashSchema, rowUpdatedAtSchema, rowPublishedAtSchema, rowCreatedAtSchema, rowCreatedIdSchema, rowVersionIdSchema, rowIdSchema } from './chunk-LLHQWDAR.js';
2
- import { JsonArrayStore, JsonObjectStore, JsonStringStore, JsonNumberStore, JsonBooleanStore, JsonObjectValueStore, JsonArrayValueStore, createJsonValueStore, getTransformation } from './chunk-WCFA4226.js';
2
+ import { JsonArrayStore, JsonObjectStore, JsonStringStore, JsonNumberStore, JsonBooleanStore, JsonObjectValueStore, JsonArrayValueStore, createJsonValueStore, getTransformation } from './chunk-HY4VE7H2.js';
3
3
 
4
4
  // src/lib/createJsonSchemaStore.ts
5
5
  var createJsonSchemaStore = (schema, refs = {}) => {
@@ -50,11 +50,16 @@ var createPrimitiveStoreBySchema = (schema) => {
50
50
  stringStore.enum = schema.enum;
51
51
  stringStore.contentMediaType = schema.contentMediaType;
52
52
  stringStore.pattern = schema.pattern;
53
+ stringStore["x-formula"] = schema["x-formula"];
53
54
  return stringStore;
54
55
  } else if (schema.type === "number" /* Number */) {
55
- return new JsonNumberStore();
56
+ const numberStore = new JsonNumberStore();
57
+ numberStore["x-formula"] = schema["x-formula"];
58
+ return numberStore;
56
59
  } else if (schema.type === "boolean" /* Boolean */) {
57
- return new JsonBooleanStore();
60
+ const booleanStore = new JsonBooleanStore();
61
+ booleanStore["x-formula"] = schema["x-formula"];
62
+ return booleanStore;
58
63
  } else {
59
64
  throw new Error("this type is not allowed");
60
65
  }
@@ -818,5 +823,5 @@ var SchemaTable = class {
818
823
  };
819
824
 
820
825
  export { SchemaTable, VALIDATE_JSON_FIELD_NAME_ERROR_MESSAGE, applyAddPatch, applyMovePatch, applyRemovePatch, applyReplacePatch, computeValueDiff, 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 };
821
- //# sourceMappingURL=chunk-DFL3HJ4Y.js.map
822
- //# sourceMappingURL=chunk-DFL3HJ4Y.js.map
826
+ //# sourceMappingURL=chunk-4BIANIHT.js.map
827
+ //# sourceMappingURL=chunk-4BIANIHT.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/json-path-utils.ts","../src/lib/computeValueDiff.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/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,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,O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CAAI,EAAE,CAAA;AAE5B,IAAA,IAAI,CAAC,GAAA,EAAK;AACR,MAAA,MAAM,IAAI,MAAM,YAAY,CAAA;AAAA,IAC9B;AAEA,IAAA,OAAO,IAAI,aAAA,EAAc;AAAA,EAC3B;AAAA,EAEO,OAAA,GAA6C;AAClD,IAAA,OAAO,CAAC,GAAG,IAAA,CAAK,IAAI,CAAA,CAAE,IAAI,CAAC,CAAC,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-4BIANIHT.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 stringStore['x-formula'] = schema['x-formula'];\n return stringStore;\n } else if (schema.type === JsonSchemaTypeName.Number) {\n const numberStore = new JsonNumberStore();\n numberStore['x-formula'] = schema['x-formula'];\n return numberStore;\n } else if (schema.type === JsonSchemaTypeName.Boolean) {\n const booleanStore = new JsonBooleanStore();\n booleanStore['x-formula'] = schema['x-formula'];\n return booleanStore;\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 { 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 { JsonArray, JsonObject } from '../types/json.types.js';\nimport { FieldChange, FieldChangeType } from '../types/value-diff.types.js';\nimport { deepEqual } from './json-path-utils.js';\n\nexport function computeValueDiff(\n fromValue: unknown | null,\n toValue: unknown | null,\n): FieldChange[] {\n if (fromValue === null && toValue === null) {\n return [];\n }\n\n if (fromValue === null && toValue !== null) {\n return [createChange('', null, toValue, FieldChangeType.Added)];\n }\n\n if (fromValue !== null && toValue === null) {\n return [createChange('', fromValue, null, FieldChangeType.Removed)];\n }\n\n return computeDiff(fromValue!, toValue!, '');\n}\n\nfunction computeDiff(\n fromValue: unknown,\n toValue: unknown,\n path: string,\n): FieldChange[] {\n if (deepEqual(fromValue, toValue)) {\n return [];\n }\n\n if (isPrimitive(fromValue) || isPrimitive(toValue)) {\n return [createChange(path, fromValue, toValue, FieldChangeType.Modified)];\n }\n\n if (hasTypeChanged(fromValue, toValue)) {\n return [createChange(path, fromValue, toValue, FieldChangeType.Modified)];\n }\n\n if (Array.isArray(fromValue) && Array.isArray(toValue)) {\n return computeArrayDiff(fromValue, toValue, path);\n }\n\n return computeObjectDiff(\n fromValue as JsonObject,\n toValue as JsonObject,\n path,\n );\n}\n\nfunction computeObjectDiff(\n fromObj: JsonObject,\n toObj: JsonObject,\n basePath: string,\n): FieldChange[] {\n const changes: FieldChange[] = [];\n const fromKeys = Object.keys(fromObj);\n const toKeys = new Set(Object.keys(toObj));\n\n for (const key of fromKeys) {\n const fieldPath = joinPath(basePath, key);\n\n if (!toKeys.has(key)) {\n changes.push(\n createChange(fieldPath, fromObj[key], null, FieldChangeType.Removed),\n );\n } else {\n changes.push(...computeDiff(fromObj[key], toObj[key], fieldPath));\n }\n }\n\n for (const key of toKeys) {\n if (!fromKeys.includes(key)) {\n const fieldPath = joinPath(basePath, key);\n changes.push(\n createChange(fieldPath, null, toObj[key], FieldChangeType.Added),\n );\n }\n }\n\n return changes;\n}\n\nfunction computeArrayDiff(\n fromArr: JsonArray,\n toArr: JsonArray,\n basePath: string,\n): FieldChange[] {\n const changes: FieldChange[] = [];\n const maxLen = Math.max(fromArr.length, toArr.length);\n\n for (let i = 0; i < maxLen; i++) {\n const fieldPath = joinPath(basePath, String(i));\n const hasFrom = i < fromArr.length;\n const hasTo = i < toArr.length;\n\n if (hasFrom && hasTo) {\n changes.push(...computeDiff(fromArr[i], toArr[i], fieldPath));\n } else if (hasFrom) {\n changes.push(\n createChange(fieldPath, fromArr[i], null, FieldChangeType.Removed),\n );\n } else {\n changes.push(\n createChange(fieldPath, null, toArr[i], FieldChangeType.Added),\n );\n }\n }\n\n return changes;\n}\n\nfunction isPrimitive(value: unknown): boolean {\n return (\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean'\n );\n}\n\nfunction hasTypeChanged(fromValue: unknown, toValue: unknown): boolean {\n const fromIsArray = Array.isArray(fromValue);\n const toIsArray = Array.isArray(toValue);\n return fromIsArray !== toIsArray;\n}\n\nfunction joinPath(base: string, segment: string): string {\n return base ? `${base}.${segment}` : segment;\n}\n\nfunction createChange(\n path: string,\n oldValue: unknown,\n newValue: unknown,\n changeType: FieldChangeType,\n): FieldChange {\n return { path, oldValue, newValue, changeType };\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 { 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"]}
@@ -11,5 +11,5 @@ var JsonSchemaTypeName = /* @__PURE__ */ ((JsonSchemaTypeName2) => {
11
11
  })(JsonSchemaTypeName || {});
12
12
 
13
13
  exports.JsonSchemaTypeName = JsonSchemaTypeName;
14
- //# sourceMappingURL=chunk-V2SSSD5X.cjs.map
15
- //# sourceMappingURL=chunk-V2SSSD5X.cjs.map
14
+ //# sourceMappingURL=chunk-B22UU3JK.cjs.map
15
+ //# sourceMappingURL=chunk-B22UU3JK.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types/schema.types.ts"],"names":["JsonSchemaTypeName"],"mappings":";;;AAAO,IAAK,kBAAA,qBAAAA,mBAAAA,KAAL;AACL,EAAAA,oBAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,oBAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,oBAAA,SAAA,CAAA,GAAU,SAAA;AACV,EAAAA,oBAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,oBAAA,OAAA,CAAA,GAAQ,OAAA;AALE,EAAA,OAAAA,mBAAAA;AAAA,CAAA,EAAA,kBAAA,IAAA,EAAA","file":"chunk-B22UU3JK.cjs","sourcesContent":["export enum JsonSchemaTypeName {\n String = 'string',\n Number = 'number',\n Boolean = 'boolean',\n Object = 'object',\n Array = 'array',\n}\n\nexport type XFormula = {\n version: 1;\n expression: string;\n};\n\nexport type JsonSchemaSharedFields = {\n deprecated?: boolean;\n description?: string;\n title?: string;\n};\n\nexport type JsonStringSchema = {\n type: JsonSchemaTypeName.String;\n default: string;\n foreignKey?: string;\n readOnly?: boolean;\n title?: string;\n description?: string;\n deprecated?: boolean;\n pattern?: string;\n format?: 'date-time' | 'date' | 'time' | 'email' | 'regex';\n contentMediaType?:\n | 'text/plain'\n | 'text/markdown'\n | 'text/html'\n | 'application/json'\n | 'application/schema+json'\n | 'application/yaml';\n enum?: string[];\n 'x-formula'?: XFormula;\n} & JsonSchemaSharedFields;\n\nexport type JsonNumberSchema = {\n type: JsonSchemaTypeName.Number;\n default: number;\n readOnly?: boolean;\n title?: string;\n description?: string;\n deprecated?: boolean;\n 'x-formula'?: XFormula;\n} & JsonSchemaSharedFields;\n\nexport type JsonBooleanSchema = {\n type: JsonSchemaTypeName.Boolean;\n default: boolean;\n readOnly?: boolean;\n title?: string;\n description?: string;\n deprecated?: boolean;\n 'x-formula'?: XFormula;\n} & JsonSchemaSharedFields;\n\nexport type JsonSchemaPrimitives =\n | JsonStringSchema\n | JsonNumberSchema\n | JsonBooleanSchema;\n\nexport type JsonObjectSchema = {\n type: JsonSchemaTypeName.Object;\n additionalProperties: false;\n required: string[];\n properties: Record<string, JsonSchema>;\n title?: string;\n description?: string;\n deprecated?: boolean;\n} & JsonSchemaSharedFields;\n\nexport type JsonArraySchema = {\n type: JsonSchemaTypeName.Array;\n items: JsonSchema;\n title?: string;\n description?: string;\n deprecated?: boolean;\n} & JsonSchemaSharedFields;\n\nexport type JsonRefSchema = {\n $ref: string;\n title?: string;\n description?: string;\n deprecated?: boolean;\n};\n\nexport type JsonSchema =\n | JsonObjectSchema\n | JsonArraySchema\n | JsonSchemaPrimitives\n | JsonRefSchema;\n\nexport type JsonSchemaWithoutRef =\n | JsonObjectSchema\n | JsonArraySchema\n | JsonSchemaPrimitives;\n"]}
@@ -33,6 +33,7 @@ var JsonStringStore = class extends EventEmitter {
33
33
  enum;
34
34
  format;
35
35
  contentMediaType;
36
+ "x-formula";
36
37
  valuesMap = /* @__PURE__ */ new Map();
37
38
  registerValue(value) {
38
39
  const length = this.getOrCreateValues(value.rowId).push(value);
@@ -54,7 +55,8 @@ var JsonStringStore = class extends EventEmitter {
54
55
  ...this.pattern ? { pattern: this.pattern } : {},
55
56
  ...this.enum ? { enum: this.enum } : {},
56
57
  ...this.format ? { format: this.format } : {},
57
- ...this.contentMediaType ? { contentMediaType: this.contentMediaType } : {}
58
+ ...this.contentMediaType ? { contentMediaType: this.contentMediaType } : {},
59
+ ...this["x-formula"] ? { "x-formula": this["x-formula"] } : {}
58
60
  },
59
61
  this
60
62
  );
@@ -82,6 +84,7 @@ var JsonNumberStore = class extends EventEmitter {
82
84
  title;
83
85
  description;
84
86
  deprecated;
87
+ "x-formula";
85
88
  valuesMap = /* @__PURE__ */ new Map();
86
89
  registerValue(value) {
87
90
  const length = this.getOrCreateValues(value.rowId).push(value);
@@ -98,7 +101,8 @@ var JsonNumberStore = class extends EventEmitter {
98
101
  {
99
102
  type: this.type,
100
103
  default: this.default,
101
- ...this.readOnly ? { readOnly: this.readOnly } : {}
104
+ ...this.readOnly ? { readOnly: this.readOnly } : {},
105
+ ...this["x-formula"] ? { "x-formula": this["x-formula"] } : {}
102
106
  },
103
107
  this
104
108
  );
@@ -126,6 +130,7 @@ var JsonBooleanStore = class extends EventEmitter {
126
130
  title;
127
131
  description;
128
132
  deprecated;
133
+ "x-formula";
129
134
  valuesMap = /* @__PURE__ */ new Map();
130
135
  registerValue(value) {
131
136
  const length = this.getOrCreateValues(value.rowId).push(value);
@@ -142,7 +147,8 @@ var JsonBooleanStore = class extends EventEmitter {
142
147
  {
143
148
  type: this.type,
144
149
  default: this.default,
145
- ...this.readOnly ? { readOnly: this.readOnly } : {}
150
+ ...this.readOnly ? { readOnly: this.readOnly } : {},
151
+ ...this["x-formula"] ? { "x-formula": this["x-formula"] } : {}
146
152
  },
147
153
  this
148
154
  );
@@ -753,5 +759,5 @@ var JsonArrayValueStore = class {
753
759
  };
754
760
 
755
761
  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 };
756
- //# sourceMappingURL=chunk-WCFA4226.js.map
757
- //# sourceMappingURL=chunk-WCFA4226.js.map
762
+ //# sourceMappingURL=chunk-HY4VE7H2.js.map
763
+ //# sourceMappingURL=chunk-HY4VE7H2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/addSharedFieldsFromStore.ts","../src/model/schema/json-string.store.ts","../src/model/schema/json-number.store.ts","../src/model/schema/json-boolean.store.ts","../src/model/schema/json-object.store.ts","../src/model/schema/json-array.store.ts","../src/model/value/json-string-value.store.ts","../src/model/value/json-number-value.store.ts","../src/model/value/json-boolean-value.store.ts","../src/model/value/value-transformation.ts","../src/model/value/json-object-value.store.ts","../src/lib/createJsonValueStore.ts","../src/model/value/json-array-value.store.ts"],"names":["EventEmitter","nanoid","value"],"mappings":";;;;AAEO,IAAM,wBAAA,GAA2B,CACtC,MAAA,EACA,KAAA,KACM;AACN,EAAA,IAAI,MAAM,KAAA,EAAO;AACf,IAAA,MAAA,CAAO,QAAQ,KAAA,CAAM,KAAA;AAAA,EACvB;AAEA,EAAA,IAAI,MAAM,WAAA,EAAa;AACrB,IAAA,MAAA,CAAO,cAAc,KAAA,CAAM,WAAA;AAAA,EAC7B;AAEA,EAAA,IAAI,MAAM,UAAA,EAAY;AACpB,IAAA,MAAA,CAAO,aAAa,KAAA,CAAM,UAAA;AAAA,EAC5B;AAEA,EAAA,OAAO,MAAA;AACT;ACPO,IAAM,eAAA,GAAN,cAA8B,YAAA,CAAyC;AAAA,EAwB5E,WAAA,CAA4B,MAAA,GAAiB,MAAA,EAAO,EAAG;AACrD,IAAA,KAAA,EAAM;AADoB,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AAAA,EAE5B;AAAA,EAzBgB,IAAA,GAAA,QAAA;AAAA,EAET,IAAA,GAAe,EAAA;AAAA,EACf,IAAA,GAAe,EAAA;AAAA,EACf,MAAA,GAAiC,IAAA;AAAA,EAEjC,OAAA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MAAA,MAAM,QAAA,GAAW,IAAA,CAAK,gBAAA,CAAiB,KAAK,CAAA;AAE5C,MAAA,OAAO,oBAAA,CAAqB,KAAA,CAAM,KAAA,EAAO,IAAA,CAAK,OAAO,QAAQ,CAAA;AAAA,IAC/D,CAAC,CAAA;AAAA,EACH;AAAA,EAEQ,iBAAiB,KAAA,EAAqC;AAC5D,IAAA,MAAM,aAAA,GAAgB,KAAA,CAAM,KAAA,CAAM,QAAA,CAAS,KAAK,KAAK,CAAA;AAErD,IAAA,IAAI,aAAA,EAAe;AACjB,MAAA,OAAO,cAAc,aAAA,EAAc;AAAA,IACrC;AAEA,IAAA,OAAO,MAAM,KAAA,CAAM,OAAA;AAAA,EACrB;AAAA,EAEQ,IAAA,GAAO;AACb,IAAA,KAAA,MAAW,KAAA,IAAS,KAAK,KAAA,EAAO;AAC9B,MAAA,KAAA,CAAM,MAAA,GAAS,IAAA;AAAA,IACjB;AAAA,EACF;AACF","file":"chunk-HY4VE7H2.js","sourcesContent":["import { JsonSchema } from '../types/schema.types.js';\n\nexport const addSharedFieldsFromState = <T extends JsonSchema = JsonSchema>(\n schema: T,\n state: { title?: string; description?: string; deprecated?: boolean },\n): T => {\n if (state.title) {\n schema.title = state.title;\n }\n\n if (state.description) {\n schema.description = state.description;\n }\n\n if (state.deprecated) {\n schema.deprecated = state.deprecated;\n }\n\n return schema;\n};\n","import { nanoid } from 'nanoid';\nimport { EventEmitter } from 'node:events';\nimport {\n JsonRefSchema,\n JsonSchemaTypeName,\n JsonStringSchema,\n XFormula,\n} from '../../types/schema.types.js';\nimport { JsonSchemaStore } from './json-schema.store.js';\nimport { JsonStringValueStore } from '../value/json-string-value.store.js';\nimport { addSharedFieldsFromState } from '../../lib/addSharedFieldsFromStore.js';\n\nexport class JsonStringStore extends EventEmitter implements JsonStringSchema {\n public readonly type = JsonSchemaTypeName.String;\n\n public $ref: string = '';\n public name: string = '';\n public parent: JsonSchemaStore | null = null;\n\n public default: string = '';\n public readOnly?: boolean;\n public title?: string;\n public description?: string;\n public deprecated?: boolean;\n public foreignKey?: string;\n public pattern?: string;\n public enum?: string[];\n public format?: JsonStringSchema['format'];\n public contentMediaType?: JsonStringSchema['contentMediaType'];\n public 'x-formula'?: XFormula;\n\n private readonly valuesMap: Map<string, JsonStringValueStore[]> = new Map<\n string,\n JsonStringValueStore[]\n >();\n\n constructor(public readonly nodeId: string = nanoid()) {\n super();\n }\n\n public registerValue(value: JsonStringValueStore): number {\n const length = this.getOrCreateValues(value.rowId).push(value);\n return length - 1;\n }\n\n public getValue(\n rowId: string,\n index: number = 0,\n ): JsonStringValueStore | undefined {\n return this.getOrCreateValues(rowId)[index];\n }\n\n public getPlainSchema(options?: {\n skip$Ref?: boolean;\n }): JsonStringSchema | JsonRefSchema {\n if (this.$ref && options?.skip$Ref !== true) {\n return addSharedFieldsFromState({ $ref: this.$ref }, this);\n }\n\n return addSharedFieldsFromState(\n {\n type: this.type,\n default: this.default,\n ...(this.foreignKey ? { foreignKey: this.foreignKey } : {}),\n ...(this.readOnly ? { readOnly: this.readOnly } : {}),\n ...(this.pattern ? { pattern: this.pattern } : {}),\n ...(this.enum ? { enum: this.enum } : {}),\n ...(this.format ? { format: this.format } : {}),\n ...(this.contentMediaType\n ? { contentMediaType: this.contentMediaType }\n : {}),\n ...(this['x-formula'] ? { 'x-formula': this['x-formula'] } : {}),\n },\n this,\n );\n }\n\n private getOrCreateValues(rowId: string): JsonStringValueStore[] {\n let values = this.valuesMap.get(rowId);\n\n if (!values) {\n values = [];\n this.valuesMap.set(rowId, values);\n }\n\n return values;\n }\n}\n","import { nanoid } from 'nanoid';\nimport { EventEmitter } from 'node:events';\nimport {\n JsonNumberSchema,\n JsonRefSchema,\n JsonSchemaTypeName,\n XFormula,\n} from '../../types/schema.types.js';\nimport { JsonSchemaStore } from './json-schema.store.js';\nimport { JsonNumberValueStore } from '../value/json-number-value.store.js';\nimport { addSharedFieldsFromState } from '../../lib/addSharedFieldsFromStore.js';\n\nexport class JsonNumberStore extends EventEmitter implements JsonNumberSchema {\n public readonly type = JsonSchemaTypeName.Number;\n\n public $ref: string = '';\n public name: string = '';\n public parent: JsonSchemaStore | null = null;\n\n public default: number = 0;\n public readOnly?: boolean;\n public title?: string;\n public description?: string;\n public deprecated?: boolean;\n public 'x-formula'?: XFormula;\n\n private readonly valuesMap: Map<string, JsonNumberValueStore[]> = new Map<\n string,\n JsonNumberValueStore[]\n >();\n\n constructor(public readonly nodeId: string = nanoid()) {\n super();\n }\n\n public registerValue(value: JsonNumberValueStore): number {\n const length = this.getOrCreateValues(value.rowId).push(value);\n return length - 1;\n }\n\n public getValue(\n rowId: string,\n index: number = 0,\n ): JsonNumberValueStore | undefined {\n return this.getOrCreateValues(rowId)[index];\n }\n\n public getPlainSchema(options?: {\n skip$Ref?: boolean;\n }): JsonNumberSchema | JsonRefSchema {\n if (this.$ref && options?.skip$Ref !== true) {\n return addSharedFieldsFromState({ $ref: this.$ref }, this);\n }\n\n return addSharedFieldsFromState(\n {\n type: this.type,\n default: this.default,\n ...(this.readOnly ? { readOnly: this.readOnly } : {}),\n ...(this['x-formula'] ? { 'x-formula': this['x-formula'] } : {}),\n },\n this,\n );\n }\n\n private getOrCreateValues(rowId: string): JsonNumberValueStore[] {\n let values = this.valuesMap.get(rowId);\n\n if (!values) {\n values = [];\n this.valuesMap.set(rowId, values);\n }\n\n return values;\n }\n}\n","import { nanoid } from 'nanoid';\nimport { EventEmitter } from 'node:events';\nimport {\n JsonBooleanSchema,\n JsonRefSchema,\n JsonSchemaTypeName,\n XFormula,\n} from '../../types/schema.types.js';\nimport { JsonSchemaStore } from './json-schema.store.js';\nimport { JsonBooleanValueStore } from '../value/json-boolean-value.store.js';\nimport { addSharedFieldsFromState } from '../../lib/addSharedFieldsFromStore.js';\n\nexport class JsonBooleanStore\n extends EventEmitter\n implements JsonBooleanSchema\n{\n public readonly type = JsonSchemaTypeName.Boolean;\n\n public $ref: string = '';\n public name: string = '';\n public parent: JsonSchemaStore | null = null;\n\n public default: boolean = false;\n public readOnly?: boolean;\n public title?: string;\n public description?: string;\n public deprecated?: boolean;\n public 'x-formula'?: XFormula;\n\n private readonly valuesMap: Map<string, JsonBooleanValueStore[]> = new Map<\n string,\n JsonBooleanValueStore[]\n >();\n\n constructor(public readonly nodeId: string = nanoid()) {\n super();\n }\n\n public registerValue(value: JsonBooleanValueStore): number {\n const length = this.getOrCreateValues(value.rowId).push(value);\n return length - 1;\n }\n\n public getValue(\n rowId: string,\n index: number = 0,\n ): JsonBooleanValueStore | undefined {\n return this.getOrCreateValues(rowId)[index];\n }\n\n public getPlainSchema(options?: {\n skip$Ref?: boolean;\n }): JsonBooleanSchema | JsonRefSchema {\n if (this.$ref && options?.skip$Ref !== true) {\n return addSharedFieldsFromState({ $ref: this.$ref }, this);\n }\n\n return addSharedFieldsFromState(\n {\n type: this.type,\n default: this.default,\n ...(this.readOnly ? { readOnly: this.readOnly } : {}),\n ...(this['x-formula'] ? { 'x-formula': this['x-formula'] } : {}),\n },\n this,\n );\n }\n\n private getOrCreateValues(rowId: string): JsonBooleanValueStore[] {\n let values = this.valuesMap.get(rowId);\n\n if (!values) {\n values = [];\n this.valuesMap.set(rowId, values);\n }\n\n return values;\n }\n}\n","import { nanoid } from 'nanoid';\nimport { JsonObject } from '../../types/json.types.js';\nimport {\n JsonObjectSchema,\n JsonRefSchema,\n JsonSchema,\n JsonSchemaTypeName,\n} from '../../types/schema.types.js';\nimport { JsonSchemaStore } from './json-schema.store.js';\nimport { JsonObjectValueStore } from '../value/json-object-value.store.js';\nimport { addSharedFieldsFromState } from '../../lib/addSharedFieldsFromStore.js';\n\nexport type AddedPropertyEvent = { name: string; property: JsonSchemaStore };\nexport type MigratePropertyEvent = {\n name: string;\n property: JsonSchemaStore;\n previousProperty: JsonSchemaStore;\n};\nexport type RemovedPropertyEvent = { name: string; property: JsonSchemaStore };\nexport type ChangeNameEvent = {\n fromName: string;\n toName: string;\n property: JsonSchemaStore;\n};\n\nexport class JsonObjectStore implements JsonObjectSchema {\n public readonly type = JsonSchemaTypeName.Object;\n\n public $ref: string = '';\n public name: string = '';\n public parent: JsonSchemaStore | null = null;\n public default: JsonObject = {};\n\n public title?: string;\n public description?: string;\n public deprecated?: boolean;\n\n public readonly additionalProperties = false;\n public readonly required: string[] = [];\n public readonly properties: Record<string, JsonSchemaStore> = {};\n\n private readonly valuesMap: Map<string, JsonObjectValueStore[]> = new Map<\n string,\n JsonObjectValueStore[]\n >();\n\n constructor(public readonly nodeId: string = nanoid()) {}\n\n public get empty(): boolean {\n return Object.keys(this.properties).length === 0;\n }\n\n public registerValue(value: JsonObjectValueStore): number {\n const length = this.getOrCreateValues(value.rowId).push(value);\n return length - 1;\n }\n\n public getValue(\n rowId: string,\n index: number = 0,\n ): JsonObjectValueStore | undefined {\n return this.getOrCreateValues(rowId)[index];\n }\n\n public addPropertyWithStore(name: string, store: JsonSchemaStore) {\n if (this.properties[name] || this.required.includes(name)) {\n throw new Error('this name already exists');\n }\n\n store.parent = this;\n store.name = name;\n\n this.required.push(name);\n this.required.sort((a, b) => a.localeCompare(b));\n\n this.properties[name] = store;\n this.default[name] = store.default;\n\n const event: AddedPropertyEvent = { name, property: store };\n\n for (const value of this.iterValues()) {\n value.addProperty(event);\n }\n\n return store;\n }\n\n public migratePropertyWithStore(name: string, store: JsonSchemaStore) {\n const item = this.properties[name];\n\n if (!item) {\n throw new Error('this name does not exist');\n }\n\n item.parent = null;\n\n store.parent = this;\n store.name = name;\n\n this.properties[name] = store;\n this.default[name] = store.default;\n\n const event: MigratePropertyEvent = {\n name,\n property: store,\n previousProperty: item,\n };\n\n for (const value of this.iterValues()) {\n value.migrateProperty(event);\n }\n\n return store;\n }\n\n public changeName(fromName: string, toName: string) {\n const item = this.properties[fromName];\n\n if (!item) {\n throw new Error('this fromName does not exist');\n }\n\n // remove\n delete this.properties[fromName];\n delete this.default[fromName];\n\n const foundRequiredIndex = this.required.findIndex(\n (required) => required === fromName,\n );\n\n if (foundRequiredIndex !== -1) {\n this.required.splice(foundRequiredIndex, 1);\n }\n\n // add\n if (!this.required.includes(toName)) {\n this.required.push(toName);\n this.required.sort((a, b) => a.localeCompare(b));\n }\n\n this.properties[toName] = item;\n this.default[toName] = item.default;\n\n const event: ChangeNameEvent = {\n fromName,\n toName,\n property: item,\n };\n\n for (const value of this.iterValues()) {\n value.changeName(event);\n }\n }\n\n public removeProperty(name: string) {\n const item = this.properties[name];\n\n if (!item) {\n throw new Error('this name does not exist');\n }\n\n item.parent = null;\n item.name = '';\n\n delete this.properties[name];\n delete this.default[name];\n\n const foundRequiredIndex = this.required.findIndex(\n (required) => required === name,\n );\n\n if (foundRequiredIndex !== -1) {\n this.required.splice(foundRequiredIndex, 1);\n }\n\n const event: RemovedPropertyEvent = {\n name,\n property: item,\n };\n\n for (const value of this.iterValues()) {\n value.removeProperty(event);\n }\n }\n\n public getProperty(name: string): JsonSchemaStore | undefined {\n return this.properties[name];\n }\n\n public getPlainSchema(options?: {\n skip$Ref?: boolean;\n }): JsonObjectSchema | JsonRefSchema {\n if (this.$ref && options?.skip$Ref !== true) {\n return addSharedFieldsFromState({ $ref: this.$ref }, this);\n }\n\n return addSharedFieldsFromState(\n {\n type: this.type,\n additionalProperties: this.additionalProperties,\n required: this.required,\n properties: Object.entries<JsonSchemaStore>(this.properties).reduce<\n Record<string, JsonSchema>\n >((result, [name, store]) => {\n result[name] = store.getPlainSchema(options);\n return result;\n }, {}),\n },\n this,\n );\n }\n\n private getOrCreateValues(rowId: string): JsonObjectValueStore[] {\n let values = this.valuesMap.get(rowId);\n\n if (!values) {\n values = [];\n this.valuesMap.set(rowId, values);\n }\n\n return values;\n }\n\n private *iterValues(): Generator<JsonObjectValueStore> {\n for (const values of this.valuesMap.values()) {\n for (const value of values) {\n yield value;\n }\n }\n }\n}\n","import { nanoid } from 'nanoid';\nimport { JsonArray } from '../../types/json.types.js';\nimport {\n JsonArraySchema,\n JsonRefSchema,\n JsonSchemaTypeName,\n} from '../../types/schema.types.js';\nimport { JsonSchemaStore } from './json-schema.store.js';\nimport { JsonArrayValueStore } from '../value/json-array-value.store.js';\nimport { addSharedFieldsFromState } from '../../lib/addSharedFieldsFromStore.js';\n\nexport type MigrateItemsEvent = {\n items: JsonSchemaStore;\n previousItems: JsonSchemaStore;\n};\n\nexport type ReplaceItemsEvent = {\n items: JsonSchemaStore;\n previousItems: JsonSchemaStore;\n};\n\nexport class JsonArrayStore implements JsonArraySchema {\n public readonly type = JsonSchemaTypeName.Array;\n\n public $ref: string = '';\n public name: string = '';\n public parent: JsonSchemaStore | null = null;\n public default: JsonArray[] = [];\n\n public title?: string;\n public description?: string;\n public deprecated?: boolean;\n\n private readonly valuesMap: Map<string, JsonArrayValueStore[]> = new Map<\n string,\n JsonArrayValueStore[]\n >();\n\n constructor(\n private _items: JsonSchemaStore,\n public readonly nodeId: string = nanoid(),\n ) {\n this.items.parent = this;\n }\n\n public get items() {\n return this._items;\n }\n\n public registerValue(value: JsonArrayValueStore): number {\n const length = this.getOrCreateValues(value.rowId).push(value);\n return length - 1;\n }\n\n public getValue(\n rowId: string,\n index: number = 0,\n ): JsonArrayValueStore | undefined {\n return this.getOrCreateValues(rowId)[index];\n }\n\n public migrateItems(items: JsonSchemaStore) {\n const previousItems = this._items;\n previousItems.parent = null;\n this._items = items;\n this._items.parent = this;\n\n const event: MigrateItemsEvent = { items, previousItems };\n\n for (const value of this.iterValues()) {\n value.migrateItems(event);\n }\n }\n\n public replaceItems(items: JsonSchemaStore) {\n const previousItems = this._items;\n previousItems.parent = null;\n this._items = items;\n this._items.parent = this;\n\n const event: ReplaceItemsEvent = { items, previousItems };\n\n for (const value of this.iterValues()) {\n value.replaceItems(event);\n }\n }\n\n public getPlainSchema(options?: {\n skip$Ref?: boolean;\n }): JsonArraySchema | JsonRefSchema {\n if (this.$ref && options?.skip$Ref !== true) {\n return addSharedFieldsFromState({ $ref: this.$ref }, this);\n }\n\n return addSharedFieldsFromState(\n {\n type: this.type,\n items: this.items.getPlainSchema(options),\n },\n this,\n );\n }\n\n private getOrCreateValues(rowId: string): JsonArrayValueStore[] {\n let values = this.valuesMap.get(rowId);\n\n if (!values) {\n values = [];\n this.valuesMap.set(rowId, values);\n }\n\n return values;\n }\n\n private *iterValues(): Generator<JsonArrayValueStore> {\n for (const values of this.valuesMap.values()) {\n for (const value of values) {\n yield value;\n }\n }\n }\n}\n","import { JsonSchemaTypeName } from '../../types/schema.types.js';\nimport { JsonStringStore } from '../schema/json-string.store.js';\nimport { JsonValueStoreParent } from './json-value.store.js';\n\nexport class JsonStringValueStore {\n public readonly type = JsonSchemaTypeName.String;\n\n public readonly index: number;\n\n public parent: JsonValueStoreParent | null = null;\n\n constructor(\n public readonly schema: JsonStringStore,\n public readonly rowId: string,\n public value: string | null = null,\n ) {\n this.index = this.schema.registerValue(this);\n }\n\n public get foreignKey() {\n return this.schema.foreignKey;\n }\n\n public getPlainValue() {\n return this.value ?? this.schema.default;\n }\n}\n","import { JsonSchemaTypeName } from '../../types/schema.types.js';\nimport { JsonNumberStore } from '../schema/json-number.store.js';\nimport { JsonValueStoreParent } from './json-value.store.js';\n\nexport class JsonNumberValueStore {\n public readonly type = JsonSchemaTypeName.Number;\n\n public readonly index: number;\n\n public parent: JsonValueStoreParent | null = null;\n\n constructor(\n public readonly schema: JsonNumberStore,\n public readonly rowId: string,\n public value: number | null = null,\n ) {\n this.index = this.schema.registerValue(this);\n }\n\n public getPlainValue() {\n return this.value ?? this.schema.default;\n }\n}\n","import { JsonSchemaTypeName } from '../../types/schema.types.js';\nimport { JsonBooleanStore } from '../schema/json-boolean.store.js';\nimport { JsonValueStoreParent } from './json-value.store.js';\n\nexport class JsonBooleanValueStore {\n public readonly type = JsonSchemaTypeName.Boolean;\n\n public readonly index: number;\n\n public parent: JsonValueStoreParent | null = null;\n\n constructor(\n public readonly schema: JsonBooleanStore,\n public readonly rowId: string,\n public value: boolean | null = null,\n ) {\n this.index = this.schema.registerValue(this);\n }\n\n public getPlainValue() {\n return this.value ?? this.schema.default;\n }\n}\n","import { JsonSchemaTypeName } from '../../types/schema.types.js';\nimport { JsonArrayStore } from '../schema/json-array.store.js';\nimport { JsonSchemaStore } from '../schema/json-schema.store.js';\nimport { JsonObjectStore } from '../schema/json-object.store.js';\n\nexport const equal = (value: unknown): unknown => value;\n\nexport const fromNumberToString = (\n value: number,\n defaultValue: string = '',\n): string => value.toString() || defaultValue;\n\nexport const fromBooleanToString = (\n value: boolean,\n defaultValue: string = '',\n): string => value.toString() || defaultValue;\n\nexport const fromStringToBoolean = (\n value: string,\n defaultValue: boolean = false,\n): boolean => {\n if (!value) {\n return defaultValue;\n }\n\n if (value.toLowerCase() === 'false') {\n return false;\n }\n\n return true;\n};\n\nexport const fromStringToNumber = (\n value: string,\n defaultValue: number = 0,\n): number => {\n const number = Number.parseFloat(value);\n\n if (Number.isNaN(number)) {\n return defaultValue;\n }\n\n return number;\n};\n\nexport const fromBooleanToNumber = (value: boolean): number => {\n return Number(value);\n};\n\nexport const fromNumberToBoolean = (value: number): boolean => {\n return Boolean(value);\n};\n\nexport const toArrayTransformation =\n (transformation: Transformation) => (value: unknown) => {\n const result = transformation(value);\n return [result];\n };\n\nexport const fromArrayTransformation =\n (transformation: Transformation) => (value: unknown) => {\n if (Array.isArray(value) && value.length) {\n return transformation(value[0]);\n }\n return undefined;\n };\n\nexport const fromObjectToPrimitive = (\n _value: unknown,\n defaultValue: unknown,\n): unknown => {\n return defaultValue;\n};\n\nexport const fromPrimitiveToObject = (\n _value: unknown,\n defaultValue: unknown,\n): unknown => {\n return defaultValue;\n};\n\nexport const fromObjectToArray = (\n _value: unknown,\n defaultValue: unknown,\n): unknown => {\n return defaultValue;\n};\n\nexport const fromArrayToObject = (\n _value: unknown,\n defaultValue: unknown,\n): unknown => {\n return defaultValue;\n};\n\nconst replaceTransformationsMapper: ReplaceTransformationsMapper = [\n {\n fromType: JsonSchemaTypeName.Number,\n toType: JsonSchemaTypeName.String,\n transformation: fromNumberToString as Transformation,\n },\n {\n fromType: JsonSchemaTypeName.String,\n toType: JsonSchemaTypeName.Number,\n transformation: fromStringToNumber as Transformation,\n },\n {\n fromType: JsonSchemaTypeName.Boolean,\n toType: JsonSchemaTypeName.String,\n transformation: fromBooleanToString as Transformation,\n },\n {\n fromType: JsonSchemaTypeName.String,\n toType: JsonSchemaTypeName.Boolean,\n transformation: fromStringToBoolean as Transformation,\n },\n {\n fromType: JsonSchemaTypeName.Boolean,\n toType: JsonSchemaTypeName.Number,\n transformation: fromBooleanToNumber as Transformation,\n },\n {\n fromType: JsonSchemaTypeName.Number,\n toType: JsonSchemaTypeName.Boolean,\n transformation: fromNumberToBoolean as Transformation,\n },\n];\nexport const getTransformation = (\n from: JsonSchemaStore,\n to: JsonSchemaStore,\n): Transformation | undefined => {\n if (\n from instanceof JsonObjectStore &&\n !(to instanceof JsonObjectStore) &&\n !(to instanceof JsonArrayStore)\n ) {\n return fromObjectToPrimitive;\n }\n\n if (\n !(from instanceof JsonObjectStore) &&\n !(from instanceof JsonArrayStore) &&\n to instanceof JsonObjectStore\n ) {\n return fromPrimitiveToObject;\n }\n\n if (from instanceof JsonObjectStore && to instanceof JsonArrayStore) {\n return fromObjectToArray;\n }\n\n if (from instanceof JsonArrayStore && to instanceof JsonObjectStore) {\n return fromArrayToObject;\n }\n\n if (from instanceof JsonArrayStore && to instanceof JsonArrayStore) {\n const itemTransformation = findTransformation(\n from.items.type,\n to.items.type,\n );\n\n if (itemTransformation && itemTransformation !== equal) {\n return (value: unknown, defaultValue?: unknown) => {\n if (!Array.isArray(value)) {\n return defaultValue;\n }\n\n return value.map((item) => {\n const result = itemTransformation(item, to.items.default);\n return result !== undefined ? result : to.items.default;\n });\n };\n }\n\n if (from.items.type !== to.items.type) {\n return (_value: unknown, defaultValue?: unknown) => defaultValue;\n }\n\n return equal;\n }\n\n if (to instanceof JsonArrayStore) {\n const transformation = findTransformation(from.type, to.items.type);\n\n if (!transformation) {\n return;\n }\n\n return toArrayTransformation(transformation);\n }\n\n if (from instanceof JsonArrayStore) {\n const transformation = findTransformation(from.items.type, to.type);\n\n if (!transformation) {\n return;\n }\n\n return fromArrayTransformation(transformation);\n }\n\n return findTransformation(from.type, to.type);\n};\n\nconst findTransformation = (\n from: JsonSchemaTypeName,\n to: JsonSchemaTypeName,\n): Transformation | undefined => {\n if (from === to) {\n return equal;\n }\n\n for (const item of replaceTransformationsMapper) {\n if (item.fromType === from && item.toType === to) {\n return item.transformation;\n }\n }\n\n return undefined;\n};\n\ntype Transformation = (value: unknown, defaultValue?: unknown) => unknown;\ntype ReplaceTransformationsMapper = {\n fromType: JsonSchemaTypeName;\n toType: JsonSchemaTypeName;\n transformation: Transformation;\n}[];\n","import { createJsonValueStore } from '../../lib/createJsonValueStore.js';\nimport { JsonSchemaStore } from '../../model/schema';\nimport { JsonObject, JsonValue } from '../../types/json.types.js';\nimport { JsonSchemaTypeName } from '../../types/schema.types.js';\nimport {\n AddedPropertyEvent,\n ChangeNameEvent,\n JsonObjectStore,\n MigratePropertyEvent,\n RemovedPropertyEvent,\n} from '../schema/json-object.store.js';\nimport { JsonValueStore, JsonValueStoreParent } from './json-value.store.js';\nimport { getTransformation } from './value-transformation.js';\n\nexport class JsonObjectValueStore {\n public readonly type = JsonSchemaTypeName.Object;\n\n public index: number;\n\n public parent: JsonValueStoreParent | null = null;\n\n constructor(\n public readonly schema: JsonObjectStore,\n public readonly rowId: string,\n public value: Record<string, JsonValueStore>,\n ) {\n this.index = this.schema.registerValue(this);\n this.init();\n }\n\n public getPlainValue(): JsonObject {\n return Object.entries(this.value).reduce<Record<string, JsonValue>>(\n (result, [name, store]) => {\n result[name] = store.getPlainValue() as JsonValue;\n return result;\n },\n {},\n );\n }\n\n public migrateProperty(event: MigratePropertyEvent) {\n const rawValue = this.getMigratedValue(event);\n\n this.value[event.name] = createJsonValueStore(\n event.property,\n this.rowId,\n rawValue,\n );\n }\n\n public addProperty(event: AddedPropertyEvent) {\n const rawValue = this.getAddedValue(event);\n\n this.value[event.name] = createJsonValueStore(\n event.property,\n this.rowId,\n rawValue,\n );\n }\n\n public removeProperty(event: RemovedPropertyEvent) {\n delete this.value[event.name];\n }\n\n public changeName(event: ChangeNameEvent) {\n const itemValue = this.value[event.fromName];\n\n if (itemValue !== undefined) {\n delete this.value[event.fromName];\n this.value[event.toName] = itemValue;\n }\n }\n\n private getAddedValue(event: AddedPropertyEvent): JsonValue {\n const ancestorValue = this.findValueAtSchemaLevel(event.property);\n if (ancestorValue !== undefined) {\n return ancestorValue;\n }\n\n const previousValue = event.property.getValue(this.rowId, this.index);\n if (previousValue) {\n return previousValue.getPlainValue();\n }\n\n return event.property.default;\n }\n\n private findValueAtSchemaLevel(\n targetSchema: JsonSchemaStore,\n ): JsonValue | undefined {\n let current: JsonValueStore | null = this.parent;\n\n while (current) {\n if (current.type === JsonSchemaTypeName.Object) {\n for (const [, fieldValue] of Object.entries(current.value)) {\n if (fieldValue.schema === targetSchema) {\n return fieldValue.getPlainValue();\n }\n }\n }\n\n current = current.parent;\n }\n\n return undefined;\n }\n\n private getMigratedValue(event: MigratePropertyEvent): JsonValue {\n const transformation = getTransformation(\n event.previousProperty,\n event.property,\n );\n\n const valueStore = this.value[event.name];\n if (transformation && valueStore) {\n return transformation(\n valueStore.getPlainValue(),\n event.property.default,\n ) as JsonValue;\n }\n\n return event.property.default;\n }\n\n private init() {\n for (const value of Object.values(this.value)) {\n value.parent = this;\n }\n }\n}\n","import {\n JsonArray,\n JsonObject,\n JsonPrimitives,\n JsonValue,\n} from '../types/json.types.js';\nimport { JsonSchemaTypeName } from '../types/schema.types.js';\nimport { JsonArrayStore } from '../model/schema/json-array.store.js';\nimport { JsonObjectStore } from '../model/schema/json-object.store.js';\nimport {\n JsonSchemaStore,\n JsonSchemaStorePrimitives,\n} from '../model/schema/json-schema.store.js';\nimport { JsonArrayValueStore } from '../model/value/json-array-value.store.js';\nimport { JsonBooleanValueStore } from '../model/value/json-boolean-value.store.js';\nimport { JsonNumberValueStore } from '../model/value/json-number-value.store.js';\nimport { JsonObjectValueStore } from '../model/value/json-object-value.store.js';\nimport { JsonStringValueStore } from '../model/value/json-string-value.store.js';\nimport {\n JsonValueStore,\n JsonValueStorePrimitives,\n} from '../model/value/json-value.store.js';\n\nexport const createJsonValueStore = (\n schema: JsonSchemaStore,\n rowId: string,\n rawValue: JsonValue,\n): JsonValueStore => {\n if (schema.type === JsonSchemaTypeName.Object) {\n return createJsonObjectValueStore(schema, rowId, rawValue as JsonObject);\n } else if (schema.type === JsonSchemaTypeName.Array) {\n return createJsonArrayValueStore(schema, rowId, rawValue as JsonArray);\n } else {\n return createPrimitiveValueStore(schema, rowId, rawValue as JsonPrimitives);\n }\n};\n\nexport const createJsonObjectValueStore = (\n schema: JsonObjectStore,\n rowId: string,\n rawValue: JsonObject,\n): JsonObjectValueStore => {\n const value = Object.entries(rawValue).reduce<Record<string, JsonValueStore>>(\n (reduceValue, [key, itemValue]) => {\n const itemSchema = schema.getProperty(key);\n\n if (itemSchema === undefined || itemValue === undefined) {\n throw new Error('Invalid item');\n }\n\n reduceValue[key] = createJsonValueStore(itemSchema, rowId, itemValue);\n\n return reduceValue;\n },\n {},\n );\n\n return new JsonObjectValueStore(schema, rowId, value);\n};\n\nexport const createJsonArrayValueStore = (\n schema: JsonArrayStore,\n rowId: string,\n rawValue: JsonArray,\n): JsonArrayValueStore => {\n const value = rawValue.map((value) =>\n createJsonValueStore(schema.items, rowId, value),\n );\n\n return new JsonArrayValueStore(schema, rowId, value);\n};\n\nexport const createPrimitiveValueStore = (\n schema: JsonSchemaStorePrimitives,\n rowId: string,\n rawValue: JsonPrimitives,\n): JsonValueStorePrimitives => {\n if (schema.type === JsonSchemaTypeName.String) {\n return new JsonStringValueStore(schema, rowId, rawValue as string | null);\n } else if (schema.type === JsonSchemaTypeName.Number) {\n return new JsonNumberValueStore(schema, rowId, rawValue as number | null);\n } else if (schema.type === JsonSchemaTypeName.Boolean) {\n return new JsonBooleanValueStore(schema, rowId, rawValue as boolean | null);\n } else {\n throw new Error('this type is not allowed');\n }\n};\n","import { JsonArray, JsonValue } from '../../types/json.types.js';\nimport { JsonSchemaTypeName } from '../../types/schema.types.js';\nimport {\n JsonArrayStore,\n MigrateItemsEvent,\n ReplaceItemsEvent,\n} from '../schema/json-array.store.js';\nimport { createJsonValueStore } from '../../lib/createJsonValueStore.js';\nimport { JsonValueStore, JsonValueStoreParent } from './json-value.store.js';\nimport { getTransformation } from './value-transformation.js';\n\nexport class JsonArrayValueStore {\n public readonly type = JsonSchemaTypeName.Array;\n\n public index: number;\n\n public parent: JsonValueStoreParent | null = null;\n\n constructor(\n public readonly schema: JsonArrayStore,\n public readonly rowId: string,\n public value: JsonValueStore[],\n ) {\n this.index = this.schema.registerValue(this);\n this.init();\n }\n\n public getPlainValue(): JsonArray {\n return this.value.map((item) => item.getPlainValue());\n }\n\n public migrateItems(event: MigrateItemsEvent) {\n const transformation = getTransformation(event.previousItems, event.items);\n\n this.value = this.value.map((valueItem) => {\n const rawValue = transformation\n ? (transformation(\n valueItem.getPlainValue(),\n event.items.default,\n ) as JsonValue)\n : event.items.default;\n\n return createJsonValueStore(event.items, this.rowId, rawValue);\n });\n }\n\n public replaceItems(event: ReplaceItemsEvent) {\n this.value = this.value.map(() => {\n const rawValue = this.getReplacedValue(event);\n\n return createJsonValueStore(event.items, this.rowId, rawValue);\n });\n }\n\n private getReplacedValue(event: ReplaceItemsEvent): JsonValue {\n const previousValue = event.items.getValue(this.rowId);\n\n if (previousValue) {\n return previousValue.getPlainValue();\n }\n\n return event.items.default;\n }\n\n private init() {\n for (const value of this.value) {\n value.parent = this;\n }\n }\n}\n"]}
@@ -9,5 +9,5 @@ var JsonSchemaTypeName = /* @__PURE__ */ ((JsonSchemaTypeName2) => {
9
9
  })(JsonSchemaTypeName || {});
10
10
 
11
11
  export { JsonSchemaTypeName };
12
- //# sourceMappingURL=chunk-ZXLLJAMQ.js.map
13
- //# sourceMappingURL=chunk-ZXLLJAMQ.js.map
12
+ //# sourceMappingURL=chunk-L5MLJEC7.js.map
13
+ //# sourceMappingURL=chunk-L5MLJEC7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types/schema.types.ts"],"names":["JsonSchemaTypeName"],"mappings":";AAAO,IAAK,kBAAA,qBAAAA,mBAAAA,KAAL;AACL,EAAAA,oBAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,oBAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,oBAAA,SAAA,CAAA,GAAU,SAAA;AACV,EAAAA,oBAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,oBAAA,OAAA,CAAA,GAAQ,OAAA;AALE,EAAA,OAAAA,mBAAAA;AAAA,CAAA,EAAA,kBAAA,IAAA,EAAA","file":"chunk-L5MLJEC7.js","sourcesContent":["export enum JsonSchemaTypeName {\n String = 'string',\n Number = 'number',\n Boolean = 'boolean',\n Object = 'object',\n Array = 'array',\n}\n\nexport type XFormula = {\n version: 1;\n expression: string;\n};\n\nexport type JsonSchemaSharedFields = {\n deprecated?: boolean;\n description?: string;\n title?: string;\n};\n\nexport type JsonStringSchema = {\n type: JsonSchemaTypeName.String;\n default: string;\n foreignKey?: string;\n readOnly?: boolean;\n title?: string;\n description?: string;\n deprecated?: boolean;\n pattern?: string;\n format?: 'date-time' | 'date' | 'time' | 'email' | 'regex';\n contentMediaType?:\n | 'text/plain'\n | 'text/markdown'\n | 'text/html'\n | 'application/json'\n | 'application/schema+json'\n | 'application/yaml';\n enum?: string[];\n 'x-formula'?: XFormula;\n} & JsonSchemaSharedFields;\n\nexport type JsonNumberSchema = {\n type: JsonSchemaTypeName.Number;\n default: number;\n readOnly?: boolean;\n title?: string;\n description?: string;\n deprecated?: boolean;\n 'x-formula'?: XFormula;\n} & JsonSchemaSharedFields;\n\nexport type JsonBooleanSchema = {\n type: JsonSchemaTypeName.Boolean;\n default: boolean;\n readOnly?: boolean;\n title?: string;\n description?: string;\n deprecated?: boolean;\n 'x-formula'?: XFormula;\n} & JsonSchemaSharedFields;\n\nexport type JsonSchemaPrimitives =\n | JsonStringSchema\n | JsonNumberSchema\n | JsonBooleanSchema;\n\nexport type JsonObjectSchema = {\n type: JsonSchemaTypeName.Object;\n additionalProperties: false;\n required: string[];\n properties: Record<string, JsonSchema>;\n title?: string;\n description?: string;\n deprecated?: boolean;\n} & JsonSchemaSharedFields;\n\nexport type JsonArraySchema = {\n type: JsonSchemaTypeName.Array;\n items: JsonSchema;\n title?: string;\n description?: string;\n deprecated?: boolean;\n} & JsonSchemaSharedFields;\n\nexport type JsonRefSchema = {\n $ref: string;\n title?: string;\n description?: string;\n deprecated?: boolean;\n};\n\nexport type JsonSchema =\n | JsonObjectSchema\n | JsonArraySchema\n | JsonSchemaPrimitives\n | JsonRefSchema;\n\nexport type JsonSchemaWithoutRef =\n | JsonObjectSchema\n | JsonArraySchema\n | JsonSchemaPrimitives;\n"]}
@@ -14,6 +14,25 @@ var sharedFields = {
14
14
  };
15
15
 
16
16
  // src/validation-schemas/meta-schema.ts
17
+ var xFormulaSchema = {
18
+ type: "object",
19
+ properties: {
20
+ version: { const: 1 },
21
+ expression: { type: "string", minLength: 1, maxLength: 1e4 }
22
+ },
23
+ required: ["version", "expression"],
24
+ additionalProperties: false
25
+ };
26
+ var xFormulaRequiresReadOnly = {
27
+ if: {
28
+ properties: { "x-formula": { type: "object" } },
29
+ required: ["x-formula"]
30
+ },
31
+ then: {
32
+ properties: { readOnly: { const: true } },
33
+ required: ["readOnly"]
34
+ }
35
+ };
17
36
  var refMetaSchema = {
18
37
  type: "object",
19
38
  properties: {
@@ -60,6 +79,7 @@ var baseStringFields = {
60
79
  "application/yaml"
61
80
  ]
62
81
  },
82
+ "x-formula": xFormulaSchema,
63
83
  ...sharedFields
64
84
  };
65
85
  var stringMetaSchema = {
@@ -71,7 +91,8 @@ var stringMetaSchema = {
71
91
  }
72
92
  },
73
93
  additionalProperties: false,
74
- required: ["type", "default"]
94
+ required: ["type", "default"],
95
+ ...xFormulaRequiresReadOnly
75
96
  };
76
97
  var noForeignKeyStringMetaSchema = {
77
98
  type: "object",
@@ -79,7 +100,8 @@ var noForeignKeyStringMetaSchema = {
79
100
  ...baseStringFields
80
101
  },
81
102
  additionalProperties: false,
82
- required: ["type", "default"]
103
+ required: ["type", "default"],
104
+ ...xFormulaRequiresReadOnly
83
105
  };
84
106
  var numberMetaSchema = {
85
107
  type: "object",
@@ -93,10 +115,12 @@ var numberMetaSchema = {
93
115
  readOnly: {
94
116
  type: "boolean"
95
117
  },
118
+ "x-formula": xFormulaSchema,
96
119
  ...sharedFields
97
120
  },
98
121
  additionalProperties: false,
99
- required: ["type", "default"]
122
+ required: ["type", "default"],
123
+ ...xFormulaRequiresReadOnly
100
124
  };
101
125
  var booleanMetaSchema = {
102
126
  type: "object",
@@ -110,10 +134,12 @@ var booleanMetaSchema = {
110
134
  readOnly: {
111
135
  type: "boolean"
112
136
  },
137
+ "x-formula": xFormulaSchema,
113
138
  ...sharedFields
114
139
  },
115
140
  additionalProperties: false,
116
- required: ["type", "default"]
141
+ required: ["type", "default"],
142
+ ...xFormulaRequiresReadOnly
117
143
  };
118
144
  var objectMetaSchema = {
119
145
  type: "object",
@@ -376,5 +402,7 @@ exports.refMetaSchema = refMetaSchema;
376
402
  exports.sharedFields = sharedFields;
377
403
  exports.stringMetaSchema = stringMetaSchema;
378
404
  exports.tableMigrationsSchema = tableMigrationsSchema;
379
- //# sourceMappingURL=chunk-VGTHMWJJ.cjs.map
380
- //# sourceMappingURL=chunk-VGTHMWJJ.cjs.map
405
+ exports.xFormulaRequiresReadOnly = xFormulaRequiresReadOnly;
406
+ exports.xFormulaSchema = xFormulaSchema;
407
+ //# sourceMappingURL=chunk-T7VRK5OQ.cjs.map
408
+ //# sourceMappingURL=chunk-T7VRK5OQ.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/validation-schemas/shared-fields.ts","../src/validation-schemas/meta-schema.ts","../src/validation-schemas/json-patch-schema.ts","../src/validation-schemas/history-patches-schema.ts","../src/validation-schemas/table-migrations-schema.ts"],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EAAS;AAAA,QACrB,OAAA,EAAS,EAAE,IAAA,EAAM,QAAA;AAAS;AAC5B;AACF,GACF;AAAA,EACA,KAAA,EAAO;AACT","file":"chunk-T7VRK5OQ.cjs","sourcesContent":["export const sharedFields = {\n deprecated: {\n type: 'boolean',\n },\n title: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n};\n","import { Schema } from 'ajv/dist/2020';\nimport { sharedFields } from './shared-fields.js';\n\n// https://json-schema.org/specification#single-vocabulary-meta-schemas\n\nexport const xFormulaSchema: Schema = {\n type: 'object',\n properties: {\n version: { const: 1 },\n expression: { type: 'string', minLength: 1, maxLength: 10000 },\n },\n required: ['version', 'expression'],\n additionalProperties: false,\n};\n\n// When x-formula is present, readOnly must be true\nexport const xFormulaRequiresReadOnly: Schema = {\n if: {\n properties: { 'x-formula': { type: 'object' } },\n required: ['x-formula'],\n },\n then: {\n properties: { readOnly: { const: true } },\n required: ['readOnly'],\n },\n};\n\nexport const refMetaSchema: Schema = {\n type: 'object',\n properties: {\n ...sharedFields,\n $ref: {\n type: 'string',\n },\n },\n additionalProperties: false,\n required: ['$ref'],\n};\n\nexport const baseStringFields: Schema = {\n type: {\n const: 'string',\n },\n default: {\n type: 'string',\n },\n readOnly: {\n type: 'boolean',\n },\n pattern: {\n type: 'string',\n format: 'regex',\n },\n enum: {\n type: 'array',\n items: { type: 'string' },\n minItems: 1,\n uniqueItems: true,\n },\n format: {\n type: 'string',\n enum: ['date-time', 'date', 'time', 'email', 'regex'],\n },\n contentMediaType: {\n type: 'string',\n enum: [\n 'text/plain',\n 'text/markdown',\n 'text/html',\n 'application/json',\n 'application/schema+json',\n 'application/yaml',\n ],\n },\n 'x-formula': xFormulaSchema,\n ...sharedFields,\n};\n\nexport const stringMetaSchema: Schema = {\n type: 'object',\n properties: {\n ...baseStringFields,\n foreignKey: {\n type: 'string',\n },\n },\n additionalProperties: false,\n required: ['type', 'default'],\n ...xFormulaRequiresReadOnly,\n};\n\nexport const noForeignKeyStringMetaSchema: Schema = {\n type: 'object',\n properties: {\n ...baseStringFields,\n },\n additionalProperties: false,\n required: ['type', 'default'],\n ...xFormulaRequiresReadOnly,\n};\n\nexport const numberMetaSchema: Schema = {\n type: 'object',\n properties: {\n type: {\n const: 'number',\n },\n default: {\n type: 'number',\n },\n readOnly: {\n type: 'boolean',\n },\n 'x-formula': xFormulaSchema,\n ...sharedFields,\n },\n additionalProperties: false,\n required: ['type', 'default'],\n ...xFormulaRequiresReadOnly,\n};\n\nexport const booleanMetaSchema: Schema = {\n type: 'object',\n properties: {\n type: {\n const: 'boolean',\n },\n default: {\n type: 'boolean',\n },\n readOnly: {\n type: 'boolean',\n },\n 'x-formula': xFormulaSchema,\n ...sharedFields,\n },\n additionalProperties: false,\n required: ['type', 'default'],\n ...xFormulaRequiresReadOnly,\n};\n\nexport const objectMetaSchema: Schema = {\n type: 'object',\n properties: {\n type: {\n const: 'object',\n },\n ...sharedFields,\n properties: {\n type: 'object',\n additionalProperties: { $dynamicRef: '#meta' },\n default: {},\n },\n additionalProperties: { const: false },\n required: { $ref: '#/$defs/stringArray' },\n },\n additionalProperties: false,\n required: ['type', 'properties', 'additionalProperties', 'required'],\n};\n\nexport const arrayMetaSchema: Schema = {\n type: 'object',\n properties: {\n type: {\n const: 'array',\n },\n ...sharedFields,\n items: {\n oneOf: [\n { $ref: '#/$defs/refSchema' },\n { $ref: '#/$defs/objectSchema' },\n { $ref: '#/$defs/arraySchema' },\n { $ref: '#/$defs/stringSchema' },\n { $ref: '#/$defs/numberSchema' },\n { $ref: '#/$defs/booleanSchema' },\n ],\n },\n },\n additionalProperties: false,\n required: ['type', 'items'],\n};\n\nexport const metaSchema: Schema = {\n $id: 'meta-schema.json',\n type: 'object',\n $dynamicAnchor: 'meta',\n oneOf: [\n { $ref: '#/$defs/refSchema' },\n { $ref: '#/$defs/objectSchema' },\n { $ref: '#/$defs/arraySchema' },\n { $ref: '#/$defs/stringSchema' },\n { $ref: '#/$defs/numberSchema' },\n { $ref: '#/$defs/booleanSchema' },\n ],\n $defs: {\n stringArray: {\n type: 'array',\n items: { type: 'string' },\n uniqueItems: true,\n default: [],\n },\n refSchema: refMetaSchema,\n objectSchema: objectMetaSchema,\n stringSchema: stringMetaSchema,\n numberSchema: numberMetaSchema,\n booleanSchema: booleanMetaSchema,\n arraySchema: arrayMetaSchema,\n },\n};\n\nexport const notForeignKeyMetaSchema: Schema = {\n type: 'object',\n $dynamicAnchor: 'meta',\n oneOf: [\n { $ref: '#/$defs/refSchema' },\n { $ref: '#/$defs/objectSchema' },\n { $ref: '#/$defs/arraySchema' },\n { $ref: '#/$defs/stringSchema' },\n { $ref: '#/$defs/numberSchema' },\n { $ref: '#/$defs/booleanSchema' },\n ],\n $defs: {\n stringArray: {\n type: 'array',\n items: { type: 'string' },\n uniqueItems: true,\n default: [],\n },\n refSchema: refMetaSchema,\n objectSchema: objectMetaSchema,\n stringSchema: noForeignKeyStringMetaSchema,\n numberSchema: numberMetaSchema,\n booleanSchema: booleanMetaSchema,\n arraySchema: arrayMetaSchema,\n },\n};\n","import { Schema } from 'ajv/dist/2020';\nimport {\n arrayMetaSchema,\n booleanMetaSchema,\n numberMetaSchema,\n objectMetaSchema,\n stringMetaSchema,\n} from './meta-schema.js';\n\n// copied and modified from https://json.schemastore.org/json-patch\n\nexport const jsonPatchSchema: Schema = {\n $id: 'json-patch-schema.json',\n definitions: {\n path: {\n description: 'A JSON Pointer path.',\n type: 'string',\n },\n objectSchema: objectMetaSchema,\n stringSchema: stringMetaSchema,\n numberSchema: numberMetaSchema,\n booleanSchema: booleanMetaSchema,\n arraySchema: arrayMetaSchema,\n },\n minItems: 1,\n items: {\n oneOf: [\n {\n type: 'object',\n additionalProperties: false,\n required: ['value', 'op', 'path'],\n properties: {\n path: {\n $ref: '#/definitions/path',\n },\n op: {\n description: 'The operation to perform.',\n type: 'string',\n enum: ['add', 'replace'],\n },\n value: {\n $ref: 'meta-schema.json',\n description: 'The value to add, replace or test.',\n },\n },\n },\n {\n type: 'object',\n additionalProperties: false,\n required: ['op', 'path'],\n properties: {\n path: {\n $ref: '#/definitions/path',\n },\n op: {\n description: 'The operation to perform.',\n type: 'string',\n enum: ['remove'],\n },\n },\n },\n {\n type: 'object',\n additionalProperties: false,\n required: ['from', 'op', 'path'],\n properties: {\n path: {\n $ref: '#/definitions/path',\n },\n op: {\n description: 'The operation to perform.',\n type: 'string',\n enum: ['move', 'copy'],\n },\n from: {\n $ref: '#/definitions/path',\n description:\n 'A JSON Pointer path pointing to the location to move/copy from.',\n },\n },\n },\n ],\n },\n title: 'JSON schema for JSONPatch files',\n type: 'array',\n};\n","import { Schema } from 'ajv/dist/2020';\n\nexport const historyPatchesSchema: Schema = {\n $id: 'history-patches-schema.json',\n type: 'array',\n minItems: 1,\n items: {\n type: 'object',\n properties: {\n patches: {\n $ref: 'json-patch-schema.json',\n },\n hash: {\n type: 'string',\n },\n },\n required: ['patches', 'hash'],\n },\n};\n","import { Schema } from 'ajv/dist/2020';\n\nexport const tableMigrationsSchema: Schema = {\n $id: 'table-migrations-schema.json',\n oneOf: [\n { $ref: '#/definitions/InitMigration' },\n { $ref: '#/definitions/UpdateMigration' },\n { $ref: '#/definitions/RenameMigration' },\n { $ref: '#/definitions/RemoveMigration' },\n ],\n definitions: {\n InitMigration: {\n type: 'object',\n additionalProperties: false,\n required: ['changeType', 'tableId', 'hash', 'id', 'schema'],\n properties: {\n changeType: { type: 'string', const: 'init' },\n tableId: { type: 'string' },\n hash: { type: 'string' },\n id: { type: 'string' },\n schema: { $ref: 'meta-schema.json' },\n },\n },\n UpdateMigration: {\n type: 'object',\n additionalProperties: false,\n required: ['changeType', 'tableId', 'hash', 'id', 'patches'],\n properties: {\n changeType: { type: 'string', const: 'update' },\n tableId: { type: 'string' },\n hash: { type: 'string' },\n id: { type: 'string' },\n patches: { $ref: 'json-patch-schema.json' },\n },\n },\n RenameMigration: {\n type: 'object',\n additionalProperties: false,\n required: ['changeType', 'id', 'tableId', 'nextTableId'],\n properties: {\n changeType: { type: 'string', const: 'rename' },\n id: { type: 'string' },\n tableId: { type: 'string' },\n nextTableId: { type: 'string' },\n },\n },\n RemoveMigration: {\n type: 'object',\n additionalProperties: false,\n required: ['changeType', 'id', 'tableId'],\n properties: {\n changeType: { type: 'string', const: 'remove' },\n id: { type: 'string' },\n tableId: { type: 'string' },\n },\n },\n },\n title: 'JSON Schema for a Single Migration',\n};\n"]}