@cdklabs/cdk-ecs-codedeploy 0.0.432 → 0.0.434
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/.jsii +3 -3
- package/.jsii.tabl.json +1 -1
- package/lib/api-canary/index.js +1 -1
- package/lib/ecs-appspec/index.js +1 -1
- package/lib/ecs-deployment/index.js +1 -1
- package/lib/ecs-patterns/application-load-balanced-codedeployed-fargate-service.js +1 -1
- package/node_modules/@aws/lambda-invoke-store/dist-cjs/invoke-store.js +2 -2
- package/node_modules/@aws/lambda-invoke-store/dist-es/invoke-store.js +2 -2
- package/node_modules/@aws/lambda-invoke-store/dist-types/invoke-store.d.ts +1 -1
- package/node_modules/@aws/lambda-invoke-store/package.json +1 -1
- package/node_modules/@aws-sdk/client-codedeploy/README.md +26 -46
- package/node_modules/@aws-sdk/client-codedeploy/package.json +34 -34
- package/node_modules/@aws-sdk/core/dist-cjs/index.js +4 -0
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +4 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/index.js +2 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/query/AwsEc2QueryProtocol.js +3 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/index.d.ts +2 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/query/AwsEc2QueryProtocol.d.ts +4 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/query/QuerySerializerSettings.d.ts +3 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/index.d.ts +2 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/query/AwsEc2QueryProtocol.d.ts +1 -0
- package/node_modules/@aws-sdk/core/package.json +11 -11
- package/node_modules/@aws-sdk/credential-provider-env/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-http/package.json +10 -10
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +14 -14
- package/node_modules/@aws-sdk/credential-provider-login/package.json +8 -8
- package/node_modules/@aws-sdk/credential-provider-node/package.json +12 -12
- package/node_modules/@aws-sdk/credential-provider-process/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +8 -8
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +7 -7
- package/node_modules/@aws-sdk/middleware-host-header/package.json +4 -4
- package/node_modules/@aws-sdk/middleware-logger/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-recursion-detection/package.json +4 -4
- package/node_modules/@aws-sdk/middleware-user-agent/package.json +8 -8
- package/node_modules/@aws-sdk/nested-clients/package.json +32 -32
- package/node_modules/@aws-sdk/region-config-resolver/package.json +5 -5
- package/node_modules/@aws-sdk/token-providers/package.json +7 -7
- package/node_modules/@aws-sdk/types/package.json +2 -2
- package/node_modules/@aws-sdk/util-endpoints/package.json +5 -5
- package/node_modules/@aws-sdk/util-user-agent-browser/package.json +3 -3
- package/node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js +75 -19
- package/node_modules/@aws-sdk/util-user-agent-node/dist-es/getNodeModulesParentDirs.js +15 -0
- package/node_modules/@aws-sdk/util-user-agent-node/dist-es/getSanitizedDevTypeScriptVersion.js +14 -0
- package/node_modules/@aws-sdk/util-user-agent-node/dist-es/getTypeScriptUserAgentPair.js +53 -7
- package/node_modules/@aws-sdk/util-user-agent-node/dist-types/{getTypeScriptPackageJsonPaths.d.ts → getNodeModulesParentDirs.d.ts} +2 -2
- package/node_modules/@aws-sdk/util-user-agent-node/dist-types/getSanitizedDevTypeScriptVersion.d.ts +8 -0
- package/node_modules/@aws-sdk/util-user-agent-node/dist-types/ts3.4/getNodeModulesParentDirs.d.ts +1 -0
- package/node_modules/@aws-sdk/util-user-agent-node/dist-types/ts3.4/getSanitizedDevTypeScriptVersion.d.ts +3 -0
- package/node_modules/@aws-sdk/util-user-agent-node/package.json +6 -5
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/index.js +21 -11
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-parser.js +5 -1
- package/node_modules/@aws-sdk/xml-builder/dist-es/escape-attribute.js +8 -1
- package/node_modules/@aws-sdk/xml-builder/dist-es/escape-element.js +13 -10
- package/node_modules/@aws-sdk/xml-builder/dist-es/xml-parser.js +5 -1
- package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/CHANGELOG.md +40 -4
- package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/README.md +8 -7
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxbuilder.min.js +2 -0
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxbuilder.min.js.map +1 -0
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.cjs +1 -0
- package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/lib/fxp.d.cts +82 -20
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.min.js +2 -0
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -0
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxparser.min.js +2 -0
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -0
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxvalidator.min.js.map +1 -0
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/pem.d.cts +148 -0
- package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/package.json +4 -3
- package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/fxp.d.ts +75 -19
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/pem.d.ts +135 -0
- package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/util.js +18 -0
- package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/xmlparser/DocTypeReader.js +37 -18
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +159 -0
- package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/xmlparser/OrderedObjParser.js +298 -116
- package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/xmlparser/XMLParser.js +2 -2
- package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/xmlparser/node2json.js +65 -15
- package/node_modules/{strnum → @aws-sdk/xml-builder/node_modules/strnum}/CHANGELOG.md +9 -2
- package/node_modules/{strnum → @aws-sdk/xml-builder/node_modules/strnum}/package.json +1 -1
- package/node_modules/{strnum → @aws-sdk/xml-builder/node_modules/strnum}/strnum.js +12 -6
- package/node_modules/{strnum → @aws-sdk/xml-builder/node_modules/strnum}/tests/strnum_test.js +3 -0
- package/node_modules/@aws-sdk/xml-builder/node_modules/strnum/tests/temp.js +8 -0
- package/node_modules/@aws-sdk/xml-builder/package.json +3 -3
- package/node_modules/@smithy/abort-controller/package.json +2 -2
- package/node_modules/@smithy/config-resolver/dist-cjs/index.js +12 -0
- package/node_modules/@smithy/config-resolver/dist-es/endpointsConfig/NodeUseDualstackEndpointConfigOptions.js +5 -0
- package/node_modules/@smithy/config-resolver/dist-es/endpointsConfig/NodeUseFipsEndpointConfigOptions.js +5 -0
- package/node_modules/@smithy/config-resolver/dist-types/endpointsConfig/NodeUseDualstackEndpointConfigOptions.d.ts +6 -0
- package/node_modules/@smithy/config-resolver/dist-types/endpointsConfig/NodeUseFipsEndpointConfigOptions.d.ts +6 -0
- package/node_modules/@smithy/config-resolver/dist-types/ts3.4/endpointsConfig/NodeUseDualstackEndpointConfigOptions.d.ts +6 -0
- package/node_modules/@smithy/config-resolver/dist-types/ts3.4/endpointsConfig/NodeUseFipsEndpointConfigOptions.d.ts +6 -0
- package/node_modules/@smithy/config-resolver/package.json +5 -5
- package/node_modules/@smithy/core/dist-cjs/index.js +1 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +7 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js +22 -0
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +11 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +41 -4
- package/node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/getHttpAuthSchemePlugin.js +1 -2
- package/node_modules/@smithy/core/dist-es/submodules/cbor/parseCborBody.js +7 -1
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/index.js +1 -0
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/toEndpointV1.js +17 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +10 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaSerializationMiddleware.js +3 -2
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/NormalizedSchema.js +30 -1
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/translateTraits.js +5 -1
- package/node_modules/@smithy/core/dist-types/submodules/endpoints/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/submodules/endpoints/toEndpointV1.d.ts +6 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/NormalizedSchema.d.ts +11 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/translateTraits.d.ts +6 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/endpoints/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/endpoints/toEndpointV1.d.ts +6 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/NormalizedSchema.d.ts +11 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/translateTraits.d.ts +6 -0
- package/node_modules/@smithy/core/endpoints.d.ts +7 -0
- package/node_modules/@smithy/core/endpoints.js +6 -0
- package/node_modules/@smithy/core/package.json +16 -7
- package/node_modules/@smithy/credential-provider-imds/package.json +5 -5
- package/node_modules/@smithy/fetch-http-handler/dist-cjs/index.js +4 -1
- package/node_modules/@smithy/fetch-http-handler/dist-es/fetch-http-handler.js +4 -1
- package/node_modules/@smithy/fetch-http-handler/package.json +5 -5
- package/node_modules/@smithy/hash-node/package.json +2 -2
- package/node_modules/@smithy/invalid-dependency/package.json +2 -2
- package/node_modules/@smithy/middleware-content-length/package.json +3 -3
- package/node_modules/@smithy/middleware-endpoint/dist-cjs/index.js +17 -1
- package/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointFromInstructions.js +9 -0
- package/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/toEndpointV1.js +8 -1
- package/node_modules/@smithy/middleware-endpoint/dist-types/adaptors/toEndpointV1.d.ts +1 -0
- package/node_modules/@smithy/middleware-endpoint/dist-types/resolveEndpointConfig.d.ts +2 -2
- package/node_modules/@smithy/middleware-endpoint/dist-types/ts3.4/adaptors/toEndpointV1.d.ts +1 -0
- package/node_modules/@smithy/middleware-endpoint/dist-types/ts3.4/resolveEndpointConfig.d.ts +2 -2
- package/node_modules/@smithy/middleware-endpoint/package.json +8 -8
- package/node_modules/@smithy/middleware-retry/dist-cjs/index.js +9 -12
- package/node_modules/@smithy/middleware-retry/dist-es/configurations.js +9 -12
- package/node_modules/@smithy/middleware-retry/package.json +8 -8
- package/node_modules/@smithy/middleware-serde/dist-cjs/index.js +3 -2
- package/node_modules/@smithy/middleware-serde/dist-es/serializerMiddleware.js +3 -2
- package/node_modules/@smithy/middleware-serde/package.json +4 -3
- package/node_modules/@smithy/middleware-stack/package.json +2 -2
- package/node_modules/@smithy/node-config-provider/package.json +4 -4
- package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +48 -38
- package/node_modules/@smithy/node-http-handler/dist-es/build-abort-error.js +4 -1
- package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +38 -31
- package/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +1 -1
- package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +1 -1
- package/node_modules/@smithy/node-http-handler/dist-es/readable.mock.js +1 -1
- package/node_modules/@smithy/node-http-handler/dist-es/server.mock.js +6 -6
- package/node_modules/@smithy/node-http-handler/dist-es/stream-collector/collector.js +1 -1
- package/node_modules/@smithy/node-http-handler/dist-es/stream-collector/readable.mock.js +1 -1
- package/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js +1 -1
- package/node_modules/@smithy/node-http-handler/dist-types/build-abort-error.d.ts +4 -3
- package/node_modules/@smithy/node-http-handler/dist-types/get-transformed-headers.d.ts +1 -1
- package/node_modules/@smithy/node-http-handler/dist-types/node-http-handler.d.ts +4 -4
- package/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-manager.d.ts +1 -1
- package/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-pool.d.ts +1 -1
- package/node_modules/@smithy/node-http-handler/dist-types/readable.mock.d.ts +2 -2
- package/node_modules/@smithy/node-http-handler/dist-types/server.mock.d.ts +3 -3
- package/node_modules/@smithy/node-http-handler/dist-types/set-connection-timeout.d.ts +1 -1
- package/node_modules/@smithy/node-http-handler/dist-types/set-request-timeout.d.ts +1 -1
- package/node_modules/@smithy/node-http-handler/dist-types/set-socket-keep-alive.d.ts +1 -1
- package/node_modules/@smithy/node-http-handler/dist-types/set-socket-timeout.d.ts +1 -1
- package/node_modules/@smithy/node-http-handler/dist-types/stream-collector/collector.d.ts +1 -1
- package/node_modules/@smithy/node-http-handler/dist-types/stream-collector/readable.mock.d.ts +2 -2
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/build-abort-error.d.ts +4 -3
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/get-transformed-headers.d.ts +1 -1
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http-handler.d.ts +4 -4
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-manager.d.ts +1 -1
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-pool.d.ts +1 -1
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/readable.mock.d.ts +2 -2
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/server.mock.d.ts +3 -3
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-connection-timeout.d.ts +1 -1
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-request-timeout.d.ts +1 -1
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-keep-alive.d.ts +1 -1
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-timeout.d.ts +1 -1
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/collector.d.ts +1 -1
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/readable.mock.d.ts +2 -2
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/write-request-body.d.ts +2 -2
- package/node_modules/@smithy/node-http-handler/dist-types/write-request-body.d.ts +2 -2
- package/node_modules/@smithy/node-http-handler/package.json +5 -5
- package/node_modules/@smithy/property-provider/package.json +2 -2
- package/node_modules/@smithy/protocol-http/package.json +2 -2
- package/node_modules/@smithy/querystring-builder/package.json +2 -2
- package/node_modules/@smithy/querystring-parser/package.json +2 -2
- package/node_modules/@smithy/service-error-classification/package.json +2 -2
- package/node_modules/@smithy/shared-ini-file-loader/package.json +2 -2
- package/node_modules/@smithy/signature-v4/package.json +4 -4
- package/node_modules/@smithy/smithy-client/package.json +7 -7
- package/node_modules/@smithy/types/dist-types/http.d.ts +1 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/http.d.ts +1 -0
- package/node_modules/@smithy/types/package.json +1 -1
- package/node_modules/@smithy/url-parser/package.json +3 -3
- package/node_modules/@smithy/util-defaults-mode-browser/package.json +4 -4
- package/node_modules/@smithy/util-defaults-mode-node/package.json +7 -7
- package/node_modules/@smithy/util-endpoints/package.json +3 -3
- package/node_modules/@smithy/util-middleware/package.json +2 -2
- package/node_modules/@smithy/util-retry/package.json +3 -3
- package/node_modules/@smithy/util-stream/package.json +4 -4
- package/node_modules/@smithy/util-waiter/dist-cjs/index.js +1 -1
- package/node_modules/@smithy/util-waiter/dist-es/poller.js +1 -1
- package/node_modules/@smithy/util-waiter/package.json +3 -3
- package/node_modules/fast-xml-builder/CHANGELOG.md +16 -0
- package/node_modules/fast-xml-builder/README.md +1 -1
- package/node_modules/fast-xml-builder/lib/fxb.cjs +1 -0
- package/node_modules/fast-xml-builder/lib/fxb.d.cts +22 -9
- package/node_modules/fast-xml-builder/lib/fxb.min.js +2 -0
- package/node_modules/fast-xml-builder/lib/fxb.min.js.map +1 -0
- package/node_modules/fast-xml-builder/package.json +7 -5
- package/node_modules/fast-xml-builder/src/fxb.d.ts +27 -3
- package/node_modules/fast-xml-builder/src/fxb.js +265 -21
- package/node_modules/fast-xml-builder/src/orderedJs2Xml.js +165 -18
- package/node_modules/path-expression-matcher/LICENSE +21 -0
- package/node_modules/path-expression-matcher/README.md +720 -0
- package/node_modules/path-expression-matcher/lib/pem.cjs +1 -0
- package/node_modules/path-expression-matcher/lib/pem.d.cts +523 -0
- package/node_modules/path-expression-matcher/lib/pem.min.js +2 -0
- package/node_modules/path-expression-matcher/lib/pem.min.js.map +1 -0
- package/node_modules/path-expression-matcher/package.json +78 -0
- package/node_modules/path-expression-matcher/src/Expression.js +232 -0
- package/node_modules/path-expression-matcher/src/Matcher.js +498 -0
- package/node_modules/path-expression-matcher/src/index.d.ts +518 -0
- package/node_modules/path-expression-matcher/src/index.js +28 -0
- package/package.json +4 -4
- package/node_modules/@aws-sdk/util-user-agent-node/dist-es/getTypeScriptPackageJsonPaths.js +0 -17
- package/node_modules/@aws-sdk/util-user-agent-node/dist-types/ts3.4/getTypeScriptPackageJsonPaths.d.ts +0 -3
- package/node_modules/fast-xml-builder/lib/builder.cjs +0 -1
- package/node_modules/fast-xml-builder/lib/builder.min.js +0 -2
- package/node_modules/fast-xml-builder/lib/builder.min.js.map +0 -1
- package/node_modules/fast-xml-parser/lib/fxbuilder.min.js +0 -2
- package/node_modules/fast-xml-parser/lib/fxbuilder.min.js.map +0 -1
- package/node_modules/fast-xml-parser/lib/fxp.cjs +0 -1
- package/node_modules/fast-xml-parser/lib/fxp.min.js +0 -2
- package/node_modules/fast-xml-parser/lib/fxp.min.js.map +0 -1
- package/node_modules/fast-xml-parser/lib/fxparser.min.js +0 -2
- package/node_modules/fast-xml-parser/lib/fxparser.min.js.map +0 -1
- package/node_modules/fast-xml-parser/lib/fxvalidator.min.js.map +0 -1
- package/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +0 -88
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/LICENSE +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/lib/fxvalidator.min.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/cli/cli.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/cli/man.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/cli/read.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/fxp.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/ignoreAttributes.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/CharsSymbol.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/EntitiesParser.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/OptionsBuilder.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/OutputBuilders/BaseOutputBuilder.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/OutputBuilders/JsArrBuilder.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/OutputBuilders/JsMinArrBuilder.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/OutputBuilders/JsObjBuilder.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/OutputBuilders/ParserOptionsBuilder.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/Report.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/TagPath.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/TagPathMatcher.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/XMLParser.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/Xml2JsParser.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/XmlPartReader.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/XmlSpecialTagsReader.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/inputSource/BufferSource.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/inputSource/StringSource.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/valueParsers/EntitiesParser.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/valueParsers/booleanParser.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/valueParsers/booleanParserExt.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/valueParsers/currency.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/valueParsers/join.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/valueParsers/number.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/valueParsers/trim.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/validator.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/xmlbuilder/json2xml.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/xmlparser/xmlNode.js +0 -0
- /package/node_modules/{strnum → @aws-sdk/xml-builder/node_modules/strnum}/.github/SECURITY.md +0 -0
- /package/node_modules/{strnum → @aws-sdk/xml-builder/node_modules/strnum}/.vscode/launch.json +0 -0
- /package/node_modules/{strnum → @aws-sdk/xml-builder/node_modules/strnum}/LICENSE +0 -0
- /package/node_modules/{strnum → @aws-sdk/xml-builder/node_modules/strnum}/README.md +0 -0
- /package/node_modules/{strnum → @aws-sdk/xml-builder/node_modules/strnum}/algo.stflow +0 -0
- /package/node_modules/{strnum → @aws-sdk/xml-builder/node_modules/strnum}/tests/infinity_test.js +0 -0
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Matcher - Tracks current path in XML/JSON tree and matches against Expressions
|
|
3
|
+
*
|
|
4
|
+
* The matcher maintains a stack of nodes representing the current path from root to
|
|
5
|
+
* current tag. It only stores attribute values for the current (top) node to minimize
|
|
6
|
+
* memory usage. Sibling tracking is used to auto-calculate position and counter.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const matcher = new Matcher();
|
|
10
|
+
* matcher.push("root", {});
|
|
11
|
+
* matcher.push("users", {});
|
|
12
|
+
* matcher.push("user", { id: "123", type: "admin" });
|
|
13
|
+
*
|
|
14
|
+
* const expr = new Expression("root.users.user");
|
|
15
|
+
* matcher.matches(expr); // true
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Names of methods that mutate Matcher state.
|
|
20
|
+
* Any attempt to call these on a read-only view throws a TypeError.
|
|
21
|
+
* @type {Set<string>}
|
|
22
|
+
*/
|
|
23
|
+
const MUTATING_METHODS = new Set(['push', 'pop', 'reset', 'updateCurrent', 'restore']);
|
|
24
|
+
|
|
25
|
+
export default class Matcher {
|
|
26
|
+
/**
|
|
27
|
+
* Create a new Matcher
|
|
28
|
+
* @param {Object} options - Configuration options
|
|
29
|
+
* @param {string} options.separator - Default path separator (default: '.')
|
|
30
|
+
*/
|
|
31
|
+
constructor(options = {}) {
|
|
32
|
+
this.separator = options.separator || '.';
|
|
33
|
+
this.path = [];
|
|
34
|
+
this.siblingStacks = [];
|
|
35
|
+
// Each path node: { tag: string, values: object, position: number, counter: number }
|
|
36
|
+
// values only present for current (last) node
|
|
37
|
+
// Each siblingStacks entry: Map<tagName, count> tracking occurrences at each level
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Push a new tag onto the path
|
|
42
|
+
* @param {string} tagName - Name of the tag
|
|
43
|
+
* @param {Object} attrValues - Attribute key-value pairs for current node (optional)
|
|
44
|
+
* @param {string} namespace - Namespace for the tag (optional)
|
|
45
|
+
*/
|
|
46
|
+
push(tagName, attrValues = null, namespace = null) {
|
|
47
|
+
// Remove values from previous current node (now becoming ancestor)
|
|
48
|
+
if (this.path.length > 0) {
|
|
49
|
+
const prev = this.path[this.path.length - 1];
|
|
50
|
+
prev.values = undefined;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Get or create sibling tracking for current level
|
|
54
|
+
const currentLevel = this.path.length;
|
|
55
|
+
if (!this.siblingStacks[currentLevel]) {
|
|
56
|
+
this.siblingStacks[currentLevel] = new Map();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const siblings = this.siblingStacks[currentLevel];
|
|
60
|
+
|
|
61
|
+
// Create a unique key for sibling tracking that includes namespace
|
|
62
|
+
const siblingKey = namespace ? `${namespace}:${tagName}` : tagName;
|
|
63
|
+
|
|
64
|
+
// Calculate counter (how many times this tag appeared at this level)
|
|
65
|
+
const counter = siblings.get(siblingKey) || 0;
|
|
66
|
+
|
|
67
|
+
// Calculate position (total children at this level so far)
|
|
68
|
+
let position = 0;
|
|
69
|
+
for (const count of siblings.values()) {
|
|
70
|
+
position += count;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Update sibling count for this tag
|
|
74
|
+
siblings.set(siblingKey, counter + 1);
|
|
75
|
+
|
|
76
|
+
// Create new node
|
|
77
|
+
const node = {
|
|
78
|
+
tag: tagName,
|
|
79
|
+
position: position,
|
|
80
|
+
counter: counter
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// Store namespace if provided
|
|
84
|
+
if (namespace !== null && namespace !== undefined) {
|
|
85
|
+
node.namespace = namespace;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Store values only for current node
|
|
89
|
+
if (attrValues !== null && attrValues !== undefined) {
|
|
90
|
+
node.values = attrValues;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
this.path.push(node);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Pop the last tag from the path
|
|
98
|
+
* @returns {Object|undefined} The popped node
|
|
99
|
+
*/
|
|
100
|
+
pop() {
|
|
101
|
+
if (this.path.length === 0) {
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const node = this.path.pop();
|
|
106
|
+
|
|
107
|
+
// Clean up sibling tracking for levels deeper than current
|
|
108
|
+
// After pop, path.length is the new depth
|
|
109
|
+
// We need to clean up siblingStacks[path.length + 1] and beyond
|
|
110
|
+
if (this.siblingStacks.length > this.path.length + 1) {
|
|
111
|
+
this.siblingStacks.length = this.path.length + 1;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return node;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Update current node's attribute values
|
|
119
|
+
* Useful when attributes are parsed after push
|
|
120
|
+
* @param {Object} attrValues - Attribute values
|
|
121
|
+
*/
|
|
122
|
+
updateCurrent(attrValues) {
|
|
123
|
+
if (this.path.length > 0) {
|
|
124
|
+
const current = this.path[this.path.length - 1];
|
|
125
|
+
if (attrValues !== null && attrValues !== undefined) {
|
|
126
|
+
current.values = attrValues;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Get current tag name
|
|
133
|
+
* @returns {string|undefined}
|
|
134
|
+
*/
|
|
135
|
+
getCurrentTag() {
|
|
136
|
+
return this.path.length > 0 ? this.path[this.path.length - 1].tag : undefined;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Get current namespace
|
|
141
|
+
* @returns {string|undefined}
|
|
142
|
+
*/
|
|
143
|
+
getCurrentNamespace() {
|
|
144
|
+
return this.path.length > 0 ? this.path[this.path.length - 1].namespace : undefined;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Get current node's attribute value
|
|
149
|
+
* @param {string} attrName - Attribute name
|
|
150
|
+
* @returns {*} Attribute value or undefined
|
|
151
|
+
*/
|
|
152
|
+
getAttrValue(attrName) {
|
|
153
|
+
if (this.path.length === 0) return undefined;
|
|
154
|
+
const current = this.path[this.path.length - 1];
|
|
155
|
+
return current.values?.[attrName];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Check if current node has an attribute
|
|
160
|
+
* @param {string} attrName - Attribute name
|
|
161
|
+
* @returns {boolean}
|
|
162
|
+
*/
|
|
163
|
+
hasAttr(attrName) {
|
|
164
|
+
if (this.path.length === 0) return false;
|
|
165
|
+
const current = this.path[this.path.length - 1];
|
|
166
|
+
return current.values !== undefined && attrName in current.values;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Get current node's sibling position (child index in parent)
|
|
171
|
+
* @returns {number}
|
|
172
|
+
*/
|
|
173
|
+
getPosition() {
|
|
174
|
+
if (this.path.length === 0) return -1;
|
|
175
|
+
return this.path[this.path.length - 1].position ?? 0;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Get current node's repeat counter (occurrence count of this tag name)
|
|
180
|
+
* @returns {number}
|
|
181
|
+
*/
|
|
182
|
+
getCounter() {
|
|
183
|
+
if (this.path.length === 0) return -1;
|
|
184
|
+
return this.path[this.path.length - 1].counter ?? 0;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Get current node's sibling index (alias for getPosition for backward compatibility)
|
|
189
|
+
* @returns {number}
|
|
190
|
+
* @deprecated Use getPosition() or getCounter() instead
|
|
191
|
+
*/
|
|
192
|
+
getIndex() {
|
|
193
|
+
return this.getPosition();
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Get current path depth
|
|
198
|
+
* @returns {number}
|
|
199
|
+
*/
|
|
200
|
+
getDepth() {
|
|
201
|
+
return this.path.length;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Get path as string
|
|
206
|
+
* @param {string} separator - Optional separator (uses default if not provided)
|
|
207
|
+
* @param {boolean} includeNamespace - Whether to include namespace in output (default: true)
|
|
208
|
+
* @returns {string}
|
|
209
|
+
*/
|
|
210
|
+
toString(separator, includeNamespace = true) {
|
|
211
|
+
const sep = separator || this.separator;
|
|
212
|
+
return this.path.map(n => {
|
|
213
|
+
if (includeNamespace && n.namespace) {
|
|
214
|
+
return `${n.namespace}:${n.tag}`;
|
|
215
|
+
}
|
|
216
|
+
return n.tag;
|
|
217
|
+
}).join(sep);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Get path as array of tag names
|
|
222
|
+
* @returns {string[]}
|
|
223
|
+
*/
|
|
224
|
+
toArray() {
|
|
225
|
+
return this.path.map(n => n.tag);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Reset the path to empty
|
|
230
|
+
*/
|
|
231
|
+
reset() {
|
|
232
|
+
this.path = [];
|
|
233
|
+
this.siblingStacks = [];
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Match current path against an Expression
|
|
238
|
+
* @param {Expression} expression - The expression to match against
|
|
239
|
+
* @returns {boolean} True if current path matches the expression
|
|
240
|
+
*/
|
|
241
|
+
matches(expression) {
|
|
242
|
+
const segments = expression.segments;
|
|
243
|
+
|
|
244
|
+
if (segments.length === 0) {
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// Handle deep wildcard patterns
|
|
249
|
+
if (expression.hasDeepWildcard()) {
|
|
250
|
+
return this._matchWithDeepWildcard(segments);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// Simple path matching (no deep wildcards)
|
|
254
|
+
return this._matchSimple(segments);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Match simple path (no deep wildcards)
|
|
259
|
+
* @private
|
|
260
|
+
*/
|
|
261
|
+
_matchSimple(segments) {
|
|
262
|
+
// Path must be same length as segments
|
|
263
|
+
if (this.path.length !== segments.length) {
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// Match each segment bottom-to-top
|
|
268
|
+
for (let i = 0; i < segments.length; i++) {
|
|
269
|
+
const segment = segments[i];
|
|
270
|
+
const node = this.path[i];
|
|
271
|
+
const isCurrentNode = (i === this.path.length - 1);
|
|
272
|
+
|
|
273
|
+
if (!this._matchSegment(segment, node, isCurrentNode)) {
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return true;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Match path with deep wildcards
|
|
283
|
+
* @private
|
|
284
|
+
*/
|
|
285
|
+
_matchWithDeepWildcard(segments) {
|
|
286
|
+
let pathIdx = this.path.length - 1; // Start from current node (bottom)
|
|
287
|
+
let segIdx = segments.length - 1; // Start from last segment
|
|
288
|
+
|
|
289
|
+
while (segIdx >= 0 && pathIdx >= 0) {
|
|
290
|
+
const segment = segments[segIdx];
|
|
291
|
+
|
|
292
|
+
if (segment.type === 'deep-wildcard') {
|
|
293
|
+
// ".." matches zero or more levels
|
|
294
|
+
segIdx--;
|
|
295
|
+
|
|
296
|
+
if (segIdx < 0) {
|
|
297
|
+
// Pattern ends with "..", always matches
|
|
298
|
+
return true;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// Find where next segment matches in the path
|
|
302
|
+
const nextSeg = segments[segIdx];
|
|
303
|
+
let found = false;
|
|
304
|
+
|
|
305
|
+
for (let i = pathIdx; i >= 0; i--) {
|
|
306
|
+
const isCurrentNode = (i === this.path.length - 1);
|
|
307
|
+
if (this._matchSegment(nextSeg, this.path[i], isCurrentNode)) {
|
|
308
|
+
pathIdx = i - 1;
|
|
309
|
+
segIdx--;
|
|
310
|
+
found = true;
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
if (!found) {
|
|
316
|
+
return false;
|
|
317
|
+
}
|
|
318
|
+
} else {
|
|
319
|
+
// Regular segment
|
|
320
|
+
const isCurrentNode = (pathIdx === this.path.length - 1);
|
|
321
|
+
if (!this._matchSegment(segment, this.path[pathIdx], isCurrentNode)) {
|
|
322
|
+
return false;
|
|
323
|
+
}
|
|
324
|
+
pathIdx--;
|
|
325
|
+
segIdx--;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// All segments must be consumed
|
|
330
|
+
return segIdx < 0;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Match a single segment against a node
|
|
335
|
+
* @private
|
|
336
|
+
* @param {Object} segment - Segment from Expression
|
|
337
|
+
* @param {Object} node - Node from path
|
|
338
|
+
* @param {boolean} isCurrentNode - Whether this is the current (last) node
|
|
339
|
+
* @returns {boolean}
|
|
340
|
+
*/
|
|
341
|
+
_matchSegment(segment, node, isCurrentNode) {
|
|
342
|
+
// Match tag name (* is wildcard)
|
|
343
|
+
if (segment.tag !== '*' && segment.tag !== node.tag) {
|
|
344
|
+
return false;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// Match namespace if specified in segment
|
|
348
|
+
if (segment.namespace !== undefined) {
|
|
349
|
+
// Segment has namespace - node must match it
|
|
350
|
+
if (segment.namespace !== '*' && segment.namespace !== node.namespace) {
|
|
351
|
+
return false;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
// If segment has no namespace, it matches nodes with or without namespace
|
|
355
|
+
|
|
356
|
+
// Match attribute name (check if node has this attribute)
|
|
357
|
+
// Can only check for current node since ancestors don't have values
|
|
358
|
+
if (segment.attrName !== undefined) {
|
|
359
|
+
if (!isCurrentNode) {
|
|
360
|
+
// Can't check attributes for ancestor nodes (values not stored)
|
|
361
|
+
return false;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
if (!node.values || !(segment.attrName in node.values)) {
|
|
365
|
+
return false;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
// Match attribute value (only possible for current node)
|
|
369
|
+
if (segment.attrValue !== undefined) {
|
|
370
|
+
const actualValue = node.values[segment.attrName];
|
|
371
|
+
// Both should be strings
|
|
372
|
+
if (String(actualValue) !== String(segment.attrValue)) {
|
|
373
|
+
return false;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
// Match position (only for current node)
|
|
379
|
+
if (segment.position !== undefined) {
|
|
380
|
+
if (!isCurrentNode) {
|
|
381
|
+
// Can't check position for ancestor nodes
|
|
382
|
+
return false;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
const counter = node.counter ?? 0;
|
|
386
|
+
|
|
387
|
+
if (segment.position === 'first' && counter !== 0) {
|
|
388
|
+
return false;
|
|
389
|
+
} else if (segment.position === 'odd' && counter % 2 !== 1) {
|
|
390
|
+
return false;
|
|
391
|
+
} else if (segment.position === 'even' && counter % 2 !== 0) {
|
|
392
|
+
return false;
|
|
393
|
+
} else if (segment.position === 'nth') {
|
|
394
|
+
if (counter !== segment.positionValue) {
|
|
395
|
+
return false;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
return true;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Create a snapshot of current state
|
|
405
|
+
* @returns {Object} State snapshot
|
|
406
|
+
*/
|
|
407
|
+
snapshot() {
|
|
408
|
+
return {
|
|
409
|
+
path: this.path.map(node => ({ ...node })),
|
|
410
|
+
siblingStacks: this.siblingStacks.map(map => new Map(map))
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Restore state from snapshot
|
|
416
|
+
* @param {Object} snapshot - State snapshot
|
|
417
|
+
*/
|
|
418
|
+
restore(snapshot) {
|
|
419
|
+
this.path = snapshot.path.map(node => ({ ...node }));
|
|
420
|
+
this.siblingStacks = snapshot.siblingStacks.map(map => new Map(map));
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Return a read-only view of this matcher.
|
|
425
|
+
*
|
|
426
|
+
* The returned object exposes all query/inspection methods but throws a
|
|
427
|
+
* TypeError if any state-mutating method is called (`push`, `pop`, `reset`,
|
|
428
|
+
* `updateCurrent`, `restore`). Property reads (e.g. `.path`, `.separator`)
|
|
429
|
+
* are allowed but the returned arrays/objects are frozen so callers cannot
|
|
430
|
+
* mutate internal state through them either.
|
|
431
|
+
*
|
|
432
|
+
* @returns {ReadOnlyMatcher} A proxy that forwards read operations and blocks writes.
|
|
433
|
+
*
|
|
434
|
+
* @example
|
|
435
|
+
* const matcher = new Matcher();
|
|
436
|
+
* matcher.push("root", {});
|
|
437
|
+
*
|
|
438
|
+
* const ro = matcher.readOnly();
|
|
439
|
+
* ro.matches(expr); // ✓ works
|
|
440
|
+
* ro.getCurrentTag(); // ✓ works
|
|
441
|
+
* ro.push("child", {}); // ✗ throws TypeError
|
|
442
|
+
* ro.reset(); // ✗ throws TypeError
|
|
443
|
+
*/
|
|
444
|
+
readOnly() {
|
|
445
|
+
const self = this;
|
|
446
|
+
|
|
447
|
+
return new Proxy(self, {
|
|
448
|
+
get(target, prop, receiver) {
|
|
449
|
+
// Block mutating methods
|
|
450
|
+
if (MUTATING_METHODS.has(prop)) {
|
|
451
|
+
return () => {
|
|
452
|
+
throw new TypeError(
|
|
453
|
+
`Cannot call '${prop}' on a read-only Matcher. ` +
|
|
454
|
+
`Obtain a writable instance to mutate state.`
|
|
455
|
+
);
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
const value = Reflect.get(target, prop, receiver);
|
|
460
|
+
|
|
461
|
+
// Freeze array/object properties so callers can't mutate internal
|
|
462
|
+
// state through direct property access (e.g. matcher.path.push(...))
|
|
463
|
+
if (prop === 'path' || prop === 'siblingStacks') {
|
|
464
|
+
return Object.freeze(
|
|
465
|
+
Array.isArray(value)
|
|
466
|
+
? value.map(item =>
|
|
467
|
+
item instanceof Map
|
|
468
|
+
? Object.freeze(new Map(item)) // freeze a copy of each Map
|
|
469
|
+
: Object.freeze({ ...item }) // freeze a copy of each node
|
|
470
|
+
)
|
|
471
|
+
: value
|
|
472
|
+
);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
// Bind methods so `this` inside them still refers to the real Matcher
|
|
476
|
+
if (typeof value === 'function') {
|
|
477
|
+
return value.bind(target);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
return value;
|
|
481
|
+
},
|
|
482
|
+
|
|
483
|
+
// Prevent any property assignment on the read-only view
|
|
484
|
+
set(_target, prop) {
|
|
485
|
+
throw new TypeError(
|
|
486
|
+
`Cannot set property '${String(prop)}' on a read-only Matcher.`
|
|
487
|
+
);
|
|
488
|
+
},
|
|
489
|
+
|
|
490
|
+
// Prevent property deletion
|
|
491
|
+
deleteProperty(_target, prop) {
|
|
492
|
+
throw new TypeError(
|
|
493
|
+
`Cannot delete property '${String(prop)}' from a read-only Matcher.`
|
|
494
|
+
);
|
|
495
|
+
}
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
}
|