oak-domain 3.0.2 → 3.0.4

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.
Files changed (157) hide show
  1. package/lib/actions/action.d.ts +8 -8
  2. package/lib/actions/action.js +2 -2
  3. package/lib/actions/relation.d.ts +1 -1
  4. package/lib/actions/relation.js +9 -22
  5. package/lib/base-app-domain/ActionAuth/Schema.d.ts +68 -42
  6. package/lib/base-app-domain/ActionAuth/Storage.js +12 -15
  7. package/lib/base-app-domain/ActionDefDict.d.ts +2 -3
  8. package/lib/base-app-domain/ActionDefDict.js +3 -5
  9. package/lib/base-app-domain/EntityDict.d.ts +5 -1
  10. package/lib/base-app-domain/I18n/Schema.d.ts +24 -24
  11. package/lib/base-app-domain/I18n/Storage.js +5 -5
  12. package/lib/base-app-domain/Modi/Action.d.ts +4 -4
  13. package/lib/base-app-domain/Modi/Action.js +3 -3
  14. package/lib/base-app-domain/Modi/Schema.d.ts +24 -24
  15. package/lib/base-app-domain/Modi/Storage.js +3 -3
  16. package/lib/base-app-domain/ModiEntity/Schema.d.ts +128 -55
  17. package/lib/base-app-domain/ModiEntity/Storage.js +2 -2
  18. package/lib/base-app-domain/Oper/Schema.d.ts +30 -29
  19. package/lib/base-app-domain/Oper/Storage.js +1 -1
  20. package/lib/base-app-domain/OperEntity/Schema.d.ts +126 -53
  21. package/lib/base-app-domain/OperEntity/Storage.js +2 -2
  22. package/lib/base-app-domain/Path/Schema.d.ts +149 -0
  23. package/lib/base-app-domain/Path/Schema.js +2 -0
  24. package/lib/base-app-domain/Path/Storage.d.ts +3 -0
  25. package/lib/base-app-domain/Path/Storage.js +54 -0
  26. package/lib/base-app-domain/Relation/Schema.d.ts +34 -34
  27. package/lib/base-app-domain/Relation/Storage.js +6 -6
  28. package/lib/base-app-domain/Relation.d.ts +0 -8
  29. package/lib/base-app-domain/Relation.js +1 -7
  30. package/lib/base-app-domain/RelationAuth/Schema.d.ts +74 -40
  31. package/lib/base-app-domain/RelationAuth/Storage.js +9 -11
  32. package/lib/base-app-domain/Storage.js +20 -16
  33. package/lib/base-app-domain/User/Action.d.ts +4 -4
  34. package/lib/base-app-domain/User/Action.js +3 -3
  35. package/lib/base-app-domain/User/Schema.d.ts +40 -27
  36. package/lib/base-app-domain/User/Storage.js +1 -1
  37. package/lib/base-app-domain/UserEntityClaim/Schema.d.ts +264 -0
  38. package/lib/base-app-domain/UserEntityClaim/Schema.js +2 -0
  39. package/lib/base-app-domain/UserEntityClaim/Storage.d.ts +3 -0
  40. package/lib/base-app-domain/UserEntityClaim/Storage.js +37 -0
  41. package/lib/base-app-domain/UserEntityGrant/Action.d.ts +2 -2
  42. package/lib/base-app-domain/UserEntityGrant/Schema.d.ts +55 -81
  43. package/lib/base-app-domain/UserEntityGrant/Storage.js +7 -11
  44. package/lib/base-app-domain/UserRelation/Schema.d.ts +50 -36
  45. package/lib/base-app-domain/UserRelation/Storage.js +7 -7
  46. package/lib/base-app-domain/_SubQuery.d.ts +45 -15
  47. package/lib/base-app-domain/index.js +1 -1
  48. package/lib/checkers/index.js +6 -7
  49. package/lib/compiler/env.js +16 -18
  50. package/lib/compiler/localeBuilder.js +83 -79
  51. package/lib/compiler/schemalBuilder.d.ts +16 -0
  52. package/lib/compiler/schemalBuilder.js +1160 -1378
  53. package/lib/entities/ActionAuth.d.ts +3 -5
  54. package/lib/entities/ActionAuth.js +9 -7
  55. package/lib/entities/I18n.js +1 -1
  56. package/lib/entities/Modi.js +2 -2
  57. package/lib/entities/ModiEntity.js +1 -1
  58. package/lib/entities/Oper.js +1 -1
  59. package/lib/entities/OperEntity.js +1 -1
  60. package/lib/entities/Path.d.ts +8 -0
  61. package/lib/entities/Path.js +35 -0
  62. package/lib/entities/Relation.js +1 -1
  63. package/lib/entities/RelationAuth.d.ts +2 -2
  64. package/lib/entities/RelationAuth.js +1 -1
  65. package/lib/entities/User.js +2 -2
  66. package/lib/entities/UserEntityClaim.d.ts +13 -0
  67. package/lib/entities/UserEntityClaim.js +17 -0
  68. package/lib/entities/UserEntityGrant.d.ts +5 -4
  69. package/lib/entities/UserEntityGrant.js +4 -7
  70. package/lib/entities/UserRelation.js +1 -1
  71. package/lib/index.d.ts +23 -0
  72. package/lib/index.js +37 -0
  73. package/lib/store/AsyncRowStore.d.ts +2 -1
  74. package/lib/store/AsyncRowStore.js +75 -149
  75. package/lib/store/CascadeStore.js +968 -1341
  76. package/lib/store/RelationAuth.d.ts +9 -16
  77. package/lib/store/RelationAuth.js +752 -910
  78. package/lib/store/SyncRowStore.d.ts +1 -1
  79. package/lib/store/SyncRowStore.js +27 -26
  80. package/lib/store/TriggerExecutor.d.ts +17 -10
  81. package/lib/store/TriggerExecutor.js +350 -423
  82. package/lib/store/actionAuth.js +13 -28
  83. package/lib/store/actionDef.js +142 -215
  84. package/lib/store/checker.js +225 -361
  85. package/lib/store/filter.d.ts +2 -3
  86. package/lib/store/filter.js +451 -589
  87. package/lib/store/modi.js +116 -177
  88. package/lib/store/relation.js +17 -17
  89. package/lib/timers/oper.d.ts +1 -1
  90. package/lib/timers/oper.js +44 -47
  91. package/lib/timers/vaccum.d.ts +2 -2
  92. package/lib/timers/vaccum.js +100 -165
  93. package/lib/triggers/index.js +1 -1
  94. package/lib/types/Action.d.ts +7 -7
  95. package/lib/types/AppLoader.d.ts +8 -2
  96. package/lib/types/AppLoader.js +4 -4
  97. package/lib/types/Auth.d.ts +15 -19
  98. package/lib/types/Connector.d.ts +19 -14
  99. package/lib/types/Connector.js +0 -7
  100. package/lib/types/DataType.d.ts +19 -18
  101. package/lib/types/DataType.js +1 -1
  102. package/lib/types/Demand.d.ts +25 -25
  103. package/lib/types/Endpoint.d.ts +1 -1
  104. package/lib/types/Entity.d.ts +62 -53
  105. package/lib/types/Entity.js +4 -3
  106. package/lib/types/EntityDesc.d.ts +2 -1
  107. package/lib/types/Environment.d.ts +4 -4
  108. package/lib/types/Exception.d.ts +34 -2
  109. package/lib/types/Exception.js +214 -197
  110. package/lib/types/Expression.d.ts +14 -14
  111. package/lib/types/Expression.js +54 -87
  112. package/lib/types/Geo.d.ts +6 -6
  113. package/lib/types/Locale.d.ts +5 -5
  114. package/lib/types/Polyfill.d.ts +9 -9
  115. package/lib/types/Port.d.ts +4 -4
  116. package/lib/types/RowStore.d.ts +3 -3
  117. package/lib/types/RowStore.js +18 -19
  118. package/lib/types/Storage.d.ts +5 -4
  119. package/lib/types/Style.d.ts +2 -2
  120. package/lib/types/Timer.d.ts +3 -3
  121. package/lib/types/Trigger.d.ts +30 -14
  122. package/lib/types/Trigger.js +6 -2
  123. package/lib/types/Watcher.d.ts +2 -2
  124. package/lib/types/index.d.ts +1 -0
  125. package/lib/types/index.js +2 -1
  126. package/lib/types/schema/DataTypes.d.ts +7 -7
  127. package/lib/utils/SimpleConnector.d.ts +26 -10
  128. package/lib/utils/SimpleConnector.js +167 -141
  129. package/lib/utils/assert.js +2 -2
  130. package/lib/utils/concurrent.d.ts +1 -1
  131. package/lib/utils/concurrent.js +31 -57
  132. package/lib/utils/date.js +2 -2
  133. package/lib/utils/geo.js +8 -8
  134. package/lib/utils/lodash.d.ts +3 -1
  135. package/lib/utils/lodash.js +21 -34
  136. package/lib/utils/mask.js +12 -13
  137. package/lib/utils/money.d.ts +1 -1
  138. package/lib/utils/money.js +22 -11
  139. package/lib/utils/projection.d.ts +4 -0
  140. package/lib/utils/projection.js +15 -0
  141. package/lib/utils/random/random.js +11 -16
  142. package/lib/utils/random/random.mp.js +7 -18
  143. package/lib/utils/random/random.web.js +6 -12
  144. package/lib/utils/string.d.ts +4 -4
  145. package/lib/utils/string.js +19 -32
  146. package/lib/utils/url.js +5 -4
  147. package/lib/utils/uuid.d.ts +1 -1
  148. package/lib/utils/uuid.js +46 -85
  149. package/lib/utils/validator.d.ts +4 -3
  150. package/lib/utils/validator.js +35 -32
  151. package/lib/utils/version.js +6 -6
  152. package/package.json +7 -7
  153. package/src/entities/ActionAuth.ts +10 -10
  154. package/src/entities/Path.ts +43 -0
  155. package/src/entities/RelationAuth.ts +2 -1
  156. package/src/entities/UserEntityClaim.ts +30 -0
  157. package/src/entities/UserEntityGrant.ts +9 -12
