oak-domain 6.0.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/es/actions/action.d.ts +1 -1
- package/es/base-app-domain/EntityDict.d.ts +27 -0
- package/es/base-app-domain/LocalizedContent/Schema.d.ts +19 -0
- package/es/base-app-domain/LocalizedContent/Schema.js +1 -0
- package/es/base-app-domain/LocalizedContent/Storage.d.ts +3 -0
- package/es/base-app-domain/LocalizedContent/Storage.js +75 -0
- package/es/base-app-domain/LocalizedContent/Style.d.ts +3 -0
- package/es/base-app-domain/LocalizedContent/Style.js +12 -0
- package/es/base-app-domain/LocalizedContent/_baseSchema.d.ts +58 -0
- package/es/base-app-domain/Storage.js +2 -0
- package/es/base-app-domain/StyleDict.js +2 -0
- package/es/compiler/customChecks/i18n.js +4 -1
- package/es/compiler/customChecks/runner.d.ts +1 -1
- package/es/compiler/customChecks/runner.js +1 -1
- package/es/compiler/customChecks/types.d.ts +2 -1
- package/es/compiler/dependencyBuilder.d.ts +11 -2
- package/es/compiler/dependencyBuilder.js +188 -199
- package/es/compiler/entityDescEnum.d.ts +5 -0
- package/es/compiler/entityDescEnum.js +443 -0
- package/es/compiler/entitySource.d.ts +28 -0
- package/es/compiler/entitySource.js +521 -0
- package/es/compiler/localeBuilder.d.ts +7 -2
- package/es/compiler/localeBuilder.js +52 -56
- package/es/compiler/routerBuilder.d.ts +32 -3
- package/es/compiler/routerBuilder.js +157 -45
- package/es/compiler/schemaBuilder.d.ts +12 -2
- package/es/compiler/schemaBuilder.js +653 -148
- package/es/compiler/tscBuilder.d.ts +20 -2
- package/es/compiler/tscBuilder.js +231 -45
- package/es/context/BackendRuntimeContext.d.ts +6 -4
- package/es/context/BackendRuntimeContext.js +9 -1
- package/es/context/ContextComposer.d.ts +93 -0
- package/es/context/ContextComposer.js +353 -0
- package/es/context/SerializedData.d.ts +2 -1
- package/es/data/i18n.d.ts +1 -1
- package/es/data/i18n.js +1 -86
- package/es/data/i18n.json +86 -0
- package/es/entities/ActionAuth.d.ts +3 -3
- package/es/entities/I18n.d.ts +2 -2
- package/es/entities/LocalizedContent.d.ts +22 -0
- package/es/entities/LocalizedContent.js +101 -0
- package/es/entities/Log.d.ts +3 -3
- package/es/entities/Modi.d.ts +2 -2
- package/es/entities/ModiEntity.d.ts +3 -3
- package/es/entities/Oper.d.ts +5 -5
- package/es/entities/OperEntity.d.ts +3 -3
- package/es/entities/Path.d.ts +2 -2
- package/es/entities/Relation.d.ts +2 -2
- package/es/entities/RelationAuth.d.ts +3 -3
- package/es/entities/User.d.ts +4 -4
- package/es/entities/UserEntityClaim.d.ts +6 -6
- package/es/entities/UserEntityGrant.d.ts +2 -2
- package/es/entities/UserRelation.d.ts +4 -4
- package/es/store/AsyncRowStore.d.ts +2 -2
- package/es/store/AsyncRowStore.js +2 -2
- package/es/store/CascadeStore.d.ts +5 -3
- package/es/store/CascadeStore.js +56 -24
- package/es/store/IntrinsicCheckers.d.ts +1 -1
- package/es/store/IntrinsicCheckers.js +2 -2
- package/es/store/IntrinsicLogics.d.ts +1 -1
- package/es/store/RelationAuth.js +3 -3
- package/es/store/SyncRowStore.d.ts +1 -1
- package/es/store/SyncRowStore.js +1 -1
- package/es/store/TriggerExecutor.d.ts +6 -4
- package/es/store/TriggerExecutor.js +16 -4
- package/es/store/checker.d.ts +2 -2
- package/es/store/checker.js +45 -9
- package/es/store/filter.d.ts +3 -3
- package/es/store/filter.js +4 -4
- package/es/store/modi.d.ts +5 -5
- package/es/store/modi.js +4 -4
- package/es/store/projection.d.ts +1 -1
- package/es/store/relation.js +1 -1
- package/es/store/triggers.d.ts +4 -4
- package/es/store/triggers.js +2 -2
- package/es/timers/oper.d.ts +3 -3
- package/es/timers/oper.js +1 -1
- package/es/timers/vaccum.d.ts +3 -3
- package/es/types/Action.d.ts +1 -1
- package/es/types/AppLoader.d.ts +1 -1
- package/es/types/Aspect.d.ts +1 -1
- package/es/types/Auth.d.ts +2 -2
- package/es/types/Configuration.d.ts +7 -6
- package/es/types/Connector.d.ts +47 -1
- package/es/types/DataType.d.ts +2 -2
- package/es/types/Demand.d.ts +40 -6
- package/es/types/Endpoint.d.ts +17 -1
- package/es/types/Entity.d.ts +21 -4
- package/es/types/Entity.js +23 -0
- package/es/types/EntityDesc.d.ts +9 -8
- package/es/types/Environment.d.ts +17 -0
- package/es/types/Exception.d.ts +1 -1
- package/es/types/Exception.js +1 -1
- package/es/types/Expression.d.ts +13 -2
- package/es/types/Expression.js +36 -1
- package/es/types/Locale.d.ts +14 -1
- package/es/types/Locale.js +13 -1
- package/es/types/OakPackage.d.ts +29 -0
- package/es/types/OakPackage.js +30 -0
- package/es/types/Port.d.ts +1 -1
- package/es/types/RowStore.d.ts +9 -7
- package/es/types/Storage.d.ts +11 -3
- package/es/types/Storage.js +12 -1
- package/es/types/Style.d.ts +2 -2
- package/es/types/Sync.d.ts +3 -3
- package/es/types/Timer.d.ts +14 -2
- package/es/types/Trigger.d.ts +1 -1
- package/es/types/Watcher.d.ts +1 -1
- package/es/types/index.d.ts +1 -0
- package/es/types/index.js +1 -0
- package/es/utils/SimpleConnector.d.ts +30 -4
- package/es/utils/SimpleConnector.js +294 -21
- package/es/utils/concurrent.js +1 -1
- package/es/utils/decimal.d.ts +26 -0
- package/es/utils/decimal.js +87 -0
- package/es/utils/fetch/index.d.ts +1 -0
- package/es/utils/fetch/index.js +3 -0
- package/es/utils/fetch/index.mp.d.ts +3 -0
- package/es/utils/fetch/index.mp.js +280 -0
- package/es/utils/fetch/index.native.d.ts +1 -0
- package/es/utils/fetch/index.native.js +3 -0
- package/es/utils/fetch/index.web.d.ts +1 -0
- package/es/utils/fetch/index.web.js +3 -0
- package/es/utils/fetch/shared.d.ts +6 -0
- package/es/utils/fetch/shared.js +23 -0
- package/es/utils/localizedContent.d.ts +11 -0
- package/es/utils/localizedContent.js +346 -0
- package/es/utils/lodash.d.ts +1 -35
- package/es/utils/lodash.js +1 -52
- package/es/utils/module/combine.common.d.ts +3 -3
- package/es/utils/module/combine.common.js +2 -2
- package/es/utils/module/combine.dev.d.ts +2 -2
- package/es/utils/module/combine.dev.js +2 -2
- package/es/utils/module/combine.prod.d.ts +1 -1
- package/es/utils/module/combine.server.d.ts +2 -2
- package/es/utils/module/combine.server.js +2 -2
- package/es/utils/money.d.ts +2 -2
- package/es/utils/money.js +2 -2
- package/es/utils/operationResult.js +1 -1
- package/es/utils/projection.d.ts +3 -3
- package/es/utils/projection.js +1 -1
- package/es/utils/relationPath.d.ts +1 -1
- package/es/utils/relationPath.js +1 -1
- package/es/utils/row.d.ts +3 -3
- package/es/utils/row.js +2 -2
- package/es/utils/sseEndpoint.d.ts +41 -0
- package/es/utils/sseEndpoint.js +151 -0
- package/es/utils/toolkit.d.ts +28 -0
- package/es/utils/toolkit.js +220 -0
- package/es/utils/url/index.d.ts +1 -3
- package/es/utils/url/index.js +1 -1
- package/es/utils/url/index.mp.d.ts +16 -3
- package/es/utils/url/index.mp.js +2 -2
- package/es/utils/url/index.native.d.ts +13 -1
- package/es/utils/url/index.native.js +3 -1
- package/es/utils/url/index.web.d.ts +13 -1
- package/es/utils/url/index.web.js +3 -1
- package/es/utils/url/lightweight.d.ts +65 -0
- package/es/utils/url/lightweight.js +530 -0
- package/es/utils/url/urlObject.d.ts +16 -0
- package/es/utils/validate/id.d.ts +5 -0
- package/es/utils/validate/id.js +28 -0
- package/es/utils/validate/index.d.ts +4 -0
- package/es/utils/validate/index.js +4 -0
- package/es/utils/validate/mobile.d.ts +6 -0
- package/es/utils/validate/mobile.js +49 -0
- package/es/utils/validate/nationality.d.ts +14 -0
- package/es/utils/validate/nationality.data.d.ts +9 -0
- package/es/utils/validate/nationality.data.js +257 -0
- package/es/utils/validate/nationality.js +64 -0
- package/es/utils/validate/passport.d.ts +3 -0
- package/es/utils/validate/passport.js +19 -0
- package/es/utils/validator.d.ts +10 -8
- package/es/utils/validator.js +24 -40
- package/lib/actions/action.d.ts +1 -1
- package/lib/base-app-domain/EntityDict.d.ts +27 -0
- package/lib/base-app-domain/LocalizedContent/Schema.d.ts +19 -0
- package/lib/base-app-domain/LocalizedContent/Schema.js +4 -0
- package/lib/base-app-domain/LocalizedContent/Storage.d.ts +3 -0
- package/lib/base-app-domain/LocalizedContent/Storage.js +78 -0
- package/lib/base-app-domain/LocalizedContent/Style.d.ts +3 -0
- package/lib/base-app-domain/LocalizedContent/Style.js +15 -0
- package/lib/base-app-domain/LocalizedContent/_baseSchema.d.ts +58 -0
- package/lib/base-app-domain/Storage.js +26 -24
- package/lib/base-app-domain/StyleDict.js +10 -8
- package/lib/compiler/customChecks/i18n.js +5 -2
- package/lib/compiler/customChecks/runner.d.ts +1 -1
- package/lib/compiler/customChecks/types.d.ts +2 -1
- package/lib/compiler/dependencyBuilder.d.ts +11 -2
- package/lib/compiler/dependencyBuilder.js +237 -243
- package/lib/compiler/entityDescEnum.d.ts +5 -0
- package/lib/compiler/entityDescEnum.js +450 -0
- package/lib/compiler/entitySource.d.ts +28 -0
- package/lib/compiler/entitySource.js +529 -0
- package/lib/compiler/localeBuilder.d.ts +7 -2
- package/lib/compiler/localeBuilder.js +52 -56
- package/lib/compiler/routerBuilder.d.ts +32 -3
- package/lib/compiler/routerBuilder.js +160 -48
- package/lib/compiler/schemaBuilder.d.ts +12 -2
- package/lib/compiler/schemaBuilder.js +855 -350
- package/lib/compiler/tscBuilder.d.ts +20 -2
- package/lib/compiler/tscBuilder.js +217 -37
- package/lib/context/BackendRuntimeContext.d.ts +6 -4
- package/lib/context/BackendRuntimeContext.js +10 -3
- package/lib/context/ContextComposer.d.ts +93 -0
- package/lib/context/ContextComposer.js +361 -0
- package/lib/context/SerializedData.d.ts +2 -1
- package/lib/data/i18n.d.ts +1 -1
- package/lib/data/i18n.js +1 -86
- package/lib/data/i18n.json +86 -0
- package/lib/entities/ActionAuth.d.ts +3 -3
- package/lib/entities/I18n.d.ts +2 -2
- package/lib/entities/LocalizedContent.d.ts +22 -0
- package/lib/entities/LocalizedContent.js +104 -0
- package/lib/entities/Log.d.ts +3 -3
- package/lib/entities/Modi.d.ts +2 -2
- package/lib/entities/ModiEntity.d.ts +3 -3
- package/lib/entities/Oper.d.ts +5 -5
- package/lib/entities/OperEntity.d.ts +3 -3
- package/lib/entities/Path.d.ts +2 -2
- package/lib/entities/Relation.d.ts +2 -2
- package/lib/entities/RelationAuth.d.ts +3 -3
- package/lib/entities/User.d.ts +4 -4
- package/lib/entities/UserEntityClaim.d.ts +6 -6
- package/lib/entities/UserEntityGrant.d.ts +2 -2
- package/lib/entities/UserRelation.d.ts +4 -4
- package/lib/store/AsyncRowStore.d.ts +2 -2
- package/lib/store/AsyncRowStore.js +6 -7
- package/lib/store/CascadeStore.d.ts +5 -3
- package/lib/store/CascadeStore.js +101 -70
- package/lib/store/IntrinsicCheckers.d.ts +1 -1
- package/lib/store/IntrinsicCheckers.js +12 -13
- package/lib/store/IntrinsicLogics.d.ts +1 -1
- package/lib/store/RelationAuth.js +42 -43
- package/lib/store/SyncRowStore.d.ts +1 -1
- package/lib/store/SyncRowStore.js +4 -5
- package/lib/store/TriggerExecutor.d.ts +6 -4
- package/lib/store/TriggerExecutor.js +39 -28
- package/lib/store/checker.d.ts +2 -2
- package/lib/store/checker.js +55 -20
- package/lib/store/filter.d.ts +3 -3
- package/lib/store/filter.js +47 -48
- package/lib/store/modi.d.ts +5 -5
- package/lib/store/modi.js +5 -6
- package/lib/store/projection.d.ts +1 -1
- package/lib/store/relation.js +4 -5
- package/lib/store/triggers.d.ts +4 -4
- package/lib/store/triggers.js +13 -14
- package/lib/timers/oper.d.ts +3 -3
- package/lib/timers/vaccum.d.ts +3 -3
- package/lib/types/Action.d.ts +1 -1
- package/lib/types/AppLoader.d.ts +1 -1
- package/lib/types/Aspect.d.ts +1 -1
- package/lib/types/Auth.d.ts +2 -2
- package/lib/types/Configuration.d.ts +7 -6
- package/lib/types/Connector.d.ts +47 -1
- package/lib/types/DataType.d.ts +2 -2
- package/lib/types/Demand.d.ts +40 -6
- package/lib/types/Endpoint.d.ts +17 -1
- package/lib/types/Entity.d.ts +21 -4
- package/lib/types/Entity.js +27 -0
- package/lib/types/EntityDesc.d.ts +9 -8
- package/lib/types/Environment.d.ts +17 -0
- package/lib/types/Exception.d.ts +1 -1
- package/lib/types/Exception.js +2 -2
- package/lib/types/Expression.d.ts +13 -2
- package/lib/types/Expression.js +40 -5
- package/lib/types/Locale.d.ts +14 -1
- package/lib/types/Locale.js +14 -0
- package/lib/types/OakPackage.d.ts +29 -0
- package/lib/types/OakPackage.js +36 -0
- package/lib/types/Port.d.ts +1 -1
- package/lib/types/RowStore.d.ts +9 -7
- package/lib/types/Storage.d.ts +11 -3
- package/lib/types/Storage.js +13 -0
- package/lib/types/Style.d.ts +2 -2
- package/lib/types/Sync.d.ts +3 -3
- package/lib/types/Timer.d.ts +14 -2
- package/lib/types/Trigger.d.ts +1 -1
- package/lib/types/Watcher.d.ts +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/lib/utils/SimpleConnector.d.ts +30 -4
- package/lib/utils/SimpleConnector.js +297 -24
- package/lib/utils/concurrent.js +4 -5
- package/lib/utils/decimal.d.ts +26 -0
- package/lib/utils/decimal.js +112 -0
- package/lib/utils/fetch/index.d.ts +1 -0
- package/lib/utils/fetch/index.js +6 -0
- package/lib/utils/fetch/index.mp.d.ts +3 -0
- package/lib/utils/fetch/index.mp.js +285 -0
- package/lib/utils/fetch/index.native.d.ts +1 -0
- package/lib/utils/fetch/index.native.js +6 -0
- package/lib/utils/fetch/index.web.d.ts +1 -0
- package/lib/utils/fetch/index.web.js +6 -0
- package/lib/utils/fetch/shared.d.ts +6 -0
- package/lib/utils/fetch/shared.js +28 -0
- package/lib/utils/localizedContent.d.ts +11 -0
- package/lib/utils/localizedContent.js +352 -0
- package/lib/utils/lodash.d.ts +1 -35
- package/lib/utils/lodash.js +1 -76
- package/lib/utils/module/combine.common.d.ts +3 -3
- package/lib/utils/module/combine.common.js +6 -7
- package/lib/utils/module/combine.dev.d.ts +2 -2
- package/lib/utils/module/combine.dev.js +19 -19
- package/lib/utils/module/combine.prod.d.ts +1 -1
- package/lib/utils/module/combine.server.d.ts +2 -2
- package/lib/utils/module/combine.server.js +19 -19
- package/lib/utils/money.d.ts +2 -2
- package/lib/utils/money.js +2 -2
- package/lib/utils/operationResult.js +4 -4
- package/lib/utils/projection.d.ts +3 -3
- package/lib/utils/relationPath.d.ts +1 -1
- package/lib/utils/relationPath.js +10 -11
- package/lib/utils/row.d.ts +3 -3
- package/lib/utils/row.js +4 -5
- package/lib/utils/sseEndpoint.d.ts +41 -0
- package/lib/utils/sseEndpoint.js +156 -0
- package/lib/utils/toolkit.d.ts +28 -0
- package/lib/utils/toolkit.js +253 -0
- package/lib/utils/url/index.d.ts +1 -3
- package/lib/utils/url/index.js +3 -1
- package/lib/utils/url/index.mp.d.ts +16 -3
- package/lib/utils/url/index.mp.js +6 -4
- package/lib/utils/url/index.native.d.ts +13 -1
- package/lib/utils/url/index.native.js +5 -1
- package/lib/utils/url/index.web.d.ts +13 -1
- package/lib/utils/url/index.web.js +5 -1
- package/lib/utils/url/lightweight.d.ts +65 -0
- package/lib/utils/url/lightweight.js +535 -0
- package/lib/utils/url/urlObject.d.ts +16 -0
- package/lib/utils/url/urlObject.js +2 -0
- package/lib/utils/url/whatwg-url/lib/URL-impl.d.ts +8 -15
- package/lib/utils/url/whatwg-url/lib/infra.js +5 -4
- package/lib/utils/url/whatwg-url/lib/urlencoded.d.ts +3 -1
- package/lib/utils/url/whatwg-url/lib/utils.d.ts +1 -1
- package/lib/utils/validate/id.d.ts +5 -0
- package/lib/utils/validate/id.js +35 -0
- package/lib/utils/validate/index.d.ts +4 -0
- package/lib/utils/validate/index.js +7 -0
- package/lib/utils/validate/mobile.d.ts +6 -0
- package/lib/utils/validate/mobile.js +57 -0
- package/lib/utils/validate/nationality.d.ts +14 -0
- package/lib/utils/validate/nationality.data.d.ts +9 -0
- package/lib/utils/validate/nationality.data.js +260 -0
- package/lib/utils/validate/nationality.js +76 -0
- package/lib/utils/validate/passport.d.ts +3 -0
- package/lib/utils/validate/passport.js +24 -0
- package/lib/utils/validator.d.ts +10 -8
- package/lib/utils/validator.js +38 -42
- package/package.json +19 -9
- package/es/utils/url/whatwg-url/index.d.ts +0 -3
- package/es/utils/url/whatwg-url/index.js +0 -12
- package/es/utils/url/whatwg-url/lib/URL-impl.d.ts +0 -27
- package/es/utils/url/whatwg-url/lib/URL-impl.js +0 -172
- package/es/utils/url/whatwg-url/lib/URL.js +0 -295
- package/es/utils/url/whatwg-url/lib/URLSearchParams-impl.d.ts +0 -19
- package/es/utils/url/whatwg-url/lib/URLSearchParams-impl.js +0 -123
- package/es/utils/url/whatwg-url/lib/URLSearchParams.js +0 -423
- package/es/utils/url/whatwg-url/lib/infra.d.ts +0 -12
- package/es/utils/url/whatwg-url/lib/infra.js +0 -19
- package/es/utils/url/whatwg-url/lib/url-state-machine.d.ts +0 -24
- package/es/utils/url/whatwg-url/lib/url-state-machine.js +0 -1228
- package/es/utils/url/whatwg-url/lib/urlencoded.d.ts +0 -14
- package/es/utils/url/whatwg-url/lib/urlencoded.js +0 -160
- package/es/utils/url/whatwg-url/lib/utils.d.ts +0 -37
- package/es/utils/url/whatwg-url/lib/utils.js +0 -99
- package/lib/store/diffSchema.d.ts +0 -1
- package/lib/utils/url/whatwg-url/index.d.ts +0 -3
- package/lib/utils/url/whatwg-url/index.js +0 -16
- package/lib/utils/url/whatwg-url/lib/URL-impl.js +0 -175
- package/lib/utils/url/whatwg-url/lib/URL.d.ts +0 -1
- package/lib/utils/url/whatwg-url/lib/URL.js +0 -298
- package/lib/utils/url/whatwg-url/lib/URLSearchParams-impl.d.ts +0 -19
- package/lib/utils/url/whatwg-url/lib/URLSearchParams-impl.js +0 -126
- package/lib/utils/url/whatwg-url/lib/URLSearchParams.d.ts +0 -1
- package/lib/utils/url/whatwg-url/lib/URLSearchParams.js +0 -426
- package/lib/utils/url/whatwg-url/lib/infra.d.ts +0 -12
- package/lib/utils/url/whatwg-url/lib/url-state-machine.d.ts +0 -24
- package/lib/utils/url/whatwg-url/lib/url-state-machine.js +0 -1238
- package/lib/utils/url/whatwg-url/lib/urlencoded.js +0 -162
- package/lib/utils/url/whatwg-url/lib/utils.js +0 -101
- package/src/entities/ActionAuth.ts +0 -50
- package/src/entities/I18n.ts +0 -53
- package/src/entities/Log.ts +0 -62
- package/src/entities/Modi.ts +0 -107
- package/src/entities/ModiEntity.ts +0 -35
- package/src/entities/Oper.ts +0 -115
- package/src/entities/OperEntity.ts +0 -36
- package/src/entities/Path.ts +0 -56
- package/src/entities/Relation.ts +0 -53
- package/src/entities/RelationAuth.ts +0 -53
- package/src/entities/User.ts +0 -85
- package/src/entities/UserEntityClaim.ts +0 -41
- package/src/entities/UserEntityGrant.ts +0 -33
- package/src/entities/UserRelation.ts +0 -60
- /package/es/{utils/url/whatwg-url/lib/URL.d.ts → base-app-domain/LocalizedContent/_baseSchema.js} +0 -0
- /package/es/utils/url/{whatwg-url/lib/URLSearchParams.d.ts → urlObject.js} +0 -0
- /package/lib/{store/diffSchema.js → base-app-domain/LocalizedContent/_baseSchema.js} +0 -0
|
@@ -0,0 +1,535 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.URL = exports.URLSearchParams = void 0;
|
|
4
|
+
const searchParamsObservers = new WeakMap();
|
|
5
|
+
const defaultPorts = {
|
|
6
|
+
'ftp:': '21',
|
|
7
|
+
'http:': '80',
|
|
8
|
+
'https:': '443',
|
|
9
|
+
'ws:': '80',
|
|
10
|
+
'wss:': '443',
|
|
11
|
+
};
|
|
12
|
+
function encodeQueryComponent(value) {
|
|
13
|
+
return encodeURIComponent(value)
|
|
14
|
+
.replace(/%20/g, '+')
|
|
15
|
+
.replace(/~/g, '%7E')
|
|
16
|
+
.replace(/!/g, '%21')
|
|
17
|
+
.replace(/\(/g, '%28')
|
|
18
|
+
.replace(/\)/g, '%29')
|
|
19
|
+
.replace(/'/g, '%27');
|
|
20
|
+
}
|
|
21
|
+
function decodeQueryComponent(value) {
|
|
22
|
+
return decodeURIComponent(value.replace(/\+/g, ' '));
|
|
23
|
+
}
|
|
24
|
+
function normalizeSearch(value) {
|
|
25
|
+
if (!value) {
|
|
26
|
+
return '';
|
|
27
|
+
}
|
|
28
|
+
return value.startsWith('?') ? value : `?${value}`;
|
|
29
|
+
}
|
|
30
|
+
function normalizeHash(value) {
|
|
31
|
+
if (!value) {
|
|
32
|
+
return '';
|
|
33
|
+
}
|
|
34
|
+
return value.startsWith('#') ? value : `#${value}`;
|
|
35
|
+
}
|
|
36
|
+
function parseQueryString(value) {
|
|
37
|
+
const query = value.startsWith('?') ? value.slice(1) : value;
|
|
38
|
+
if (!query) {
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
return query
|
|
42
|
+
.split('&')
|
|
43
|
+
.filter((segment) => segment.length > 0)
|
|
44
|
+
.map((segment) => {
|
|
45
|
+
const separatorIndex = segment.indexOf('=');
|
|
46
|
+
if (separatorIndex === -1) {
|
|
47
|
+
return [decodeQueryComponent(segment), ''];
|
|
48
|
+
}
|
|
49
|
+
return [
|
|
50
|
+
decodeQueryComponent(segment.slice(0, separatorIndex)),
|
|
51
|
+
decodeQueryComponent(segment.slice(separatorIndex + 1)),
|
|
52
|
+
];
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function serializeQuery(entries) {
|
|
56
|
+
return entries
|
|
57
|
+
.map(([key, value]) => `${encodeQueryComponent(key)}=${encodeQueryComponent(value)}`)
|
|
58
|
+
.join('&');
|
|
59
|
+
}
|
|
60
|
+
function isIterableEntries(value) {
|
|
61
|
+
return !!value && typeof value[Symbol.iterator] === 'function';
|
|
62
|
+
}
|
|
63
|
+
function encodePathname(pathname) {
|
|
64
|
+
return pathname
|
|
65
|
+
.replace(/%(?![0-9a-fA-F]{2})/g, '%25')
|
|
66
|
+
.replace(/ /g, '%20')
|
|
67
|
+
.replace(/#/g, '%23')
|
|
68
|
+
.replace(/\?/g, '%3F')
|
|
69
|
+
.replace(/{/g, '%7B')
|
|
70
|
+
.replace(/}/g, '%7D')
|
|
71
|
+
.replace(/`/g, '%60')
|
|
72
|
+
.replace(/</g, '%3C')
|
|
73
|
+
.replace(/>/g, '%3E')
|
|
74
|
+
.replace(/"/g, '%22');
|
|
75
|
+
}
|
|
76
|
+
function normalizePathname(pathname, forceLeadingSlash) {
|
|
77
|
+
const encodedPathname = encodePathname(pathname);
|
|
78
|
+
if (!encodedPathname) {
|
|
79
|
+
return forceLeadingSlash ? '/' : '';
|
|
80
|
+
}
|
|
81
|
+
const hasLeadingSlash = encodedPathname.startsWith('/');
|
|
82
|
+
const hasTrailingSlash = encodedPathname.length > 1 && encodedPathname.endsWith('/');
|
|
83
|
+
const segments = encodedPathname.split('/');
|
|
84
|
+
const normalizedSegments = [];
|
|
85
|
+
segments.forEach((segment) => {
|
|
86
|
+
if (!segment || segment === '.') {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (segment === '..') {
|
|
90
|
+
if (normalizedSegments.length > 0 && normalizedSegments[normalizedSegments.length - 1] !== '..') {
|
|
91
|
+
normalizedSegments.pop();
|
|
92
|
+
}
|
|
93
|
+
else if (!hasLeadingSlash && !forceLeadingSlash) {
|
|
94
|
+
normalizedSegments.push('..');
|
|
95
|
+
}
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
normalizedSegments.push(segment);
|
|
99
|
+
});
|
|
100
|
+
let result = normalizedSegments.join('/');
|
|
101
|
+
if (hasLeadingSlash || forceLeadingSlash) {
|
|
102
|
+
result = `/${result}`;
|
|
103
|
+
}
|
|
104
|
+
if (!result) {
|
|
105
|
+
return forceLeadingSlash || hasLeadingSlash ? '/' : '';
|
|
106
|
+
}
|
|
107
|
+
if (hasTrailingSlash && result !== '/') {
|
|
108
|
+
result += '/';
|
|
109
|
+
}
|
|
110
|
+
return result;
|
|
111
|
+
}
|
|
112
|
+
function splitPathnameSearchHash(value) {
|
|
113
|
+
let pathname = value;
|
|
114
|
+
let search = '';
|
|
115
|
+
let hash = '';
|
|
116
|
+
const hashIndex = pathname.indexOf('#');
|
|
117
|
+
if (hashIndex >= 0) {
|
|
118
|
+
hash = pathname.slice(hashIndex);
|
|
119
|
+
pathname = pathname.slice(0, hashIndex);
|
|
120
|
+
}
|
|
121
|
+
const searchIndex = pathname.indexOf('?');
|
|
122
|
+
if (searchIndex >= 0) {
|
|
123
|
+
search = pathname.slice(searchIndex);
|
|
124
|
+
pathname = pathname.slice(0, searchIndex);
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
pathname,
|
|
128
|
+
search,
|
|
129
|
+
hash,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function isAbsoluteUrl(value) {
|
|
133
|
+
return /^[a-z][a-z0-9+.-]*:/i.test(value);
|
|
134
|
+
}
|
|
135
|
+
function parseAuthority(authority) {
|
|
136
|
+
let credentials = '';
|
|
137
|
+
let hostPart = authority;
|
|
138
|
+
const atIndex = authority.lastIndexOf('@');
|
|
139
|
+
if (atIndex >= 0) {
|
|
140
|
+
credentials = authority.slice(0, atIndex);
|
|
141
|
+
hostPart = authority.slice(atIndex + 1);
|
|
142
|
+
}
|
|
143
|
+
let username = '';
|
|
144
|
+
let password = '';
|
|
145
|
+
if (credentials) {
|
|
146
|
+
const separatorIndex = credentials.indexOf(':');
|
|
147
|
+
if (separatorIndex === -1) {
|
|
148
|
+
username = decodeURIComponent(credentials);
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
username = decodeURIComponent(credentials.slice(0, separatorIndex));
|
|
152
|
+
password = decodeURIComponent(credentials.slice(separatorIndex + 1));
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
let hostname = hostPart;
|
|
156
|
+
let port = '';
|
|
157
|
+
if (hostPart.startsWith('[')) {
|
|
158
|
+
const bracketIndex = hostPart.indexOf(']');
|
|
159
|
+
if (bracketIndex === -1) {
|
|
160
|
+
throw new TypeError(`Invalid URL host: ${hostPart}`);
|
|
161
|
+
}
|
|
162
|
+
hostname = hostPart.slice(0, bracketIndex + 1).toLowerCase();
|
|
163
|
+
if (hostPart[bracketIndex + 1] === ':') {
|
|
164
|
+
port = hostPart.slice(bracketIndex + 2);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
const separatorIndex = hostPart.lastIndexOf(':');
|
|
169
|
+
if (separatorIndex > 0 && hostPart.indexOf(':') === separatorIndex) {
|
|
170
|
+
hostname = hostPart.slice(0, separatorIndex);
|
|
171
|
+
port = hostPart.slice(separatorIndex + 1);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
username,
|
|
176
|
+
password,
|
|
177
|
+
hostname: hostname.toLowerCase(),
|
|
178
|
+
port,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
function parseAbsoluteUrl(value) {
|
|
182
|
+
const matched = value.match(/^([a-z][a-z0-9+.-]*:)(?:\/\/([^/?#]*))?([^?#]*)(\?[^#]*)?(#.*)?$/i);
|
|
183
|
+
if (!matched) {
|
|
184
|
+
throw new TypeError(`Invalid URL: ${value}`);
|
|
185
|
+
}
|
|
186
|
+
const [, rawProtocol, authority = '', rawPathname = '', search = '', hash = ''] = matched;
|
|
187
|
+
const protocol = rawProtocol.toLowerCase();
|
|
188
|
+
const parsedAuthority = authority ? parseAuthority(authority) : {
|
|
189
|
+
username: '',
|
|
190
|
+
password: '',
|
|
191
|
+
hostname: '',
|
|
192
|
+
port: '',
|
|
193
|
+
};
|
|
194
|
+
const hasAuthority = matched[2] !== undefined;
|
|
195
|
+
const forceLeadingSlash = hasAuthority;
|
|
196
|
+
const pathname = normalizePathname(rawPathname || (hasAuthority ? '/' : ''), forceLeadingSlash);
|
|
197
|
+
return {
|
|
198
|
+
protocol,
|
|
199
|
+
pathname,
|
|
200
|
+
search,
|
|
201
|
+
hash,
|
|
202
|
+
hasAuthority,
|
|
203
|
+
...normalizeAuthority(protocol, parsedAuthority),
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
function normalizeAuthority(protocol, authority) {
|
|
207
|
+
return {
|
|
208
|
+
...authority,
|
|
209
|
+
port: authority.port === defaultPorts[protocol] ? '' : authority.port,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function buildHref(parts) {
|
|
213
|
+
const credentialPrefix = parts.username || parts.password
|
|
214
|
+
? `${encodeURIComponent(parts.username)}${parts.password ? `:${encodeURIComponent(parts.password)}` : ''}@`
|
|
215
|
+
: '';
|
|
216
|
+
const authority = parts.hasAuthority
|
|
217
|
+
? `//${credentialPrefix}${parts.hostname}${parts.port ? `:${parts.port}` : ''}`
|
|
218
|
+
: '';
|
|
219
|
+
const pathname = parts.pathname || (parts.hasAuthority ? '/' : '');
|
|
220
|
+
return `${parts.protocol}${authority}${pathname}${parts.search}${parts.hash}`;
|
|
221
|
+
}
|
|
222
|
+
function resolveRelativePath(basePathname, relativePathname) {
|
|
223
|
+
if (!relativePathname) {
|
|
224
|
+
return normalizePathname(basePathname, basePathname.startsWith('/'));
|
|
225
|
+
}
|
|
226
|
+
if (relativePathname.startsWith('/')) {
|
|
227
|
+
return normalizePathname(relativePathname, true);
|
|
228
|
+
}
|
|
229
|
+
const currentDirectory = basePathname.endsWith('/')
|
|
230
|
+
? basePathname
|
|
231
|
+
: basePathname.slice(0, basePathname.lastIndexOf('/') + 1) || '/';
|
|
232
|
+
return normalizePathname(`${currentDirectory}${relativePathname}`, true);
|
|
233
|
+
}
|
|
234
|
+
function resolveUrl(value, base) {
|
|
235
|
+
const href = typeof value === 'string' ? value : value.href;
|
|
236
|
+
if (isAbsoluteUrl(href)) {
|
|
237
|
+
return buildHref(parseAbsoluteUrl(href));
|
|
238
|
+
}
|
|
239
|
+
if (!base) {
|
|
240
|
+
throw new TypeError(`Invalid URL: ${href}`);
|
|
241
|
+
}
|
|
242
|
+
const baseHref = typeof base === 'string' ? base : base.href;
|
|
243
|
+
const baseParts = parseAbsoluteUrl(resolveUrl(baseHref));
|
|
244
|
+
if (href.startsWith('//')) {
|
|
245
|
+
return buildHref(parseAbsoluteUrl(`${baseParts.protocol}${href}`));
|
|
246
|
+
}
|
|
247
|
+
if (href.startsWith('#')) {
|
|
248
|
+
return buildHref({
|
|
249
|
+
...baseParts,
|
|
250
|
+
hash: normalizeHash(href),
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
if (href.startsWith('?')) {
|
|
254
|
+
return buildHref({
|
|
255
|
+
...baseParts,
|
|
256
|
+
search: normalizeSearch(href),
|
|
257
|
+
hash: '',
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
const { pathname, search, hash } = splitPathnameSearchHash(href);
|
|
261
|
+
return buildHref({
|
|
262
|
+
...baseParts,
|
|
263
|
+
pathname: resolveRelativePath(baseParts.pathname, pathname),
|
|
264
|
+
search: href === '' ? baseParts.search : normalizeSearch(search),
|
|
265
|
+
hash: normalizeHash(hash),
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
class URLSearchParams {
|
|
269
|
+
pairs;
|
|
270
|
+
constructor(init = '') {
|
|
271
|
+
if (typeof init === 'string') {
|
|
272
|
+
this.pairs = parseQueryString(init);
|
|
273
|
+
}
|
|
274
|
+
else if (init instanceof URLSearchParams) {
|
|
275
|
+
this.pairs = [...init.entries()];
|
|
276
|
+
}
|
|
277
|
+
else if (Array.isArray(init)) {
|
|
278
|
+
this.pairs = init.map(([key, value]) => [String(key), String(value)]);
|
|
279
|
+
}
|
|
280
|
+
else if (isIterableEntries(init)) {
|
|
281
|
+
this.pairs = Array.from(init, ([key, value]) => [String(key), String(value)]);
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
this.pairs = Object.entries(init).map(([key, value]) => [key, String(value)]);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
get size() {
|
|
288
|
+
return this.pairs.length;
|
|
289
|
+
}
|
|
290
|
+
append(name, value) {
|
|
291
|
+
this.pairs.push([String(name), String(value)]);
|
|
292
|
+
this.notifyUpdate();
|
|
293
|
+
}
|
|
294
|
+
delete(name, value) {
|
|
295
|
+
const normalizedName = String(name);
|
|
296
|
+
const normalizedValue = value === undefined ? undefined : String(value);
|
|
297
|
+
this.pairs = this.pairs.filter(([currentName, currentValue]) => currentName !== normalizedName
|
|
298
|
+
|| (normalizedValue !== undefined && currentValue !== normalizedValue));
|
|
299
|
+
this.notifyUpdate();
|
|
300
|
+
}
|
|
301
|
+
get(name) {
|
|
302
|
+
const found = this.pairs.find(([currentName]) => currentName === String(name));
|
|
303
|
+
return found ? found[1] : null;
|
|
304
|
+
}
|
|
305
|
+
getAll(name) {
|
|
306
|
+
const normalizedName = String(name);
|
|
307
|
+
return this.pairs
|
|
308
|
+
.filter(([currentName]) => currentName === normalizedName)
|
|
309
|
+
.map(([, value]) => value);
|
|
310
|
+
}
|
|
311
|
+
has(name, value) {
|
|
312
|
+
const normalizedName = String(name);
|
|
313
|
+
const normalizedValue = value === undefined ? undefined : String(value);
|
|
314
|
+
return this.pairs.some(([currentName, currentValue]) => currentName === normalizedName
|
|
315
|
+
&& (normalizedValue === undefined || currentValue === normalizedValue));
|
|
316
|
+
}
|
|
317
|
+
set(name, value) {
|
|
318
|
+
const normalizedName = String(name);
|
|
319
|
+
const normalizedValue = String(value);
|
|
320
|
+
const nextEntries = [];
|
|
321
|
+
let replaced = false;
|
|
322
|
+
this.pairs.forEach(([currentName, currentValue]) => {
|
|
323
|
+
if (currentName !== normalizedName) {
|
|
324
|
+
nextEntries.push([currentName, currentValue]);
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
if (!replaced) {
|
|
328
|
+
nextEntries.push([normalizedName, normalizedValue]);
|
|
329
|
+
replaced = true;
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
if (!replaced) {
|
|
333
|
+
nextEntries.push([normalizedName, normalizedValue]);
|
|
334
|
+
}
|
|
335
|
+
this.pairs = nextEntries;
|
|
336
|
+
this.notifyUpdate();
|
|
337
|
+
}
|
|
338
|
+
sort() {
|
|
339
|
+
this.pairs = this.pairs
|
|
340
|
+
.map((entry, index) => ({ entry, index }))
|
|
341
|
+
.sort((left, right) => {
|
|
342
|
+
const nameComparison = left.entry[0].localeCompare(right.entry[0]);
|
|
343
|
+
return nameComparison || left.index - right.index;
|
|
344
|
+
})
|
|
345
|
+
.map(({ entry }) => entry);
|
|
346
|
+
this.notifyUpdate();
|
|
347
|
+
}
|
|
348
|
+
forEach(callback, thisArg) {
|
|
349
|
+
this.pairs.forEach(([name, value]) => callback.call(thisArg, value, name, this));
|
|
350
|
+
}
|
|
351
|
+
*keys() {
|
|
352
|
+
for (const [name] of this.pairs) {
|
|
353
|
+
yield name;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
*values() {
|
|
357
|
+
for (const [, value] of this.pairs) {
|
|
358
|
+
yield value;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
*entries() {
|
|
362
|
+
for (const [name, value] of this.pairs) {
|
|
363
|
+
yield [name, value];
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
[Symbol.iterator]() {
|
|
367
|
+
return this.entries();
|
|
368
|
+
}
|
|
369
|
+
toString() {
|
|
370
|
+
return serializeQuery(this.pairs);
|
|
371
|
+
}
|
|
372
|
+
notifyUpdate() {
|
|
373
|
+
searchParamsObservers.get(this)?.(this.toString());
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
exports.URLSearchParams = URLSearchParams;
|
|
377
|
+
class URL {
|
|
378
|
+
protocolValue = '';
|
|
379
|
+
usernameValue = '';
|
|
380
|
+
passwordValue = '';
|
|
381
|
+
hostnameValue = '';
|
|
382
|
+
portValue = '';
|
|
383
|
+
pathnameValue = '';
|
|
384
|
+
searchValue = '';
|
|
385
|
+
hashValue = '';
|
|
386
|
+
hasAuthorityValue = true;
|
|
387
|
+
searchParamsValue = new URLSearchParams('');
|
|
388
|
+
constructor(url, base) {
|
|
389
|
+
this.update(resolveUrl(url, base));
|
|
390
|
+
}
|
|
391
|
+
static canParse(url, base) {
|
|
392
|
+
try {
|
|
393
|
+
new URL(url, base);
|
|
394
|
+
return true;
|
|
395
|
+
}
|
|
396
|
+
catch {
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
static parse(url, base) {
|
|
401
|
+
try {
|
|
402
|
+
return new URL(url, base);
|
|
403
|
+
}
|
|
404
|
+
catch {
|
|
405
|
+
return null;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
static createObjectURL(obj) {
|
|
409
|
+
if (typeof globalThis.URL?.createObjectURL === 'function') {
|
|
410
|
+
return globalThis.URL.createObjectURL(obj);
|
|
411
|
+
}
|
|
412
|
+
throw new TypeError('URL.createObjectURL is not supported in the current runtime');
|
|
413
|
+
}
|
|
414
|
+
static revokeObjectURL(url) {
|
|
415
|
+
if (typeof globalThis.URL?.revokeObjectURL === 'function') {
|
|
416
|
+
globalThis.URL.revokeObjectURL(url);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
get href() {
|
|
420
|
+
return buildHref(this.toParsedUrl());
|
|
421
|
+
}
|
|
422
|
+
set href(value) {
|
|
423
|
+
this.update(resolveUrl(value, this.href));
|
|
424
|
+
}
|
|
425
|
+
get origin() {
|
|
426
|
+
if (!this.hasAuthorityValue || !this.hostnameValue || this.protocolValue === 'file:') {
|
|
427
|
+
return 'null';
|
|
428
|
+
}
|
|
429
|
+
return `${this.protocolValue}//${this.host}`;
|
|
430
|
+
}
|
|
431
|
+
get protocol() {
|
|
432
|
+
return this.protocolValue;
|
|
433
|
+
}
|
|
434
|
+
set protocol(value) {
|
|
435
|
+
this.protocolValue = value.endsWith(':') ? value.toLowerCase() : `${value.toLowerCase()}:`;
|
|
436
|
+
if (this.portValue === defaultPorts[this.protocolValue]) {
|
|
437
|
+
this.portValue = '';
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
get username() {
|
|
441
|
+
return this.usernameValue;
|
|
442
|
+
}
|
|
443
|
+
set username(value) {
|
|
444
|
+
this.usernameValue = String(value);
|
|
445
|
+
}
|
|
446
|
+
get password() {
|
|
447
|
+
return this.passwordValue;
|
|
448
|
+
}
|
|
449
|
+
set password(value) {
|
|
450
|
+
this.passwordValue = String(value);
|
|
451
|
+
}
|
|
452
|
+
get host() {
|
|
453
|
+
if (!this.hostnameValue) {
|
|
454
|
+
return '';
|
|
455
|
+
}
|
|
456
|
+
return this.portValue ? `${this.hostnameValue}:${this.portValue}` : this.hostnameValue;
|
|
457
|
+
}
|
|
458
|
+
set host(value) {
|
|
459
|
+
const { hostname, port } = parseAuthority(value);
|
|
460
|
+
const normalized = normalizeAuthority(this.protocolValue, { username: '', password: '', hostname, port });
|
|
461
|
+
this.hostnameValue = normalized.hostname;
|
|
462
|
+
this.portValue = normalized.port;
|
|
463
|
+
}
|
|
464
|
+
get hostname() {
|
|
465
|
+
return this.hostnameValue;
|
|
466
|
+
}
|
|
467
|
+
set hostname(value) {
|
|
468
|
+
this.hostnameValue = String(value).toLowerCase();
|
|
469
|
+
}
|
|
470
|
+
get port() {
|
|
471
|
+
return this.portValue;
|
|
472
|
+
}
|
|
473
|
+
set port(value) {
|
|
474
|
+
const port = String(value).replace(/^:/, '');
|
|
475
|
+
this.portValue = port === defaultPorts[this.protocolValue] ? '' : port;
|
|
476
|
+
}
|
|
477
|
+
get pathname() {
|
|
478
|
+
return this.pathnameValue;
|
|
479
|
+
}
|
|
480
|
+
set pathname(value) {
|
|
481
|
+
this.pathnameValue = normalizePathname(String(value), this.hasAuthorityValue);
|
|
482
|
+
}
|
|
483
|
+
get search() {
|
|
484
|
+
return this.searchValue;
|
|
485
|
+
}
|
|
486
|
+
set search(value) {
|
|
487
|
+
this.searchValue = normalizeSearch(String(value));
|
|
488
|
+
this.searchParamsValue = new URLSearchParams(this.searchValue);
|
|
489
|
+
searchParamsObservers.set(this.searchParamsValue, (serialized) => {
|
|
490
|
+
this.searchValue = serialized ? `?${serialized}` : '';
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
get searchParams() {
|
|
494
|
+
return this.searchParamsValue;
|
|
495
|
+
}
|
|
496
|
+
get hash() {
|
|
497
|
+
return this.hashValue;
|
|
498
|
+
}
|
|
499
|
+
set hash(value) {
|
|
500
|
+
this.hashValue = normalizeHash(String(value));
|
|
501
|
+
}
|
|
502
|
+
toString() {
|
|
503
|
+
return this.href;
|
|
504
|
+
}
|
|
505
|
+
toJSON() {
|
|
506
|
+
return this.href;
|
|
507
|
+
}
|
|
508
|
+
toParsedUrl() {
|
|
509
|
+
return {
|
|
510
|
+
protocol: this.protocolValue,
|
|
511
|
+
username: this.usernameValue,
|
|
512
|
+
password: this.passwordValue,
|
|
513
|
+
hostname: this.hostnameValue,
|
|
514
|
+
port: this.portValue,
|
|
515
|
+
pathname: this.pathnameValue,
|
|
516
|
+
search: this.searchValue,
|
|
517
|
+
hash: this.hashValue,
|
|
518
|
+
hasAuthority: this.hasAuthorityValue,
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
update(href) {
|
|
522
|
+
const parsed = parseAbsoluteUrl(href);
|
|
523
|
+
this.protocolValue = parsed.protocol;
|
|
524
|
+
this.usernameValue = parsed.username;
|
|
525
|
+
this.passwordValue = parsed.password;
|
|
526
|
+
this.hostnameValue = parsed.hostname;
|
|
527
|
+
this.portValue = parsed.port;
|
|
528
|
+
this.pathnameValue = parsed.pathname;
|
|
529
|
+
this.hashValue = parsed.hash;
|
|
530
|
+
this.hasAuthorityValue = parsed.hasAuthority;
|
|
531
|
+
this.searchValue = '';
|
|
532
|
+
this.search = parsed.search;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
exports.URL = URL;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type QueryPrimitive = string | number | boolean;
|
|
2
|
+
type QueryValue = QueryPrimitive | null | undefined | readonly QueryPrimitive[] | readonly null[] | readonly undefined[];
|
|
3
|
+
export interface urlObject {
|
|
4
|
+
auth?: string | null | undefined;
|
|
5
|
+
hash?: string | null | undefined;
|
|
6
|
+
host?: string | null | undefined;
|
|
7
|
+
hostname?: string | null | undefined;
|
|
8
|
+
href?: string | null | undefined;
|
|
9
|
+
pathname?: string | null | undefined;
|
|
10
|
+
protocol?: string | null | undefined;
|
|
11
|
+
search?: string | null | undefined;
|
|
12
|
+
slashes?: boolean | null | undefined;
|
|
13
|
+
port?: string | number | null | undefined;
|
|
14
|
+
query?: string | null | Record<string, QueryValue> | undefined;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -1,25 +1,18 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
implementation: {
|
|
3
3
|
new (globalObject: any, constructorArgs: any): {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
get protocol(): string;
|
|
8
|
-
set protocol(v: string);
|
|
4
|
+
href: string;
|
|
5
|
+
readonly origin: any;
|
|
6
|
+
protocol: string;
|
|
9
7
|
username: any;
|
|
10
8
|
password: any;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
set hostname(v: any);
|
|
15
|
-
get port(): string;
|
|
16
|
-
set port(v: string);
|
|
9
|
+
host: any;
|
|
10
|
+
hostname: any;
|
|
11
|
+
port: string;
|
|
17
12
|
pathname: any;
|
|
18
|
-
|
|
19
|
-
set search(v: string);
|
|
13
|
+
search: string;
|
|
20
14
|
readonly searchParams: any;
|
|
21
|
-
|
|
22
|
-
set hash(v: string);
|
|
15
|
+
hash: string;
|
|
23
16
|
toJSON(): string;
|
|
24
17
|
};
|
|
25
18
|
};
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isASCIIDigit =
|
|
4
|
-
exports.isASCIIAlpha = isASCIIAlpha;
|
|
5
|
-
exports.isASCIIAlphanumeric = isASCIIAlphanumeric;
|
|
6
|
-
exports.isASCIIHex = isASCIIHex;
|
|
3
|
+
exports.isASCIIHex = exports.isASCIIAlphanumeric = exports.isASCIIAlpha = exports.isASCIIDigit = void 0;
|
|
7
4
|
function isASCIIDigit(c) {
|
|
8
5
|
return c >= 0x30 && c <= 0x39;
|
|
9
6
|
}
|
|
7
|
+
exports.isASCIIDigit = isASCIIDigit;
|
|
10
8
|
function isASCIIAlpha(c) {
|
|
11
9
|
return (c >= 0x41 && c <= 0x5A) || (c >= 0x61 && c <= 0x7A);
|
|
12
10
|
}
|
|
11
|
+
exports.isASCIIAlpha = isASCIIAlpha;
|
|
13
12
|
function isASCIIAlphanumeric(c) {
|
|
14
13
|
return isASCIIAlpha(c) || isASCIIDigit(c);
|
|
15
14
|
}
|
|
15
|
+
exports.isASCIIAlphanumeric = isASCIIAlphanumeric;
|
|
16
16
|
function isASCIIHex(c) {
|
|
17
17
|
return isASCIIDigit(c) || (c >= 0x41 && c <= 0x46) || (c >= 0x61 && c <= 0x66);
|
|
18
18
|
}
|
|
19
|
+
exports.isASCIIHex = isASCIIHex;
|
|
19
20
|
exports.default = {
|
|
20
21
|
isASCIIDigit,
|
|
21
22
|
isASCIIAlpha,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
1
3
|
import { Buffer, WithImplicitCoercion } from 'buffer';
|
|
2
4
|
declare function percentEncode(c: number): string;
|
|
3
|
-
declare function percentDecode(input: Buffer): Buffer
|
|
5
|
+
declare function percentDecode(input: Buffer): Buffer;
|
|
4
6
|
declare function serializeUrlencoded(tuples: any[], encodingOverride?: undefined): string;
|
|
5
7
|
declare function parseUrlencoded(input: WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer>): string[][];
|
|
6
8
|
declare function ucs2decode(string: string): number[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare function isObject(value: null):
|
|
1
|
+
declare function isObject(value: null): boolean;
|
|
2
2
|
declare function hasOwn(obj: any, prop: PropertyKey): boolean;
|
|
3
3
|
declare function getSameObject(wrapper: any, prop: string, creator: () => any): any;
|
|
4
4
|
declare function wrapperForImpl(impl: any): any;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function isChinaMainlandIdCardNumber(text: string): boolean;
|
|
2
|
+
export declare function isIdCardNumber(text: string, nationality?: string | null): boolean;
|
|
3
|
+
export declare function isHkCardNumber(text: string): boolean;
|
|
4
|
+
export declare function isAmCardNumber(text: string): boolean;
|
|
5
|
+
export declare function isTwCardNumber(text: string): boolean;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isChinaMainlandIdCardNumber = isChinaMainlandIdCardNumber;
|
|
4
|
+
exports.isIdCardNumber = isIdCardNumber;
|
|
5
|
+
exports.isHkCardNumber = isHkCardNumber;
|
|
6
|
+
exports.isAmCardNumber = isAmCardNumber;
|
|
7
|
+
exports.isTwCardNumber = isTwCardNumber;
|
|
8
|
+
const nationality_1 = require("./nationality");
|
|
9
|
+
function normalizeIdText(text) {
|
|
10
|
+
return text.trim().toUpperCase();
|
|
11
|
+
}
|
|
12
|
+
function isChinaMainlandIdCardNumber(text) {
|
|
13
|
+
const normalized = normalizeIdText(text);
|
|
14
|
+
return normalized.length === 18
|
|
15
|
+
&& /^\d{6}(18|19|20)\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(normalized);
|
|
16
|
+
}
|
|
17
|
+
function isIdCardNumber(text, nationality) {
|
|
18
|
+
const normalizedNationality = (0, nationality_1.normalizeNationality)(nationality);
|
|
19
|
+
if (normalizedNationality && normalizedNationality !== 'CN') {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
return typeof text === 'string' && isChinaMainlandIdCardNumber(text);
|
|
23
|
+
}
|
|
24
|
+
function isHkCardNumber(text) {
|
|
25
|
+
return typeof text === 'string'
|
|
26
|
+
&& /^([A-Z]\d{6,10}(\(\w{1}\))?)$/.test(normalizeIdText(text));
|
|
27
|
+
}
|
|
28
|
+
function isAmCardNumber(text) {
|
|
29
|
+
return typeof text === 'string'
|
|
30
|
+
&& /^([A-Z]\d{6,10}(\(\w{1}\))?)$/.test(normalizeIdText(text));
|
|
31
|
+
}
|
|
32
|
+
function isTwCardNumber(text) {
|
|
33
|
+
return typeof text === 'string'
|
|
34
|
+
&& /^(?:\d{8}|[A-Z0-9]{10}|\d{18})$/.test(normalizeIdText(text));
|
|
35
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./nationality"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./mobile"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./id"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./passport"), exports);
|