oak-domain 6.0.0 → 6.1.1
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 +256 -234
- 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 +304 -277
- 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 +21 -11
- 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
package/lib/utils/validator.js
CHANGED
|
@@ -3,71 +3,74 @@
|
|
|
3
3
|
*/
|
|
4
4
|
'use strict';
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.isDomain = exports.isIP = exports.isIPV6 = exports.isIPV4 = exports.isEmail = exports.isVehicleNumber = exports.isMoney = exports.isNumber = exports.isTel = exports.isPhone = exports.isDigital = exports.isSizedCaptcha = exports.isNickname = exports.isUrl = exports.isSoldierNumber = exports.isBirthNumber = exports.
|
|
6
|
+
exports.isDomain = exports.isIP = exports.isIPV6 = exports.isIPV4 = exports.isEmail = exports.isVehicleNumber = exports.isMoney = exports.isNumber = exports.isTel = exports.isPhone = exports.isDigital = exports.isSizedCaptcha = exports.isNickname = exports.isUrl = exports.isSoldierNumber = exports.isBirthNumber = exports.isCaptcha = exports.isPassword = exports.isTaiwanNationality = exports.isMacauNationality = exports.isHongKongNationality = exports.isMainlandChinaNationality = exports.normalizeNationality = exports.isTaiwanMobile = exports.isMacauMobile = exports.isInternationalMobile = exports.isHongKongMobile = exports.isGenericPassportNumber = exports.isChinaMainlandMobile = exports.isChinaMainlandIdCardNumber = exports.isTwCardNumber = exports.isAmCardNumber = exports.isHkCardNumber = exports.isPassportNumber = exports.isIdCardNumber = exports.isMobile = void 0;
|
|
7
7
|
exports.checkAttributesNotNull = checkAttributesNotNull;
|
|
8
8
|
exports.checkAttributesScope = checkAttributesScope;
|
|
9
|
+
const tslib_1 = require("tslib");
|
|
9
10
|
const types_1 = require("../types");
|
|
10
|
-
const
|
|
11
|
-
|
|
11
|
+
const validate_1 = require("./validate");
|
|
12
|
+
Object.defineProperty(exports, "isChinaMainlandIdCardNumber", { enumerable: true, get: function () { return validate_1.isChinaMainlandIdCardNumber; } });
|
|
13
|
+
Object.defineProperty(exports, "isChinaMainlandMobile", { enumerable: true, get: function () { return validate_1.isChinaMainlandMobile; } });
|
|
14
|
+
Object.defineProperty(exports, "isGenericPassportNumber", { enumerable: true, get: function () { return validate_1.isGenericPassportNumber; } });
|
|
15
|
+
Object.defineProperty(exports, "isHongKongMobile", { enumerable: true, get: function () { return validate_1.isHongKongMobile; } });
|
|
16
|
+
Object.defineProperty(exports, "isInternationalMobile", { enumerable: true, get: function () { return validate_1.isInternationalMobile; } });
|
|
17
|
+
Object.defineProperty(exports, "isMacauMobile", { enumerable: true, get: function () { return validate_1.isMacauMobile; } });
|
|
18
|
+
Object.defineProperty(exports, "isTaiwanMobile", { enumerable: true, get: function () { return validate_1.isTaiwanMobile; } });
|
|
19
|
+
Object.defineProperty(exports, "normalizeNationality", { enumerable: true, get: function () { return validate_1.normalizeNationality; } });
|
|
20
|
+
Object.defineProperty(exports, "isMainlandChinaNationality", { enumerable: true, get: function () { return validate_1.isMainlandChinaNationality; } });
|
|
21
|
+
Object.defineProperty(exports, "isHongKongNationality", { enumerable: true, get: function () { return validate_1.isHongKongNationality; } });
|
|
22
|
+
Object.defineProperty(exports, "isMacauNationality", { enumerable: true, get: function () { return validate_1.isMacauNationality; } });
|
|
23
|
+
Object.defineProperty(exports, "isTaiwanNationality", { enumerable: true, get: function () { return validate_1.isTaiwanNationality; } });
|
|
24
|
+
tslib_1.__exportStar(require("./validate"), exports);
|
|
25
|
+
const isMobile = (text, nationality) => {
|
|
26
|
+
return (0, validate_1.isMobile)(text, nationality);
|
|
12
27
|
};
|
|
13
28
|
exports.isMobile = isMobile;
|
|
14
|
-
const
|
|
15
|
-
return (
|
|
16
|
-
};
|
|
17
|
-
exports.isPassword = isPassword;
|
|
18
|
-
const isCaptcha = (text, num) => {
|
|
19
|
-
const n = num || 4;
|
|
20
|
-
const regex = new RegExp(`^\\d{${n}}$`);
|
|
21
|
-
return ((text) && (typeof text === "string") && (regex.test(text)));
|
|
22
|
-
};
|
|
23
|
-
exports.isCaptcha = isCaptcha;
|
|
24
|
-
const isIdCardNumber = (text) => {
|
|
25
|
-
return ((typeof text === "string") && text.length === 18 && (/^\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(text)));
|
|
29
|
+
const isIdCardNumber = (text, nationality) => {
|
|
30
|
+
return (0, validate_1.isIdCardNumber)(text, nationality);
|
|
26
31
|
};
|
|
27
32
|
exports.isIdCardNumber = isIdCardNumber;
|
|
28
|
-
const isPassportNumber = (text) => {
|
|
29
|
-
|
|
30
|
-
// 规则: 14/15开头 + 7位数字, G + 8位数字, P + 7位数字, S/D + 7或8位数字,等
|
|
31
|
-
// 样本: 141234567, G12345678, P1234567
|
|
32
|
-
return typeof text === 'string' && /^([a-zA-z]|[0-9]){5,17}$/.test(text);
|
|
33
|
+
const isPassportNumber = (text, nationality) => {
|
|
34
|
+
return (0, validate_1.isPassportNumber)(text, nationality);
|
|
33
35
|
};
|
|
34
36
|
exports.isPassportNumber = isPassportNumber;
|
|
35
37
|
const isHkCardNumber = (text) => {
|
|
36
|
-
|
|
37
|
-
// 规则: H/M + 10位或6位数字
|
|
38
|
-
// 样本: H1234567890
|
|
39
|
-
return typeof text === 'string' && /^([A-Z]\d{6,10}(\(\w{1}\))?)$/.test(text);
|
|
38
|
+
return (0, validate_1.isHkCardNumber)(text);
|
|
40
39
|
};
|
|
41
40
|
exports.isHkCardNumber = isHkCardNumber;
|
|
42
41
|
const isAmCardNumber = (text) => {
|
|
43
|
-
return
|
|
42
|
+
return (0, validate_1.isAmCardNumber)(text);
|
|
44
43
|
};
|
|
45
44
|
exports.isAmCardNumber = isAmCardNumber;
|
|
46
45
|
const isTwCardNumber = (text) => {
|
|
47
|
-
|
|
48
|
-
// 规则: 新版8位或18位数字, 旧版10位数字 + 英文字母
|
|
49
|
-
// 样本: 12345678 或 1234567890B
|
|
50
|
-
return typeof text === 'string' && /^\d{8}|^[a-zA-Z0-9]{10}|^\d{18}$/.test(text);
|
|
46
|
+
return (0, validate_1.isTwCardNumber)(text);
|
|
51
47
|
};
|
|
52
48
|
exports.isTwCardNumber = isTwCardNumber;
|
|
49
|
+
const isPassword = (text) => {
|
|
50
|
+
return !!(text && typeof text === 'string' && /^[a-zA-Z0-9!.@]{8,16}$/.test(text));
|
|
51
|
+
};
|
|
52
|
+
exports.isPassword = isPassword;
|
|
53
|
+
const isCaptcha = (text, num) => {
|
|
54
|
+
const n = num || 4;
|
|
55
|
+
const regex = new RegExp(`^\\d{${n}}$`);
|
|
56
|
+
return !!(text && typeof text === 'string' && regex.test(text));
|
|
57
|
+
};
|
|
58
|
+
exports.isCaptcha = isCaptcha;
|
|
53
59
|
const isBirthNumber = (text) => {
|
|
54
60
|
return typeof text === 'string' && /^[a-zA-Z0-9]{5,21}$/.test(text);
|
|
55
61
|
};
|
|
56
62
|
exports.isBirthNumber = isBirthNumber;
|
|
57
63
|
const isSoldierNumber = (text) => {
|
|
58
|
-
// 军官证
|
|
59
|
-
// 规则: 军/兵/士/文/职/广/(其他中文) + "字第" + 4到8位字母或数字 + "号"
|
|
60
|
-
// 样本: 军字第2001988号, 士字第P011816X号
|
|
61
64
|
return typeof text === 'string' && /^[\u4E00-\u9FA5](字第)([0-9a-zA-Z]{4,8})(号?)$/.test(text);
|
|
62
65
|
};
|
|
63
66
|
exports.isSoldierNumber = isSoldierNumber;
|
|
64
67
|
const isUrl = (str) => {
|
|
65
68
|
const regex = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/;
|
|
66
|
-
return typeof str ===
|
|
69
|
+
return typeof str === 'string' && regex.test(str);
|
|
67
70
|
};
|
|
68
71
|
exports.isUrl = isUrl;
|
|
69
72
|
const isNickname = (str) => {
|
|
70
|
-
return str && typeof str ===
|
|
73
|
+
return !!(str && typeof str === 'string' && str.trim().length > 0 && str.length < 16);
|
|
71
74
|
};
|
|
72
75
|
exports.isNickname = isNickname;
|
|
73
76
|
const isSizedCaptcha = (text, size) => {
|
|
@@ -79,12 +82,10 @@ const isDigital = (digital) => {
|
|
|
79
82
|
};
|
|
80
83
|
exports.isDigital = isDigital;
|
|
81
84
|
const isPhone = (phone) => {
|
|
82
|
-
// return /^((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)/.test(phone);
|
|
83
85
|
return /^(\(\d{3,4}\)|\d{3,4}-)?\d{7,8}$/.test(phone);
|
|
84
86
|
};
|
|
85
87
|
exports.isPhone = isPhone;
|
|
86
88
|
const isTel = (text) => {
|
|
87
|
-
// 1、133xxxx4545 2、0571-630xx239 3、400-123-1400
|
|
88
89
|
const reg = /^(((\d{3,4}-)?[0-9]{7,8})|(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}|((400)-(\d{3})-(\d{4})(.)(\d{1,4})|(400)-(\d{3})-(\d{4}$)|(400)(\d{3})(\d{4}$)|(400)-(\d{4})-(\d{3}$)))$/.test(text);
|
|
89
90
|
return reg;
|
|
90
91
|
};
|
|
@@ -94,7 +95,6 @@ const isNumber = (str) => {
|
|
|
94
95
|
};
|
|
95
96
|
exports.isNumber = isNumber;
|
|
96
97
|
const isMoney = (str, disableZero) => {
|
|
97
|
-
// 金额,最多可以有两位小数 默认包含零
|
|
98
98
|
if (disableZero) {
|
|
99
99
|
return /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/.test(str);
|
|
100
100
|
}
|
|
@@ -102,7 +102,7 @@ const isMoney = (str, disableZero) => {
|
|
|
102
102
|
};
|
|
103
103
|
exports.isMoney = isMoney;
|
|
104
104
|
const isVehicleNumber = (str) => {
|
|
105
|
-
const reg = /^(
|
|
105
|
+
const reg = /^([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z])([A-HJ-NP-Z0-9]{5}|[DF][A-HJ-NP-Z0-9]{4}|[0-9]{5}[DF])$/;
|
|
106
106
|
return reg.test(str);
|
|
107
107
|
};
|
|
108
108
|
exports.isVehicleNumber = isVehicleNumber;
|
|
@@ -124,7 +124,6 @@ function checkAttributesNotNull(entity, data, attributes, allowEmpty) {
|
|
|
124
124
|
throw new types_1.OakAttrNotNullException(entity, attrs, 'error::attributesNull');
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
;
|
|
128
127
|
function checkAttributesScope(entity, data, attributes) {
|
|
129
128
|
const attrs = attributes.filter(attr => !data.hasOwnProperty(attr));
|
|
130
129
|
if (attrs.length > 0) {
|
|
@@ -132,13 +131,11 @@ function checkAttributesScope(entity, data, attributes) {
|
|
|
132
131
|
}
|
|
133
132
|
}
|
|
134
133
|
const isIPV4 = (ip) => {
|
|
135
|
-
// IPv4正则
|
|
136
134
|
const ipv4Regex = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
|
|
137
135
|
return ipv4Regex.test(ip);
|
|
138
136
|
};
|
|
139
137
|
exports.isIPV4 = isIPV4;
|
|
140
138
|
const isIPV6 = (ip) => {
|
|
141
|
-
// IPv6正则(简化版,匹配常见格式)
|
|
142
139
|
const ipv6Regex = /^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$|^::([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}$|^[0-9a-fA-F]{1,4}::([0-9a-fA-F]{1,4}:){0,5}[0-9a-fA-F]{1,4}$|^([0-9a-fA-F]{1,4}:){1}:([0-9a-fA-F]{1,4}:){0,4}[0-9a-fA-F]{1,4}$|^([0-9a-fA-F]{1,4}:){2}:([0-9a-fA-F]{1,4}:){0,3}[0-9a-fA-F]{1,4}$|^([0-9a-fA-F]{1,4}:){3}:([0-9a-fA-F]{1,4}:){0,2}[0-9a-fA-F]{1,4}$|^([0-9a-fA-F]{1,4}:){4}:([0-9a-fA-F]{1,4}:){0,1}[0-9a-fA-F]{1,4}$|^([0-9a-fA-F]{1,4}:){5}:[0-9a-fA-F]{1,4}$|^([0-9a-fA-F]{1,4}:){1,6}:$/;
|
|
143
140
|
return ipv6Regex.test(ip);
|
|
144
141
|
};
|
|
@@ -148,7 +145,6 @@ const isIP = (ip) => {
|
|
|
148
145
|
};
|
|
149
146
|
exports.isIP = isIP;
|
|
150
147
|
const isDomain = (domain) => {
|
|
151
|
-
//基础域名验证正则
|
|
152
148
|
const domainRegex = /^(?!-)[A-Za-z0-9-]{1,63}(?<!-)(\.[A-Za-z0-9-]{1,63}(?<!-))*\.[A-Za-z]{2,}$/;
|
|
153
149
|
return domainRegex.test(domain);
|
|
154
150
|
};
|
package/package.json
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oak-domain",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.1",
|
|
4
4
|
"oak": {
|
|
5
5
|
"package": true,
|
|
6
|
-
"i18n": true
|
|
6
|
+
"i18n": true,
|
|
7
|
+
"es": {
|
|
8
|
+
"optimize": {
|
|
9
|
+
"includeDeps": [
|
|
10
|
+
"dayjs",
|
|
11
|
+
"dayjs/plugin/weekOfYear",
|
|
12
|
+
"dayjs/plugin/weekYear",
|
|
13
|
+
"dayjs/plugin/dayOfYear",
|
|
14
|
+
"es-toolkit",
|
|
15
|
+
"uuid"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
7
19
|
},
|
|
8
20
|
"author": {
|
|
9
21
|
"name": "XuChang"
|
|
@@ -19,8 +31,7 @@
|
|
|
19
31
|
},
|
|
20
32
|
"files": [
|
|
21
33
|
"lib/**/*",
|
|
22
|
-
"es/**/*"
|
|
23
|
-
"src/entities/*"
|
|
34
|
+
"es/**/*"
|
|
24
35
|
],
|
|
25
36
|
"main": "lib/index",
|
|
26
37
|
"module": "es/index",
|
|
@@ -35,7 +46,6 @@
|
|
|
35
46
|
"@types/fs-extra": "^9.0.13",
|
|
36
47
|
"@types/koa": "^2.15.0",
|
|
37
48
|
"@types/koa-router": "^7.4.8",
|
|
38
|
-
"@types/lodash": "^4.14.182",
|
|
39
49
|
"@types/mocha": "^8.2.0",
|
|
40
50
|
"@types/node": "^20.6.1",
|
|
41
51
|
"@types/node-schedule": "^2.1.0",
|
|
@@ -48,20 +58,20 @@
|
|
|
48
58
|
"cross-env": "^7.0.2",
|
|
49
59
|
"cross-spawn": "^7.0.3",
|
|
50
60
|
"fs-extra": "^10.0.0",
|
|
51
|
-
"lodash": "^4.17.21",
|
|
52
61
|
"mocha": "^8.2.1",
|
|
53
62
|
"node-watch": "^0.7.4",
|
|
54
|
-
"ts-node": "^10.9.1"
|
|
55
|
-
"tslib": "^2.4.0",
|
|
56
|
-
"typescript": "^5.2.2"
|
|
63
|
+
"ts-node": "^10.9.1"
|
|
57
64
|
},
|
|
58
65
|
"dependencies": {
|
|
66
|
+
"bignumber.js": "^11.1.1",
|
|
59
67
|
"dayjs": "^1.11.9",
|
|
68
|
+
"es-toolkit": "^1.45.1",
|
|
60
69
|
"koa": "^2.16.1",
|
|
61
70
|
"koa-body": "^5.0.0",
|
|
62
71
|
"node-schedule": "^2.1.1",
|
|
63
72
|
"socket.io": "^4.8.1",
|
|
64
|
-
"
|
|
65
|
-
"
|
|
73
|
+
"tslib": "^2.4.0",
|
|
74
|
+
"typescript": ">=5.9.0 <7",
|
|
75
|
+
"uuid": "^9.0.0"
|
|
66
76
|
}
|
|
67
77
|
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 为了能在小程序中使用URL、URLSearchParams
|
|
3
|
-
* 但whatwg-url-without-unicode这个库未更新,把其的代码放本地进行更新
|
|
4
|
-
*/
|
|
5
|
-
const whatwgUrl = require('./lib/URL');
|
|
6
|
-
const whatwgUrlSearchParams = require('./lib/URLSearchParams');
|
|
7
|
-
const sharedGlobalObject = {};
|
|
8
|
-
whatwgUrl.install(sharedGlobalObject);
|
|
9
|
-
whatwgUrlSearchParams.install(sharedGlobalObject);
|
|
10
|
-
const URL = sharedGlobalObject.URL;
|
|
11
|
-
const URLSearchParams = sharedGlobalObject.URLSearchParams;
|
|
12
|
-
export { URL, URLSearchParams };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
implementation: {
|
|
3
|
-
new (globalObject: any, constructorArgs: any): {
|
|
4
|
-
get href(): string;
|
|
5
|
-
set href(v: string);
|
|
6
|
-
get origin(): any;
|
|
7
|
-
get protocol(): string;
|
|
8
|
-
set protocol(v: string);
|
|
9
|
-
username: any;
|
|
10
|
-
password: any;
|
|
11
|
-
get host(): any;
|
|
12
|
-
set host(v: any);
|
|
13
|
-
get hostname(): any;
|
|
14
|
-
set hostname(v: any);
|
|
15
|
-
get port(): string;
|
|
16
|
-
set port(v: string);
|
|
17
|
-
pathname: any;
|
|
18
|
-
get search(): string;
|
|
19
|
-
set search(v: string);
|
|
20
|
-
readonly searchParams: any;
|
|
21
|
-
get hash(): string;
|
|
22
|
-
set hash(v: string);
|
|
23
|
-
toJSON(): string;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
export default _default;
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import usm from './url-state-machine';
|
|
3
|
-
import urlencoded from './urlencoded';
|
|
4
|
-
import URLSearchParams from './URLSearchParams';
|
|
5
|
-
const implementation = class URLImpl {
|
|
6
|
-
constructor(globalObject, constructorArgs) {
|
|
7
|
-
const url = constructorArgs[0];
|
|
8
|
-
const base = constructorArgs[1];
|
|
9
|
-
let parsedBase = null;
|
|
10
|
-
if (base !== undefined) {
|
|
11
|
-
parsedBase = usm.basicURLParse(base);
|
|
12
|
-
if (parsedBase === null) {
|
|
13
|
-
throw new TypeError(`Invalid base URL: ${base}`);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
const parsedURL = usm.basicURLParse(url, { baseURL: parsedBase });
|
|
17
|
-
if (parsedURL === null) {
|
|
18
|
-
throw new TypeError(`Invalid URL: ${url}`);
|
|
19
|
-
}
|
|
20
|
-
const query = parsedURL.query !== null ? parsedURL.query : "";
|
|
21
|
-
this._url = parsedURL;
|
|
22
|
-
// We cannot invoke the "new URLSearchParams object" algorithm without going through the constructor, which strips
|
|
23
|
-
// question mark by default. Therefore the doNotStripQMark hack is used.
|
|
24
|
-
this._query = URLSearchParams.createImpl(globalObject, [query], { doNotStripQMark: true });
|
|
25
|
-
this._query._url = this;
|
|
26
|
-
}
|
|
27
|
-
get href() {
|
|
28
|
-
return usm.serializeURL(this._url);
|
|
29
|
-
}
|
|
30
|
-
set href(v) {
|
|
31
|
-
const parsedURL = usm.basicURLParse(v);
|
|
32
|
-
if (parsedURL === null) {
|
|
33
|
-
throw new TypeError(`Invalid URL: ${v}`);
|
|
34
|
-
}
|
|
35
|
-
this._url = parsedURL;
|
|
36
|
-
this._query._list.splice(0);
|
|
37
|
-
const { query } = parsedURL;
|
|
38
|
-
if (query !== null) {
|
|
39
|
-
this._query._list = urlencoded.parseUrlencoded(query);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
get origin() {
|
|
43
|
-
return usm.serializeURLOrigin(this._url);
|
|
44
|
-
}
|
|
45
|
-
get protocol() {
|
|
46
|
-
return this._url.scheme + ":";
|
|
47
|
-
}
|
|
48
|
-
set protocol(v) {
|
|
49
|
-
usm.basicURLParse(v + ":", { url: this._url, stateOverride: "scheme start" });
|
|
50
|
-
}
|
|
51
|
-
get username() {
|
|
52
|
-
return this._url.username;
|
|
53
|
-
}
|
|
54
|
-
set username(v) {
|
|
55
|
-
if (usm.cannotHaveAUsernamePasswordPort(this._url)) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
usm.setTheUsername(this._url, v);
|
|
59
|
-
}
|
|
60
|
-
get password() {
|
|
61
|
-
return this._url.password;
|
|
62
|
-
}
|
|
63
|
-
set password(v) {
|
|
64
|
-
if (usm.cannotHaveAUsernamePasswordPort(this._url)) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
usm.setThePassword(this._url, v);
|
|
68
|
-
}
|
|
69
|
-
get host() {
|
|
70
|
-
const url = this._url;
|
|
71
|
-
if (url.host === null) {
|
|
72
|
-
return "";
|
|
73
|
-
}
|
|
74
|
-
if (url.port === null) {
|
|
75
|
-
return usm.serializeHost(url.host);
|
|
76
|
-
}
|
|
77
|
-
return usm.serializeHost(url.host) + ":" + usm.serializeInteger(url.port);
|
|
78
|
-
}
|
|
79
|
-
set host(v) {
|
|
80
|
-
if (this._url.cannotBeABaseURL) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
usm.basicURLParse(v, { url: this._url, stateOverride: "host" });
|
|
84
|
-
}
|
|
85
|
-
get hostname() {
|
|
86
|
-
if (this._url.host === null) {
|
|
87
|
-
return "";
|
|
88
|
-
}
|
|
89
|
-
return usm.serializeHost(this._url.host);
|
|
90
|
-
}
|
|
91
|
-
set hostname(v) {
|
|
92
|
-
if (this._url.cannotBeABaseURL) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
usm.basicURLParse(v, { url: this._url, stateOverride: "hostname" });
|
|
96
|
-
}
|
|
97
|
-
get port() {
|
|
98
|
-
if (this._url.port === null) {
|
|
99
|
-
return "";
|
|
100
|
-
}
|
|
101
|
-
return usm.serializeInteger(this._url.port);
|
|
102
|
-
}
|
|
103
|
-
set port(v) {
|
|
104
|
-
if (usm.cannotHaveAUsernamePasswordPort(this._url)) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
if (v === "") {
|
|
108
|
-
this._url.port = null;
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
usm.basicURLParse(v, { url: this._url, stateOverride: "port" });
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
get pathname() {
|
|
115
|
-
if (this._url.cannotBeABaseURL) {
|
|
116
|
-
return this._url.path[0];
|
|
117
|
-
}
|
|
118
|
-
if (this._url.path.length === 0) {
|
|
119
|
-
return "";
|
|
120
|
-
}
|
|
121
|
-
return "/" + this._url.path.join("/");
|
|
122
|
-
}
|
|
123
|
-
set pathname(v) {
|
|
124
|
-
if (this._url.cannotBeABaseURL) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
this._url.path = [];
|
|
128
|
-
usm.basicURLParse(v, { url: this._url, stateOverride: "path start" });
|
|
129
|
-
}
|
|
130
|
-
get search() {
|
|
131
|
-
if (this._url.query === null || this._url.query === "") {
|
|
132
|
-
return "";
|
|
133
|
-
}
|
|
134
|
-
return "?" + this._url.query;
|
|
135
|
-
}
|
|
136
|
-
set search(v) {
|
|
137
|
-
const url = this._url;
|
|
138
|
-
if (v === "") {
|
|
139
|
-
url.query = null;
|
|
140
|
-
this._query._list = [];
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
const input = v[0] === "?" ? v.substring(1) : v;
|
|
144
|
-
url.query = "";
|
|
145
|
-
usm.basicURLParse(input, { url, stateOverride: "query" });
|
|
146
|
-
this._query._list = urlencoded.parseUrlencoded(input);
|
|
147
|
-
}
|
|
148
|
-
get searchParams() {
|
|
149
|
-
return this._query;
|
|
150
|
-
}
|
|
151
|
-
get hash() {
|
|
152
|
-
if (this._url.fragment === null || this._url.fragment === "") {
|
|
153
|
-
return "";
|
|
154
|
-
}
|
|
155
|
-
return "#" + this._url.fragment;
|
|
156
|
-
}
|
|
157
|
-
set hash(v) {
|
|
158
|
-
if (v === "") {
|
|
159
|
-
this._url.fragment = null;
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
const input = v[0] === "#" ? v.substring(1) : v;
|
|
163
|
-
this._url.fragment = "";
|
|
164
|
-
usm.basicURLParse(input, { url: this._url, stateOverride: "fragment" });
|
|
165
|
-
}
|
|
166
|
-
toJSON() {
|
|
167
|
-
return this.href;
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
export default {
|
|
171
|
-
implementation
|
|
172
|
-
};
|