@@ -1,12 +1,12 @@
1
1
  import { RefOrExpression } from "./Expression";
2
2
  import { OneOf } from "./Polyfill";
3
3
  export declare const EXPRESSION_PREFIX = "$expr";
4
- export declare type NodeId = `node-${number}`;
5
- export declare type ExpressionKey = '$expr' | '$expr1' | '$expr2' | '$expr3' | '$expr4' | '$expr5' | '$expr6' | '$expr7' | '$expr8' | '$expr9' | '$expr10' | '$expr11' | '$expr12' | '$expr13' | '$expr14' | '$expr15' | '$expr16' | '$expr17' | '$expr18' | '$expr19' | '$expr20';
6
- export declare type ExprOp<A> = {
4
+ export type NodeId = `node-${number}`;
5
+ export type ExpressionKey = '$expr' | '$expr1' | '$expr2' | '$expr3' | '$expr4' | '$expr5' | '$expr6' | '$expr7' | '$expr8' | '$expr9' | '$expr10' | '$expr11' | '$expr12' | '$expr13' | '$expr14' | '$expr15' | '$expr16' | '$expr17' | '$expr18' | '$expr19' | '$expr20';
6
+ export type ExprOp<A> = {
7
7
  [K in ExpressionKey]: RefOrExpression<A>;
8
8
  };
9
- export declare type Q_NumberComparisonValue = number | OneOf<{
9
+ export type Q_NumberComparisonValue = number | OneOf<{
10
10
  $gt: number;
11
11
  $lt: number;
12
12
  $gte: number;
@@ -17,7 +17,7 @@ export declare type Q_NumberComparisonValue = number | OneOf<{
17
17
  $nin: number[];
18
18
  $between: [number, number];
19
19
  }>;
20
- export declare type Q_StringComparisonValue = string | OneOf<{
20
+ export type Q_StringComparisonValue = string | OneOf<{
21
21
  $gt: string;
22
22
  $lt: string;
23
23
  $gte: string;
@@ -30,58 +30,58 @@ export declare type Q_StringComparisonValue = string | OneOf<{
30
30
  $in: string[];
31
31
  $nin: string[];
32
32
  }>;
33
- export declare type Q_BooleanComparisonValue = boolean;
34
- export declare type Q_DateComparisonValue = Q_NumberComparisonValue;
35
- export declare type Q_EnumComparisonValue<E> = E | OneOf<{
33
+ export type Q_BooleanComparisonValue = boolean;
34
+ export type Q_DateComparisonValue = Q_NumberComparisonValue;
35
+ export type Q_EnumComparisonValue<E> = E | OneOf<{
36
36
  $in: E[];
37
37
  $nin: E[];
38
38
  $ne: E;
39
39
  }>;
40
- export declare type Q_ExistsValue = {
40
+ export type Q_ExistsValue = {
41
41
  $exists: boolean;
42
42
  };
43
- export declare type Q_NumberValue = Q_NumberComparisonValue | Q_ExistsValue;
44
- export declare type Q_StringValue = Q_StringComparisonValue | Q_ExistsValue;
45
- export declare type Q_BooleanValue = Q_BooleanComparisonValue | Q_ExistsValue;
46
- export declare type Q_DateValue = Q_DateComparisonValue | Q_ExistsValue;
47
- export declare type Q_EnumValue<E> = Q_EnumComparisonValue<E> | Q_ExistsValue;
48
- export declare type Q_State<S> = S | {
43
+ export type Q_NumberValue = Q_NumberComparisonValue | Q_ExistsValue;
44
+ export type Q_StringValue = Q_StringComparisonValue | Q_ExistsValue;
45
+ export type Q_BooleanValue = Q_BooleanComparisonValue | Q_ExistsValue;
46
+ export type Q_DateValue = Q_DateComparisonValue | Q_ExistsValue;
47
+ export type Q_EnumValue<E> = Q_EnumComparisonValue<E> | Q_ExistsValue;
48
+ export type Q_State<S> = S | {
49
49
  $in: S[];
50
50
  } | {
51
51
  $nin: S[];
52
52
  } | Q_ExistsValue;
53
- export declare type Q_FullTextValue = {
53
+ export type Q_FullTextValue = {
54
54
  $search: string;
55
55
  $language?: 'zh_CN' | 'en_US';
56
56
  };
57
- export declare type Q_FullTextKey = '$text';
58
- export declare type FulltextFilter = {
57
+ export type Q_FullTextKey = '$text';
58
+ export type FulltextFilter = {
59
59
  [F in Q_FullTextKey]?: Q_FullTextValue;
60
60
  };
61
- declare type Q_LogicKey = '$and' | '$or';
62
- declare type Q_LinearLogicKey = '$not';
63
- export declare type MakeFilterWrapper<F extends Object> = {
61
+ type Q_LogicKey = '$and' | '$or';
62
+ type Q_LinearLogicKey = '$not';
63
+ export type MakeFilterWrapper<F extends Object> = {
64
64
  [Q in Q_LogicKey]?: Array<MakeFilterWrapper<F>>;
65
65
  } & {
66
66
  [Q in Q_LinearLogicKey]?: MakeFilterWrapper<F>;
67
67
  } & Partial<F>;
68
- export declare type MakeFilter<F extends Object> = {
68
+ export type MakeFilter<F extends Object> = {
69
69
  '#id'?: NodeId;
70
70
  } & MakeFilterWrapper<F>;
71
- export declare type RefAttr<A> = {
71
+ export type RefAttr<A> = {
72
72
  '#attr': A;
73
73
  } | {
74
74
  '#refId': NodeId;
75
75
  '#refAttr': string;
76
76
  };
77
77
  export declare function isRefAttrNode<A>(node: any): node is RefAttr<A>;
78
- export declare type JsonFilter<O extends any> = O extends Array<infer P> ? (JsonFilter<P> | undefined)[] | {
78
+ export type JsonFilter<O extends any> = O extends Array<infer P> ? (JsonFilter<P> | undefined)[] | {
79
79
  $contains?: P | P[];
80
80
  $overlaps?: P | P[];
81
81
  } : O extends number ? Q_NumberValue : O extends string ? Q_StringValue : O extends boolean ? Q_BooleanValue : O extends Record<string, any> ? {
82
82
  [A in keyof O]?: JsonFilter<O[A]>;
83
83
  } : never;
84
- export declare type SubQueryPredicateMetadata = {
84
+ export type SubQueryPredicateMetadata = {
85
85
  '#sqp'?: 'in' | 'not in' | 'all' | 'not all';
86
86
  };
87
87
  export declare const SUB_QUERY_PREDICATE_KEYWORD = "#sqp";
@@ -8,4 +8,4 @@ export interface EndpointItem<ED extends EntityDict, BackCxt extends AsyncContex
8
8
  method: 'get' | 'post' | 'put' | 'delete';
9
9
  fn: (context: BackCxt, params: Record<string, string>, headers: IncomingHttpHeaders, req: IncomingMessage, body?: any) => Promise<any>;
10
10
  }
11
- export declare type Endpoint<ED extends EntityDict, BackCxt extends AsyncContext<ED>> = EndpointItem<ED, BackCxt> | EndpointItem<ED, BackCxt>[];
11
+ export type Endpoint<ED extends EntityDict, BackCxt extends AsyncContext<ED>> = EndpointItem<ED, BackCxt> | EndpointItem<ED, BackCxt>[];
@@ -1,59 +1,61 @@
1
1
  import { ReadOnlyAction } from '../actions/action';
2
2
  import { PrimaryKey, Sequence } from './DataType';
3
- declare type TriggerDataAttributeType = '$$triggerData$$';
4
- declare type TriggerTimestampAttributeType = '$$triggerTimestamp$$';
5
- declare type PrimaryKeyAttributeType = 'id';
6
- declare type CreateAtAttributeType = '$$createAt$$';
7
- declare type UpdateAtAttributeType = '$$updateAt$$';
8
- declare type DeleteAtAttributeType = '$$deleteAt$$';
9
- declare type SeqAttributeType = '$$seq$$';
3
+ type TriggerDataAttributeType = '$$triggerData$$';
4
+ type TriggerUuidAttributeType = '$$triggerUuid$$';
5
+ type PrimaryKeyAttributeType = 'id';
6
+ type CreateAtAttributeType = '$$createAt$$';
7
+ type UpdateAtAttributeType = '$$updateAt$$';
8
+ type DeleteAtAttributeType = '$$deleteAt$$';
9
+ type SeqAttributeType = '$$seq$$';
10
10
  export declare const TriggerDataAttribute = "$$triggerData$$";
11
- export declare const TriggerTimestampAttribute = "$$triggerTimestamp$$";
11
+ export declare const TriggerUuidAttribute = "$$triggerUuid$$";
12
12
  export declare const PrimaryKeyAttribute = "id";
13
13
  export declare const CreateAtAttribute = "$$createAt$$";
14
14
  export declare const UpdateAtAttribute = "$$updateAt$$";
15
15
  export declare const DeleteAtAttribute = "$$deleteAt$$";
16
16
  export declare const SeqAttribute = "$$seq$$";
17
- export declare type InstinctiveAttributes = PrimaryKeyAttributeType | CreateAtAttributeType | UpdateAtAttributeType | DeleteAtAttributeType | TriggerDataAttributeType | TriggerTimestampAttributeType | SeqAttributeType;
17
+ export type InstinctiveAttributes = PrimaryKeyAttributeType | CreateAtAttributeType | UpdateAtAttributeType | DeleteAtAttributeType | TriggerDataAttributeType | SeqAttributeType | TriggerUuidAttributeType;
18
18
  export declare const initinctiveAttributes: string[];
19
- declare type FilterPart<A extends string, F extends Object | undefined> = {
19
+ type FilterPart<A extends string, F extends Object | undefined> = {
20
20
  filter?: A extends 'create' ? undefined : F;
21
21
  indexFrom?: A extends 'create' ? undefined : number;
22
22
  count?: A extends 'create' ? undefined : number;
23
23
  };
24
- export declare type SelectOption = {
24
+ export type SelectOption = {
25
25
  dontCollect?: boolean;
26
26
  blockTrigger?: true;
27
27
  obscure?: boolean;
28
28
  forUpdate?: true;
29
29
  includedDeleted?: true;
30
- ignoreForeignKeyMiss?: true;
30
+ ignoreAttrMiss?: true;
31
31
  dummy?: 1;
32
32
  };
33
- export declare type OperateOption = {
33
+ export type OperateOption = {
34
34
  blockTrigger?: true;
35
35
  dontCollect?: boolean;
36
36
  dontCreateOper?: boolean;
37
37
  dontCreateModi?: boolean;
38
+ includedDeleted?: true;
38
39
  allowExists?: boolean;
39
40
  modiParentId?: string;
40
41
  modiParentEntity?: string;
41
42
  deletePhysically?: boolean;
43
+ applyingModi?: boolean;
42
44
  dummy?: 1;
43
45
  };
44
- export declare type FormUpdateData<SH extends GeneralEntityShape> = Partial<{
45
- [K in keyof Omit<SH, InstinctiveAttributes>]: SH[K] | null;
46
+ export type FormUpdateData<SH extends GeneralEntityShape> = Partial<{
47
+ [K in keyof Omit<SH, "id" | "$$createAt$$" | "$$seq$$">]: SH[K] | null;
46
48
  }>;
47
- export declare type FormCreateData<SH extends GeneralEntityShape> = Partial<Omit<SH, InstinctiveAttributes>> & {
49
+ export type FormCreateData<SH extends GeneralEntityShape> = Partial<SH> & {
48
50
  id: string;
49
51
  };
50
- export declare type Operation<A extends string, D extends Projection, F extends Filter | undefined = undefined, S extends Sorter | undefined = undefined> = {
52
+ export type Operation<A extends string, D extends Projection, F extends Filter | undefined = undefined, S extends Sorter | undefined = undefined> = {
51
53
  id: string;
52
54
  action: A;
53
55
  data: D;
54
56
  sorter?: S;
55
57
  } & FilterPart<A, F>;
56
- export declare type Selection<A extends ReadOnlyAction, D extends Projection, F extends Filter | undefined = undefined, S extends Sorter | undefined = undefined> = {
58
+ export type Selection<A extends ReadOnlyAction, D extends Projection, F extends Filter | undefined = undefined, S extends Sorter | undefined = undefined> = {
57
59
  id?: string;
58
60
  action?: A;
59
61
  data: D;
@@ -71,7 +73,7 @@ export interface EntityShape {
71
73
  export interface GeneralEntityShape extends EntityShape {
72
74
  [K: string]: any;
73
75
  }
74
- export declare type MakeAction<A extends string> = A;
76
+ export type MakeAction<A extends string> = A;
75
77
  export interface EntityDef {
76
78
  Schema: GeneralEntityShape;
77
79
  OpSchema: GeneralEntityShape;
@@ -93,79 +95,79 @@ export interface EntityDict {
93
95
  export interface OtmSubProjection extends Omit<Operation<'select', any, any, any>, 'action'> {
94
96
  $entity: string;
95
97
  }
96
- export declare type AggregationOp = `#max-${number}` | `#min-${number}` | `#avg-${number}` | `#count-${number}` | `#sum-${number}`;
97
- export declare type DeduceAggregationData<P extends Projection> = {
98
+ export type AggregationOp = `#max-${number}` | `#min-${number}` | `#avg-${number}` | `#count-${number}` | `#sum-${number}`;
99
+ export type DeduceAggregationData<P extends Projection> = {
98
100
  [A in AggregationOp]?: P;
99
101
  } & {
100
102
  '#aggr'?: P;
101
103
  };
102
- export declare type AggregationResult<SH extends GeneralEntityShape> = Array<{
104
+ export type AggregationResult<SH extends GeneralEntityShape> = Array<{
103
105
  [A in AggregationOp]?: number | string;
104
106
  } & {
105
107
  '#data'?: Partial<SH>;
106
108
  }>;
107
- export declare type AttrFilter<SH extends GeneralEntityShape> = {
109
+ export type AttrFilter<SH extends GeneralEntityShape> = {
108
110
  [K in keyof SH]?: any;
109
111
  };
110
- declare type SortAttr = {
112
+ type SortAttr = {
111
113
  [K: string]: any;
112
114
  };
113
- declare type SorterItem = {
115
+ type SorterItem = {
114
116
  $attr: SortAttr;
115
117
  $direction?: "asc" | "desc";
116
118
  };
117
- declare type Sorter = Array<SorterItem>;
118
- declare type Filter = {
119
+ type Sorter = Array<SorterItem>;
120
+ type Filter = {
119
121
  [K: string]: any;
120
122
  };
121
- declare type Projection = {
123
+ type Projection = {
122
124
  [K: string]: any;
123
125
  };
124
- export declare type DeduceAggregation<P extends Projection, F extends Filter, S extends Sorter> = Omit<Selection<'aggregate', DeduceAggregationData<P>, F, S>, 'action'>;
125
- declare type CreateOperationData = {
126
+ export type DeduceAggregation<P extends Projection, F extends Filter, S extends Sorter> = Omit<Selection<'aggregate', DeduceAggregationData<P>, F, S>, 'action'>;
127
+ type CreateOperationData = {
126
128
  id: string;
127
129
  [K: string]: any;
128
130
  };
129
- declare type CreateSingleOperation = Operation<'create', CreateOperationData, undefined, undefined>;
130
- declare type CreateMultipleOperation = Operation<'create', Array<CreateOperationData>, undefined, undefined>;
131
- declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
132
- declare type UpdateOperationData = {
131
+ type CreateSingleOperation = Operation<'create', CreateOperationData, undefined, undefined>;
132
+ type CreateMultipleOperation = Operation<'create', Array<CreateOperationData>, undefined, undefined>;
133
+ type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
134
+ type UpdateOperationData = {
133
135
  id?: never;
134
136
  [k: string]: any;
135
137
  };
136
- export declare type UpdateOperation = Operation<string, UpdateOperationData, Filter, Sorter>;
137
- declare type RemoveOperationData = {
138
+ export type UpdateOperation = Operation<string, UpdateOperationData, Filter, Sorter>;
139
+ type RemoveOperationData = {
138
140
  [k: string]: any;
139
141
  };
140
- export declare type RemoveOperation = Operation<'remove', RemoveOperationData, Filter, Sorter>;
141
- export declare type CUDOperation = CreateOperation | UpdateOperation | RemoveOperation;
142
- export declare type CreateOpResult<ED extends EntityDict, T extends keyof ED> = {
142
+ export type RemoveOperation = Operation<'remove', RemoveOperationData, Filter, Sorter>;
143
+ export type CUDOperation = CreateOperation | UpdateOperation | RemoveOperation;
144
+ export type CreateOpResult<ED extends EntityDict, T extends keyof ED> = {
143
145
  a: 'c';
144
146
  e: T;
145
147
  d: ED[T]['OpSchema'] | ED[T]['OpSchema'][];
146
148
  };
147
- export declare type UpdateOpResult<ED extends EntityDict, T extends keyof ED> = {
149
+ export type UpdateOpResult<ED extends EntityDict, T extends keyof ED> = {
148
150
  a: 'u';
149
151
  e: T;
150
152
  d: UpdateOperationData;
151
153
  f?: Filter;
152
154
  };
153
- export declare type RemoveOpResult<ED extends EntityDict, T extends keyof ED> = {
155
+ export type RemoveOpResult<ED extends EntityDict, T extends keyof ED> = {
154
156
  a: 'r';
155
157
  e: T;
156
158
  f?: Filter;
157
159
  };
158
- export declare type RelationHierarchy<R extends string> = {
160
+ export type RelationHierarchy<R extends string> = {
159
161
  [K in R]?: R[];
160
162
  };
161
- export declare type CascadeRelationItem = {
163
+ export type CascadeRelationItem = {
162
164
  cascadePath: string;
163
165
  relations?: string[];
164
166
  };
165
- export declare type CascadeRelationAuth<R extends string> = {
167
+ export type CascadeRelationAuth<R extends string> = {
166
168
  [K in R]?: CascadeRelationItem | (CascadeRelationItem | CascadeRelationItem[])[];
167
169
  };
168
- export declare type SelectOpResult<ED extends EntityDict> = {
170
+ export type SelectOpResult<ED extends EntityDict> = {
169
171
  a: 's';
170
172
  d: {
171
173
  [T in keyof ED]?: {
@@ -173,21 +175,28 @@ export declare type SelectOpResult<ED extends EntityDict> = {
173
175
  };
174
176
  };
175
177
  };
176
- export declare type OpRecord<ED extends EntityDict> = CreateOpResult<ED, keyof ED> | UpdateOpResult<ED, keyof ED> | RemoveOpResult<ED, keyof ED> | SelectOpResult<ED>;
177
- export declare type OperationResult<ED extends EntityDict> = {
178
+ export type OpRecord<ED extends EntityDict> = CreateOpResult<ED, keyof ED> | UpdateOpResult<ED, keyof ED> | RemoveOpResult<ED, keyof ED> | SelectOpResult<ED>;
179
+ export type OperationResult<ED extends EntityDict> = {
178
180
  [K in keyof ED]?: {
179
181
  [A in ED[K]['Action']]?: number;
180
182
  };
181
183
  };
182
- export declare type ActionType = 'readOnly' | 'appendOnly' | 'excludeUpdate' | 'excludeRemove' | 'crud';
183
- export declare type Configuration = {
184
+ export type ActionType = 'readOnly' | 'appendOnly' | 'excludeUpdate' | 'excludeRemove' | 'crud';
185
+ export type Configuration = {
184
186
  actionType?: ActionType;
185
187
  static?: boolean;
186
188
  };
187
- export declare type AuthCascadePath<ED extends EntityDict> = [keyof ED, string, keyof ED, boolean];
188
- export declare type AuthDeduceRelationMap<ED extends EntityDict> = {
189
+ export type AuthDeduceRelationMap<ED extends EntityDict> = {
189
190
  [T in keyof ED]?: keyof ED[T]['OpSchema'];
190
191
  };
191
- export declare type SelectFreeEntities<ED extends EntityDict> = (keyof ED)[];
192
- export declare type OtmKey<K extends string> = K | `${K}$${number}`;
192
+ export type SelectFreeEntities<ED extends EntityDict> = (keyof ED)[];
193
+ export type UpdateFreeDict<ED extends EntityDict> = {
194
+ [A in keyof ED]?: string[];
195
+ };
196
+ export type OtmKey<K extends string> = K | `${K}$${number}`;
197
+ export interface SubDataDef<ED extends EntityDict, T extends keyof ED> {
198
+ id: string;
199
+ entity: T;
200
+ filter: ED[T]['Selection']['filter'];
201
+ }
193
202
  export {};
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initinctiveAttributes = exports.SeqAttribute = exports.DeleteAtAttribute = exports.UpdateAtAttribute = exports.CreateAtAttribute = exports.PrimaryKeyAttribute = exports.TriggerTimestampAttribute = exports.TriggerDataAttribute = void 0;
3
+ exports.initinctiveAttributes = exports.SeqAttribute = exports.DeleteAtAttribute = exports.UpdateAtAttribute = exports.CreateAtAttribute = exports.PrimaryKeyAttribute = exports.TriggerUuidAttribute = exports.TriggerDataAttribute = void 0;
4
4
  exports.TriggerDataAttribute = '$$triggerData$$';
5
- exports.TriggerTimestampAttribute = '$$triggerTimestamp$$';
5
+ exports.TriggerUuidAttribute = '$$triggerUuid$$';
6
6
  exports.PrimaryKeyAttribute = 'id';
7
7
  exports.CreateAtAttribute = '$$createAt$$';
8
8
  exports.UpdateAtAttribute = '$$updateAt$$';
9
9
  exports.DeleteAtAttribute = '$$deleteAt$$';
10
10
  exports.SeqAttribute = '$$seq$$';
11
- exports.initinctiveAttributes = [exports.PrimaryKeyAttribute, exports.TriggerDataAttribute, exports.TriggerTimestampAttribute, exports.CreateAtAttribute, exports.UpdateAtAttribute, exports.DeleteAtAttribute, exports.SeqAttribute];
11
+ exports.initinctiveAttributes = [exports.PrimaryKeyAttribute, exports.TriggerDataAttribute, exports.TriggerUuidAttribute, exports.CreateAtAttribute, exports.UpdateAtAttribute, exports.DeleteAtAttribute, exports.SeqAttribute];
12
+ ;
12
13
  ;
13
14
  ;
14
15
  ;
@@ -1,8 +1,9 @@
1
1
  import { LocaleDef } from './Locale';
2
2
  import { Index } from './Storage';
3
3
  import { EntityShape, Configuration } from './Entity';
4
- export declare type EntityDesc<Schema extends EntityShape, Action extends string = '', Relation extends string = '', V extends Record<string, string> = {}> = {
4
+ export type EntityDesc<Schema extends EntityShape, Action extends string = '', Relation extends string = '', V extends Record<string, string> = {}> = {
5
5
  locales: LocaleDef<Schema, Action, Relation, V>;
6
6
  indexes?: Index<Schema>[];
7
7
  configuration?: Configuration;
8
+ recursiveDepth?: number;
8
9
  };
@@ -1,4 +1,4 @@
1
- export declare type WechatMpEnv = {
1
+ export type WechatMpEnv = {
2
2
  type: 'wechatMp';
3
3
  brand: string;
4
4
  model: string;
@@ -33,7 +33,7 @@ export declare type WechatMpEnv = {
33
33
  deviceOrientation: 'portrait' | 'landscape';
34
34
  localStorageEnabled: true;
35
35
  };
36
- export declare type WebEnv = {
36
+ export type WebEnv = {
37
37
  type: 'web';
38
38
  visitorId: string;
39
39
  platform: {
@@ -51,7 +51,7 @@ export declare type WebEnv = {
51
51
  language: string;
52
52
  localStorageEnabled: boolean;
53
53
  };
54
- export declare type ServerEnv = {
54
+ export type ServerEnv = {
55
55
  type: 'server';
56
56
  };
57
- export declare type Environment = WechatMpEnv | WebEnv | ServerEnv;
57
+ export type Environment = WechatMpEnv | WebEnv | ServerEnv;
@@ -43,10 +43,18 @@ export declare class OakRowUnexistedException<ED extends EntityDict> extends Oak
43
43
  selection: any;
44
44
  }[];
45
45
  }
46
- export declare class OakExternalException extends Error {
47
- }
46
+ /**
47
+ * 可接受的、由用户操作造成的异常
48
+ */
48
49
  export declare class OakUserException<ED extends EntityDict> extends OakException<ED> {
49
50
  }
51
+ /**
52
+ * 网络中断异常
53
+ */
54
+ export declare class OakNetworkException<ED extends EntityDict> extends OakException<ED> {
55
+ }
56
+ export declare class OakServerProxyException<ED extends EntityDict> extends OakException<ED> {
57
+ }
50
58
  /**
51
59
  * 数据不一致异常,系统认为现有的数据不允许相应的动作时抛此异常
52
60
  *
@@ -67,6 +75,9 @@ export declare class OakInputIllegalException<ED extends EntityDict> extends Oak
67
75
  addAttributesPrefix(prefix: string): void;
68
76
  toString(): string;
69
77
  }
78
+ /**
79
+ * 属性为空时抛的异常
80
+ */
70
81
  export declare class OakAttrNotNullException<ED extends EntityDict> extends OakInputIllegalException<ED> {
71
82
  constructor(entity: keyof ED, attributes: string[], message?: string);
72
83
  }
@@ -75,6 +86,11 @@ export declare class OakAttrNotNullException<ED extends EntityDict> extends OakI
75
86
  */
76
87
  export declare class OakUserUnpermittedException<ED extends EntityDict> extends OakUserException<ED> {
77
88
  }
89
+ /**
90
+ * 用户查询权限不够抛出异常
91
+ */
92
+ export declare class OakUserInvisibleException<ED extends EntityDict> extends OakUserException<ED> {
93
+ }
78
94
  /**
79
95
  * 用户未登录抛的异常
80
96
  */
@@ -98,15 +114,31 @@ export declare class OakCongruentRowExists<ED extends EntityDict, T extends keyo
98
114
  getEntity(): T;
99
115
  toString(): string;
100
116
  }
117
+ /**
118
+ * 死锁抛的异常
119
+ */
101
120
  export declare class OakDeadlock<ED extends EntityDict> extends OakUserException<ED> {
102
121
  constructor(message?: string | undefined);
103
122
  }
123
+ /**
124
+ * 前置条件不满足抛的异常
125
+ */
104
126
  export declare class OakPreConditionUnsetException<ED extends EntityDict> extends OakUserException<ED> {
105
127
  entity?: keyof ED;
106
128
  code?: string;
107
129
  constructor(message?: string | undefined, entity?: keyof ED | undefined, code?: string | undefined);
108
130
  toString(): string;
109
131
  }
132
+ /**
133
+ * 调用外部接口抛出的异常
134
+ */
135
+ export declare class OakExternalException<ED extends EntityDict> extends OakUserException<ED> {
136
+ code?: string;
137
+ source: string;
138
+ data?: any;
139
+ constructor(source: string, code?: string, message?: string, data?: any);
140
+ toString(): string;
141
+ }
110
142
  export declare function makeException<ED extends EntityDict>(data: {
111
143
  name: string;
112
144
  message?: string;