@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,5 +1,5 @@
|
|
|
1
|
-
import { UniSpecCacheManager } from "./cache-manager
|
|
2
|
-
import type { CacheOptions } from "./types
|
|
1
|
+
import { UniSpecCacheManager } from "./cache-manager";
|
|
2
|
+
import type { CacheOptions } from "./types";
|
|
3
3
|
/**
|
|
4
4
|
* Create a new isolated cache manager instance.
|
|
5
5
|
* @param options - Cache configuration options
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ValidationResult } from "
|
|
2
|
-
import type { CacheOptions, CacheStats } from "./types
|
|
1
|
+
import type { ValidationResult } from "@/types";
|
|
2
|
+
import type { CacheOptions, CacheStats } from "./types";
|
|
3
3
|
/**
|
|
4
4
|
* Cache manager for UniSpec operations.
|
|
5
5
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CACHE_CONSTANTS, CACHE_MESSAGES } from "./constants
|
|
2
|
-
import { LRUCache } from "./lru-cache
|
|
1
|
+
import { CACHE_CONSTANTS, CACHE_MESSAGES } from "./constants";
|
|
2
|
+
import { LRUCache } from "./lru-cache";
|
|
3
3
|
/**
|
|
4
4
|
* Cache manager for UniSpec operations.
|
|
5
5
|
*/
|
|
@@ -8,18 +8,20 @@ export class UniSpecCacheManager {
|
|
|
8
8
|
this.cleanupInterval = null;
|
|
9
9
|
this.validationCache = new LRUCache({
|
|
10
10
|
...options,
|
|
11
|
-
maxSize: CACHE_CONSTANTS.VALIDATION_MAX_SIZE,
|
|
11
|
+
maxSize: options.maxSize || CACHE_CONSTANTS.VALIDATION_MAX_SIZE,
|
|
12
12
|
});
|
|
13
13
|
this.normalizationCache = new LRUCache({
|
|
14
14
|
...options,
|
|
15
|
-
maxSize: CACHE_CONSTANTS.NORMALIZATION_MAX_SIZE,
|
|
15
|
+
maxSize: options.maxSize || CACHE_CONSTANTS.NORMALIZATION_MAX_SIZE,
|
|
16
16
|
});
|
|
17
17
|
this.diffCache = new LRUCache({
|
|
18
18
|
...options,
|
|
19
|
-
maxSize: CACHE_CONSTANTS.DIFF_MAX_SIZE,
|
|
19
|
+
maxSize: options.maxSize || CACHE_CONSTANTS.DIFF_MAX_SIZE,
|
|
20
20
|
});
|
|
21
|
-
//
|
|
22
|
-
|
|
21
|
+
// Only start cleanup if not in test environment
|
|
22
|
+
if (process.env.NODE_ENV !== "test") {
|
|
23
|
+
this.startCleanup();
|
|
24
|
+
}
|
|
23
25
|
}
|
|
24
26
|
/**
|
|
25
27
|
* Get cached validation result asynchronously.
|
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
import type { UniSpecDocument } from "
|
|
1
|
+
import type { UniSpecDocument } from "@/types";
|
|
2
2
|
/**
|
|
3
3
|
* Generate a hash for a UniSpec document for caching purposes.
|
|
4
4
|
* Uses optimized hashing for better performance and collision resistance.
|
|
5
5
|
*/
|
|
6
6
|
export declare function generateDocumentHash(document: UniSpecDocument): Promise<string>;
|
|
7
|
-
/**
|
|
8
|
-
* Synchronous version for backward compatibility (deprecated).
|
|
9
|
-
* @deprecated Use async version for better security
|
|
10
|
-
*/
|
|
11
|
-
export declare function generateDocumentHashSync(document: UniSpecDocument): string;
|
|
12
7
|
/**
|
|
13
8
|
* Generate a hash for two documents (for diff caching).
|
|
14
9
|
* Uses optimized diff hashing with better collision resistance.
|
|
15
10
|
*/
|
|
16
11
|
export declare function generateDiffHash(oldDoc: UniSpecDocument, newDoc: UniSpecDocument): Promise<string>;
|
|
17
|
-
/**
|
|
18
|
-
* Synchronous version for backward compatibility (deprecated).
|
|
19
|
-
* @deprecated Use async version for better security
|
|
20
|
-
*/
|
|
21
|
-
export declare function generateDiffHashSync(oldDoc: UniSpecDocument, newDoc: UniSpecDocument): string;
|
package/dist/cache/hash-utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { generateOptimizedDiffHash, generateOptimizedDocumentHash,
|
|
1
|
+
import { generateOptimizedDiffHash, generateOptimizedDocumentHash, } from "./hashing";
|
|
2
2
|
/**
|
|
3
3
|
* Generate a hash for a UniSpec document for caching purposes.
|
|
4
4
|
* Uses optimized hashing for better performance and collision resistance.
|
|
@@ -6,16 +6,6 @@ import { generateOptimizedDiffHash, generateOptimizedDocumentHash, simpleHash, }
|
|
|
6
6
|
export async function generateDocumentHash(document) {
|
|
7
7
|
return await generateOptimizedDocumentHash(document);
|
|
8
8
|
}
|
|
9
|
-
/**
|
|
10
|
-
* Synchronous version for backward compatibility (deprecated).
|
|
11
|
-
* @deprecated Use async version for better security
|
|
12
|
-
*/
|
|
13
|
-
export function generateDocumentHashSync(document) {
|
|
14
|
-
// Fallback to old method for backward compatibility
|
|
15
|
-
console.warn("generateDocumentHashSync is deprecated. Use async generateDocumentHash for better security.");
|
|
16
|
-
const str = JSON.stringify(document, Object.keys(document).sort());
|
|
17
|
-
return simpleHash(str);
|
|
18
|
-
}
|
|
19
9
|
/**
|
|
20
10
|
* Generate a hash for two documents (for diff caching).
|
|
21
11
|
* Uses optimized diff hashing with better collision resistance.
|
|
@@ -23,13 +13,3 @@ export function generateDocumentHashSync(document) {
|
|
|
23
13
|
export async function generateDiffHash(oldDoc, newDoc) {
|
|
24
14
|
return await generateOptimizedDiffHash(oldDoc, newDoc);
|
|
25
15
|
}
|
|
26
|
-
/**
|
|
27
|
-
* Synchronous version for backward compatibility (deprecated).
|
|
28
|
-
* @deprecated Use async version for better security
|
|
29
|
-
*/
|
|
30
|
-
export function generateDiffHashSync(oldDoc, newDoc) {
|
|
31
|
-
console.warn("generateDiffHashSync is deprecated. Use async generateDiffHash for better security.");
|
|
32
|
-
const oldStr = JSON.stringify(oldDoc, Object.keys(oldDoc).sort());
|
|
33
|
-
const newStr = JSON.stringify(newDoc, Object.keys(newDoc).sort());
|
|
34
|
-
return simpleHash(`${oldStr}:${newStr}`);
|
|
35
|
-
}
|
package/dist/cache/hashing.d.ts
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
|
-
import type { UniSpecDocument } from "
|
|
1
|
+
import type { UniSpecDocument } from "@/types";
|
|
2
2
|
/**
|
|
3
3
|
* Generate a secure hash for a document using optimized sorting and Web Crypto API.
|
|
4
4
|
*/
|
|
5
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;
|
|
6
19
|
/**
|
|
7
20
|
* Generate a secure hash for two documents (for diff caching) with optimized collision resistance.
|
|
8
21
|
*/
|
|
@@ -12,8 +25,4 @@ export declare function generateOptimizedDiffHash(oldDoc: UniSpecDocument, newDo
|
|
|
12
25
|
* Kept for backward compatibility but consider using secureHash for new code.
|
|
13
26
|
*/
|
|
14
27
|
export declare function simpleHash(str: string): string;
|
|
15
|
-
|
|
16
|
-
* Legacy synchronous hash function (deprecated - use secureHash instead).
|
|
17
|
-
* @deprecated Use secureHash for better security
|
|
18
|
-
*/
|
|
19
|
-
export declare function fnv1aHash(str: string): number;
|
|
28
|
+
export { stableStringify };
|
package/dist/cache/hashing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CACHE_CONSTANTS } from "../cache/constants
|
|
1
|
+
import { CACHE_CONSTANTS } from "../cache/constants";
|
|
2
2
|
/**
|
|
3
3
|
* Secure document hashing utilities using Web Crypto API.
|
|
4
4
|
*/
|
|
@@ -180,18 +180,14 @@ export async function generateOptimizedDiffHash(oldDoc, newDoc) {
|
|
|
180
180
|
* Kept for backward compatibility but consider using secureHash for new code.
|
|
181
181
|
*/
|
|
182
182
|
export function simpleHash(str) {
|
|
183
|
-
let hash =
|
|
183
|
+
let hash = 5381; // DJB2 hash initial value
|
|
184
184
|
for (let i = 0; i < str.length; i++) {
|
|
185
185
|
const char = str.charCodeAt(i);
|
|
186
|
-
hash = ((hash << 5)
|
|
186
|
+
hash = ((hash << 5) + hash + char) & CACHE_CONSTANTS.HASH_MASK;
|
|
187
187
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
* Legacy synchronous hash function (deprecated - use secureHash instead).
|
|
192
|
-
* @deprecated Use secureHash for better security
|
|
193
|
-
*/
|
|
194
|
-
export function fnv1aHash(str) {
|
|
195
|
-
console.warn("fnv1aHash is deprecated. Use secureHash for better security.");
|
|
196
|
-
return fnv1aHashFallback(str);
|
|
188
|
+
// Convert to hex and pad to 8 characters
|
|
189
|
+
const hex = hash.toString(16);
|
|
190
|
+
return hex.padStart(8, "0").slice(-8);
|
|
197
191
|
}
|
|
192
|
+
// Export stableStringify for use in hash-utils
|
|
193
|
+
export { stableStringify };
|
package/dist/cache/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { clearTestRegistry, createCacheManager, createNamedCacheManager, destroyManagers, getManagersStats, } from "./cache-factory
|
|
2
|
-
export { UniSpecCacheManager } from "./cache-manager
|
|
3
|
-
export { CACHE_CONSTANTS, CACHE_MESSAGES } from "./constants
|
|
4
|
-
export { generateDiffHash,
|
|
5
|
-
export { LRUCache } from "./lru-cache
|
|
6
|
-
export type { CacheEntry, CacheOptions, CacheSize, CacheStats, TTL, } from "./types
|
|
1
|
+
export { clearTestRegistry, createCacheManager, createNamedCacheManager, destroyManagers, getManagersStats, } from "./cache-factory";
|
|
2
|
+
export { UniSpecCacheManager } from "./cache-manager";
|
|
3
|
+
export { CACHE_CONSTANTS, CACHE_MESSAGES } from "./constants";
|
|
4
|
+
export { generateDiffHash, generateDocumentHash, } from "./hash-utils";
|
|
5
|
+
export { LRUCache } from "./lru-cache";
|
|
6
|
+
export type { CacheEntry, CacheOptions, CacheSize, CacheStats, TTL, } from "./types";
|
package/dist/cache/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Constants and messages
|
|
2
2
|
// Cache factory
|
|
3
|
-
export { clearTestRegistry, createCacheManager, createNamedCacheManager, destroyManagers, getManagersStats, } from "./cache-factory
|
|
3
|
+
export { clearTestRegistry, createCacheManager, createNamedCacheManager, destroyManagers, getManagersStats, } from "./cache-factory";
|
|
4
4
|
// Cache manager
|
|
5
|
-
export { UniSpecCacheManager } from "./cache-manager
|
|
6
|
-
export { CACHE_CONSTANTS, CACHE_MESSAGES } from "./constants
|
|
5
|
+
export { UniSpecCacheManager } from "./cache-manager";
|
|
6
|
+
export { CACHE_CONSTANTS, CACHE_MESSAGES } from "./constants";
|
|
7
7
|
// Hash utilities
|
|
8
|
-
export { generateDiffHash,
|
|
8
|
+
export { generateDiffHash, generateDocumentHash, } from "./hash-utils";
|
|
9
9
|
// Core cache implementation
|
|
10
|
-
export { LRUCache } from "./lru-cache
|
|
10
|
+
export { LRUCache } from "./lru-cache";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CacheOptions, CacheStats } from "./types
|
|
1
|
+
import type { CacheOptions, CacheStats } from "./types";
|
|
2
2
|
/**
|
|
3
3
|
* Simple LRU (Least Recently Used) cache implementation.
|
|
4
4
|
*/
|
|
@@ -11,24 +11,12 @@ export declare class LRUCache<T> {
|
|
|
11
11
|
constructor(options?: CacheOptions);
|
|
12
12
|
/**
|
|
13
13
|
* Get a value from the cache asynchronously.
|
|
14
|
-
* For performance, this uses sync operations wrapped in Promise for compatibility.
|
|
15
14
|
*/
|
|
16
15
|
get(key: string): Promise<T | undefined>;
|
|
17
16
|
/**
|
|
18
17
|
* Set a value in the cache asynchronously.
|
|
19
|
-
* For performance, this uses sync operations wrapped in Promise for compatibility.
|
|
20
18
|
*/
|
|
21
19
|
set(key: string, value: T): Promise<void>;
|
|
22
|
-
/**
|
|
23
|
-
* Get a value from the cache (synchronous version for backward compatibility).
|
|
24
|
-
* @deprecated Use async get() method instead
|
|
25
|
-
*/
|
|
26
|
-
getSync(key: string): T | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* Set a value in the cache (synchronous version for backward compatibility).
|
|
29
|
-
* @deprecated Use async set() method instead
|
|
30
|
-
*/
|
|
31
|
-
setSync(key: string, value: T): void;
|
|
32
20
|
/**
|
|
33
21
|
* Delete a value from the cache.
|
|
34
22
|
*/
|
package/dist/cache/lru-cache.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CACHE_CONSTANTS } from "./constants
|
|
1
|
+
import { CACHE_CONSTANTS } from "./constants";
|
|
2
2
|
/**
|
|
3
3
|
* Simple LRU (Least Recently Used) cache implementation.
|
|
4
4
|
*/
|
|
@@ -18,28 +18,8 @@ export class LRUCache {
|
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Get a value from the cache asynchronously.
|
|
21
|
-
* For performance, this uses sync operations wrapped in Promise for compatibility.
|
|
22
21
|
*/
|
|
23
22
|
async get(key) {
|
|
24
|
-
// Use synchronous operations for better performance
|
|
25
|
-
// Only wrap in Promise for async interface compatibility
|
|
26
|
-
return Promise.resolve(this.getSync(key));
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Set a value in the cache asynchronously.
|
|
30
|
-
* For performance, this uses sync operations wrapped in Promise for compatibility.
|
|
31
|
-
*/
|
|
32
|
-
async set(key, value) {
|
|
33
|
-
// Use synchronous operations for better performance
|
|
34
|
-
// Only wrap in Promise for async interface compatibility
|
|
35
|
-
this.setSync(key, value);
|
|
36
|
-
return Promise.resolve();
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Get a value from the cache (synchronous version for backward compatibility).
|
|
40
|
-
* @deprecated Use async get() method instead
|
|
41
|
-
*/
|
|
42
|
-
getSync(key) {
|
|
43
23
|
const entry = this.cache.get(key);
|
|
44
24
|
if (!entry) {
|
|
45
25
|
if (this.enableStats) {
|
|
@@ -71,10 +51,9 @@ export class LRUCache {
|
|
|
71
51
|
return entry.value;
|
|
72
52
|
}
|
|
73
53
|
/**
|
|
74
|
-
* Set a value in the cache
|
|
75
|
-
* @deprecated Use async set() method instead
|
|
54
|
+
* Set a value in the cache asynchronously.
|
|
76
55
|
*/
|
|
77
|
-
|
|
56
|
+
async set(key, value) {
|
|
78
57
|
// Remove existing entry if present
|
|
79
58
|
if (this.cache.has(key)) {
|
|
80
59
|
this.cache.delete(key);
|
|
@@ -5,7 +5,7 @@ exports.createNamedCacheManager = createNamedCacheManager;
|
|
|
5
5
|
exports.getManagersStats = getManagersStats;
|
|
6
6
|
exports.destroyManagers = destroyManagers;
|
|
7
7
|
exports.clearTestRegistry = clearTestRegistry;
|
|
8
|
-
const cache_manager_1 = require("./cache-manager
|
|
8
|
+
const cache_manager_1 = require("./cache-manager");
|
|
9
9
|
/**
|
|
10
10
|
* Simple registry for test cleanup (minimal, not persistent global state)
|
|
11
11
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UniSpecCacheManager = void 0;
|
|
4
|
-
const constants_1 = require("./constants
|
|
5
|
-
const lru_cache_1 = require("./lru-cache
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
const lru_cache_1 = require("./lru-cache");
|
|
6
6
|
/**
|
|
7
7
|
* Cache manager for UniSpec operations.
|
|
8
8
|
*/
|
|
@@ -11,18 +11,20 @@ class UniSpecCacheManager {
|
|
|
11
11
|
this.cleanupInterval = null;
|
|
12
12
|
this.validationCache = new lru_cache_1.LRUCache({
|
|
13
13
|
...options,
|
|
14
|
-
maxSize: constants_1.CACHE_CONSTANTS.VALIDATION_MAX_SIZE,
|
|
14
|
+
maxSize: options.maxSize || constants_1.CACHE_CONSTANTS.VALIDATION_MAX_SIZE,
|
|
15
15
|
});
|
|
16
16
|
this.normalizationCache = new lru_cache_1.LRUCache({
|
|
17
17
|
...options,
|
|
18
|
-
maxSize: constants_1.CACHE_CONSTANTS.NORMALIZATION_MAX_SIZE,
|
|
18
|
+
maxSize: options.maxSize || constants_1.CACHE_CONSTANTS.NORMALIZATION_MAX_SIZE,
|
|
19
19
|
});
|
|
20
20
|
this.diffCache = new lru_cache_1.LRUCache({
|
|
21
21
|
...options,
|
|
22
|
-
maxSize: constants_1.CACHE_CONSTANTS.DIFF_MAX_SIZE,
|
|
22
|
+
maxSize: options.maxSize || constants_1.CACHE_CONSTANTS.DIFF_MAX_SIZE,
|
|
23
23
|
});
|
|
24
|
-
//
|
|
25
|
-
|
|
24
|
+
// Only start cleanup if not in test environment
|
|
25
|
+
if (process.env.NODE_ENV !== "test") {
|
|
26
|
+
this.startCleanup();
|
|
27
|
+
}
|
|
26
28
|
}
|
|
27
29
|
/**
|
|
28
30
|
* Get cached validation result asynchronously.
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateDocumentHash = generateDocumentHash;
|
|
4
|
-
exports.generateDocumentHashSync = generateDocumentHashSync;
|
|
5
4
|
exports.generateDiffHash = generateDiffHash;
|
|
6
|
-
|
|
7
|
-
const hashing_1 = require("./hashing.js");
|
|
5
|
+
const hashing_1 = require("./hashing");
|
|
8
6
|
/**
|
|
9
7
|
* Generate a hash for a UniSpec document for caching purposes.
|
|
10
8
|
* Uses optimized hashing for better performance and collision resistance.
|
|
@@ -12,16 +10,6 @@ const hashing_1 = require("./hashing.js");
|
|
|
12
10
|
async function generateDocumentHash(document) {
|
|
13
11
|
return await (0, hashing_1.generateOptimizedDocumentHash)(document);
|
|
14
12
|
}
|
|
15
|
-
/**
|
|
16
|
-
* Synchronous version for backward compatibility (deprecated).
|
|
17
|
-
* @deprecated Use async version for better security
|
|
18
|
-
*/
|
|
19
|
-
function generateDocumentHashSync(document) {
|
|
20
|
-
// Fallback to old method for backward compatibility
|
|
21
|
-
console.warn("generateDocumentHashSync is deprecated. Use async generateDocumentHash for better security.");
|
|
22
|
-
const str = JSON.stringify(document, Object.keys(document).sort());
|
|
23
|
-
return (0, hashing_1.simpleHash)(str);
|
|
24
|
-
}
|
|
25
13
|
/**
|
|
26
14
|
* Generate a hash for two documents (for diff caching).
|
|
27
15
|
* Uses optimized diff hashing with better collision resistance.
|
|
@@ -29,13 +17,3 @@ function generateDocumentHashSync(document) {
|
|
|
29
17
|
async function generateDiffHash(oldDoc, newDoc) {
|
|
30
18
|
return await (0, hashing_1.generateOptimizedDiffHash)(oldDoc, newDoc);
|
|
31
19
|
}
|
|
32
|
-
/**
|
|
33
|
-
* Synchronous version for backward compatibility (deprecated).
|
|
34
|
-
* @deprecated Use async version for better security
|
|
35
|
-
*/
|
|
36
|
-
function generateDiffHashSync(oldDoc, newDoc) {
|
|
37
|
-
console.warn("generateDiffHashSync is deprecated. Use async generateDiffHash for better security.");
|
|
38
|
-
const oldStr = JSON.stringify(oldDoc, Object.keys(oldDoc).sort());
|
|
39
|
-
const newStr = JSON.stringify(newDoc, Object.keys(newDoc).sort());
|
|
40
|
-
return (0, hashing_1.simpleHash)(`${oldStr}:${newStr}`);
|
|
41
|
-
}
|
|
@@ -36,8 +36,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.generateOptimizedDocumentHash = generateOptimizedDocumentHash;
|
|
37
37
|
exports.generateOptimizedDiffHash = generateOptimizedDiffHash;
|
|
38
38
|
exports.simpleHash = simpleHash;
|
|
39
|
-
exports.
|
|
40
|
-
const constants_1 = require("../cache/constants
|
|
39
|
+
exports.stableStringify = stableStringify;
|
|
40
|
+
const constants_1 = require("../cache/constants");
|
|
41
41
|
/**
|
|
42
42
|
* Secure document hashing utilities using Web Crypto API.
|
|
43
43
|
*/
|
|
@@ -219,18 +219,12 @@ async function generateOptimizedDiffHash(oldDoc, newDoc) {
|
|
|
219
219
|
* Kept for backward compatibility but consider using secureHash for new code.
|
|
220
220
|
*/
|
|
221
221
|
function simpleHash(str) {
|
|
222
|
-
let hash =
|
|
222
|
+
let hash = 5381; // DJB2 hash initial value
|
|
223
223
|
for (let i = 0; i < str.length; i++) {
|
|
224
224
|
const char = str.charCodeAt(i);
|
|
225
|
-
hash = ((hash << 5)
|
|
225
|
+
hash = ((hash << 5) + hash + char) & constants_1.CACHE_CONSTANTS.HASH_MASK;
|
|
226
226
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
* Legacy synchronous hash function (deprecated - use secureHash instead).
|
|
231
|
-
* @deprecated Use secureHash for better security
|
|
232
|
-
*/
|
|
233
|
-
function fnv1aHash(str) {
|
|
234
|
-
console.warn("fnv1aHash is deprecated. Use secureHash for better security.");
|
|
235
|
-
return fnv1aHashFallback(str);
|
|
227
|
+
// Convert to hex and pad to 8 characters
|
|
228
|
+
const hex = hash.toString(16);
|
|
229
|
+
return hex.padStart(8, "0").slice(-8);
|
|
236
230
|
}
|
package/dist/cjs/cache/index.js
CHANGED
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Constants and messages
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.LRUCache = exports.
|
|
4
|
+
exports.LRUCache = exports.generateDocumentHash = exports.generateDiffHash = exports.CACHE_MESSAGES = exports.CACHE_CONSTANTS = exports.UniSpecCacheManager = exports.getManagersStats = exports.destroyManagers = exports.createNamedCacheManager = exports.createCacheManager = exports.clearTestRegistry = void 0;
|
|
5
5
|
// Cache factory
|
|
6
|
-
var cache_factory_1 = require("./cache-factory
|
|
6
|
+
var cache_factory_1 = require("./cache-factory");
|
|
7
7
|
Object.defineProperty(exports, "clearTestRegistry", { enumerable: true, get: function () { return cache_factory_1.clearTestRegistry; } });
|
|
8
8
|
Object.defineProperty(exports, "createCacheManager", { enumerable: true, get: function () { return cache_factory_1.createCacheManager; } });
|
|
9
9
|
Object.defineProperty(exports, "createNamedCacheManager", { enumerable: true, get: function () { return cache_factory_1.createNamedCacheManager; } });
|
|
10
10
|
Object.defineProperty(exports, "destroyManagers", { enumerable: true, get: function () { return cache_factory_1.destroyManagers; } });
|
|
11
11
|
Object.defineProperty(exports, "getManagersStats", { enumerable: true, get: function () { return cache_factory_1.getManagersStats; } });
|
|
12
12
|
// Cache manager
|
|
13
|
-
var cache_manager_1 = require("./cache-manager
|
|
13
|
+
var cache_manager_1 = require("./cache-manager");
|
|
14
14
|
Object.defineProperty(exports, "UniSpecCacheManager", { enumerable: true, get: function () { return cache_manager_1.UniSpecCacheManager; } });
|
|
15
|
-
var constants_1 = require("./constants
|
|
15
|
+
var constants_1 = require("./constants");
|
|
16
16
|
Object.defineProperty(exports, "CACHE_CONSTANTS", { enumerable: true, get: function () { return constants_1.CACHE_CONSTANTS; } });
|
|
17
17
|
Object.defineProperty(exports, "CACHE_MESSAGES", { enumerable: true, get: function () { return constants_1.CACHE_MESSAGES; } });
|
|
18
18
|
// Hash utilities
|
|
19
|
-
var hash_utils_1 = require("./hash-utils
|
|
19
|
+
var hash_utils_1 = require("./hash-utils");
|
|
20
20
|
Object.defineProperty(exports, "generateDiffHash", { enumerable: true, get: function () { return hash_utils_1.generateDiffHash; } });
|
|
21
|
-
Object.defineProperty(exports, "generateDiffHashSync", { enumerable: true, get: function () { return hash_utils_1.generateDiffHashSync; } });
|
|
22
21
|
Object.defineProperty(exports, "generateDocumentHash", { enumerable: true, get: function () { return hash_utils_1.generateDocumentHash; } });
|
|
23
|
-
Object.defineProperty(exports, "generateDocumentHashSync", { enumerable: true, get: function () { return hash_utils_1.generateDocumentHashSync; } });
|
|
24
22
|
// Core cache implementation
|
|
25
|
-
var lru_cache_1 = require("./lru-cache
|
|
23
|
+
var lru_cache_1 = require("./lru-cache");
|
|
26
24
|
Object.defineProperty(exports, "LRUCache", { enumerable: true, get: function () { return lru_cache_1.LRUCache; } });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LRUCache = void 0;
|
|
4
|
-
const constants_1 = require("./constants
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
5
|
/**
|
|
6
6
|
* Simple LRU (Least Recently Used) cache implementation.
|
|
7
7
|
*/
|
|
@@ -21,28 +21,8 @@ class LRUCache {
|
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Get a value from the cache asynchronously.
|
|
24
|
-
* For performance, this uses sync operations wrapped in Promise for compatibility.
|
|
25
24
|
*/
|
|
26
25
|
async get(key) {
|
|
27
|
-
// Use synchronous operations for better performance
|
|
28
|
-
// Only wrap in Promise for async interface compatibility
|
|
29
|
-
return Promise.resolve(this.getSync(key));
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Set a value in the cache asynchronously.
|
|
33
|
-
* For performance, this uses sync operations wrapped in Promise for compatibility.
|
|
34
|
-
*/
|
|
35
|
-
async set(key, value) {
|
|
36
|
-
// Use synchronous operations for better performance
|
|
37
|
-
// Only wrap in Promise for async interface compatibility
|
|
38
|
-
this.setSync(key, value);
|
|
39
|
-
return Promise.resolve();
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Get a value from the cache (synchronous version for backward compatibility).
|
|
43
|
-
* @deprecated Use async get() method instead
|
|
44
|
-
*/
|
|
45
|
-
getSync(key) {
|
|
46
26
|
const entry = this.cache.get(key);
|
|
47
27
|
if (!entry) {
|
|
48
28
|
if (this.enableStats) {
|
|
@@ -74,10 +54,9 @@ class LRUCache {
|
|
|
74
54
|
return entry.value;
|
|
75
55
|
}
|
|
76
56
|
/**
|
|
77
|
-
* Set a value in the cache
|
|
78
|
-
* @deprecated Use async set() method instead
|
|
57
|
+
* Set a value in the cache asynchronously.
|
|
79
58
|
*/
|
|
80
|
-
|
|
59
|
+
async set(key, value) {
|
|
81
60
|
// Remove existing entry if present
|
|
82
61
|
if (this.cache.has(key)) {
|
|
83
62
|
this.cache.delete(key);
|
|
@@ -130,7 +130,7 @@ function annotateGraphQLChange(change) {
|
|
|
130
130
|
const singularMap = {
|
|
131
131
|
queries: "query",
|
|
132
132
|
mutations: "mutation",
|
|
133
|
-
subscriptions: "subscription"
|
|
133
|
+
subscriptions: "subscription",
|
|
134
134
|
};
|
|
135
135
|
const operationKind = `graphql.${singularMap[operationType]}`;
|
|
136
136
|
// Check for specific changes first, then general ones
|
|
@@ -141,7 +141,8 @@ function annotateGraphQLChange(change) {
|
|
|
141
141
|
annotated.severity = "breaking";
|
|
142
142
|
}
|
|
143
143
|
else if (change.path.includes("/args") &&
|
|
144
|
-
(change.description === "Item added" ||
|
|
144
|
+
(change.description === "Item added" ||
|
|
145
|
+
change.description === "Item removed")) {
|
|
145
146
|
// Argument changes
|
|
146
147
|
const action = change.description === "Item added" ? "added" : "removed";
|
|
147
148
|
annotated.kind = `${operationKind}.argument_${action}`;
|
package/dist/cjs/diff/core.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.diffUniSpec = diffUniSpec;
|
|
4
|
-
const annotators_1 = require("./annotators
|
|
5
|
-
const types_1 = require("./types
|
|
4
|
+
const annotators_1 = require("./annotators");
|
|
5
|
+
const types_1 = require("./types");
|
|
6
6
|
/**
|
|
7
7
|
* Check if a value is a plain object (not array, null, or other object types).
|
|
8
8
|
*
|
|
@@ -1,30 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.diffUniSpecEnhanced = diffUniSpecEnhanced;
|
|
4
|
-
const core_1 = require("./core
|
|
5
|
-
const impact_strategies_refactored_1 = require("./impact-strategies-refactored
|
|
6
|
-
const metrics_calculator_1 = require("./metrics-calculator
|
|
7
|
-
const risk_calculator_1 = require("./risk-calculator
|
|
8
|
-
const suggestion_generator_1 = require("./suggestion-generator
|
|
4
|
+
const core_1 = require("./core");
|
|
5
|
+
const impact_strategies_refactored_1 = require("./impact-strategies-refactored");
|
|
6
|
+
const metrics_calculator_1 = require("./metrics-calculator");
|
|
7
|
+
const risk_calculator_1 = require("./risk-calculator");
|
|
8
|
+
const suggestion_generator_1 = require("./suggestion-generator");
|
|
9
9
|
/**
|
|
10
10
|
* Service instances for better separation of concerns.
|
|
11
11
|
*/
|
|
12
12
|
const suggestionGenerator = new suggestion_generator_1.SuggestionGeneratorService();
|
|
13
13
|
const metricsCalculator = new metrics_calculator_1.MetricsCalculatorService();
|
|
14
|
-
/**
|
|
15
|
-
* Generate migration suggestions based on change impact.
|
|
16
|
-
* @deprecated Use SuggestionGeneratorService.generateSuggestions instead
|
|
17
|
-
*/
|
|
18
|
-
function generateSuggestions(change, impact) {
|
|
19
|
-
return suggestionGenerator.generateSuggestions(change, impact);
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Calculate compatibility metrics from enhanced changes.
|
|
23
|
-
* @deprecated Use MetricsCalculatorService.calculateMetrics instead
|
|
24
|
-
*/
|
|
25
|
-
function calculateMetrics(changes) {
|
|
26
|
-
return metricsCalculator.calculateMetrics(changes);
|
|
27
|
-
}
|
|
28
14
|
/**
|
|
29
15
|
* Perform enhanced diff analysis with impact assessment and compatibility metrics.
|
|
30
16
|
*
|
|
@@ -48,7 +34,7 @@ function diffUniSpecEnhanced(oldDoc, newDoc) {
|
|
|
48
34
|
// Analyze impact using strategy
|
|
49
35
|
const impact = strategy.analyze(change);
|
|
50
36
|
// Generate suggestions
|
|
51
|
-
const suggestions = generateSuggestions(change, impact);
|
|
37
|
+
const suggestions = suggestionGenerator.generateSuggestions(change, impact);
|
|
52
38
|
// Calculate risk level using calculator
|
|
53
39
|
const riskLevel = risk_calculator_1.RiskLevelCalculator.calculate(impact);
|
|
54
40
|
return {
|
|
@@ -59,7 +45,7 @@ function diffUniSpecEnhanced(oldDoc, newDoc) {
|
|
|
59
45
|
};
|
|
60
46
|
});
|
|
61
47
|
// Calculate metrics
|
|
62
|
-
const metrics = calculateMetrics(enhancedChanges);
|
|
48
|
+
const metrics = metricsCalculator.calculateMetrics(enhancedChanges);
|
|
63
49
|
// Generate summary
|
|
64
50
|
const summary = {
|
|
65
51
|
totalChanges: enhancedChanges.length,
|
package/dist/cjs/diff/index.js
CHANGED
|
@@ -15,13 +15,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
16
|
};
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
__exportStar(require("./change-reports
|
|
18
|
+
__exportStar(require("./change-reports"), exports);
|
|
19
19
|
// Export core functionality
|
|
20
|
-
__exportStar(require("./core
|
|
20
|
+
__exportStar(require("./core"), exports);
|
|
21
21
|
// Export enhanced functionality
|
|
22
|
-
__exportStar(require("./enhanced-diff
|
|
23
|
-
__exportStar(require("./impact-strategies-refactored
|
|
24
|
-
__exportStar(require("./metrics-calculator
|
|
25
|
-
__exportStar(require("./risk-calculator
|
|
26
|
-
__exportStar(require("./suggestion-generator
|
|
27
|
-
__exportStar(require("./types
|
|
22
|
+
__exportStar(require("./enhanced-diff"), exports);
|
|
23
|
+
__exportStar(require("./impact-strategies-refactored"), exports);
|
|
24
|
+
__exportStar(require("./metrics-calculator"), exports);
|
|
25
|
+
__exportStar(require("./risk-calculator"), exports);
|
|
26
|
+
__exportStar(require("./suggestion-generator"), exports);
|
|
27
|
+
__exportStar(require("./types"), exports);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UniSpecConfigError = void 0;
|
|
4
|
-
const base_error_1 = require("./base-error
|
|
4
|
+
const base_error_1 = require("./base-error");
|
|
5
5
|
class UniSpecConfigError extends base_error_1.UniSpecValidationError {
|
|
6
6
|
constructor(message, path = "", details) {
|
|
7
7
|
super(message, "config_error", path, "error", details);
|