oak-domain 6.1.1 → 6.1.2
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/es/base-app-domain/ActionDefDict.d.ts +1 -0
- package/es/base-app-domain/ActionDefDict.js +3 -1
- package/es/base-app-domain/EntityDict.d.ts +86 -1
- package/es/base-app-domain/Log/Storage.js +4 -0
- package/es/base-app-domain/Log/_baseSchema.d.ts +5 -0
- package/es/base-app-domain/Storage.js +3 -1
- package/es/base-app-domain/StyleDict.js +3 -1
- package/es/base-app-domain/Version/Action.d.ts +6 -0
- package/es/base-app-domain/Version/Action.js +2 -0
- package/es/base-app-domain/Version/Schema.d.ts +19 -0
- package/es/base-app-domain/Version/Schema.js +1 -0
- package/es/base-app-domain/Version/Storage.d.ts +3 -0
- package/es/base-app-domain/Version/Storage.js +54 -0
- package/es/base-app-domain/Version/Style.d.ts +3 -0
- package/es/base-app-domain/Version/Style.js +6 -0
- package/es/base-app-domain/Version/_baseSchema.d.ts +57 -0
- package/es/base-app-domain/Version/_baseSchema.js +1 -0
- package/es/compiler/dependencyBuilder.d.ts +1 -0
- package/es/compiler/dependencyBuilder.js +94 -9
- package/es/compiler/routerBuilder.d.ts +4 -1
- package/es/compiler/routerBuilder.js +22 -19
- package/es/compiler/schemaBuilder.d.ts +5 -1
- package/es/compiler/schemaBuilder.js +10 -0
- package/es/context/BackendRuntimeContext.d.ts +9 -1
- package/es/context/BackendRuntimeContext.js +13 -1
- package/es/entities/Log.d.ts +2 -0
- package/es/entities/Log.js +2 -0
- package/es/entities/Version.d.ts +14 -0
- package/es/entities/Version.js +42 -0
- package/es/store/AsyncRowStore.d.ts +4 -1
- package/es/store/AsyncRowStore.js +7 -0
- package/es/store/CascadeStore.js +22 -0
- package/es/store/RelationAuth/authorizationFilter.d.ts +11 -0
- package/es/store/RelationAuth/authorizationFilter.js +104 -0
- package/es/store/RelationAuth/continuation.d.ts +9 -0
- package/es/store/RelationAuth/continuation.js +33 -0
- package/es/store/RelationAuth/index.d.ts +141 -0
- package/es/store/RelationAuth/index.js +1440 -0
- package/es/store/RelationAuth/model.d.ts +38 -0
- package/es/store/RelationAuth/model.js +24 -0
- package/es/store/RelationAuth/userLookup.d.ts +21 -0
- package/es/store/RelationAuth/userLookup.js +102 -0
- package/es/store/SyncRowStore.d.ts +2 -1
- package/es/store/SyncRowStore.js +3 -0
- package/es/store/filter.fix.d.ts +128 -0
- package/es/store/filter.fix.js +2862 -0
- package/es/store/filter.js +14 -9
- package/es/store/triggers.js +239 -44
- package/es/types/Context.d.ts +2 -1
- package/es/types/Demand.d.ts +11 -1
- package/es/types/Environment.d.ts +13 -2
- package/es/types/Exception.d.ts +3 -3
- package/es/types/Exception.js +25 -22
- package/es/types/Expression.d.ts +4 -1
- package/es/types/Expression.js +1 -1
- package/es/types/Storage.d.ts +15 -2
- package/es/utils/SimpleConnector.js +5 -2
- package/es/utils/decimal.js +2 -1
- package/es/utils/fetch/index.ali.d.ts +3 -0
- package/es/utils/fetch/index.ali.js +31 -0
- package/es/utils/fetch/index.d.ts +3 -0
- package/es/utils/fetch/index.js +5 -0
- package/es/utils/fetch/index.mp.d.ts +5 -3
- package/es/utils/fetch/index.mp.js +5 -280
- package/es/utils/fetch/index.wechat.d.ts +5 -0
- package/es/utils/fetch/index.wechat.js +174 -0
- package/es/utils/fetch/mini-program.shared.d.ts +37 -0
- package/es/utils/fetch/mini-program.shared.js +85 -0
- package/es/utils/geo.d.ts +1 -1
- package/es/utils/geo.js +1 -1
- package/es/utils/random/random.ali.d.ts +6 -0
- package/es/utils/random/random.ali.js +21 -0
- package/es/utils/random/random.mp.d.ts +5 -1
- package/es/utils/random/random.mp.js +11 -5
- package/es/utils/random/random.native.d.ts +1 -1
- package/es/utils/random/random.native.js +7 -4
- package/es/utils/random/random.wechat.d.ts +1 -0
- package/es/utils/random/random.wechat.js +10 -0
- package/lib/base-app-domain/ActionDefDict.d.ts +1 -0
- package/lib/base-app-domain/ActionDefDict.js +3 -1
- package/lib/base-app-domain/EntityDict.d.ts +86 -1
- package/lib/base-app-domain/Log/Storage.js +4 -0
- package/lib/base-app-domain/Log/_baseSchema.d.ts +5 -0
- package/lib/base-app-domain/Storage.js +3 -1
- package/lib/base-app-domain/StyleDict.js +3 -1
- package/lib/base-app-domain/Version/Action.d.ts +6 -0
- package/lib/base-app-domain/Version/Action.js +5 -0
- package/lib/base-app-domain/Version/Schema.d.ts +19 -0
- package/lib/base-app-domain/Version/Schema.js +4 -0
- package/lib/base-app-domain/Version/Storage.d.ts +3 -0
- package/lib/base-app-domain/Version/Storage.js +57 -0
- package/lib/base-app-domain/Version/Style.d.ts +3 -0
- package/lib/base-app-domain/Version/Style.js +9 -0
- package/lib/base-app-domain/Version/_baseSchema.d.ts +57 -0
- package/lib/base-app-domain/Version/_baseSchema.js +2 -0
- package/lib/compiler/dependencyBuilder.d.ts +1 -0
- package/lib/compiler/dependencyBuilder.js +95 -9
- package/lib/compiler/routerBuilder.d.ts +4 -1
- package/lib/compiler/routerBuilder.js +22 -19
- package/lib/compiler/schemaBuilder.d.ts +5 -1
- package/lib/compiler/schemaBuilder.js +10 -0
- package/lib/context/BackendRuntimeContext.d.ts +9 -1
- package/lib/context/BackendRuntimeContext.js +13 -1
- package/lib/entities/Log.d.ts +2 -0
- package/lib/entities/Log.js +2 -0
- package/lib/entities/Version.d.ts +14 -0
- package/lib/entities/Version.js +43 -0
- package/lib/store/AsyncRowStore.d.ts +4 -1
- package/lib/store/AsyncRowStore.js +7 -0
- package/lib/store/CascadeStore.js +22 -0
- package/lib/store/RelationAuth/authorizationFilter.d.ts +11 -0
- package/lib/store/RelationAuth/authorizationFilter.js +110 -0
- package/lib/store/RelationAuth/continuation.d.ts +9 -0
- package/lib/store/RelationAuth/continuation.js +37 -0
- package/lib/store/RelationAuth/index.d.ts +141 -0
- package/lib/store/RelationAuth/index.js +1445 -0
- package/lib/store/RelationAuth/model.d.ts +38 -0
- package/lib/store/RelationAuth/model.js +27 -0
- package/lib/store/RelationAuth/userLookup.d.ts +21 -0
- package/lib/store/RelationAuth/userLookup.js +105 -0
- package/lib/store/SyncRowStore.d.ts +2 -1
- package/lib/store/SyncRowStore.js +3 -0
- package/lib/store/filter.fix.d.ts +128 -0
- package/lib/store/filter.fix.js +2876 -0
- package/lib/store/filter.js +14 -9
- package/lib/store/triggers.js +239 -44
- package/lib/types/Context.d.ts +2 -1
- package/lib/types/Demand.d.ts +11 -1
- package/lib/types/Environment.d.ts +13 -2
- package/lib/types/Exception.d.ts +3 -3
- package/lib/types/Exception.js +25 -22
- package/lib/types/Expression.d.ts +4 -1
- package/lib/types/Expression.js +1 -1
- package/lib/types/Storage.d.ts +15 -2
- package/lib/utils/SimpleConnector.js +5 -2
- package/lib/utils/decimal.js +2 -1
- package/lib/utils/fetch/index.ali.d.ts +3 -0
- package/lib/utils/fetch/index.ali.js +36 -0
- package/lib/utils/fetch/index.d.ts +3 -0
- package/lib/utils/fetch/index.js +7 -0
- package/lib/utils/fetch/index.mp.d.ts +5 -3
- package/lib/utils/fetch/index.mp.js +5 -282
- package/lib/utils/fetch/index.wechat.d.ts +5 -0
- package/lib/utils/fetch/index.wechat.js +180 -0
- package/lib/utils/fetch/mini-program.shared.d.ts +37 -0
- package/lib/utils/fetch/mini-program.shared.js +96 -0
- package/lib/utils/geo.d.ts +1 -1
- package/lib/utils/geo.js +1 -1
- package/lib/utils/random/random.ali.d.ts +6 -0
- package/lib/utils/random/random.ali.js +24 -0
- package/lib/utils/random/random.mp.d.ts +5 -1
- package/lib/utils/random/random.mp.js +11 -5
- package/lib/utils/random/random.native.d.ts +1 -1
- package/lib/utils/random/random.native.js +7 -5
- package/lib/utils/random/random.wechat.d.ts +1 -0
- package/lib/utils/random/random.wechat.js +13 -0
- package/package.json +6 -3
- package/es/store/RelationAuth.d.ts +0 -115
- package/es/store/RelationAuth.js +0 -1340
- package/lib/store/RelationAuth.d.ts +0 -115
- package/lib/store/RelationAuth.js +0 -1345
|
@@ -2,9 +2,11 @@ import { actionDefDict as log } from "./Log/Action";
|
|
|
2
2
|
import { actionDefDict as modi } from "./Modi/Action";
|
|
3
3
|
import { actionDefDict as oper } from "./Oper/Action";
|
|
4
4
|
import { actionDefDict as user } from "./User/Action";
|
|
5
|
+
import { actionDefDict as version } from "./Version/Action";
|
|
5
6
|
export const actionDefDict = {
|
|
6
7
|
log,
|
|
7
8
|
modi,
|
|
8
9
|
oper,
|
|
9
|
-
user
|
|
10
|
+
user,
|
|
11
|
+
version
|
|
10
12
|
};
|
|
@@ -15,6 +15,7 @@ import * as BaseUser from "./User/_baseSchema";
|
|
|
15
15
|
import * as BaseUserEntityClaim from "./UserEntityClaim/_baseSchema";
|
|
16
16
|
import * as BaseUserEntityGrant from "./UserEntityGrant/_baseSchema";
|
|
17
17
|
import * as BaseUserRelation from "./UserRelation/_baseSchema";
|
|
18
|
+
import * as BaseVersion from "./Version/_baseSchema";
|
|
18
19
|
export type ActionAuth = {
|
|
19
20
|
OpSchema: BaseActionAuth.OpSchema;
|
|
20
21
|
Action: BaseActionAuth.OpAction;
|
|
@@ -112,22 +113,36 @@ export type Log = {
|
|
|
112
113
|
OpSchema: BaseLog.OpSchema;
|
|
113
114
|
Action: BaseLog.OpAction;
|
|
114
115
|
Schema: BaseLog.OpSchema & {
|
|
116
|
+
version?: Version["Schema"];
|
|
115
117
|
oper$log?: Array<Omit<Oper["Schema"], "log">>;
|
|
118
|
+
version$log?: Array<Omit<Version["Schema"], "log">>;
|
|
116
119
|
oper$log$$aggr?: AggregationResult<Omit<Oper["Schema"], "log">>;
|
|
120
|
+
version$log$$aggr?: AggregationResult<Omit<Version["Schema"], "log">>;
|
|
117
121
|
};
|
|
118
122
|
Projection: BaseLog.OpProjection & {
|
|
123
|
+
version?: Version["Projection"];
|
|
119
124
|
oper$log?: OakSelection<"select", Omit<Oper["Projection"], "log">, Omit<Oper["Filter"], "log">, Oper["Sorter"]> & {
|
|
120
125
|
$entity: "oper";
|
|
121
126
|
};
|
|
122
127
|
oper$log$$aggr?: DeduceAggregation<Omit<Oper["Projection"], "log">, Omit<Oper["Filter"], "log">, Oper["Sorter"]> & {
|
|
123
128
|
$entity: "oper";
|
|
124
129
|
};
|
|
130
|
+
version$log?: OakSelection<"select", Omit<Version["Projection"], "log">, Omit<Version["Filter"], "log">, Version["Sorter"]> & {
|
|
131
|
+
$entity: "version";
|
|
132
|
+
};
|
|
133
|
+
version$log$$aggr?: DeduceAggregation<Omit<Version["Projection"], "log">, Omit<Version["Filter"], "log">, Version["Sorter"]> & {
|
|
134
|
+
$entity: "version";
|
|
135
|
+
};
|
|
125
136
|
};
|
|
126
137
|
FilterUnit: BaseLog.OpFilter & {
|
|
138
|
+
version: MakeFilter<Version["FilterUnit"]>;
|
|
127
139
|
oper$log: MakeFilter<Omit<Oper["FilterUnit"], "log">> & SubQueryPredicateMetadata;
|
|
140
|
+
version$log: MakeFilter<Omit<Version["FilterUnit"], "log">> & SubQueryPredicateMetadata;
|
|
128
141
|
};
|
|
129
142
|
Filter: MakeFilter<Log["FilterUnit"]>;
|
|
130
|
-
SortAttr: Partial<BaseLog.OpSortAttr | {
|
|
143
|
+
SortAttr: Partial<BaseLog.OpSortAttr | {
|
|
144
|
+
version: Version["SortAttr"];
|
|
145
|
+
}>;
|
|
131
146
|
SortNode: {
|
|
132
147
|
$attr: Log["SortAttr"];
|
|
133
148
|
$direction?: "asc" | "desc";
|
|
@@ -136,13 +151,17 @@ export type Log = {
|
|
|
136
151
|
Selection: OakSelection<"select", Log["Projection"], Log["Filter"], Log["Sorter"]>;
|
|
137
152
|
Aggregation: DeduceAggregation<Log["Projection"], Log["Filter"], Log["Sorter"]>;
|
|
138
153
|
CreateOperationData: FormCreateData<BaseLog.OpSchema & {
|
|
154
|
+
version?: OakOperation<"create", Version["CreateOperationData"]> | OakOperation<BaseVersion.OpUpdateAction, Version["UpdateOperationData"], Version["Filter"]>;
|
|
139
155
|
oper$log?: (OakOperation<"create", Omit<Oper["CreateOperationData"], "log"> | Omit<Oper["CreateOperationData"], "log">[]> | OakOperation<BaseOper.OpUpdateAction, Omit<Oper["UpdateOperationData"], "log">, Oper["Filter"]>)[];
|
|
156
|
+
version$log?: (OakOperation<"create", Omit<Version["CreateOperationData"], "log"> | Omit<Version["CreateOperationData"], "log">[]> | OakOperation<BaseVersion.OpUpdateAction, Omit<Version["UpdateOperationData"], "log">, Version["Filter"]>)[];
|
|
140
157
|
}>;
|
|
141
158
|
CreateSingle: OakOperation<"create", Log["CreateOperationData"]>;
|
|
142
159
|
CreateMulti: OakOperation<"create", Array<Log["CreateOperationData"]>>;
|
|
143
160
|
Create: Log["CreateSingle"] | Log["CreateMulti"];
|
|
144
161
|
UpdateOperationData: FormUpdateData<BaseLog.OpSchema & {
|
|
162
|
+
version?: OakOperation<"create", Version["CreateOperationData"]> | OakOperation<BaseVersion.OpUpdateAction, Version["UpdateOperationData"], Version["Filter"]> | OakOperation<"remove", Version["RemoveOperationData"], Version["Filter"]>;
|
|
145
163
|
oper$log?: (OakOperation<"create", Omit<Oper["CreateOperationData"], "log"> | Omit<Oper["CreateOperationData"], "log">[]> | OakOperation<BaseOper.OpUpdateAction, Omit<Oper["UpdateOperationData"], "log">, Oper["Filter"]> | OakOperation<"remove", Oper["RemoveOperationData"], Oper["Filter"]>)[];
|
|
164
|
+
version$log?: (OakOperation<"create", Omit<Version["CreateOperationData"], "log"> | Omit<Version["CreateOperationData"], "log">[]> | OakOperation<BaseVersion.OpUpdateAction, Omit<Version["UpdateOperationData"], "log">, Version["Filter"]> | OakOperation<"remove", Version["RemoveOperationData"], Version["Filter"]>)[];
|
|
146
165
|
}>;
|
|
147
166
|
Update: OakOperation<BaseLog.OpUpdateAction, Log["UpdateOperationData"], Log["Filter"], Log["Sorter"]>;
|
|
148
167
|
RemoveOperationData: {};
|
|
@@ -513,10 +532,12 @@ export type User = {
|
|
|
513
532
|
user$ref?: Array<Omit<User["Schema"], "ref">>;
|
|
514
533
|
userEntityClaim$user?: Array<Omit<UserEntityClaim["Schema"], "user">>;
|
|
515
534
|
userRelation$user?: Array<Omit<UserRelation["Schema"], "user">>;
|
|
535
|
+
version$operator?: Array<Omit<Version["Schema"], "operator">>;
|
|
516
536
|
oper$operator$$aggr?: AggregationResult<Omit<Oper["Schema"], "operator">>;
|
|
517
537
|
user$ref$$aggr?: AggregationResult<Omit<User["Schema"], "ref">>;
|
|
518
538
|
userEntityClaim$user$$aggr?: AggregationResult<Omit<UserEntityClaim["Schema"], "user">>;
|
|
519
539
|
userRelation$user$$aggr?: AggregationResult<Omit<UserRelation["Schema"], "user">>;
|
|
540
|
+
version$operator$$aggr?: AggregationResult<Omit<Version["Schema"], "operator">>;
|
|
520
541
|
};
|
|
521
542
|
Projection: BaseUser.OpProjection & {
|
|
522
543
|
ref?: User["Projection"];
|
|
@@ -544,6 +565,12 @@ export type User = {
|
|
|
544
565
|
userRelation$user$$aggr?: DeduceAggregation<Omit<UserRelation["Projection"], "user">, Omit<UserRelation["Filter"], "user">, UserRelation["Sorter"]> & {
|
|
545
566
|
$entity: "userRelation";
|
|
546
567
|
};
|
|
568
|
+
version$operator?: OakSelection<"select", Omit<Version["Projection"], "user">, Omit<Version["Filter"], "user">, Version["Sorter"]> & {
|
|
569
|
+
$entity: "version";
|
|
570
|
+
};
|
|
571
|
+
version$operator$$aggr?: DeduceAggregation<Omit<Version["Projection"], "user">, Omit<Version["Filter"], "user">, Version["Sorter"]> & {
|
|
572
|
+
$entity: "version";
|
|
573
|
+
};
|
|
547
574
|
};
|
|
548
575
|
FilterUnit: BaseUser.OpFilter & {
|
|
549
576
|
ref: MakeFilter<User["FilterUnit"]>;
|
|
@@ -551,6 +578,7 @@ export type User = {
|
|
|
551
578
|
user$ref: MakeFilter<Omit<User["FilterUnit"], "ref">> & SubQueryPredicateMetadata;
|
|
552
579
|
userEntityClaim$user: MakeFilter<Omit<UserEntityClaim["FilterUnit"], "user">> & SubQueryPredicateMetadata;
|
|
553
580
|
userRelation$user: MakeFilter<Omit<UserRelation["FilterUnit"], "user">> & SubQueryPredicateMetadata;
|
|
581
|
+
version$operator: MakeFilter<Omit<Version["FilterUnit"], "operator">> & SubQueryPredicateMetadata;
|
|
554
582
|
};
|
|
555
583
|
Filter: MakeFilter<User["FilterUnit"]>;
|
|
556
584
|
SortAttr: Partial<BaseUser.OpSortAttr | {
|
|
@@ -569,6 +597,7 @@ export type User = {
|
|
|
569
597
|
user$ref?: (OakOperation<"create", Omit<User["CreateOperationData"], "ref"> | Omit<User["CreateOperationData"], "ref">[]> | OakOperation<BaseUser.OpUpdateAction, Omit<User["UpdateOperationData"], "ref">, User["Filter"]>)[];
|
|
570
598
|
userEntityClaim$user?: (OakOperation<"create", Omit<UserEntityClaim["CreateOperationData"], "user"> | Omit<UserEntityClaim["CreateOperationData"], "user">[]> | OakOperation<BaseUserEntityClaim.OpUpdateAction, Omit<UserEntityClaim["UpdateOperationData"], "user">, UserEntityClaim["Filter"]>)[];
|
|
571
599
|
userRelation$user?: (OakOperation<"create", Omit<UserRelation["CreateOperationData"], "user"> | Omit<UserRelation["CreateOperationData"], "user">[]> | OakOperation<BaseUserRelation.OpUpdateAction, Omit<UserRelation["UpdateOperationData"], "user">, UserRelation["Filter"]>)[];
|
|
600
|
+
version$operator?: (OakOperation<"create", Omit<Version["CreateOperationData"], "operator"> | Omit<Version["CreateOperationData"], "operator">[]> | OakOperation<BaseVersion.OpUpdateAction, Omit<Version["UpdateOperationData"], "operator">, Version["Filter"]>)[];
|
|
572
601
|
}>;
|
|
573
602
|
CreateSingle: OakOperation<"create", User["CreateOperationData"]>;
|
|
574
603
|
CreateMulti: OakOperation<"create", Array<User["CreateOperationData"]>>;
|
|
@@ -579,6 +608,7 @@ export type User = {
|
|
|
579
608
|
user$ref?: (OakOperation<"create", Omit<User["CreateOperationData"], "ref"> | Omit<User["CreateOperationData"], "ref">[]> | OakOperation<BaseUser.OpUpdateAction, Omit<User["UpdateOperationData"], "ref">, User["Filter"]> | OakOperation<"remove", User["RemoveOperationData"], User["Filter"]>)[];
|
|
580
609
|
userEntityClaim$user?: (OakOperation<"create", Omit<UserEntityClaim["CreateOperationData"], "user"> | Omit<UserEntityClaim["CreateOperationData"], "user">[]> | OakOperation<BaseUserEntityClaim.OpUpdateAction, Omit<UserEntityClaim["UpdateOperationData"], "user">, UserEntityClaim["Filter"]> | OakOperation<"remove", UserEntityClaim["RemoveOperationData"], UserEntityClaim["Filter"]>)[];
|
|
581
610
|
userRelation$user?: (OakOperation<"create", Omit<UserRelation["CreateOperationData"], "user"> | Omit<UserRelation["CreateOperationData"], "user">[]> | OakOperation<BaseUserRelation.OpUpdateAction, Omit<UserRelation["UpdateOperationData"], "user">, UserRelation["Filter"]> | OakOperation<"remove", UserRelation["RemoveOperationData"], UserRelation["Filter"]>)[];
|
|
611
|
+
version$operator?: (OakOperation<"create", Omit<Version["CreateOperationData"], "operator"> | Omit<Version["CreateOperationData"], "operator">[]> | OakOperation<BaseVersion.OpUpdateAction, Omit<Version["UpdateOperationData"], "operator">, Version["Filter"]> | OakOperation<"remove", Version["RemoveOperationData"], Version["Filter"]>)[];
|
|
582
612
|
}>;
|
|
583
613
|
Update: OakOperation<BaseUser.OpUpdateAction, User["UpdateOperationData"], User["Filter"], User["Sorter"]>;
|
|
584
614
|
RemoveOperationData: {};
|
|
@@ -735,6 +765,60 @@ export type UserRelation = {
|
|
|
735
765
|
Remove: OakOperation<"remove", UserRelation["RemoveOperationData"], UserRelation["Filter"], UserRelation["Sorter"]>;
|
|
736
766
|
Operation: UserRelation["Create"] | UserRelation["Update"] | UserRelation["Remove"];
|
|
737
767
|
};
|
|
768
|
+
export type Version = {
|
|
769
|
+
OpSchema: BaseVersion.OpSchema;
|
|
770
|
+
Action: BaseVersion.OpAction;
|
|
771
|
+
Schema: BaseVersion.OpSchema & {
|
|
772
|
+
operator?: User["Schema"];
|
|
773
|
+
log?: Log["Schema"];
|
|
774
|
+
log$version?: Array<Omit<Log["Schema"], "version">>;
|
|
775
|
+
log$version$$aggr?: AggregationResult<Omit<Log["Schema"], "version">>;
|
|
776
|
+
};
|
|
777
|
+
Projection: BaseVersion.OpProjection & {
|
|
778
|
+
operator?: User["Projection"];
|
|
779
|
+
log?: Log["Projection"];
|
|
780
|
+
log$version?: OakSelection<"select", Omit<Log["Projection"], "version">, Omit<Log["Filter"], "version">, Log["Sorter"]> & {
|
|
781
|
+
$entity: "log";
|
|
782
|
+
};
|
|
783
|
+
log$version$$aggr?: DeduceAggregation<Omit<Log["Projection"], "version">, Omit<Log["Filter"], "version">, Log["Sorter"]> & {
|
|
784
|
+
$entity: "log";
|
|
785
|
+
};
|
|
786
|
+
};
|
|
787
|
+
FilterUnit: BaseVersion.OpFilter & {
|
|
788
|
+
operator: MakeFilter<User["FilterUnit"]>;
|
|
789
|
+
log: MakeFilter<Log["FilterUnit"]>;
|
|
790
|
+
log$version: MakeFilter<Omit<Log["FilterUnit"], "version">> & SubQueryPredicateMetadata;
|
|
791
|
+
};
|
|
792
|
+
Filter: MakeFilter<Version["FilterUnit"]>;
|
|
793
|
+
SortAttr: Partial<BaseVersion.OpSortAttr | {
|
|
794
|
+
operator: User["SortAttr"];
|
|
795
|
+
log: Log["SortAttr"];
|
|
796
|
+
}>;
|
|
797
|
+
SortNode: {
|
|
798
|
+
$attr: Version["SortAttr"];
|
|
799
|
+
$direction?: "asc" | "desc";
|
|
800
|
+
};
|
|
801
|
+
Sorter: Version["SortNode"][];
|
|
802
|
+
Selection: OakSelection<"select", Version["Projection"], Version["Filter"], Version["Sorter"]>;
|
|
803
|
+
Aggregation: DeduceAggregation<Version["Projection"], Version["Filter"], Version["Sorter"]>;
|
|
804
|
+
CreateOperationData: FormCreateData<BaseVersion.OpSchema & {
|
|
805
|
+
operator?: OakOperation<"create", User["CreateOperationData"]> | OakOperation<BaseUser.OpUpdateAction, User["UpdateOperationData"], User["Filter"]>;
|
|
806
|
+
log?: OakOperation<"create", Log["CreateOperationData"]> | OakOperation<BaseLog.OpUpdateAction, Log["UpdateOperationData"], Log["Filter"]>;
|
|
807
|
+
log$version?: (OakOperation<"create", Omit<Log["CreateOperationData"], "version"> | Omit<Log["CreateOperationData"], "version">[]> | OakOperation<BaseLog.OpUpdateAction, Omit<Log["UpdateOperationData"], "version">, Log["Filter"]>)[];
|
|
808
|
+
}>;
|
|
809
|
+
CreateSingle: OakOperation<"create", Version["CreateOperationData"]>;
|
|
810
|
+
CreateMulti: OakOperation<"create", Array<Version["CreateOperationData"]>>;
|
|
811
|
+
Create: Version["CreateSingle"] | Version["CreateMulti"];
|
|
812
|
+
UpdateOperationData: FormUpdateData<BaseVersion.OpSchema & {
|
|
813
|
+
operator?: OakOperation<"create", User["CreateOperationData"]> | OakOperation<BaseUser.OpUpdateAction, User["UpdateOperationData"], User["Filter"]> | OakOperation<"remove", User["RemoveOperationData"], User["Filter"]>;
|
|
814
|
+
log?: OakOperation<"create", Log["CreateOperationData"]> | OakOperation<BaseLog.OpUpdateAction, Log["UpdateOperationData"], Log["Filter"]> | OakOperation<"remove", Log["RemoveOperationData"], Log["Filter"]>;
|
|
815
|
+
log$version?: (OakOperation<"create", Omit<Log["CreateOperationData"], "version"> | Omit<Log["CreateOperationData"], "version">[]> | OakOperation<BaseLog.OpUpdateAction, Omit<Log["UpdateOperationData"], "version">, Log["Filter"]> | OakOperation<"remove", Log["RemoveOperationData"], Log["Filter"]>)[];
|
|
816
|
+
}>;
|
|
817
|
+
Update: OakOperation<BaseVersion.OpUpdateAction, Version["UpdateOperationData"], Version["Filter"], Version["Sorter"]>;
|
|
818
|
+
RemoveOperationData: {};
|
|
819
|
+
Remove: OakOperation<"remove", Version["RemoveOperationData"], Version["Filter"], Version["Sorter"]>;
|
|
820
|
+
Operation: Version["Create"] | Version["Update"] | Version["Remove"];
|
|
821
|
+
};
|
|
738
822
|
export type EntityDict = {
|
|
739
823
|
actionAuth: ActionAuth;
|
|
740
824
|
i18n: I18n;
|
|
@@ -751,4 +835,5 @@ export type EntityDict = {
|
|
|
751
835
|
userEntityClaim: UserEntityClaim;
|
|
752
836
|
userEntityGrant: UserEntityGrant;
|
|
753
837
|
userRelation: UserRelation;
|
|
838
|
+
version: Version;
|
|
754
839
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ForeignKey } from "../../types/DataType";
|
|
1
2
|
import { Q_DateValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, ExprOp, ExpressionKey } from "../../types/Demand";
|
|
2
3
|
import { MakeAction as OakMakeAction, EntityShape } from "../../types/Entity";
|
|
3
4
|
import { Action, ParticularAction } from "./Action";
|
|
@@ -5,6 +6,7 @@ import { String } from "../../types/DataType";
|
|
|
5
6
|
export type OpSchema = EntityShape & {
|
|
6
7
|
entity: String<32>;
|
|
7
8
|
entityId: String<64>;
|
|
9
|
+
versionId?: ForeignKey<"version"> | null;
|
|
8
10
|
iState: "normal" | "rollbacked";
|
|
9
11
|
} & {
|
|
10
12
|
[A in ExpressionKey]?: any;
|
|
@@ -17,6 +19,7 @@ export type OpFilter = {
|
|
|
17
19
|
$$updateAt$$: Q_DateValue;
|
|
18
20
|
entity: Q_StringValue;
|
|
19
21
|
entityId: Q_StringValue;
|
|
22
|
+
versionId: Q_StringValue;
|
|
20
23
|
iState: Q_EnumValue<"normal" | "rollbacked">;
|
|
21
24
|
} & ExprOp<OpAttr | string>;
|
|
22
25
|
export type OpProjection = {
|
|
@@ -28,6 +31,7 @@ export type OpProjection = {
|
|
|
28
31
|
$$seq$$?: number;
|
|
29
32
|
entity?: number;
|
|
30
33
|
entityId?: number;
|
|
34
|
+
versionId?: number;
|
|
31
35
|
iState?: number;
|
|
32
36
|
} & Partial<ExprOp<OpAttr | string>>;
|
|
33
37
|
export type OpSortAttr = Partial<{
|
|
@@ -37,6 +41,7 @@ export type OpSortAttr = Partial<{
|
|
|
37
41
|
$$updateAt$$: number;
|
|
38
42
|
entity: number;
|
|
39
43
|
entityId: number;
|
|
44
|
+
versionId: number;
|
|
40
45
|
iState: number;
|
|
41
46
|
[k: string]: any;
|
|
42
47
|
} | ExprOp<OpAttr | string>>;
|
|
@@ -13,6 +13,7 @@ import { desc as userDesc } from "./User/Storage";
|
|
|
13
13
|
import { desc as userEntityClaimDesc } from "./UserEntityClaim/Storage";
|
|
14
14
|
import { desc as userEntityGrantDesc } from "./UserEntityGrant/Storage";
|
|
15
15
|
import { desc as userRelationDesc } from "./UserRelation/Storage";
|
|
16
|
+
import { desc as versionDesc } from "./Version/Storage";
|
|
16
17
|
export const storageSchema = {
|
|
17
18
|
actionAuth: actionAuthDesc,
|
|
18
19
|
i18n: i18nDesc,
|
|
@@ -28,5 +29,6 @@ export const storageSchema = {
|
|
|
28
29
|
user: userDesc,
|
|
29
30
|
userEntityClaim: userEntityClaimDesc,
|
|
30
31
|
userEntityGrant: userEntityGrantDesc,
|
|
31
|
-
userRelation: userRelationDesc
|
|
32
|
+
userRelation: userRelationDesc,
|
|
33
|
+
version: versionDesc
|
|
32
34
|
};
|
|
@@ -3,10 +3,12 @@ import { style as log } from "./Log/Style";
|
|
|
3
3
|
import { style as modi } from "./Modi/Style";
|
|
4
4
|
import { style as oper } from "./Oper/Style";
|
|
5
5
|
import { style as user } from "./User/Style";
|
|
6
|
+
import { style as version } from "./Version/Style";
|
|
6
7
|
export const styleDict = {
|
|
7
8
|
localizedContent,
|
|
8
9
|
log,
|
|
9
10
|
modi,
|
|
10
11
|
oper,
|
|
11
|
-
user
|
|
12
|
+
user,
|
|
13
|
+
version
|
|
12
14
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { GenericAction } from "../../actions/action";
|
|
2
|
+
export type IAction = 'undo' | 'redo' | string;
|
|
3
|
+
export type ParticularAction = IAction;
|
|
4
|
+
export declare const actions: string[];
|
|
5
|
+
export type Action = GenericAction | ParticularAction | string;
|
|
6
|
+
export declare const actionDefDict: {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export * from "./_baseSchema";
|
|
2
|
+
import { Version } from "../EntityDict";
|
|
3
|
+
export type Schema = Version["Schema"];
|
|
4
|
+
export type Action = Version["Action"];
|
|
5
|
+
export type Projection = Version["Projection"];
|
|
6
|
+
export type Filter = Version["Filter"];
|
|
7
|
+
export type SortNode = Version["SortNode"];
|
|
8
|
+
export type Sorter = Version["Sorter"];
|
|
9
|
+
export type Selection = Version["Selection"];
|
|
10
|
+
export type Aggregation = Version["Aggregation"];
|
|
11
|
+
export type CreateOperationData = Version["CreateOperationData"];
|
|
12
|
+
export type CreateSingle = Version["CreateSingle"];
|
|
13
|
+
export type CreateMulti = Version["CreateMulti"];
|
|
14
|
+
export type Create = Version["Create"];
|
|
15
|
+
export type UpdateOperationData = Version["UpdateOperationData"];
|
|
16
|
+
export type Update = Version["Update"];
|
|
17
|
+
export type RemoveOperationData = Version["RemoveOperationData"];
|
|
18
|
+
export type Remove = Version["Remove"];
|
|
19
|
+
export type Operation = Version["Operation"];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./_baseSchema";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { actions } from "./Action";
|
|
2
|
+
export const desc = {
|
|
3
|
+
attributes: {
|
|
4
|
+
entity: {
|
|
5
|
+
notNull: true,
|
|
6
|
+
type: "varchar",
|
|
7
|
+
params: {
|
|
8
|
+
length: 32
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
entityId: {
|
|
12
|
+
notNull: true,
|
|
13
|
+
type: "varchar",
|
|
14
|
+
params: {
|
|
15
|
+
length: 64
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
name: {
|
|
19
|
+
notNull: true,
|
|
20
|
+
type: "varchar",
|
|
21
|
+
params: {
|
|
22
|
+
length: 128
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
operatorId: {
|
|
26
|
+
type: "ref",
|
|
27
|
+
ref: "user"
|
|
28
|
+
},
|
|
29
|
+
logId: {
|
|
30
|
+
type: "ref",
|
|
31
|
+
ref: "log"
|
|
32
|
+
},
|
|
33
|
+
iState: {
|
|
34
|
+
notNull: true,
|
|
35
|
+
type: "enum",
|
|
36
|
+
enumeration: ["normal", "rollbacked"]
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
actionType: "crud",
|
|
40
|
+
actions,
|
|
41
|
+
indexes: [
|
|
42
|
+
{
|
|
43
|
+
name: "index_log_unique",
|
|
44
|
+
attributes: [
|
|
45
|
+
{
|
|
46
|
+
name: "logId"
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
config: {
|
|
50
|
+
unique: true
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ForeignKey } from "../../types/DataType";
|
|
2
|
+
import { Q_DateValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, ExprOp, ExpressionKey } from "../../types/Demand";
|
|
3
|
+
import { MakeAction as OakMakeAction, EntityShape } from "../../types/Entity";
|
|
4
|
+
import { Action, ParticularAction } from "./Action";
|
|
5
|
+
import { String } from "../../types/DataType";
|
|
6
|
+
export type OpSchema = EntityShape & {
|
|
7
|
+
entity: String<32>;
|
|
8
|
+
entityId: String<64>;
|
|
9
|
+
name: String<128>;
|
|
10
|
+
operatorId?: ForeignKey<"user"> | null;
|
|
11
|
+
logId?: ForeignKey<"log"> | null;
|
|
12
|
+
iState: "normal" | "rollbacked";
|
|
13
|
+
} & {
|
|
14
|
+
[A in ExpressionKey]?: any;
|
|
15
|
+
};
|
|
16
|
+
export type OpAttr = keyof OpSchema;
|
|
17
|
+
export type OpFilter = {
|
|
18
|
+
id: Q_StringValue;
|
|
19
|
+
$$createAt$$: Q_DateValue;
|
|
20
|
+
$$seq$$: Q_NumberValue;
|
|
21
|
+
$$updateAt$$: Q_DateValue;
|
|
22
|
+
entity: Q_StringValue;
|
|
23
|
+
entityId: Q_StringValue;
|
|
24
|
+
name: Q_StringValue;
|
|
25
|
+
operatorId: Q_StringValue;
|
|
26
|
+
logId: Q_StringValue;
|
|
27
|
+
iState: Q_EnumValue<"normal" | "rollbacked">;
|
|
28
|
+
} & ExprOp<OpAttr | string>;
|
|
29
|
+
export type OpProjection = {
|
|
30
|
+
"#id"?: NodeId;
|
|
31
|
+
[k: string]: any;
|
|
32
|
+
id?: number;
|
|
33
|
+
$$createAt$$?: number;
|
|
34
|
+
$$updateAt$$?: number;
|
|
35
|
+
$$seq$$?: number;
|
|
36
|
+
entity?: number;
|
|
37
|
+
entityId?: number;
|
|
38
|
+
name?: number;
|
|
39
|
+
operatorId?: number;
|
|
40
|
+
logId?: number;
|
|
41
|
+
iState?: number;
|
|
42
|
+
} & Partial<ExprOp<OpAttr | string>>;
|
|
43
|
+
export type OpSortAttr = Partial<{
|
|
44
|
+
id: number;
|
|
45
|
+
$$createAt$$: number;
|
|
46
|
+
$$seq$$: number;
|
|
47
|
+
$$updateAt$$: number;
|
|
48
|
+
entity: number;
|
|
49
|
+
entityId: number;
|
|
50
|
+
name: number;
|
|
51
|
+
operatorId: number;
|
|
52
|
+
logId: number;
|
|
53
|
+
iState: number;
|
|
54
|
+
[k: string]: any;
|
|
55
|
+
} | ExprOp<OpAttr | string>>;
|
|
56
|
+
export type OpAction = OakMakeAction<Action | string>;
|
|
57
|
+
export type OpUpdateAction = "update" | ParticularAction | string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -27,6 +27,7 @@ export declare function writeContextCompositionFiles(cwd: string, isModule: bool
|
|
|
27
27
|
export declare function renderFeatureIndexSource(dependencies: string[], briefNames: string[], sourceFile: ts.SourceFile, isModule: boolean, printer?: ts.Printer): string;
|
|
28
28
|
export declare function renderInitializeFeaturesSource(cwd: string, dependencies: string[], briefNames: string[], sourceFile: ts.SourceFile, printer?: ts.Printer): string;
|
|
29
29
|
export declare function resolveDependencyTemplateFile(cwd: string, dependencies: string[], templateFileName: string, fallback: string): string;
|
|
30
|
+
export declare function renderSystemEntitySource(dependencies: string[], cwd: string): string | undefined;
|
|
30
31
|
export declare function initializeDependencyTemplates(cwd?: string, rebuild?: boolean): string[];
|
|
31
32
|
/**
|
|
32
33
|
* 本函数用于构建src/initialize.dev, src/initialize.prod, src/initializeFeatures, src/context/FrontendContext, src/contextBackendContext
|
|
@@ -961,7 +961,37 @@ export function resolveDependencyTemplateFile(cwd, dependencies, templateFileNam
|
|
|
961
961
|
function injectDataIndexFile(dataIndexFile, briefNames, printer) {
|
|
962
962
|
const sourceFile = ts.createSourceFile('index.ts', readFileSync(dataIndexFile, 'utf-8'), ts.ScriptTarget.Latest, false, ts.ScriptKind.TS);
|
|
963
963
|
const { statements } = sourceFile;
|
|
964
|
-
const
|
|
964
|
+
const existingSpreads = new Set();
|
|
965
|
+
const exportStmt = statements[statements.length - 1];
|
|
966
|
+
assert(ts.isExportAssignment(exportStmt));
|
|
967
|
+
const { expression } = exportStmt;
|
|
968
|
+
assert(ts.isObjectLiteralExpression(expression));
|
|
969
|
+
const { properties } = expression;
|
|
970
|
+
properties.forEach((prop) => {
|
|
971
|
+
if (ts.isSpreadAssignment(prop)) {
|
|
972
|
+
existingSpreads.add(prop.expression.getText());
|
|
973
|
+
}
|
|
974
|
+
});
|
|
975
|
+
// data/index.ts 可能来自项目模板(如 create --template blog 自行 import 了同名数据文件),
|
|
976
|
+
// 注入前按 import 声明与 export 展分别去重,避免注入出重复标识符导致编译失败。
|
|
977
|
+
const injectImports = [];
|
|
978
|
+
const injectSpreads = [];
|
|
979
|
+
briefNames.forEach((ele) => {
|
|
980
|
+
const hasImport = statements.some((stmt) => ts.isImportDeclaration(stmt)
|
|
981
|
+
&& stmt.moduleSpecifier.text === `./${ele}Data`
|
|
982
|
+
&& !!stmt.importClause?.name
|
|
983
|
+
&& stmt.importClause.name.text === `${ele}Data`);
|
|
984
|
+
if (!hasImport) {
|
|
985
|
+
injectImports.push(ele);
|
|
986
|
+
}
|
|
987
|
+
if (!existingSpreads.has(`${ele}Data`)) {
|
|
988
|
+
injectSpreads.push(ele);
|
|
989
|
+
}
|
|
990
|
+
});
|
|
991
|
+
if (injectImports.length === 0 && injectSpreads.length === 0) {
|
|
992
|
+
console.log(`data/index.ts中${briefNames.join('、')}的引用已存在,跳过注入`);
|
|
993
|
+
return;
|
|
994
|
+
}
|
|
965
995
|
/**
|
|
966
996
|
* 在文件末尾的这个位置上注入引用
|
|
967
997
|
export default {
|
|
@@ -972,24 +1002,19 @@ function injectDataIndexFile(dataIndexFile, briefNames, printer) {
|
|
|
972
1002
|
i18n,
|
|
973
1003
|
};
|
|
974
1004
|
*/
|
|
975
|
-
const exportStmt = statements[statements.length - 1];
|
|
976
|
-
assert(ts.isExportAssignment(exportStmt));
|
|
977
|
-
const { expression } = exportStmt;
|
|
978
|
-
assert(ts.isObjectLiteralExpression(expression));
|
|
979
|
-
const { properties } = expression;
|
|
980
1005
|
Object.assign(expression, {
|
|
981
1006
|
properties: [
|
|
982
1007
|
...properties,
|
|
983
|
-
...
|
|
1008
|
+
...injectSpreads.map((ele) => factory.createSpreadAssignment(factory.createIdentifier(`${ele}Data`)))
|
|
984
1009
|
]
|
|
985
1010
|
});
|
|
986
1011
|
const statements2 = [
|
|
987
|
-
...
|
|
1012
|
+
...injectImports.map((ele) => factory.createImportDeclaration(undefined, factory.createImportClause(false, factory.createIdentifier(`${ele}Data`), undefined), factory.createStringLiteral(`./${ele}Data`), undefined)),
|
|
988
1013
|
...statements,
|
|
989
1014
|
];
|
|
990
1015
|
const result = printer.printList(ts.ListFormat.SourceFileStatements, factory.createNodeArray(statements2), sourceFile);
|
|
991
1016
|
writeGeneratedFile(dataIndexFile, result);
|
|
992
|
-
console.log(`注入${dataIndexFile}文件成功,共注入了${
|
|
1017
|
+
console.log(`注入${dataIndexFile}文件成功,共注入了${injectImports.length}个 import 与 ${injectSpreads.length} 个 export 引用`);
|
|
993
1018
|
}
|
|
994
1019
|
/**
|
|
995
1020
|
* 将依赖项目的目录去覆盖原来的目录
|
|
@@ -1072,6 +1097,65 @@ function tryCopyModuleTemplateFiles(cwd, dependencies, briefNames, printer, rebu
|
|
|
1072
1097
|
injectDataIndexFile(join(cwd, 'src', 'data', 'index.ts'), injectDataIndexFileBriefNames, printer);
|
|
1073
1098
|
}
|
|
1074
1099
|
}
|
|
1100
|
+
function makeSystemAlias(packageName, usedAliases) {
|
|
1101
|
+
const packageBaseName = packageName
|
|
1102
|
+
.replace(/^@/, '')
|
|
1103
|
+
.replace(/[\\/]/g, '-')
|
|
1104
|
+
.split('-')
|
|
1105
|
+
.filter(Boolean)
|
|
1106
|
+
.map((part) => `${part[0].toUpperCase()}${part.slice(1)}`)
|
|
1107
|
+
.join('')
|
|
1108
|
+
.replace(/^Oak/, '')
|
|
1109
|
+
.replace(/Business$/, '') || 'Dependency';
|
|
1110
|
+
const baseAlias = `${packageBaseName}System`;
|
|
1111
|
+
let alias = baseAlias;
|
|
1112
|
+
let index = 2;
|
|
1113
|
+
while (usedAliases.has(alias)) {
|
|
1114
|
+
alias = `${baseAlias}${index}`;
|
|
1115
|
+
index += 1;
|
|
1116
|
+
}
|
|
1117
|
+
usedAliases.add(alias);
|
|
1118
|
+
return alias;
|
|
1119
|
+
}
|
|
1120
|
+
export function renderSystemEntitySource(dependencies, cwd) {
|
|
1121
|
+
const usedAliases = new Set();
|
|
1122
|
+
const imports = [];
|
|
1123
|
+
const schemas = [];
|
|
1124
|
+
dependencies.forEach((dependency) => {
|
|
1125
|
+
const dependencyDir = resolveInstalledPackageDir(cwd, dependency);
|
|
1126
|
+
if (!dependencyDir) {
|
|
1127
|
+
return;
|
|
1128
|
+
}
|
|
1129
|
+
const manifestPath = join(dependencyDir, 'package.json');
|
|
1130
|
+
const manifest = JSON.parse(readFileSync(manifestPath, 'utf-8'));
|
|
1131
|
+
if (!isOakBusinessModule(manifest)) {
|
|
1132
|
+
return;
|
|
1133
|
+
}
|
|
1134
|
+
const systemDeclaration = join(dependencyDir, 'es', 'entities', 'System.d.ts');
|
|
1135
|
+
if (!existsSync(systemDeclaration)) {
|
|
1136
|
+
return;
|
|
1137
|
+
}
|
|
1138
|
+
const alias = makeSystemAlias(dependency, usedAliases);
|
|
1139
|
+
imports.push(`import { Schema as ${alias} } from '${makeOakImport(dependency, 'entities/System')}';`);
|
|
1140
|
+
schemas.push(alias);
|
|
1141
|
+
});
|
|
1142
|
+
if (schemas.length === 0) {
|
|
1143
|
+
return undefined;
|
|
1144
|
+
}
|
|
1145
|
+
return `${imports.join('\n')}\nimport { EntityDesc } from '@oak-domain/types';\n\nexport interface Schema extends ${schemas.join(', ')} {}\n\nexport type Relation = 'owner' | 'manager';\n\nexport const entityDesc: EntityDesc<Schema, '', Relation> = {\n locales: {\n zh_CN: {\n name: '系统',\n attr: {\n name: '名称',\n description: '描述',\n config: '设置',\n platform: '平台',\n super: '超级系统',\n folder: '代码目录名',\n style: '样式',\n entity: '关联对象',\n entityId: '关联对象id',\n oldestVersion: '最早支持版本',\n },\n r: {\n owner: '所有者',\n manager: '管理员',\n },\n },\n },\n};\n`;
|
|
1146
|
+
}
|
|
1147
|
+
function ensureSystemEntity(cwd, dependencies, rebuild) {
|
|
1148
|
+
const systemFile = join(cwd, 'src', 'entities', 'System.ts');
|
|
1149
|
+
if (existsSync(systemFile) && !rebuild) {
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1152
|
+
const source = renderSystemEntitySource(dependencies, cwd);
|
|
1153
|
+
if (!source) {
|
|
1154
|
+
return;
|
|
1155
|
+
}
|
|
1156
|
+
writeGeneratedFile(systemFile, source);
|
|
1157
|
+
console.log(`${rebuild ? '重建' : '生成'}${systemFile}`);
|
|
1158
|
+
}
|
|
1075
1159
|
function resolveDependencyBuildContext(cwd) {
|
|
1076
1160
|
const webDir = join(cwd, 'web');
|
|
1077
1161
|
const isModule = !existsSync(webDir); // 如果没有web目录,说明是module,不需要处理应用模板注入
|
|
@@ -1098,6 +1182,7 @@ export function initializeDependencyTemplates(cwd = process.cwd(), rebuild) {
|
|
|
1098
1182
|
}
|
|
1099
1183
|
const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed });
|
|
1100
1184
|
tryCopyModuleTemplateFiles(cwd, dependencies, briefNames, printer, rebuild);
|
|
1185
|
+
ensureSystemEntity(cwd, dependencies, rebuild);
|
|
1101
1186
|
return dependencies;
|
|
1102
1187
|
}
|
|
1103
1188
|
/**
|
|
@@ -24,14 +24,17 @@ type NamespaceConfig = {
|
|
|
24
24
|
params?: Record<string, string>;
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
|
+
type RouterPlatform = 'web' | 'native' | 'miniProgram' | 'wechatMp';
|
|
27
28
|
type BuildRouterOptions = {
|
|
29
|
+
/** `wechatMp` is retained as a compatibility alias for `miniProgram`. */
|
|
30
|
+
platform: RouterPlatform;
|
|
28
31
|
useOutlet?: boolean;
|
|
29
32
|
onWarning?: (message: string) => void;
|
|
30
33
|
getPageConfig?: (pageDirectoryPath: string) => PageConfig | undefined;
|
|
31
34
|
getNamespaceConfig?: (namespaceDirectoryPath: string, namespace: string) => NamespaceConfig | undefined;
|
|
32
35
|
};
|
|
33
36
|
declare function closeCurrentWatchSession(): void;
|
|
34
|
-
export declare function buildRouter(projectDir: string, startupDir: string, watch
|
|
37
|
+
export declare function buildRouter(projectDir: string, startupDir: string, watch: boolean, options: BuildRouterOptions): {
|
|
35
38
|
close: typeof closeCurrentWatchSession;
|
|
36
39
|
} | undefined;
|
|
37
40
|
export {};
|