@adaas/a-concept 0.0.43 → 0.0.44
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/dist/src/decorators/A-Feature/A-Feature-Define.decorator.js +4 -3
- package/dist/src/decorators/A-Feature/A-Feature-Define.decorator.js.map +1 -1
- package/dist/src/global/A-Entity/A-Entity.class.d.ts +3 -3
- package/dist/src/global/A-Entity/A-Entity.class.js +12 -6
- package/dist/src/global/A-Entity/A-Entity.class.js.map +1 -1
- package/package.json +1 -1
- package/src/decorators/A-Feature/A-Feature-Define.decorator.ts +5 -4
- package/src/global/A-Entity/A-Entity.class.ts +11 -3
|
@@ -42,11 +42,12 @@ function A_Feature_Define(config = {}) {
|
|
|
42
42
|
// Get the existed metadata or create a new one
|
|
43
43
|
const existedMeta = meta.get(metaKey) || new A_Meta_class_1.A_Meta();
|
|
44
44
|
const handlerName = config.name || propertyKey;
|
|
45
|
-
|
|
45
|
+
// default to false
|
|
46
|
+
const invoke = config.invoke || false;
|
|
46
47
|
// Set the metadata of the method to define a custom Feature with name
|
|
47
48
|
existedMeta.set(propertyKey, {
|
|
48
49
|
name: `${target.constructor.name}.${handlerName}`,
|
|
49
|
-
handler:
|
|
50
|
+
handler: propertyKey,
|
|
50
51
|
invoke: invoke,
|
|
51
52
|
template: config.template && config.template.length ? config.template.map(item => (Object.assign(Object.assign({}, item), { before: item.before || [], after: item.after || [], behavior: item.behavior || 'sync' }))) : [],
|
|
52
53
|
channel: config.channel || []
|
|
@@ -66,7 +67,7 @@ function A_Feature_Define(config = {}) {
|
|
|
66
67
|
originalMethod.apply(this, args);
|
|
67
68
|
// Call your `call` with the function name
|
|
68
69
|
if (typeof this.call === "function" && invoke)
|
|
69
|
-
return this.call(
|
|
70
|
+
return this.call(handlerName);
|
|
70
71
|
};
|
|
71
72
|
return descriptor;
|
|
72
73
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Feature-Define.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/A-Feature/A-Feature-Define.decorator.ts"],"names":[],"mappings":";;AA8BA,
|
|
1
|
+
{"version":3,"file":"A-Feature-Define.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/A-Feature/A-Feature-Define.decorator.ts"],"names":[],"mappings":";;AA8BA,4CA6FC;AAtHD,oFAA2E;AAC3E,uFAA8E;AAC9E,6FAAoF;AACpF,6FAAoF;AACpF,6FAAkG;AAIlG,oFAAyF;AACzF,6FAAkG;AAClG,8EAAqE;AAErE;;;;;;;;;;;;GAYG;AACH,SAAgB,gBAAgB,CAC5B,SAAqD,EAAE;IAEvD,OAAO,UACH,MAA4C,EAC5C,WAAmB,EACnB,UAAiD;QAGjD,MAAM,IAAI,GAAqD,2BAAS,CAAC,IAAI,CAAC,MAAM,CAAC,WAAkB,CAAC,CAAC;QAEzG,IAAI,OAAO,CAAC;QAGZ,QAAQ,IAAI,EAAE,CAAC;YACX,KAAK,MAAM,YAAY,yBAAQ;gBAC3B,OAAO,GAAG,uCAAsB,CAAC,QAAQ,CAAC;gBAC1C,MAAM;YACV,KAAK,MAAM,YAAY,+BAAW;gBAC9B,OAAO,GAAG,6CAAyB,CAAC,QAAQ,CAAA;gBAC5C,MAAM;YACV,KAAK,MAAM,YAAY,+BAAW;gBAC9B,OAAO,GAAG,6CAAyB,CAAC,QAAQ,CAAA;gBAC5C,MAAM;YACV;gBACI,MAAM,IAAI,KAAK,CAAC,sCAAsC,MAAM,QAAQ,CAAC,CAAC;QAC9E,CAAC;QAGD,+CAA+C;QAC/C,MAAM,WAAW,GAOZ,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,qBAAM,EAAE,CAAC;QAIvC,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,IAAI,WAAW,CAAC;QAC/C,oBAAoB;QACpB,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,KAAK,CAAC;QAGtC,uEAAuE;QACvE,WAAW,CAAC,GAAG,C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|
|
|
59
59
|
/**
|
|
60
60
|
* The default method that can be called and extended to load entity data.
|
|
61
61
|
*/
|
|
62
|
-
load(): Promise<void>;
|
|
62
|
+
load(scope?: A_Scope): Promise<void>;
|
|
63
63
|
/**
|
|
64
64
|
* The default method that can be called and extended to destroy entity data.
|
|
65
65
|
*/
|
|
66
|
-
destroy(): Promise<void>;
|
|
66
|
+
destroy(scope?: A_Scope): Promise<void>;
|
|
67
67
|
/**
|
|
68
68
|
* The default method that can be called and extended to save entity data.
|
|
69
69
|
*/
|
|
70
|
-
save(): Promise<void>;
|
|
70
|
+
save(scope?: A_Scope): Promise<void>;
|
|
71
71
|
fromNew(newEntity: _ConstructorType): void;
|
|
72
72
|
fromJSON(serialized: _SerializedType): void;
|
|
73
73
|
/**
|
|
@@ -113,20 +113,26 @@ class A_Entity {
|
|
|
113
113
|
/**
|
|
114
114
|
* The default method that can be called and extended to load entity data.
|
|
115
115
|
*/
|
|
116
|
-
load() {
|
|
117
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
+
load(scope) {
|
|
117
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
this.call('load', scope);
|
|
119
|
+
});
|
|
118
120
|
}
|
|
119
121
|
/**
|
|
120
122
|
* The default method that can be called and extended to destroy entity data.
|
|
121
123
|
*/
|
|
122
|
-
destroy() {
|
|
123
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
124
|
+
destroy(scope) {
|
|
125
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
+
this.call('destroy', scope);
|
|
127
|
+
});
|
|
124
128
|
}
|
|
125
129
|
/**
|
|
126
130
|
* The default method that can be called and extended to save entity data.
|
|
127
131
|
*/
|
|
128
|
-
save() {
|
|
129
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
132
|
+
save(scope) {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
this.call('save', scope);
|
|
135
|
+
});
|
|
130
136
|
}
|
|
131
137
|
// ====================================================================
|
|
132
138
|
// ================== Entity Serialization ============================
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A-Entity.class.js","sourceRoot":"","sources":["../../../../src/global/A-Entity/A-Entity.class.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAIwB;AAKxB,yFAAiG;AACjG,kEAAyD;AAMzD;;;;;;GAMG;AACH,MAAa,QAAQ;IASjB;;OAEG;IACH,MAAM,KAAK,MAAM;QACb,OAAO,wBAAc;aAChB,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;aACvC,iBAAiB,EAAE;aACnB,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC5B,CAAC;IAcD,YAAY,KAA0D;QAGlE,QAAQ,IAAI,EAAE,CAAC;YACX,KAAK,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,eAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gBACpD,IAAI,CAAC,KAAK,GAAG,IAAI,eAAK,CAAC,KAAK,CAAC,CAAC;gBAC9B,MAAM;YACV,KAAK,CAAC,KAAK,YAAY,eAAK,CAAC;gBACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;gBACnB,MAAM;YACV,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,IAAI,KAAK,CAAC;gBAC3D,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACrB,MAAM;YAEV,KAAK,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC;gBAC5B,IAAI,CAAC,OAAO,CAAC,KAAyB,CAAC,CAAC;gBACxC,MAAK;YAET;gBACI,MAAM,IAAI,iBAAO,CAAC,8CAA2B,CAAC,8BAA8B,CAAC,CAAC;QACtF,CAAC;IACL,CAAC;IAED,uEAAuE;IACvE,uEAAuE;IACvE,uEAAuE;IAEvE;;;OAGG;IACH,IAAI,EAAE;QACF,OAAO,IAAI,CAAC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E;SACZ,CAAC;IACzB,CAAC;IAGD,QAAQ;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACtE,CAAC;CACJ;AA9LD,4BA8LC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaas/a-concept",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.44",
|
|
4
4
|
"description": "A-Concept is a framework to build new Applications within or outside the ADAAS ecosystem. This framework is designed to be modular structure regardless environment and program goal.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -70,13 +70,14 @@ export function A_Feature_Define(
|
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
const handlerName = config.name || propertyKey;
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
// default to false
|
|
74
|
+
const invoke = config.invoke || false;
|
|
75
|
+
|
|
75
76
|
|
|
76
77
|
// Set the metadata of the method to define a custom Feature with name
|
|
77
78
|
existedMeta.set(propertyKey, {
|
|
78
79
|
name: `${target.constructor.name}.${handlerName}`,
|
|
79
|
-
handler:
|
|
80
|
+
handler: propertyKey,
|
|
80
81
|
invoke: invoke,
|
|
81
82
|
template: config.template && config.template.length ? config.template.map(
|
|
82
83
|
item => ({
|
|
@@ -114,7 +115,7 @@ export function A_Feature_Define(
|
|
|
114
115
|
|
|
115
116
|
// Call your `call` with the function name
|
|
116
117
|
if (typeof (this as any).call === "function" && invoke)
|
|
117
|
-
return (this as any).call(
|
|
118
|
+
return (this as any).call(handlerName);
|
|
118
119
|
|
|
119
120
|
};
|
|
120
121
|
|
|
@@ -158,17 +158,25 @@ export class A_Entity<
|
|
|
158
158
|
/**
|
|
159
159
|
* The default method that can be called and extended to load entity data.
|
|
160
160
|
*/
|
|
161
|
-
async load(
|
|
161
|
+
async load(
|
|
162
|
+
scope?: A_Scope,
|
|
163
|
+
) {
|
|
164
|
+
this.call('load', scope);
|
|
165
|
+
}
|
|
162
166
|
|
|
163
167
|
/**
|
|
164
168
|
* The default method that can be called and extended to destroy entity data.
|
|
165
169
|
*/
|
|
166
|
-
async destroy() {
|
|
170
|
+
async destroy(scope?: A_Scope) {
|
|
171
|
+
this.call('destroy', scope);
|
|
172
|
+
}
|
|
167
173
|
|
|
168
174
|
/**
|
|
169
175
|
* The default method that can be called and extended to save entity data.
|
|
170
176
|
*/
|
|
171
|
-
async save() {
|
|
177
|
+
async save(scope?: A_Scope) {
|
|
178
|
+
this.call('save', scope);
|
|
179
|
+
}
|
|
172
180
|
|
|
173
181
|
|
|
174
182
|
|