@unispechq/unispec-core 0.3.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cache/cache-factory.d.ts +2 -2
- package/dist/cache/cache-factory.js +1 -1
- package/dist/cache/cache-manager.d.ts +2 -2
- package/dist/cache/cache-manager.js +9 -7
- package/dist/cache/hash-utils.d.ts +1 -11
- package/dist/cache/hash-utils.js +1 -21
- package/dist/cache/hashing.d.ts +15 -6
- package/dist/cache/hashing.js +8 -12
- package/dist/cache/index.d.ts +6 -6
- package/dist/cache/index.js +5 -5
- package/dist/cache/lru-cache.d.ts +1 -13
- package/dist/cache/lru-cache.js +3 -24
- package/dist/cjs/cache/cache-factory.js +1 -1
- package/dist/cjs/cache/cache-manager.js +9 -7
- package/dist/cjs/cache/hash-utils.js +1 -23
- package/dist/cjs/cache/hashing.js +7 -13
- package/dist/cjs/cache/index.js +6 -8
- package/dist/cjs/cache/lru-cache.js +3 -24
- package/dist/cjs/diff/annotators.js +3 -2
- package/dist/cjs/diff/core.js +2 -2
- package/dist/cjs/diff/enhanced-diff.js +7 -21
- package/dist/cjs/diff/index.js +8 -8
- package/dist/cjs/errors/config-error.js +1 -1
- package/dist/cjs/errors/error-factory.js +7 -7
- package/dist/cjs/errors/index.js +8 -8
- package/dist/cjs/errors/loader-error.js +1 -1
- package/dist/cjs/errors/reference-error.js +1 -1
- package/dist/cjs/errors/schema-error.js +1 -1
- package/dist/cjs/errors/security-error.js +1 -1
- package/dist/cjs/errors/semantic-error.js +1 -1
- package/dist/cjs/index.js +13 -13
- package/dist/cjs/loader/index.js +4 -4
- package/dist/cjs/loader/security-validator.js +1 -1
- package/dist/cjs/loader/unispec-loader.js +3 -3
- package/dist/cjs/loader/yaml-loader.js +1 -1
- package/dist/cjs/normalizer/core.js +11 -6
- package/dist/cjs/normalizer/index.js +1 -1
- package/dist/cjs/normalizer/utils.js +23 -7
- package/dist/cjs/optimizer/core.js +35 -10
- package/dist/cjs/optimizer/index.js +3 -3
- package/dist/cjs/optimizer/optimization-functions.js +2 -2
- package/dist/cjs/schemas/dedupe.js +27 -14
- package/dist/cjs/schemas/index.js +3 -3
- package/dist/cjs/schemas/resolver.js +3 -2
- package/dist/cjs/validator/ajv-validator.js +1 -1
- package/dist/cjs/validator/config-validator-main.js +4 -4
- package/dist/cjs/validator/config-validator.js +1 -1
- package/dist/cjs/validator/index.js +7 -7
- package/dist/cjs/validator/reference-validator.js +1 -1
- package/dist/cjs/validator/tests-validator.js +2 -2
- package/dist/cjs/validator/unispec-validator.js +7 -11
- package/dist/cjs/validator/validator-factory.js +1 -1
- package/dist/diff/annotators.d.ts +1 -1
- package/dist/diff/annotators.js +3 -2
- package/dist/diff/change-reports.d.ts +1 -1
- package/dist/diff/core.d.ts +2 -2
- package/dist/diff/core.js +2 -2
- package/dist/diff/enhanced-diff.d.ts +3 -3
- package/dist/diff/enhanced-diff.js +7 -21
- package/dist/diff/impact-strategies-refactored.d.ts +2 -2
- package/dist/diff/impact-strategies.d.ts +2 -2
- package/dist/diff/index.d.ts +8 -8
- package/dist/diff/index.js +8 -8
- package/dist/diff/metrics-calculator.d.ts +1 -1
- package/dist/diff/risk-calculator.d.ts +1 -1
- package/dist/diff/suggestion-generator.d.ts +2 -2
- package/dist/errors/config-error.d.ts +1 -1
- package/dist/errors/config-error.js +1 -1
- package/dist/errors/error-factory.d.ts +7 -7
- package/dist/errors/error-factory.js +7 -7
- package/dist/errors/index.d.ts +8 -8
- package/dist/errors/index.js +8 -8
- package/dist/errors/loader-error.d.ts +1 -1
- package/dist/errors/loader-error.js +1 -1
- package/dist/errors/reference-error.d.ts +1 -1
- package/dist/errors/reference-error.js +1 -1
- package/dist/errors/schema-error.d.ts +1 -1
- package/dist/errors/schema-error.js +1 -1
- package/dist/errors/security-error.d.ts +1 -1
- package/dist/errors/security-error.js +1 -1
- package/dist/errors/semantic-error.d.ts +1 -1
- package/dist/errors/semantic-error.js +1 -1
- package/dist/index.cjs +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.js +13 -13
- package/dist/loader/index.d.ts +5 -5
- package/dist/loader/index.js +4 -4
- package/dist/loader/security-validator.d.ts +1 -1
- package/dist/loader/security-validator.js +1 -1
- package/dist/loader/unispec-loader.d.ts +2 -2
- package/dist/loader/unispec-loader.js +3 -3
- package/dist/loader/yaml-loader.d.ts +1 -1
- package/dist/loader/yaml-loader.js +1 -1
- package/dist/normalizer/core.d.ts +2 -2
- package/dist/normalizer/core.js +11 -6
- package/dist/normalizer/graphql-normalizer.d.ts +1 -1
- package/dist/normalizer/index.d.ts +2 -2
- package/dist/normalizer/index.js +1 -1
- package/dist/normalizer/rest-normalizer.d.ts +1 -1
- package/dist/normalizer/types.d.ts +1 -1
- package/dist/normalizer/utils.d.ts +6 -3
- package/dist/normalizer/utils.js +23 -7
- package/dist/normalizer/websocket-normalizer.d.ts +1 -1
- package/dist/optimizer/core.d.ts +2 -2
- package/dist/optimizer/core.js +35 -10
- package/dist/optimizer/index.d.ts +4 -4
- package/dist/optimizer/index.js +3 -3
- package/dist/optimizer/optimization-functions.d.ts +2 -2
- package/dist/optimizer/optimization-functions.js +2 -2
- package/dist/optimizer/types.d.ts +1 -1
- package/dist/schemas/dedupe.d.ts +1 -1
- package/dist/schemas/dedupe.js +27 -14
- package/dist/schemas/index.d.ts +3 -3
- package/dist/schemas/index.js +3 -3
- package/dist/schemas/resolver.d.ts +1 -1
- package/dist/schemas/resolver.js +3 -2
- package/dist/types/index.d.ts +2 -1
- package/dist/validator/ajv-validator.d.ts +1 -1
- package/dist/validator/ajv-validator.js +1 -1
- package/dist/validator/config-validator-main.d.ts +2 -2
- package/dist/validator/config-validator-main.js +4 -4
- package/dist/validator/config-validator.d.ts +1 -1
- package/dist/validator/config-validator.js +1 -1
- package/dist/validator/index.d.ts +10 -10
- package/dist/validator/index.js +7 -7
- package/dist/validator/reference-validator.d.ts +1 -1
- package/dist/validator/reference-validator.js +1 -1
- package/dist/validator/schema-references.d.ts +1 -1
- package/dist/validator/semantic-validator.d.ts +1 -1
- package/dist/validator/tests-validator.d.ts +2 -2
- package/dist/validator/tests-validator.js +2 -2
- package/dist/validator/types.d.ts +3 -3
- package/dist/validator/unispec-validator.d.ts +2 -2
- package/dist/validator/unispec-validator.js +7 -11
- package/dist/validator/validator-factory.d.ts +3 -3
- package/dist/validator/validator-factory.js +1 -1
- package/package.json +3 -3
- package/dist/cjs/src/cache/cache-factory.js +0 -72
- package/dist/cjs/src/cache/cache-manager.js +0 -128
- package/dist/cjs/src/cache/constants.js +0 -25
- package/dist/cjs/src/cache/hash-utils.js +0 -19
- package/dist/cjs/src/cache/hashing.js +0 -230
- package/dist/cjs/src/cache/index.js +0 -24
- package/dist/cjs/src/cache/lru-cache.js +0 -144
- package/dist/cjs/src/cache/types.js +0 -5
- package/dist/cjs/src/diff/annotators.js +0 -160
- package/dist/cjs/src/diff/change-reports.js +0 -369
- package/dist/cjs/src/diff/core.js +0 -158
- package/dist/cjs/src/diff/enhanced-diff.js +0 -65
- package/dist/cjs/src/diff/impact-strategies-refactored.js +0 -230
- package/dist/cjs/src/diff/impact-strategies.js +0 -219
- package/dist/cjs/src/diff/index.js +0 -27
- package/dist/cjs/src/diff/metrics-calculator.js +0 -69
- package/dist/cjs/src/diff/risk-calculator.js +0 -58
- package/dist/cjs/src/diff/suggestion-generator.js +0 -78
- package/dist/cjs/src/diff/types.js +0 -11
- package/dist/cjs/src/errors/base-error.js +0 -33
- package/dist/cjs/src/errors/config-error.js +0 -11
- package/dist/cjs/src/errors/error-factory.js +0 -48
- package/dist/cjs/src/errors/index.js +0 -19
- package/dist/cjs/src/errors/loader-error.js +0 -11
- package/dist/cjs/src/errors/reference-error.js +0 -11
- package/dist/cjs/src/errors/schema-error.js +0 -11
- package/dist/cjs/src/errors/security-error.js +0 -11
- package/dist/cjs/src/errors/semantic-error.js +0 -11
- package/dist/cjs/src/generated-schemas.js +0 -2100
- package/dist/cjs/src/index.js +0 -59
- package/dist/cjs/src/loader/index.js +0 -13
- package/dist/cjs/src/loader/security-validator.js +0 -53
- package/dist/cjs/src/loader/types.js +0 -11
- package/dist/cjs/src/loader/unispec-loader.js +0 -84
- package/dist/cjs/src/loader/yaml-loader.js +0 -76
- package/dist/cjs/src/normalizer/core.js +0 -37
- package/dist/cjs/src/normalizer/graphql-normalizer.js +0 -67
- package/dist/cjs/src/normalizer/index.js +0 -7
- package/dist/cjs/src/normalizer/rest-normalizer.js +0 -51
- package/dist/cjs/src/normalizer/types.js +0 -2
- package/dist/cjs/src/normalizer/utils.js +0 -49
- package/dist/cjs/src/normalizer/websocket-normalizer.js +0 -81
- package/dist/cjs/src/optimizer/core.js +0 -140
- package/dist/cjs/src/optimizer/index.js +0 -17
- package/dist/cjs/src/optimizer/optimization-functions.js +0 -185
- package/dist/cjs/src/optimizer/types.js +0 -2
- package/dist/cjs/src/optimizer/utils.js +0 -32
- package/dist/cjs/src/schemas/dedupe.js +0 -113
- package/dist/cjs/src/schemas/index.js +0 -14
- package/dist/cjs/src/schemas/resolver.js +0 -42
- package/dist/cjs/src/schemas/utils.js +0 -53
- package/dist/cjs/src/types/index.js +0 -2
- package/dist/cjs/src/validator/ajv-validator.js +0 -82
- package/dist/cjs/src/validator/config-validator-main.js +0 -34
- package/dist/cjs/src/validator/config-validator.js +0 -17
- package/dist/cjs/src/validator/index.js +0 -23
- package/dist/cjs/src/validator/object-traversal.js +0 -112
- package/dist/cjs/src/validator/reference-validator.js +0 -233
- package/dist/cjs/src/validator/schema-references.js +0 -116
- package/dist/cjs/src/validator/semantic-validator.js +0 -328
- package/dist/cjs/src/validator/tests-validator.js +0 -16
- package/dist/cjs/src/validator/types.js +0 -2
- package/dist/cjs/src/validator/unispec-validator.js +0 -80
- package/dist/cjs/src/validator/validator-factory.js +0 -77
- package/dist/cjs/src/versions.js +0 -147
- package/dist/cjs/tests/cache/cache.test.js +0 -274
- package/dist/cjs/tests/cache/utils.js +0 -32
- package/dist/cjs/tests/concurrency-normalizer-optimizer.test.js +0 -1
- package/dist/cjs/tests/diff/diff-annotators.test.js +0 -280
- package/dist/cjs/tests/diff/diff-comprehensive.test.js +0 -262
- package/dist/cjs/tests/diff/diff-extended.test.js +0 -235
- package/dist/cjs/tests/diff/diff.test.js +0 -189
- package/dist/cjs/tests/diff/utils.js +0 -8
- package/dist/cjs/tests/errors/errors-integration.test.js +0 -173
- package/dist/cjs/tests/errors/errors.test.js +0 -280
- package/dist/cjs/tests/errors/utils.js +0 -7
- package/dist/cjs/tests/loader/integration.test.js +0 -216
- package/dist/cjs/tests/loader/loader.test.js +0 -341
- package/dist/cjs/tests/normalizer/normalizer-comprehensive.test.js +0 -648
- package/dist/cjs/tests/normalizer/normalizer-invalid.test.js +0 -258
- package/dist/cjs/tests/normalizer/normalizer-valid.test.js +0 -238
- package/dist/cjs/tests/normalizer/utils.js +0 -47
- package/dist/cjs/tests/optimizer/compress-references.test.js +0 -304
- package/dist/cjs/tests/optimizer/deduplication.test.js +0 -132
- package/dist/cjs/tests/optimizer/integration.test.js +0 -131
- package/dist/cjs/tests/optimizer/optimization-report.test.js +0 -222
- package/dist/cjs/tests/optimizer/optimize-document.test.js +0 -187
- package/dist/cjs/tests/optimizer/orphaned-schemas.test.js +0 -194
- package/dist/cjs/tests/optimizer/sort-schemas.test.js +0 -131
- package/dist/cjs/tests/optimizer/utils.js +0 -209
- package/dist/cjs/tests/schemas/schemas-edge-cases.test.js +0 -223
- package/dist/cjs/tests/schemas/schemas.test.js +0 -400
- package/dist/cjs/tests/schemas/utils.js +0 -7
- package/dist/cjs/tests/utils.js +0 -131
- package/dist/cjs/tests/validator/config-validator.test.js +0 -78
- package/dist/cjs/tests/validator/debug-config.js +0 -1
- package/dist/cjs/tests/validator/debug-missing-service.js +0 -1
- package/dist/cjs/tests/validator/debug-other-configs.js +0 -1
- package/dist/cjs/tests/validator/debug-references.js +0 -1
- package/dist/cjs/tests/validator/unispec-validator.test.js +0 -103
- package/dist/cjs/tests/validator/utils.js +0 -25
- package/dist/src/cache/cache-factory.d.ts +0 -31
- package/dist/src/cache/cache-factory.js +0 -65
- package/dist/src/cache/cache-manager.d.ts +0 -62
- package/dist/src/cache/cache-manager.js +0 -124
- package/dist/src/cache/constants.d.ts +0 -21
- package/dist/src/cache/constants.js +0 -22
- package/dist/src/cache/hash-utils.d.ts +0 -11
- package/dist/src/cache/hash-utils.js +0 -15
- package/dist/src/cache/hashing.d.ts +0 -28
- package/dist/src/cache/hashing.js +0 -193
- package/dist/src/cache/index.d.ts +0 -6
- package/dist/src/cache/index.js +0 -10
- package/dist/src/cache/lru-cache.d.ts +0 -44
- package/dist/src/cache/lru-cache.js +0 -140
- package/dist/src/cache/types.d.ts +0 -24
- package/dist/src/cache/types.js +0 -4
- package/dist/src/diff/annotators.d.ts +0 -4
- package/dist/src/diff/annotators.js +0 -155
- package/dist/src/diff/change-reports.d.ts +0 -37
- package/dist/src/diff/change-reports.js +0 -366
- package/dist/src/diff/core.d.ts +0 -26
- package/dist/src/diff/core.js +0 -155
- package/dist/src/diff/enhanced-diff.d.ts +0 -51
- package/dist/src/diff/enhanced-diff.js +0 -62
- package/dist/src/diff/impact-strategies-refactored.d.ts +0 -69
- package/dist/src/diff/impact-strategies-refactored.js +0 -223
- package/dist/src/diff/impact-strategies.d.ts +0 -41
- package/dist/src/diff/impact-strategies.js +0 -212
- package/dist/src/diff/index.d.ts +0 -8
- package/dist/src/diff/index.js +0 -11
- package/dist/src/diff/metrics-calculator.d.ts +0 -23
- package/dist/src/diff/metrics-calculator.js +0 -65
- package/dist/src/diff/risk-calculator.d.ts +0 -23
- package/dist/src/diff/risk-calculator.js +0 -55
- package/dist/src/diff/suggestion-generator.d.ts +0 -18
- package/dist/src/diff/suggestion-generator.js +0 -74
- package/dist/src/diff/types.d.ts +0 -24
- package/dist/src/diff/types.js +0 -8
- package/dist/src/errors/base-error.d.ts +0 -20
- package/dist/src/errors/base-error.js +0 -29
- package/dist/src/errors/config-error.d.ts +0 -4
- package/dist/src/errors/config-error.js +0 -7
- package/dist/src/errors/error-factory.d.ts +0 -22
- package/dist/src/errors/error-factory.js +0 -45
- package/dist/src/errors/index.d.ts +0 -8
- package/dist/src/errors/index.js +0 -8
- package/dist/src/errors/loader-error.d.ts +0 -4
- package/dist/src/errors/loader-error.js +0 -7
- package/dist/src/errors/reference-error.d.ts +0 -4
- package/dist/src/errors/reference-error.js +0 -7
- package/dist/src/errors/schema-error.d.ts +0 -4
- package/dist/src/errors/schema-error.js +0 -7
- package/dist/src/errors/security-error.d.ts +0 -4
- package/dist/src/errors/security-error.js +0 -7
- package/dist/src/errors/semantic-error.d.ts +0 -4
- package/dist/src/errors/semantic-error.js +0 -7
- package/dist/src/generated-schemas.d.ts +0 -2073
- package/dist/src/generated-schemas.js +0 -2097
- package/dist/src/index.d.ts +0 -13
- package/dist/src/index.js +0 -43
- package/dist/src/loader/index.d.ts +0 -5
- package/dist/src/loader/index.js +0 -5
- package/dist/src/loader/security-validator.d.ts +0 -5
- package/dist/src/loader/security-validator.js +0 -50
- package/dist/src/loader/types.d.ts +0 -30
- package/dist/src/loader/types.js +0 -8
- package/dist/src/loader/unispec-loader.d.ts +0 -10
- package/dist/src/loader/unispec-loader.js +0 -81
- package/dist/src/loader/yaml-loader.d.ts +0 -10
- package/dist/src/loader/yaml-loader.js +0 -39
- package/dist/src/normalizer/core.d.ts +0 -24
- package/dist/src/normalizer/core.js +0 -34
- package/dist/src/normalizer/graphql-normalizer.d.ts +0 -8
- package/dist/src/normalizer/graphql-normalizer.js +0 -64
- package/dist/src/normalizer/index.d.ts +0 -2
- package/dist/src/normalizer/index.js +0 -3
- package/dist/src/normalizer/rest-normalizer.d.ts +0 -8
- package/dist/src/normalizer/rest-normalizer.js +0 -48
- package/dist/src/normalizer/types.d.ts +0 -7
- package/dist/src/normalizer/types.js +0 -1
- package/dist/src/normalizer/utils.d.ts +0 -17
- package/dist/src/normalizer/utils.js +0 -45
- package/dist/src/normalizer/websocket-normalizer.d.ts +0 -8
- package/dist/src/normalizer/websocket-normalizer.js +0 -78
- package/dist/src/optimizer/core.d.ts +0 -17
- package/dist/src/optimizer/core.js +0 -136
- package/dist/src/optimizer/index.d.ts +0 -4
- package/dist/src/optimizer/index.js +0 -7
- package/dist/src/optimizer/optimization-functions.d.ts +0 -32
- package/dist/src/optimizer/optimization-functions.js +0 -179
- package/dist/src/optimizer/types.d.ts +0 -28
- package/dist/src/optimizer/types.js +0 -1
- package/dist/src/optimizer/utils.d.ts +0 -7
- package/dist/src/optimizer/utils.js +0 -29
- package/dist/src/schemas/dedupe.d.ts +0 -9
- package/dist/src/schemas/dedupe.js +0 -110
- package/dist/src/schemas/index.d.ts +0 -3
- package/dist/src/schemas/index.js +0 -6
- package/dist/src/schemas/resolver.d.ts +0 -19
- package/dist/src/schemas/resolver.js +0 -38
- package/dist/src/schemas/utils.d.ts +0 -20
- package/dist/src/schemas/utils.js +0 -49
- package/dist/src/types/index.d.ts +0 -434
- package/dist/src/types/index.js +0 -1
- package/dist/src/validator/ajv-validator.d.ts +0 -15
- package/dist/src/validator/ajv-validator.js +0 -75
- package/dist/src/validator/config-validator-main.d.ts +0 -10
- package/dist/src/validator/config-validator-main.js +0 -31
- package/dist/src/validator/config-validator.d.ts +0 -5
- package/dist/src/validator/config-validator.js +0 -14
- package/dist/src/validator/index.d.ts +0 -10
- package/dist/src/validator/index.js +0 -11
- package/dist/src/validator/object-traversal.d.ts +0 -52
- package/dist/src/validator/object-traversal.js +0 -104
- package/dist/src/validator/reference-validator.d.ts +0 -31
- package/dist/src/validator/reference-validator.js +0 -230
- package/dist/src/validator/schema-references.d.ts +0 -23
- package/dist/src/validator/schema-references.js +0 -111
- package/dist/src/validator/semantic-validator.d.ts +0 -26
- package/dist/src/validator/semantic-validator.js +0 -325
- package/dist/src/validator/tests-validator.d.ts +0 -9
- package/dist/src/validator/tests-validator.js +0 -13
- package/dist/src/validator/types.d.ts +0 -29
- package/dist/src/validator/types.js +0 -1
- package/dist/src/validator/unispec-validator.d.ts +0 -15
- package/dist/src/validator/unispec-validator.js +0 -77
- package/dist/src/validator/validator-factory.d.ts +0 -10
- package/dist/src/validator/validator-factory.js +0 -73
- package/dist/src/versions.d.ts +0 -10
- package/dist/src/versions.js +0 -143
- package/dist/tests/cache/cache.test.d.ts +0 -1
- package/dist/tests/cache/cache.test.js +0 -269
- package/dist/tests/cache/utils.d.ts +0 -4
- package/dist/tests/cache/utils.js +0 -24
- package/dist/tests/concurrency-normalizer-optimizer.test.d.ts +0 -0
- package/dist/tests/concurrency-normalizer-optimizer.test.js +0 -1
- package/dist/tests/diff/diff-annotators.test.d.ts +0 -1
- package/dist/tests/diff/diff-annotators.test.js +0 -275
- package/dist/tests/diff/diff-comprehensive.test.d.ts +0 -1
- package/dist/tests/diff/diff-comprehensive.test.js +0 -257
- package/dist/tests/diff/diff-extended.test.d.ts +0 -1
- package/dist/tests/diff/diff-extended.test.js +0 -230
- package/dist/tests/diff/diff.test.d.ts +0 -1
- package/dist/tests/diff/diff.test.js +0 -184
- package/dist/tests/diff/utils.d.ts +0 -2
- package/dist/tests/diff/utils.js +0 -3
- package/dist/tests/errors/errors-integration.test.d.ts +0 -1
- package/dist/tests/errors/errors-integration.test.js +0 -168
- package/dist/tests/errors/errors.test.d.ts +0 -1
- package/dist/tests/errors/errors.test.js +0 -275
- package/dist/tests/errors/utils.d.ts +0 -2
- package/dist/tests/errors/utils.js +0 -3
- package/dist/tests/loader/integration.test.d.ts +0 -1
- package/dist/tests/loader/integration.test.js +0 -211
- package/dist/tests/loader/loader.test.d.ts +0 -1
- package/dist/tests/loader/loader.test.js +0 -336
- package/dist/tests/normalizer/normalizer-comprehensive.test.d.ts +0 -1
- package/dist/tests/normalizer/normalizer-comprehensive.test.js +0 -643
- package/dist/tests/normalizer/normalizer-invalid.test.d.ts +0 -1
- package/dist/tests/normalizer/normalizer-invalid.test.js +0 -253
- package/dist/tests/normalizer/normalizer-valid.test.d.ts +0 -1
- package/dist/tests/normalizer/normalizer-valid.test.js +0 -233
- package/dist/tests/normalizer/utils.d.ts +0 -18
- package/dist/tests/normalizer/utils.js +0 -36
- package/dist/tests/optimizer/compress-references.test.d.ts +0 -1
- package/dist/tests/optimizer/compress-references.test.js +0 -299
- package/dist/tests/optimizer/deduplication.test.d.ts +0 -1
- package/dist/tests/optimizer/deduplication.test.js +0 -127
- package/dist/tests/optimizer/integration.test.d.ts +0 -1
- package/dist/tests/optimizer/integration.test.js +0 -126
- package/dist/tests/optimizer/optimization-report.test.d.ts +0 -1
- package/dist/tests/optimizer/optimization-report.test.js +0 -217
- package/dist/tests/optimizer/optimize-document.test.d.ts +0 -1
- package/dist/tests/optimizer/optimize-document.test.js +0 -182
- package/dist/tests/optimizer/orphaned-schemas.test.d.ts +0 -1
- package/dist/tests/optimizer/orphaned-schemas.test.js +0 -189
- package/dist/tests/optimizer/sort-schemas.test.d.ts +0 -1
- package/dist/tests/optimizer/sort-schemas.test.js +0 -126
- package/dist/tests/optimizer/utils.d.ts +0 -8
- package/dist/tests/optimizer/utils.js +0 -199
- package/dist/tests/schemas/schemas-edge-cases.test.d.ts +0 -1
- package/dist/tests/schemas/schemas-edge-cases.test.js +0 -218
- package/dist/tests/schemas/schemas.test.d.ts +0 -1
- package/dist/tests/schemas/schemas.test.js +0 -395
- package/dist/tests/schemas/utils.d.ts +0 -2
- package/dist/tests/schemas/utils.js +0 -3
- package/dist/tests/utils.d.ts +0 -10
- package/dist/tests/utils.js +0 -118
- package/dist/tests/validator/config-validator.test.d.ts +0 -1
- package/dist/tests/validator/config-validator.test.js +0 -73
- package/dist/tests/validator/debug-config.d.ts +0 -0
- package/dist/tests/validator/debug-config.js +0 -1
- package/dist/tests/validator/debug-missing-service.d.ts +0 -0
- package/dist/tests/validator/debug-missing-service.js +0 -1
- package/dist/tests/validator/debug-other-configs.d.ts +0 -0
- package/dist/tests/validator/debug-other-configs.js +0 -1
- package/dist/tests/validator/debug-references.d.ts +0 -0
- package/dist/tests/validator/debug-references.js +0 -1
- package/dist/tests/validator/unispec-validator.test.d.ts +0 -1
- package/dist/tests/validator/unispec-validator.test.js +0 -98
- package/dist/tests/validator/utils.d.ts +0 -6
- package/dist/tests/validator/utils.js +0 -20
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const node_assert_1 = __importDefault(require("node:assert"));
|
|
7
|
-
const node_test_1 = require("node:test");
|
|
8
|
-
const validator_1 = require("../../src/validator/index.js");
|
|
9
|
-
const utils_1 = require("./utils.js");
|
|
10
|
-
(0, node_test_1.describe)("validateUniSpec", () => {
|
|
11
|
-
(0, node_test_1.describe)("valid examples", () => {
|
|
12
|
-
(0, node_test_1.it)("should validate simple REST spec", async () => {
|
|
13
|
-
const doc = (0, utils_1.loadValidSpecExample)("rest-simple");
|
|
14
|
-
const result = await (0, validator_1.validateUniSpec)(doc);
|
|
15
|
-
node_assert_1.default.strictEqual(result.valid, true, "Valid REST spec should pass validation");
|
|
16
|
-
node_assert_1.default.deepStrictEqual(result.errors, [], "Should have no errors");
|
|
17
|
-
});
|
|
18
|
-
(0, node_test_1.it)("should validate simple GraphQL spec", async () => {
|
|
19
|
-
const doc = (0, utils_1.loadValidSpecExample)("graphql-simple");
|
|
20
|
-
const result = await (0, validator_1.validateUniSpec)(doc);
|
|
21
|
-
node_assert_1.default.strictEqual(result.valid, true, "Valid GraphQL spec should pass validation");
|
|
22
|
-
node_assert_1.default.deepStrictEqual(result.errors, [], "Should have no errors");
|
|
23
|
-
});
|
|
24
|
-
(0, node_test_1.it)("should validate simple WebSocket spec", async () => {
|
|
25
|
-
const doc = (0, utils_1.loadValidSpecExample)("websocket-simple");
|
|
26
|
-
const result = await (0, validator_1.validateUniSpec)(doc);
|
|
27
|
-
node_assert_1.default.strictEqual(result.valid, true, "Valid WebSocket spec should pass validation");
|
|
28
|
-
node_assert_1.default.deepStrictEqual(result.errors, [], "Should have no errors");
|
|
29
|
-
});
|
|
30
|
-
(0, node_test_1.it)("should validate mixed complete spec", async () => {
|
|
31
|
-
const doc = (0, utils_1.loadValidSpecExample)("mixed-complete");
|
|
32
|
-
const result = await (0, validator_1.validateUniSpec)(doc);
|
|
33
|
-
node_assert_1.default.strictEqual(result.valid, true, "Valid mixed spec should pass validation");
|
|
34
|
-
node_assert_1.default.deepStrictEqual(result.errors, [], "Should have no errors");
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
(0, node_test_1.describe)("invalid examples", () => {
|
|
38
|
-
(0, node_test_1.it)("should reject spec missing service name", async () => {
|
|
39
|
-
const doc = (0, utils_1.loadInvalidSpecExample)("missing-service-name");
|
|
40
|
-
const result = await (0, validator_1.validateUniSpec)(doc);
|
|
41
|
-
node_assert_1.default.strictEqual(result.valid, false, "Spec without service name should fail validation");
|
|
42
|
-
node_assert_1.default.ok(result.errors.length > 0, "Should have validation errors");
|
|
43
|
-
// Check that error mentions missing required property
|
|
44
|
-
const hasServiceNameError = result.errors.some((error) => error.message?.includes("required property") &&
|
|
45
|
-
error.message.includes("name"));
|
|
46
|
-
node_assert_1.default.ok(hasServiceNameError, "Should have error about missing service name");
|
|
47
|
-
});
|
|
48
|
-
(0, node_test_1.it)("should reject spec missing unispec version", async () => {
|
|
49
|
-
const doc = (0, utils_1.loadInvalidSpecExample)("missing-unispec-version");
|
|
50
|
-
const result = await (0, validator_1.validateUniSpec)(doc);
|
|
51
|
-
node_assert_1.default.strictEqual(result.valid, false, "Spec without version should fail validation");
|
|
52
|
-
node_assert_1.default.ok(result.errors.length > 0, "Should have validation errors");
|
|
53
|
-
});
|
|
54
|
-
(0, node_test_1.it)("should reject spec with invalid identifier", async () => {
|
|
55
|
-
const doc = (0, utils_1.loadInvalidSpecExample)("invalid-identifier");
|
|
56
|
-
const result = await (0, validator_1.validateUniSpec)(doc);
|
|
57
|
-
node_assert_1.default.strictEqual(result.valid, false, "Spec with invalid identifier should fail validation");
|
|
58
|
-
node_assert_1.default.ok(result.errors.length > 0, "Should have validation errors");
|
|
59
|
-
});
|
|
60
|
-
(0, node_test_1.it)("should reject GraphQL spec missing argument type", async () => {
|
|
61
|
-
const doc = (0, utils_1.loadInvalidSpecExample)("graphql-missing-arg-type");
|
|
62
|
-
const result = await (0, validator_1.validateUniSpec)(doc);
|
|
63
|
-
node_assert_1.default.strictEqual(result.valid, false, "GraphQL spec without arg type should fail validation");
|
|
64
|
-
node_assert_1.default.ok(result.errors.length > 0, "Should have validation errors");
|
|
65
|
-
});
|
|
66
|
-
(0, node_test_1.it)("should reject GraphQL spec missing name", async () => {
|
|
67
|
-
const doc = (0, utils_1.loadInvalidSpecExample)("graphql-missing-name");
|
|
68
|
-
const result = await (0, validator_1.validateUniSpec)(doc);
|
|
69
|
-
node_assert_1.default.strictEqual(result.valid, false, "GraphQL spec without name should fail validation");
|
|
70
|
-
node_assert_1.default.ok(result.errors.length > 0, "Should have validation errors");
|
|
71
|
-
});
|
|
72
|
-
(0, node_test_1.it)("should reject spec with invalid REST method", async () => {
|
|
73
|
-
const doc = (0, utils_1.loadInvalidSpecExample)("invalid-rest-method");
|
|
74
|
-
const result = await (0, validator_1.validateUniSpec)(doc);
|
|
75
|
-
node_assert_1.default.strictEqual(result.valid, false, "Spec with invalid REST method should fail validation");
|
|
76
|
-
node_assert_1.default.ok(result.errors.length > 0, "Should have validation errors");
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
(0, node_test_1.describe)("extended validation", () => {
|
|
80
|
-
(0, node_test_1.it)("should perform semantic validation when enabled", async () => {
|
|
81
|
-
const doc = (0, utils_1.loadValidSpecExample)("rest-simple");
|
|
82
|
-
const result = await (0, validator_1.validateUniSpec)(doc, {
|
|
83
|
-
enableExtendedValidation: true,
|
|
84
|
-
semanticValidation: {},
|
|
85
|
-
});
|
|
86
|
-
node_assert_1.default.strictEqual(result.valid, true, "Valid spec should pass semantic validation");
|
|
87
|
-
node_assert_1.default.ok("semantic" in result, "Should have semantic validation result");
|
|
88
|
-
const extendedResult = result;
|
|
89
|
-
node_assert_1.default.strictEqual(extendedResult.semantic?.valid, true, "Semantic validation should pass");
|
|
90
|
-
});
|
|
91
|
-
(0, node_test_1.it)("should perform reference validation when enabled", async () => {
|
|
92
|
-
const doc = (0, utils_1.loadValidSpecExample)("mixed-complete");
|
|
93
|
-
const result = await (0, validator_1.validateUniSpec)(doc, {
|
|
94
|
-
enableExtendedValidation: true,
|
|
95
|
-
referenceValidation: {},
|
|
96
|
-
});
|
|
97
|
-
node_assert_1.default.strictEqual(result.valid, true, "Valid spec should pass reference validation");
|
|
98
|
-
node_assert_1.default.ok("references" in result, "Should have reference validation result");
|
|
99
|
-
const extendedResult = result;
|
|
100
|
-
node_assert_1.default.strictEqual(extendedResult.references?.valid, true, "Reference validation should pass");
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.loadValidSpecExample = loadValidSpecExample;
|
|
4
|
-
exports.loadInvalidSpecExample = loadInvalidSpecExample;
|
|
5
|
-
exports.loadValidConfigExample = loadValidConfigExample;
|
|
6
|
-
exports.loadInvalidConfigExample = loadInvalidConfigExample;
|
|
7
|
-
const node_path_1 = require("node:path");
|
|
8
|
-
const utils_1 = require("../../tests/utils.js");
|
|
9
|
-
// Validator-specific utilities
|
|
10
|
-
function loadValidSpecExample(name) {
|
|
11
|
-
const path = (0, node_path_1.join)(utils_1.examplesDir, "valid/spec", `${name}.json`);
|
|
12
|
-
return (0, utils_1.loadExample)(path);
|
|
13
|
-
}
|
|
14
|
-
function loadInvalidSpecExample(name) {
|
|
15
|
-
const path = (0, node_path_1.join)(utils_1.examplesDir, "invalid/spec", `${name}.json`);
|
|
16
|
-
return (0, utils_1.loadExample)(path);
|
|
17
|
-
}
|
|
18
|
-
function loadValidConfigExample(name) {
|
|
19
|
-
const path = (0, node_path_1.join)(utils_1.examplesDir, "valid/config", `${name}.json`);
|
|
20
|
-
return (0, utils_1.loadExample)(path);
|
|
21
|
-
}
|
|
22
|
-
function loadInvalidConfigExample(name) {
|
|
23
|
-
const path = (0, node_path_1.join)(utils_1.examplesDir, "invalid/config", `${name}.json`);
|
|
24
|
-
return (0, utils_1.loadInvalidExample)(path);
|
|
25
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { UniSpecCacheManager } from "./cache-manager.js";
|
|
2
|
-
import type { CacheOptions } from "./types.js";
|
|
3
|
-
/**
|
|
4
|
-
* Create a new isolated cache manager instance.
|
|
5
|
-
* @param options - Cache configuration options
|
|
6
|
-
* @returns New cache manager instance
|
|
7
|
-
*/
|
|
8
|
-
export declare function createCacheManager(options?: CacheOptions): UniSpecCacheManager;
|
|
9
|
-
/**
|
|
10
|
-
* Create a named cache manager instance with simple registry.
|
|
11
|
-
* @param name - Instance name for identification
|
|
12
|
-
* @param options - Cache configuration options
|
|
13
|
-
* @returns Cache manager instance
|
|
14
|
-
*/
|
|
15
|
-
export declare function createNamedCacheManager(name?: string, options?: CacheOptions): UniSpecCacheManager;
|
|
16
|
-
/**
|
|
17
|
-
* Get cache manager statistics for multiple instances.
|
|
18
|
-
* @param managers - Array of cache manager instances
|
|
19
|
-
* @returns Statistics for all provided managers
|
|
20
|
-
*/
|
|
21
|
-
export declare function getManagersStats(managers: UniSpecCacheManager[]): Record<string, ReturnType<UniSpecCacheManager["getStats"]>>;
|
|
22
|
-
/**
|
|
23
|
-
* Destroy multiple cache manager instances.
|
|
24
|
-
* @param managers - Array of cache manager instances to destroy
|
|
25
|
-
*/
|
|
26
|
-
export declare function destroyManagers(managers: UniSpecCacheManager[]): void;
|
|
27
|
-
/**
|
|
28
|
-
* Clear test registry (for testing only).
|
|
29
|
-
* @internal
|
|
30
|
-
*/
|
|
31
|
-
export declare function clearTestRegistry(): void;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { UniSpecCacheManager } from "./cache-manager.js";
|
|
2
|
-
/**
|
|
3
|
-
* Simple registry for test cleanup (minimal, not persistent global state)
|
|
4
|
-
*/
|
|
5
|
-
const testRegistry = new Map();
|
|
6
|
-
/**
|
|
7
|
-
* Create a new isolated cache manager instance.
|
|
8
|
-
* @param options - Cache configuration options
|
|
9
|
-
* @returns New cache manager instance
|
|
10
|
-
*/
|
|
11
|
-
export function createCacheManager(options) {
|
|
12
|
-
return new UniSpecCacheManager(options);
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Create a named cache manager instance with simple registry.
|
|
16
|
-
* @param name - Instance name for identification
|
|
17
|
-
* @param options - Cache configuration options
|
|
18
|
-
* @returns Cache manager instance
|
|
19
|
-
*/
|
|
20
|
-
export function createNamedCacheManager(name = "default", options) {
|
|
21
|
-
// For testing, keep simple registry to enable cleanup
|
|
22
|
-
if (testRegistry.has(name)) {
|
|
23
|
-
const existing = testRegistry.get(name);
|
|
24
|
-
if (existing) {
|
|
25
|
-
existing.destroy(); // Cleanup existing instance
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
const manager = new UniSpecCacheManager(options);
|
|
29
|
-
manager._name = name; // Store name for debugging
|
|
30
|
-
testRegistry.set(name, manager); // Add to registry for cleanup
|
|
31
|
-
return manager;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Get cache manager statistics for multiple instances.
|
|
35
|
-
* @param managers - Array of cache manager instances
|
|
36
|
-
* @returns Statistics for all provided managers
|
|
37
|
-
*/
|
|
38
|
-
export function getManagersStats(managers) {
|
|
39
|
-
const stats = {};
|
|
40
|
-
for (const [index, manager] of managers.entries()) {
|
|
41
|
-
const name = manager._name ||
|
|
42
|
-
`manager_${index}`;
|
|
43
|
-
stats[name] = manager.getStats();
|
|
44
|
-
}
|
|
45
|
-
return stats;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Destroy multiple cache manager instances.
|
|
49
|
-
* @param managers - Array of cache manager instances to destroy
|
|
50
|
-
*/
|
|
51
|
-
export function destroyManagers(managers) {
|
|
52
|
-
for (const manager of managers) {
|
|
53
|
-
manager.destroy();
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Clear test registry (for testing only).
|
|
58
|
-
* @internal
|
|
59
|
-
*/
|
|
60
|
-
export function clearTestRegistry() {
|
|
61
|
-
for (const manager of testRegistry.values()) {
|
|
62
|
-
manager.destroy();
|
|
63
|
-
}
|
|
64
|
-
testRegistry.clear();
|
|
65
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import type { ValidationResult } from "../types/index.js";
|
|
2
|
-
import type { CacheOptions, CacheStats } from "./types.js";
|
|
3
|
-
/**
|
|
4
|
-
* Cache manager for UniSpec operations.
|
|
5
|
-
*/
|
|
6
|
-
export declare class UniSpecCacheManager {
|
|
7
|
-
private validationCache;
|
|
8
|
-
private normalizationCache;
|
|
9
|
-
private diffCache;
|
|
10
|
-
private cleanupInterval;
|
|
11
|
-
constructor(options?: CacheOptions);
|
|
12
|
-
/**
|
|
13
|
-
* Get cached validation result asynchronously.
|
|
14
|
-
*/
|
|
15
|
-
getValidationResult(documentHash: string): Promise<ValidationResult | undefined>;
|
|
16
|
-
/**
|
|
17
|
-
* Cache validation result asynchronously.
|
|
18
|
-
*/
|
|
19
|
-
setValidationResult(documentHash: string, result: ValidationResult): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Get cached normalization result asynchronously.
|
|
22
|
-
*/
|
|
23
|
-
getNormalizationResult(documentHash: string): Promise<unknown>;
|
|
24
|
-
/**
|
|
25
|
-
* Cache normalization result asynchronously.
|
|
26
|
-
*/
|
|
27
|
-
setNormalizationResult(documentHash: string, result: unknown): Promise<void>;
|
|
28
|
-
/**
|
|
29
|
-
* Get cached diff result asynchronously.
|
|
30
|
-
*/
|
|
31
|
-
getDiffResult(docsHash: string): Promise<unknown>;
|
|
32
|
-
/**
|
|
33
|
-
* Cache diff result asynchronously.
|
|
34
|
-
*/
|
|
35
|
-
setDiffResult(docsHash: string, result: unknown): Promise<void>;
|
|
36
|
-
/**
|
|
37
|
-
* Get comprehensive cache statistics.
|
|
38
|
-
*/
|
|
39
|
-
getStats(): {
|
|
40
|
-
validation: CacheStats;
|
|
41
|
-
normalization: CacheStats;
|
|
42
|
-
diff: CacheStats;
|
|
43
|
-
total: {
|
|
44
|
-
size: number;
|
|
45
|
-
hits: number;
|
|
46
|
-
misses: number;
|
|
47
|
-
hitRate: number;
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Clear all caches.
|
|
52
|
-
*/
|
|
53
|
-
clearAll(): void;
|
|
54
|
-
/**
|
|
55
|
-
* Start automatic cleanup interval.
|
|
56
|
-
*/
|
|
57
|
-
private startCleanup;
|
|
58
|
-
/**
|
|
59
|
-
* Stop automatic cleanup.
|
|
60
|
-
*/
|
|
61
|
-
destroy(): void;
|
|
62
|
-
}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { CACHE_CONSTANTS, CACHE_MESSAGES } from "./constants.js";
|
|
2
|
-
import { LRUCache } from "./lru-cache.js";
|
|
3
|
-
/**
|
|
4
|
-
* Cache manager for UniSpec operations.
|
|
5
|
-
*/
|
|
6
|
-
export class UniSpecCacheManager {
|
|
7
|
-
constructor(options = {}) {
|
|
8
|
-
this.cleanupInterval = null;
|
|
9
|
-
this.validationCache = new LRUCache({
|
|
10
|
-
...options,
|
|
11
|
-
maxSize: options.maxSize || CACHE_CONSTANTS.VALIDATION_MAX_SIZE,
|
|
12
|
-
});
|
|
13
|
-
this.normalizationCache = new LRUCache({
|
|
14
|
-
...options,
|
|
15
|
-
maxSize: options.maxSize || CACHE_CONSTANTS.NORMALIZATION_MAX_SIZE,
|
|
16
|
-
});
|
|
17
|
-
this.diffCache = new LRUCache({
|
|
18
|
-
...options,
|
|
19
|
-
maxSize: options.maxSize || CACHE_CONSTANTS.DIFF_MAX_SIZE,
|
|
20
|
-
});
|
|
21
|
-
// Only start cleanup if not in test environment
|
|
22
|
-
if (process.env.NODE_ENV !== "test") {
|
|
23
|
-
this.startCleanup();
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Get cached validation result asynchronously.
|
|
28
|
-
*/
|
|
29
|
-
async getValidationResult(documentHash) {
|
|
30
|
-
return await this.validationCache.get(documentHash);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Cache validation result asynchronously.
|
|
34
|
-
*/
|
|
35
|
-
async setValidationResult(documentHash, result) {
|
|
36
|
-
await this.validationCache.set(documentHash, result);
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Get cached normalization result asynchronously.
|
|
40
|
-
*/
|
|
41
|
-
async getNormalizationResult(documentHash) {
|
|
42
|
-
return await this.normalizationCache.get(documentHash);
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Cache normalization result asynchronously.
|
|
46
|
-
*/
|
|
47
|
-
async setNormalizationResult(documentHash, result) {
|
|
48
|
-
await this.normalizationCache.set(documentHash, result);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Get cached diff result asynchronously.
|
|
52
|
-
*/
|
|
53
|
-
async getDiffResult(docsHash) {
|
|
54
|
-
return await this.diffCache.get(docsHash);
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Cache diff result asynchronously.
|
|
58
|
-
*/
|
|
59
|
-
async setDiffResult(docsHash, result) {
|
|
60
|
-
await this.diffCache.set(docsHash, result);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Get comprehensive cache statistics.
|
|
64
|
-
*/
|
|
65
|
-
getStats() {
|
|
66
|
-
const validationStats = this.validationCache.getStats();
|
|
67
|
-
const normalizationStats = this.normalizationCache.getStats();
|
|
68
|
-
const diffStats = this.diffCache.getStats();
|
|
69
|
-
const total = {
|
|
70
|
-
size: validationStats.size + normalizationStats.size + diffStats.size,
|
|
71
|
-
hits: validationStats.hits + normalizationStats.hits + diffStats.hits,
|
|
72
|
-
misses: validationStats.misses + normalizationStats.misses + diffStats.misses,
|
|
73
|
-
hitRate: 0,
|
|
74
|
-
};
|
|
75
|
-
const totalRequests = total.hits + total.misses;
|
|
76
|
-
total.hitRate = totalRequests > 0 ? total.hits / totalRequests : 0;
|
|
77
|
-
return {
|
|
78
|
-
validation: validationStats,
|
|
79
|
-
normalization: normalizationStats,
|
|
80
|
-
diff: diffStats,
|
|
81
|
-
total,
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Clear all caches.
|
|
86
|
-
*/
|
|
87
|
-
clearAll() {
|
|
88
|
-
this.validationCache.clear();
|
|
89
|
-
this.normalizationCache.clear();
|
|
90
|
-
this.diffCache.clear();
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Start automatic cleanup interval.
|
|
94
|
-
*/
|
|
95
|
-
startCleanup() {
|
|
96
|
-
try {
|
|
97
|
-
this.cleanupInterval = setInterval(() => {
|
|
98
|
-
try {
|
|
99
|
-
this.validationCache.cleanup();
|
|
100
|
-
this.normalizationCache.cleanup();
|
|
101
|
-
this.diffCache.cleanup();
|
|
102
|
-
}
|
|
103
|
-
catch (error) {
|
|
104
|
-
console.error(CACHE_MESSAGES.CLEANUP_ERROR, error);
|
|
105
|
-
// Continue running cleanup even if one cache fails
|
|
106
|
-
}
|
|
107
|
-
}, CACHE_CONSTANTS.CLEANUP_INTERVAL);
|
|
108
|
-
}
|
|
109
|
-
catch (error) {
|
|
110
|
-
console.error(CACHE_MESSAGES.CLEANUP_START_ERROR, error);
|
|
111
|
-
// Cache will still work without automatic cleanup
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Stop automatic cleanup.
|
|
116
|
-
*/
|
|
117
|
-
destroy() {
|
|
118
|
-
if (this.cleanupInterval) {
|
|
119
|
-
clearInterval(this.cleanupInterval);
|
|
120
|
-
this.cleanupInterval = null;
|
|
121
|
-
}
|
|
122
|
-
this.clearAll();
|
|
123
|
-
}
|
|
124
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cache configuration constants.
|
|
3
|
-
*/
|
|
4
|
-
export declare const CACHE_CONSTANTS: {
|
|
5
|
-
readonly DEFAULT_MAX_SIZE: 100;
|
|
6
|
-
readonly VALIDATION_MAX_SIZE: 50;
|
|
7
|
-
readonly NORMALIZATION_MAX_SIZE: 30;
|
|
8
|
-
readonly DIFF_MAX_SIZE: 20;
|
|
9
|
-
readonly DEFAULT_TTL: number;
|
|
10
|
-
readonly CLEANUP_INTERVAL: 60000;
|
|
11
|
-
readonly HASH_GOLDEN_RATIO: 2654435761;
|
|
12
|
-
readonly HASH_BASE: 31;
|
|
13
|
-
readonly HASH_MASK: 4294967295;
|
|
14
|
-
};
|
|
15
|
-
export declare const CACHE_MESSAGES: {
|
|
16
|
-
readonly CLEANUP_ERROR: "Cache cleanup error";
|
|
17
|
-
readonly CLEANUP_START_ERROR: "Failed to start cleanup interval";
|
|
18
|
-
readonly CACHE_WILL_CONTINUE: "Cache will still work without automatic cleanup";
|
|
19
|
-
};
|
|
20
|
-
export type CacheSize = typeof CACHE_CONSTANTS.DEFAULT_MAX_SIZE | typeof CACHE_CONSTANTS.VALIDATION_MAX_SIZE | typeof CACHE_CONSTANTS.NORMALIZATION_MAX_SIZE | typeof CACHE_CONSTANTS.DIFF_MAX_SIZE;
|
|
21
|
-
export type TTL = typeof CACHE_CONSTANTS.DEFAULT_TTL | typeof CACHE_CONSTANTS.CLEANUP_INTERVAL;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cache configuration constants.
|
|
3
|
-
*/
|
|
4
|
-
export const CACHE_CONSTANTS = {
|
|
5
|
-
// Default cache sizes
|
|
6
|
-
DEFAULT_MAX_SIZE: 100,
|
|
7
|
-
VALIDATION_MAX_SIZE: 50,
|
|
8
|
-
NORMALIZATION_MAX_SIZE: 30,
|
|
9
|
-
DIFF_MAX_SIZE: 20,
|
|
10
|
-
// TTL values (in milliseconds)
|
|
11
|
-
DEFAULT_TTL: 5 * 60 * 1000, // 5 minutes
|
|
12
|
-
CLEANUP_INTERVAL: 60000, // 1 minute
|
|
13
|
-
// Hash configuration
|
|
14
|
-
HASH_GOLDEN_RATIO: 2654435761,
|
|
15
|
-
HASH_BASE: 31,
|
|
16
|
-
HASH_MASK: 0xffffffff,
|
|
17
|
-
};
|
|
18
|
-
export const CACHE_MESSAGES = {
|
|
19
|
-
CLEANUP_ERROR: "Cache cleanup error",
|
|
20
|
-
CLEANUP_START_ERROR: "Failed to start cleanup interval",
|
|
21
|
-
CACHE_WILL_CONTINUE: "Cache will still work without automatic cleanup",
|
|
22
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { UniSpecDocument } from "../types/index.js";
|
|
2
|
-
/**
|
|
3
|
-
* Generate a hash for a UniSpec document for caching purposes.
|
|
4
|
-
* Uses optimized hashing for better performance and collision resistance.
|
|
5
|
-
*/
|
|
6
|
-
export declare function generateDocumentHash(document: UniSpecDocument): Promise<string>;
|
|
7
|
-
/**
|
|
8
|
-
* Generate a hash for two documents (for diff caching).
|
|
9
|
-
* Uses optimized diff hashing with better collision resistance.
|
|
10
|
-
*/
|
|
11
|
-
export declare function generateDiffHash(oldDoc: UniSpecDocument, newDoc: UniSpecDocument): Promise<string>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { generateOptimizedDiffHash, generateOptimizedDocumentHash, } from "./hashing.js";
|
|
2
|
-
/**
|
|
3
|
-
* Generate a hash for a UniSpec document for caching purposes.
|
|
4
|
-
* Uses optimized hashing for better performance and collision resistance.
|
|
5
|
-
*/
|
|
6
|
-
export async function generateDocumentHash(document) {
|
|
7
|
-
return await generateOptimizedDocumentHash(document);
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Generate a hash for two documents (for diff caching).
|
|
11
|
-
* Uses optimized diff hashing with better collision resistance.
|
|
12
|
-
*/
|
|
13
|
-
export async function generateDiffHash(oldDoc, newDoc) {
|
|
14
|
-
return await generateOptimizedDiffHash(oldDoc, newDoc);
|
|
15
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { UniSpecDocument } from "../types/index.js";
|
|
2
|
-
/**
|
|
3
|
-
* Generate a secure hash for a document using optimized sorting and Web Crypto API.
|
|
4
|
-
*/
|
|
5
|
-
export declare function generateOptimizedDocumentHash(document: UniSpecDocument): Promise<string>;
|
|
6
|
-
/**
|
|
7
|
-
* Configuration for stable stringification.
|
|
8
|
-
*/
|
|
9
|
-
interface StringifyConfig {
|
|
10
|
-
maxDepth: number;
|
|
11
|
-
maxKeys: number;
|
|
12
|
-
handleCircular: boolean;
|
|
13
|
-
handleDeepObjects: boolean;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Optimized stable stringification that avoids recursion depth issues.
|
|
17
|
-
*/
|
|
18
|
-
declare function stableStringify(obj: unknown, config?: Partial<StringifyConfig>, depth?: number, visited?: WeakSet<object>): string;
|
|
19
|
-
/**
|
|
20
|
-
* Generate a secure hash for two documents (for diff caching) with optimized collision resistance.
|
|
21
|
-
*/
|
|
22
|
-
export declare function generateOptimizedDiffHash(oldDoc: UniSpecDocument, newDoc: UniSpecDocument): Promise<string>;
|
|
23
|
-
/**
|
|
24
|
-
* Simple hash for small objects (keys, strings) using built-in hash.
|
|
25
|
-
* Kept for backward compatibility but consider using secureHash for new code.
|
|
26
|
-
*/
|
|
27
|
-
export declare function simpleHash(str: string): string;
|
|
28
|
-
export { stableStringify };
|