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,101 @@
|
|
|
1
|
+
;
|
|
2
|
+
const entityDesc = {
|
|
3
|
+
locales: {
|
|
4
|
+
zh_CN: {
|
|
5
|
+
name: '多语言内容',
|
|
6
|
+
attr: {
|
|
7
|
+
entity: '关联对象',
|
|
8
|
+
entityId: '关联对象Id',
|
|
9
|
+
language: '语言',
|
|
10
|
+
data: '翻译内容',
|
|
11
|
+
},
|
|
12
|
+
v: {
|
|
13
|
+
language: {
|
|
14
|
+
en_US: '英语',
|
|
15
|
+
zh_CN: '中文',
|
|
16
|
+
es_ES: '西班牙语',
|
|
17
|
+
fr_FR: '法语',
|
|
18
|
+
ar_SA: '阿拉伯语',
|
|
19
|
+
ru_RU: '俄语',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
en_US: {
|
|
24
|
+
name: 'Localized Content',
|
|
25
|
+
attr: {
|
|
26
|
+
entity: 'Entity',
|
|
27
|
+
entityId: 'Entity Id',
|
|
28
|
+
language: 'Language',
|
|
29
|
+
data: 'Localized Translations',
|
|
30
|
+
},
|
|
31
|
+
v: {
|
|
32
|
+
language: {
|
|
33
|
+
en_US: 'English',
|
|
34
|
+
zh_CN: 'Chinese',
|
|
35
|
+
es_ES: 'Spanish',
|
|
36
|
+
fr_FR: 'French',
|
|
37
|
+
ar_SA: 'Arabic',
|
|
38
|
+
ru_RU: 'Russian',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
style: {
|
|
44
|
+
color: {
|
|
45
|
+
language: {
|
|
46
|
+
en_US: '#3498db',
|
|
47
|
+
zh_CN: '#e67e22',
|
|
48
|
+
es_ES: '#c0392b',
|
|
49
|
+
fr_FR: '#8e44ad',
|
|
50
|
+
ar_SA: '#16a085',
|
|
51
|
+
ru_RU: '#2c3e50',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
indexes: [
|
|
56
|
+
{
|
|
57
|
+
name: 'idx_localizedContent_entity_entityId_language',
|
|
58
|
+
attributes: [
|
|
59
|
+
{
|
|
60
|
+
name: 'entity',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'entityId',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'language',
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
config: {
|
|
70
|
+
unique: true,
|
|
71
|
+
type: 'btree',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'idx_localizedContent_entity_entityId',
|
|
76
|
+
attributes: [
|
|
77
|
+
{
|
|
78
|
+
name: 'entity',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: 'entityId',
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
config: {
|
|
85
|
+
type: 'btree',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'idx_localizedContent_language',
|
|
90
|
+
attributes: [
|
|
91
|
+
{
|
|
92
|
+
name: 'language',
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
config: {
|
|
96
|
+
type: 'btree',
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
};
|
|
101
|
+
export { entityDesc };
|
package/es/entities/Log.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { String } from
|
|
2
|
-
import { EntityShape } from
|
|
3
|
-
import { EntityDesc } from
|
|
1
|
+
import { String } from "../types/DataType";
|
|
2
|
+
import { EntityShape } from "../types/Entity";
|
|
3
|
+
import { EntityDesc } from "../types/EntityDesc";
|
|
4
4
|
export interface Schema extends EntityShape {
|
|
5
5
|
entity: String<32>;
|
|
6
6
|
entityId: String<64>;
|
package/es/entities/Modi.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { String } from
|
|
2
|
-
import { EntityShape } from
|
|
1
|
+
import { String } from "../types/DataType";
|
|
2
|
+
import { EntityShape } from "../types/Entity";
|
|
3
3
|
export interface Schema extends EntityShape {
|
|
4
4
|
targetEntity: String<32>;
|
|
5
5
|
entity: String<32>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { String } from
|
|
2
|
-
import { EntityShape } from
|
|
3
|
-
import { Schema as Modi } from
|
|
1
|
+
import { String } from "../types/DataType";
|
|
2
|
+
import { EntityShape } from "../types/Entity";
|
|
3
|
+
import { Schema as Modi } from "./Modi";
|
|
4
4
|
export interface Schema extends EntityShape {
|
|
5
5
|
modi: Modi;
|
|
6
6
|
entity: String<32>;
|
package/es/entities/Oper.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { String, Datetime } from
|
|
2
|
-
import { EntityShape } from
|
|
3
|
-
import { Schema as User } from
|
|
4
|
-
import { Schema as Log } from
|
|
5
|
-
import { ActionDef } from
|
|
1
|
+
import { String, Datetime } from "../types/DataType";
|
|
2
|
+
import { EntityShape } from "../types/Entity";
|
|
3
|
+
import { Schema as User } from "./User";
|
|
4
|
+
import { Schema as Log } from "./Log";
|
|
5
|
+
import { ActionDef } from "../types/Action";
|
|
6
6
|
export interface Schema extends EntityShape {
|
|
7
7
|
action: String<24>;
|
|
8
8
|
data: Object;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { String } from
|
|
2
|
-
import { EntityShape } from
|
|
3
|
-
import { Schema as Oper } from
|
|
1
|
+
import { String } from "../types/DataType";
|
|
2
|
+
import { EntityShape } from "../types/Entity";
|
|
3
|
+
import { Schema as Oper } from "./Oper";
|
|
4
4
|
export interface Schema extends EntityShape {
|
|
5
5
|
oper: Oper;
|
|
6
6
|
entity: String<32>;
|
package/es/entities/Path.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { String, Boolean } from
|
|
2
|
-
import { EntityShape } from
|
|
1
|
+
import { String, Boolean } from "../types/DataType";
|
|
2
|
+
import { EntityShape } from "../types/Entity";
|
|
3
3
|
export interface Schema extends EntityShape {
|
|
4
4
|
destEntity: String<32>;
|
|
5
5
|
value: String<256>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { String } from
|
|
2
|
-
import { EntityShape } from
|
|
1
|
+
import { String } from "../types/DataType";
|
|
2
|
+
import { EntityShape } from "../types/Entity";
|
|
3
3
|
export interface Schema extends EntityShape {
|
|
4
4
|
entity: String<32>;
|
|
5
5
|
entityId?: String<64>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EntityShape } from
|
|
2
|
-
import { Schema as Relation } from
|
|
3
|
-
import { Schema as Path } from
|
|
1
|
+
import { EntityShape } from "../types/Entity";
|
|
2
|
+
import { Schema as Relation } from "./Relation";
|
|
3
|
+
import { Schema as Path } from "./Path";
|
|
4
4
|
export interface Schema extends EntityShape {
|
|
5
5
|
sourceRelation: Relation;
|
|
6
6
|
path: Path;
|
package/es/entities/User.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { String, Text } from
|
|
2
|
-
import { EntityShape } from
|
|
3
|
-
import { ActionDef } from
|
|
4
|
-
import { EntityDesc } from
|
|
1
|
+
import { String, Text } from "../types/DataType";
|
|
2
|
+
import { EntityShape } from "../types/Entity";
|
|
3
|
+
import { ActionDef } from "../types/Action";
|
|
4
|
+
import { EntityDesc } from "../types/EntityDesc";
|
|
5
5
|
export interface Schema extends EntityShape {
|
|
6
6
|
name?: String<16>;
|
|
7
7
|
nickname?: String<64>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { String } from
|
|
2
|
-
import { EntityShape } from
|
|
3
|
-
import { Schema as UserEntityGrant } from
|
|
4
|
-
import { Schema as User } from
|
|
5
|
-
import { Schema as Relation } from
|
|
6
|
-
import { Schema as UserRelation } from
|
|
1
|
+
import { String } from "../types/DataType";
|
|
2
|
+
import { EntityShape } from "../types/Entity";
|
|
3
|
+
import { Schema as UserEntityGrant } from "./UserEntityGrant";
|
|
4
|
+
import { Schema as User } from "./User";
|
|
5
|
+
import { Schema as Relation } from "./Relation";
|
|
6
|
+
import { Schema as UserRelation } from "./UserRelation";
|
|
7
7
|
export interface Schema extends EntityShape {
|
|
8
8
|
ueg: UserEntityGrant;
|
|
9
9
|
user: User;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { String } from
|
|
2
|
-
import { EntityShape } from
|
|
1
|
+
import { String } from "../types/DataType";
|
|
2
|
+
import { EntityShape } from "../types/Entity";
|
|
3
3
|
type RelationIds = string[];
|
|
4
4
|
export interface Schema extends EntityShape {
|
|
5
5
|
relationEntity: String<32>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { String } from
|
|
2
|
-
import { EntityShape } from
|
|
3
|
-
import { Schema as User } from
|
|
4
|
-
import { Schema as Relation } from
|
|
1
|
+
import { String } from "../types/DataType";
|
|
2
|
+
import { EntityShape } from "../types/Entity";
|
|
3
|
+
import { Schema as User } from "./User";
|
|
4
|
+
import { Schema as Relation } from "./Relation";
|
|
5
5
|
export interface Schema extends EntityShape {
|
|
6
6
|
user: User;
|
|
7
7
|
relation: Relation;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EntityDict, RowStore, OperateOption, OperationResult, SelectOption, Context, TxnOption, OpRecord, AggregationResult, ClusterInfo, OakException } from "../types";
|
|
2
|
-
import { EntityDict as BaseEntityDict } from
|
|
2
|
+
import { EntityDict as BaseEntityDict } from "../base-app-domain";
|
|
3
3
|
import { IncomingHttpHeaders } from "http";
|
|
4
4
|
/**
|
|
5
5
|
* 服务器端执行的异步环境的底层抽象
|
|
@@ -53,7 +53,7 @@ export declare abstract class AsyncContext<ED extends EntityDict & BaseEntityDic
|
|
|
53
53
|
setMessage(message: string): void;
|
|
54
54
|
getMessage(): string | undefined;
|
|
55
55
|
abstract isRoot(): boolean;
|
|
56
|
-
abstract getCurrentUserId(allowUnloggedIn?:
|
|
56
|
+
abstract getCurrentUserId<T extends boolean>(allowUnloggedIn?: T): T extends true ? string | undefined : string;
|
|
57
57
|
abstract setCurrentUserId(userId: string | undefined): void;
|
|
58
58
|
abstract toString(): Promise<string>;
|
|
59
59
|
protected abstract getSerializedData(): Promise<object>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DeleteAtAttribute } from "../types";
|
|
2
2
|
import { readOnlyActions } from '../actions/action';
|
|
3
|
-
import assert from
|
|
3
|
+
import { assert } from '../utils/assert';
|
|
4
4
|
import { getRelevantIds } from "./filter";
|
|
5
5
|
/**
|
|
6
6
|
* 服务器端执行的异步环境的底层抽象
|
|
@@ -141,7 +141,7 @@ export class AsyncContext {
|
|
|
141
141
|
this.uuid = await this.rowStore.begin(options);
|
|
142
142
|
}
|
|
143
143
|
else {
|
|
144
|
-
assert(false);
|
|
144
|
+
assert(false, "There is already an active transaction in this context.");
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
async commit() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EntityDict, OperateOption, SelectOption, OperationResult, AggregationResult } from "../types/Entity";
|
|
2
|
-
import { EntityDict as BaseEntityDict } from
|
|
3
|
-
import { OperationRewriter, RowStore, SelectionRewriter } from
|
|
4
|
-
import { StorageSchema } from
|
|
2
|
+
import { EntityDict as BaseEntityDict } from "../base-app-domain";
|
|
3
|
+
import { OperationRewriter, RowStore, SelectionRewriter } from "../types/RowStore";
|
|
4
|
+
import { StorageSchema } from "../types/Storage";
|
|
5
5
|
import { SyncContext } from "./SyncRowStore";
|
|
6
6
|
import { AsyncContext } from "./AsyncRowStore";
|
|
7
7
|
/**
|
|
@@ -23,6 +23,8 @@ export declare abstract class CascadeStore<ED extends EntityDict & BaseEntityDic
|
|
|
23
23
|
private operationRewriters;
|
|
24
24
|
private reinforceSelectionAsync;
|
|
25
25
|
private reinforceSelectionSync;
|
|
26
|
+
private applySelectionResultProcessorsAsync;
|
|
27
|
+
private applySelectionResultProcessorsSync;
|
|
26
28
|
private reinforceOperation;
|
|
27
29
|
registerOperationRewriter(rewriter: OperationRewriter<ED, AsyncContext<ED> | SyncContext<ED>, OperateOption>): void;
|
|
28
30
|
registerSelectionRewriter(rewriter: SelectionRewriter<ED, AsyncContext<ED> | SyncContext<ED>, SelectOption>): void;
|
package/es/store/CascadeStore.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import assert from
|
|
1
|
+
import { assert } from '../utils/assert';
|
|
2
2
|
import { CreateAtAttribute, UpdateAtAttribute, DeleteAtAttribute } from "../types/Entity";
|
|
3
|
-
import { RowStore } from
|
|
3
|
+
import { RowStore } from "../types/RowStore";
|
|
4
4
|
import { combineFilters } from "./filter";
|
|
5
5
|
import { judgeRelation } from "./relation";
|
|
6
6
|
import { EXPRESSION_PREFIX, getAttrRefInExpression, OakRowUnexistedException, PrimaryKeyAttribute } from "../types";
|
|
7
|
-
import {
|
|
7
|
+
import { uniq, cloneDeep, pick, difference, omit } from '../utils/toolkit';
|
|
8
8
|
import { AsyncContext } from "./AsyncRowStore";
|
|
9
9
|
import { getRelevantIds } from "./filter";
|
|
10
10
|
import { generateNewId, generateNewIdAsync } from "../utils/uuid";
|
|
11
11
|
import { SYSTEM_RESERVE_ENTITIES } from "../compiler/entities";
|
|
12
12
|
import { makeProjection } from "../utils/projection";
|
|
13
|
+
import { LOCALIZED_CONTENT_AUTO_INJECTED, rewriteLocalizedContentSelection } from "../utils/localizedContent";
|
|
13
14
|
/**
|
|
14
15
|
* 补全一个不完整的Selection,会将需要的各种连接、过滤和排序的属性加到相应的projection上
|
|
15
16
|
* @param schema
|
|
@@ -41,7 +42,7 @@ export function polishSelection(schema, entity, selection, context, option) {
|
|
|
41
42
|
assignNecessaryProjectionAttrs(projectionNode, toBeAssignNode[filterNode[attr]]);
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
|
-
else if (['$and', '$or'].includes(attr)) {
|
|
45
|
+
else if (['$and', '$or', '$xor'].includes(attr)) {
|
|
45
46
|
for (const node of filterNode[attr]) {
|
|
46
47
|
checkFilterNode(entity2, node, projectionNode, toBeAssignNode, filterNodeDict);
|
|
47
48
|
}
|
|
@@ -292,19 +293,40 @@ export class CascadeStore extends RowStore {
|
|
|
292
293
|
if (!isAggr && !selection.distinct) {
|
|
293
294
|
polishSelection(this.getSchema(), entity, selection, context, option);
|
|
294
295
|
}
|
|
295
|
-
const
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
}
|
|
296
|
+
const localizedContentResult = await rewriteLocalizedContentSelection(this.getSchema(), entity, selection, context, option, isAggr);
|
|
297
|
+
const rewriteResults = await Promise.all(this.selectionRewriters.map(ele => ele(this.getSchema(), entity, selection, context, option, isAggr)));
|
|
298
|
+
return [localizedContentResult, ...rewriteResults].filter((ele) => typeof ele === 'function');
|
|
299
299
|
}
|
|
300
300
|
reinforceSelectionSync(entity, selection, context, option, isAggr) {
|
|
301
301
|
if (!isAggr && !selection.distinct) {
|
|
302
302
|
polishSelection(this.getSchema(), entity, selection);
|
|
303
303
|
}
|
|
304
|
+
const processors = [];
|
|
305
|
+
// @oak-ignore
|
|
306
|
+
const localizedContentResult = rewriteLocalizedContentSelection(this.getSchema(), entity, selection, context, option, isAggr);
|
|
307
|
+
assert(!(localizedContentResult instanceof Promise));
|
|
308
|
+
if (typeof localizedContentResult === 'function') {
|
|
309
|
+
processors.push(localizedContentResult);
|
|
310
|
+
}
|
|
304
311
|
this.selectionRewriters.forEach(ele => {
|
|
305
312
|
const result = ele(this.getSchema(), entity, selection, context, option, isAggr);
|
|
306
313
|
assert(!(result instanceof Promise));
|
|
314
|
+
if (typeof result === 'function') {
|
|
315
|
+
processors.push(result);
|
|
316
|
+
}
|
|
307
317
|
});
|
|
318
|
+
return processors;
|
|
319
|
+
}
|
|
320
|
+
async applySelectionResultProcessorsAsync(processors, result) {
|
|
321
|
+
for (const processor of processors) {
|
|
322
|
+
await processor(result);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
applySelectionResultProcessorsSync(processors, result) {
|
|
326
|
+
for (const processor of processors) {
|
|
327
|
+
const processorResult = processor(result);
|
|
328
|
+
assert(!(processorResult instanceof Promise));
|
|
329
|
+
}
|
|
308
330
|
}
|
|
309
331
|
async reinforceOperation(entity, operation, context, option) {
|
|
310
332
|
await Promise.all(this.operationRewriters.map(ele => ele(this.getSchema(), entity, operation, context, option)));
|
|
@@ -573,13 +595,16 @@ export class CascadeStore extends RowStore {
|
|
|
573
595
|
$in: ids,
|
|
574
596
|
},
|
|
575
597
|
}, subFilter]);
|
|
576
|
-
const
|
|
598
|
+
const subSelection = {
|
|
577
599
|
id: subSelectionId || selectionId,
|
|
578
600
|
data: subProjection,
|
|
579
601
|
filter: filter2,
|
|
580
602
|
sorter: subSorter,
|
|
581
603
|
total,
|
|
582
|
-
}
|
|
604
|
+
};
|
|
605
|
+
const subRows = cascadeSelectFn.call(this, entity2, subSelection, context, projection2[attr][LOCALIZED_CONTENT_AUTO_INJECTED]
|
|
606
|
+
? { ...option, dontCollect: true }
|
|
607
|
+
: option);
|
|
583
608
|
if (subRows instanceof Promise) {
|
|
584
609
|
return subRows.then((subRowss) => dealWithSubRows(subRowss));
|
|
585
610
|
}
|
|
@@ -601,7 +626,7 @@ export class CascadeStore extends RowStore {
|
|
|
601
626
|
entity,
|
|
602
627
|
entityId: row.id,
|
|
603
628
|
}, subFilter]);
|
|
604
|
-
const
|
|
629
|
+
const subSelection = {
|
|
605
630
|
id: subSelectionId || selectionId,
|
|
606
631
|
data: subProjection,
|
|
607
632
|
filter: filter2,
|
|
@@ -610,7 +635,10 @@ export class CascadeStore extends RowStore {
|
|
|
610
635
|
count,
|
|
611
636
|
total,
|
|
612
637
|
randomRange,
|
|
613
|
-
}
|
|
638
|
+
};
|
|
639
|
+
const subRows = cascadeSelectFn.call(this, entity2, subSelection, context, projection2[attr][LOCALIZED_CONTENT_AUTO_INJECTED]
|
|
640
|
+
? { ...option, dontCollect: true }
|
|
641
|
+
: option);
|
|
614
642
|
if (subRows instanceof Promise) {
|
|
615
643
|
return subRows.then((subRowss) => dealWithSubRows2(row, subRowss));
|
|
616
644
|
}
|
|
@@ -1026,7 +1054,7 @@ export class CascadeStore extends RowStore {
|
|
|
1026
1054
|
// 对更新的数据,去掉所有的undefined属性
|
|
1027
1055
|
preProcessDataUpdated(action, data, async) {
|
|
1028
1056
|
const undefinedKeys = Object.keys(data).filter(ele => data[ele] === undefined);
|
|
1029
|
-
undefinedKeys.forEach(ele =>
|
|
1057
|
+
undefinedKeys.forEach(ele => delete data[ele]);
|
|
1030
1058
|
// 优化一下,如果不更新任何属性,则不实际执行
|
|
1031
1059
|
const now = Date.now();
|
|
1032
1060
|
// 后台应该还是以实际操作时间为准,前台以传入的updateAt来界定操作的产生“时间”,这里可用来避免同一次更新被算做多次
|
|
@@ -1659,7 +1687,7 @@ export class CascadeStore extends RowStore {
|
|
|
1659
1687
|
}
|
|
1660
1688
|
cascadeSelect(entity, selection, context, option) {
|
|
1661
1689
|
const { data, filter, indexFrom, count, sorter, distinct } = selection;
|
|
1662
|
-
const { projection, cascadeSelectionFns } = this.destructCascadeSelect(entity, data, context, this.
|
|
1690
|
+
const { projection, cascadeSelectionFns } = this.destructCascadeSelect(entity, data, context, this.selectSync, this.aggregateSync, option);
|
|
1663
1691
|
const rows = this.selectAbjointRow(entity, {
|
|
1664
1692
|
data: projection,
|
|
1665
1693
|
filter,
|
|
@@ -1770,7 +1798,7 @@ export class CascadeStore extends RowStore {
|
|
|
1770
1798
|
}
|
|
1771
1799
|
async cascadeSelectAsync(entity, selection, context, option) {
|
|
1772
1800
|
const { data, filter, indexFrom, count, sorter, total, randomRange, distinct, id: selectionId } = selection;
|
|
1773
|
-
const { projection, cascadeSelectionFns } = this.destructCascadeSelect(entity, data, context, this.
|
|
1801
|
+
const { projection, cascadeSelectionFns } = this.destructCascadeSelect(entity, data, context, this.selectAsync, this.aggregateAsync, option, selectionId);
|
|
1774
1802
|
const rows2 = await this.selectAbjointRowAsync(entity, {
|
|
1775
1803
|
data: projection,
|
|
1776
1804
|
filter,
|
|
@@ -1793,9 +1821,6 @@ export class CascadeStore extends RowStore {
|
|
|
1793
1821
|
return true;
|
|
1794
1822
|
});
|
|
1795
1823
|
}
|
|
1796
|
-
if (!option.dontCollect) {
|
|
1797
|
-
this.addToResultSelections(entity, rows, context, selection.id);
|
|
1798
|
-
}
|
|
1799
1824
|
if (cascadeSelectionFns.length > 0) {
|
|
1800
1825
|
const ruException = [];
|
|
1801
1826
|
await Promise.all(cascadeSelectionFns.map(async (ele) => {
|
|
@@ -1836,12 +1861,19 @@ export class CascadeStore extends RowStore {
|
|
|
1836
1861
|
return this.aggregateAbjointRowSync(entity, aggregation, context, option);
|
|
1837
1862
|
}
|
|
1838
1863
|
async selectAsync(entity, selection, context, option) {
|
|
1839
|
-
await this.reinforceSelectionAsync(entity, selection, context, option);
|
|
1840
|
-
|
|
1864
|
+
const processors = await this.reinforceSelectionAsync(entity, selection, context, option);
|
|
1865
|
+
const result = await this.cascadeSelectAsync(entity, selection, context, option);
|
|
1866
|
+
await this.applySelectionResultProcessorsAsync(processors, result);
|
|
1867
|
+
if (!option.dontCollect) {
|
|
1868
|
+
this.addToResultSelections(entity, result, context, selection.id);
|
|
1869
|
+
}
|
|
1870
|
+
return result;
|
|
1841
1871
|
}
|
|
1842
1872
|
selectSync(entity, selection, context, option) {
|
|
1843
|
-
this.reinforceSelectionSync(entity, selection, context, option);
|
|
1844
|
-
|
|
1873
|
+
const processors = this.reinforceSelectionSync(entity, selection, context, option);
|
|
1874
|
+
const result = this.cascadeSelect(entity, selection, context, option);
|
|
1875
|
+
this.applySelectionResultProcessorsSync(processors, result);
|
|
1876
|
+
return result;
|
|
1845
1877
|
}
|
|
1846
1878
|
operateSync(entity, operation, context, option) {
|
|
1847
1879
|
//this.reinforceOperation(entity, operation); // 感觉前台可以无视?
|
|
@@ -1855,8 +1887,8 @@ export class CascadeStore extends RowStore {
|
|
|
1855
1887
|
this.reinforceSelectionSync(entity, selection, context, option, true); // 这样写可能有问题的,虽然能跳过本地的projection补全,但如果有更多的selectionRewriter注入可能会出问题。by Xc 20231220
|
|
1856
1888
|
return this.countAbjointRow(entity, selection, context, option);
|
|
1857
1889
|
}
|
|
1858
|
-
countAsync(entity, selection, context, option) {
|
|
1859
|
-
this.reinforceSelectionAsync(entity, selection, context, option, true); // 这样写可能有问题的,虽然能跳过本地的projection补全,但如果有更多的selectionRewriter注入可能会出问题。by Xc 20231220
|
|
1890
|
+
async countAsync(entity, selection, context, option) {
|
|
1891
|
+
await this.reinforceSelectionAsync(entity, selection, context, option, true); // 这样写可能有问题的,虽然能跳过本地的projection补全,但如果有更多的selectionRewriter注入可能会出问题。by Xc 20231220
|
|
1860
1892
|
return this.countAbjointRowAsync(entity, selection, context, option);
|
|
1861
1893
|
}
|
|
1862
1894
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ActionDefDict, Checker, EntityDict, StorageSchema, AttrUpdateMatrix } from "../types";
|
|
2
2
|
import { SyncContext } from "./SyncRowStore";
|
|
3
3
|
import { AsyncContext } from "./AsyncRowStore";
|
|
4
|
-
import { EntityDict as BaseEntityDict } from
|
|
4
|
+
import { EntityDict as BaseEntityDict } from "../base-app-domain/EntityDict";
|
|
5
5
|
export declare function makeIntrinsicCheckers<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>>(schema: StorageSchema<ED>, actionDefDict: ActionDefDict<ED>, attrUpdateMatrix?: AttrUpdateMatrix<ED>): Checker<ED, keyof ED, Cxt | FrontCxt>[];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { OakUniqueViolationException, CHECKER_MAX_PRIORITY, OakAttrCantUpdateException, UpdateAtAttribute, TriggerDataAttribute, TriggerUuidAttribute } from "../types";
|
|
2
|
-
import { pick, intersection, difference, omit } from '../utils/
|
|
2
|
+
import { pick, intersection, difference, omit } from '../utils/toolkit';
|
|
3
3
|
import { analyzeFilterRelation, checkFilterContains, combineFilters } from "./filter";
|
|
4
4
|
import { createModiRelatedCheckers } from "./modi";
|
|
5
5
|
import { createCreateCheckers, createRemoveCheckers } from "./checker";
|
|
6
6
|
import { readOnlyActions } from "../actions/action";
|
|
7
|
-
import assert from 'assert';
|
|
7
|
+
import { assert } from '../utils/assert';
|
|
8
8
|
function checkUniqueBetweenRows(rows, uniqAttrs) {
|
|
9
9
|
// 先检查这些行本身之间有无unique冲突
|
|
10
10
|
const dict = {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ActionDefDict, Checker, EntityDict, StorageSchema, Trigger, Watcher, AttrUpdateMatrix } from "../types";
|
|
2
2
|
import { SyncContext } from "./SyncRowStore";
|
|
3
3
|
import { AsyncContext } from "./AsyncRowStore";
|
|
4
|
-
import { EntityDict as BaseEntityDict } from
|
|
4
|
+
import { EntityDict as BaseEntityDict } from "../base-app-domain/EntityDict";
|
|
5
5
|
export declare function makeIntrinsicLogics<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>>(schema: StorageSchema<ED>, actionDefDict: ActionDefDict<ED>, attrUpdateMatrix?: AttrUpdateMatrix<ED>): {
|
|
6
6
|
triggers: Trigger<ED, keyof ED, Cxt>[];
|
|
7
7
|
checkers: Checker<ED, keyof ED, Cxt | FrontCxt>[];
|
package/es/store/RelationAuth.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import assert from
|
|
1
|
+
import { assert } from '../utils/assert';
|
|
2
2
|
import { OakUnloggedInException, OakDataInvisibleException, OakOperationUnpermittedException, PrimaryKeyAttribute } from "../types";
|
|
3
3
|
import { AsyncContext } from "./AsyncRowStore";
|
|
4
4
|
import { checkFilterContains, combineFilters, getRelevantIds, translateCreateDataToFilter } from "./filter";
|
|
5
5
|
import { judgeRelation } from "./relation";
|
|
6
6
|
import { readOnlyActions } from '../actions/action';
|
|
7
|
-
import { difference, intersection, uniq, cloneDeep } from '../utils/
|
|
7
|
+
import { difference, intersection, uniq, cloneDeep } from '../utils/toolkit';
|
|
8
8
|
import { SYSTEM_RESERVE_ENTITIES } from "../compiler/entities";
|
|
9
9
|
import { destructDirectUserPath, destructRelationPath } from "../utils/relationPath";
|
|
10
10
|
export class RelationAuth {
|
|
@@ -453,7 +453,7 @@ export class RelationAuth {
|
|
|
453
453
|
const refineFilter = (entity, originFilter) => {
|
|
454
454
|
let filter2 = {};
|
|
455
455
|
for (const attr in originFilter) {
|
|
456
|
-
if (['$and', '$or'].includes(attr)) {
|
|
456
|
+
if (['$and', '$or', '$xor'].includes(attr)) {
|
|
457
457
|
const refined = originFilter[attr].map((f) => refineFilter(entity, f)).filter((ele) => !!ele);
|
|
458
458
|
if (refined.length > 1) {
|
|
459
459
|
filter2[attr] = refined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EntityDict, RowStore, OperateOption, OperationResult, SelectOption, TxnOption, Context, AggregationResult } from "../types";
|
|
2
|
-
import { EntityDict as BaseEntityDict } from
|
|
2
|
+
import { EntityDict as BaseEntityDict } from "../base-app-domain";
|
|
3
3
|
export declare abstract class SyncContext<ED extends EntityDict & BaseEntityDict> implements Context {
|
|
4
4
|
rowStore: SyncRowStore<ED, this>;
|
|
5
5
|
private uuid?;
|
package/es/store/SyncRowStore.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { EntityDict, OperateOption, SelectOption } from "../types/Entity";
|
|
2
|
-
import { EntityDict as BaseEntityDict } from
|
|
2
|
+
import { EntityDict as BaseEntityDict } from "../base-app-domain";
|
|
3
3
|
import { Logger } from "../types/Logger";
|
|
4
|
-
import { Checker } from
|
|
4
|
+
import { Checker } from "../types/Auth";
|
|
5
5
|
import { Trigger, VolatileTrigger } from "../types/Trigger";
|
|
6
|
-
import { AsyncContext } from
|
|
7
|
-
import { StorageSchema } from
|
|
6
|
+
import { AsyncContext } from "./AsyncRowStore";
|
|
7
|
+
import { StorageSchema } from "../types";
|
|
8
8
|
/**
|
|
9
9
|
* update可能会传入多种不同的action,此时都需要检查update trigger
|
|
10
10
|
*/
|
|
@@ -13,12 +13,14 @@ export declare class TriggerExecutor<ED extends EntityDict & BaseEntityDict, Cxt
|
|
|
13
13
|
private triggerMap;
|
|
14
14
|
private triggerNameMap;
|
|
15
15
|
private volatileEntities;
|
|
16
|
+
private checkerTriggerMap;
|
|
16
17
|
private logger;
|
|
17
18
|
private contextBuilder;
|
|
18
19
|
private onVolatileTrigger;
|
|
19
20
|
constructor(contextBuilder: () => Cxt, logger?: Logger, onVolatileTrigger?: <T extends keyof ED>(entity: T, trigger: VolatileTrigger<ED, T, Cxt>, ids: string[], cxtStr: string, option: OperateOption) => Promise<void>);
|
|
20
21
|
setOnVolatileTrigger(onVolatileTrigger: <T extends keyof ED>(entity: T, trigger: VolatileTrigger<ED, T, Cxt>, ids: string[], cxtStr: string, option: OperateOption) => Promise<void>): void;
|
|
21
22
|
registerChecker<T extends keyof ED>(checker: Checker<ED, T, Cxt>, schema: StorageSchema<ED>): void;
|
|
23
|
+
unregisterChecker<T extends keyof ED>(checker: Checker<ED, T, Cxt>): boolean;
|
|
22
24
|
registerTrigger<T extends keyof ED>(trigger: Trigger<ED, T, Cxt>): void;
|
|
23
25
|
unregisterTrigger<T extends keyof ED>(trigger: Trigger<ED, T, Cxt>): void;
|
|
24
26
|
private preCommitTrigger;
|