@adaas/a-server 0.0.28 → 0.0.30
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/browser/index.d.mts +123 -69
- package/dist/browser/index.mjs +212 -70
- package/dist/browser/index.mjs.map +1 -1
- package/dist/node/controllers/A-EntityController/A-EntityController.component.d.mts +2 -5
- package/dist/node/controllers/A-EntityController/A-EntityController.component.d.ts +2 -5
- package/dist/node/controllers/A-EntityController/A-EntityController.component.js +66 -88
- package/dist/node/controllers/A-EntityController/A-EntityController.component.js.map +1 -1
- package/dist/node/controllers/A-EntityController/A-EntityController.component.mjs +67 -89
- package/dist/node/controllers/A-EntityController/A-EntityController.component.mjs.map +1 -1
- package/dist/node/controllers/A-ListingController/A-ListingController.component.js +20 -18
- package/dist/node/controllers/A-ListingController/A-ListingController.component.js.map +1 -1
- package/dist/node/controllers/A-ListingController/A-ListingController.component.mjs +20 -18
- package/dist/node/controllers/A-ListingController/A-ListingController.component.mjs.map +1 -1
- package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.component.d.mts +0 -2
- package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.component.d.ts +0 -2
- package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.component.js +10 -1
- package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.component.js.map +1 -1
- package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.component.mjs +10 -1
- package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.component.mjs.map +1 -1
- package/dist/node/index.d.mts +3 -1
- package/dist/node/index.d.ts +3 -1
- package/dist/node/index.js +14 -0
- package/dist/node/index.mjs +2 -0
- package/dist/node/lib/A-Request/A-Request.helper.js +1 -1
- package/dist/node/lib/A-Request/A-Request.helper.js.map +1 -1
- package/dist/node/lib/A-Request/A-Request.helper.mjs +1 -1
- package/dist/node/lib/A-Request/A-Request.helper.mjs.map +1 -1
- package/dist/node/lib/A-Server/A-HttpServer.container.d.mts +4 -6
- package/dist/node/lib/A-Server/A-HttpServer.container.d.ts +4 -6
- package/dist/node/lib/A-ServerController/A-ServerController.component.js +17 -4
- package/dist/node/lib/A-ServerController/A-ServerController.component.js.map +1 -1
- package/dist/node/lib/A-ServerController/A-ServerController.component.mjs +17 -4
- package/dist/node/lib/A-ServerController/A-ServerController.component.mjs.map +1 -1
- package/dist/node/lib/A-ServerEntityList/A-EntityList.entity.d.mts +52 -28
- package/dist/node/lib/A-ServerEntityList/A-EntityList.entity.d.ts +52 -28
- package/dist/node/lib/A-ServerEntityList/A-EntityList.entity.js +117 -44
- package/dist/node/lib/A-ServerEntityList/A-EntityList.entity.js.map +1 -1
- package/dist/node/lib/A-ServerEntityList/A-EntityList.entity.mjs +118 -45
- package/dist/node/lib/A-ServerEntityList/A-EntityList.entity.mjs.map +1 -1
- package/dist/node/lib/A-ServerEntityList/A-EntityList.types.d.mts +14 -6
- package/dist/node/lib/A-ServerEntityList/A-EntityList.types.d.ts +14 -6
- package/dist/node/lib/A-ServerEntityList/A-EntityList.types.js.map +1 -1
- package/dist/node/lib/A-ServerEntityList/A-EntityList.types.mjs.map +1 -1
- package/dist/node/lib/A-ServerEntityList/A-EntityListCacheState.context.d.mts +12 -0
- package/dist/node/lib/A-ServerEntityList/A-EntityListCacheState.context.d.ts +12 -0
- package/dist/node/lib/A-ServerEntityList/A-EntityListCacheState.context.js +25 -0
- package/dist/node/lib/A-ServerEntityList/A-EntityListCacheState.context.js.map +1 -0
- package/dist/node/lib/A-ServerEntityList/A-EntityListCacheState.context.mjs +24 -0
- package/dist/node/lib/A-ServerEntityList/A-EntityListCacheState.context.mjs.map +1 -0
- package/dist/node/lib/A-ServerEntityList/A-EntityListPagination.context.d.mts +18 -0
- package/dist/node/lib/A-ServerEntityList/A-EntityListPagination.context.d.ts +18 -0
- package/dist/node/lib/A-ServerEntityList/A-EntityListPagination.context.js +48 -0
- package/dist/node/lib/A-ServerEntityList/A-EntityListPagination.context.js.map +1 -0
- package/dist/node/lib/A-ServerEntityList/A-EntityListPagination.context.mjs +47 -0
- package/dist/node/lib/A-ServerEntityList/A-EntityListPagination.context.mjs.map +1 -0
- package/dist/node/lib/A-ServerLogger/A-ServerLogger.component.d.mts +6 -8
- package/dist/node/lib/A-ServerLogger/A-ServerLogger.component.d.ts +6 -8
- package/dist/node/lib/A-ServerLogger/A-ServerLogger.component.js +3 -4
- package/dist/node/lib/A-ServerLogger/A-ServerLogger.component.js.map +1 -1
- package/dist/node/lib/A-ServerLogger/A-ServerLogger.component.mjs +4 -5
- package/dist/node/lib/A-ServerLogger/A-ServerLogger.component.mjs.map +1 -1
- package/dist/node/lib/A-ServerRouter/A-ServerRouter.component.d.mts +0 -2
- package/dist/node/lib/A-ServerRouter/A-ServerRouter.component.d.ts +0 -2
- package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.component.js +1 -1
- package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.component.js.map +1 -1
- package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.component.mjs +1 -1
- package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.component.mjs.map +1 -1
- package/dist/node/repositories/A-EntityRepository/A-EntityRepository.component.d.mts +1 -0
- package/dist/node/repositories/A-EntityRepository/A-EntityRepository.component.d.ts +1 -0
- package/examples/simple-server/components/Users.repository.ts +2 -2
- package/jest.config.ts +1 -0
- package/package.json +1 -1
- package/src/controllers/A-EntityController/A-EntityController.component.ts +69 -109
- package/src/controllers/A-ListingController/A-ListingController.component.ts +22 -20
- package/src/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.component.ts +11 -1
- package/src/index.ts +2 -0
- package/src/lib/A-Request/A-Request.helper.ts +1 -1
- package/src/lib/A-ServerController/A-ServerController.component.ts +17 -8
- package/src/lib/A-ServerEntityList/A-EntityList.entity.ts +159 -55
- package/src/lib/A-ServerEntityList/A-EntityList.types.ts +17 -7
- package/src/lib/A-ServerEntityList/A-EntityListCacheState.context.ts +27 -0
- package/src/lib/A-ServerEntityList/A-EntityListPagination.context.ts +48 -0
- package/src/lib/A-ServerLogger/A-ServerLogger.component.ts +3 -4
- package/src/middlewares/A-ServerCORS/A_ServerCORS.component.ts +1 -1
- package/tests/A-Server-CORS.test.ts +542 -0
- package/tests/A-Server-Entity.test.ts +205 -0
- package/tests/A-Server-Health.test.ts +89 -0
- package/tests/A-Server-Routes.test.ts +113 -0
- package/tests/A-ServerEntityList.test.ts +416 -0
|
@@ -1,86 +1,159 @@
|
|
|
1
1
|
import '../../chunk-EQQGB2QZ.mjs';
|
|
2
|
-
import { A_Entity,
|
|
2
|
+
import { A_Entity, A_Context, A_Scope } from '@adaas/a-concept';
|
|
3
|
+
import { A_ServerEntityListPagination } from './A-EntityListPagination.context';
|
|
4
|
+
import { A_ServerEntityListCacheState } from './A-EntityListCacheState.context';
|
|
3
5
|
|
|
4
6
|
class A_ServerEntityList extends A_Entity {
|
|
5
7
|
constructor() {
|
|
6
8
|
super(...arguments);
|
|
9
|
+
/**
|
|
10
|
+
* Ordered item references for O(1) positional access.
|
|
11
|
+
* The list's own scope is the authoritative store (enables @A_Inject and
|
|
12
|
+
* feature chains on items); this array mirrors the same items in order.
|
|
13
|
+
*/
|
|
7
14
|
this._items = [];
|
|
8
|
-
this._pagination = {
|
|
9
|
-
total: 0,
|
|
10
|
-
page: 1,
|
|
11
|
-
pageSize: 10
|
|
12
|
-
};
|
|
13
15
|
}
|
|
14
16
|
static get scope() {
|
|
15
17
|
return "a-server";
|
|
16
18
|
}
|
|
19
|
+
// ── Getters ──────────────────────────────────────────────────────────────
|
|
17
20
|
/**
|
|
18
|
-
*
|
|
21
|
+
* The list's own scope, created on first access and bound to this entity
|
|
22
|
+
* via A_Context.allocate. Items, pagination and cache state are registered
|
|
23
|
+
* here so they participate in feature chains and @A_Inject resolution.
|
|
19
24
|
*/
|
|
25
|
+
get ownScope() {
|
|
26
|
+
if (!this._ownScope) {
|
|
27
|
+
this._ownScope = A_Context.allocate(
|
|
28
|
+
this,
|
|
29
|
+
new A_Scope({ name: `${this.aseid.id}-scope` })
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
return this._ownScope;
|
|
33
|
+
}
|
|
20
34
|
get entityConstructor() {
|
|
21
35
|
return this._entityConstructor;
|
|
22
36
|
}
|
|
23
|
-
/**
|
|
24
|
-
* Returns the list of items contained in the entity list
|
|
25
|
-
*/
|
|
26
37
|
get items() {
|
|
27
38
|
return this._items;
|
|
28
39
|
}
|
|
29
|
-
/**
|
|
30
|
-
* Returns pagination information about the entity list
|
|
31
|
-
*/
|
|
40
|
+
/** Pagination state — lives as a Fragment in the list's own scope. */
|
|
32
41
|
get pagination() {
|
|
33
|
-
return this.
|
|
42
|
+
return this.ownScope.resolveFlatOnce(A_ServerEntityListPagination);
|
|
34
43
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
get cacheState() {
|
|
45
|
+
return this.ownScope.resolveFlatOnce(A_ServerEntityListCacheState);
|
|
46
|
+
}
|
|
47
|
+
/** Total number of items currently held in memory. */
|
|
48
|
+
get length() {
|
|
49
|
+
return this._items.length;
|
|
50
|
+
}
|
|
51
|
+
// ── Initialisation ───────────────────────────────────────────────────────
|
|
40
52
|
fromNew(newEntity) {
|
|
41
|
-
this.aseid =
|
|
53
|
+
this.aseid = this.generateASEID({
|
|
42
54
|
concept: A_Context.root.name,
|
|
43
|
-
|
|
44
|
-
entity: "a-list" + (newEntity.name ? `.${newEntity.name}` : ""),
|
|
45
|
-
id: (/* @__PURE__ */ new Date()).getTime().toString()
|
|
55
|
+
entity: "a-list." + newEntity.entity.name
|
|
46
56
|
});
|
|
47
|
-
this._entityConstructor = newEntity.
|
|
57
|
+
this._entityConstructor = newEntity.entity;
|
|
58
|
+
this.ownScope.register(new A_ServerEntityListPagination(newEntity.pagination));
|
|
59
|
+
this.ownScope.register(new A_ServerEntityListCacheState());
|
|
48
60
|
}
|
|
49
61
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* @param items
|
|
55
|
-
* @param pagination
|
|
62
|
+
* Populate the list from raw repository data.
|
|
63
|
+
* Items are registered in the list's own scope so they participate in
|
|
64
|
+
* feature chains and @A_Inject resolution.
|
|
56
65
|
*/
|
|
57
66
|
fromList(items, pagination) {
|
|
58
|
-
this._items
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
const entity = new this._entityConstructor(item);
|
|
63
|
-
return entity;
|
|
67
|
+
this._items.forEach((item) => {
|
|
68
|
+
try {
|
|
69
|
+
this.ownScope.deregister(item);
|
|
70
|
+
} catch {
|
|
64
71
|
}
|
|
65
72
|
});
|
|
73
|
+
this._items = items.map((item) => {
|
|
74
|
+
const entity = item instanceof A_Entity ? item : new this._entityConstructor(item);
|
|
75
|
+
this.ownScope.register(entity);
|
|
76
|
+
return entity;
|
|
77
|
+
});
|
|
66
78
|
if (pagination) {
|
|
67
|
-
this.
|
|
68
|
-
total: pagination.total,
|
|
69
|
-
page: pagination.page,
|
|
70
|
-
pageSize: pagination.pageSize
|
|
71
|
-
};
|
|
79
|
+
this.pagination.update(pagination);
|
|
72
80
|
}
|
|
73
81
|
}
|
|
82
|
+
// ── Collection access ────────────────────────────────────────────────────
|
|
83
|
+
/** Return the item at `index`, or `undefined` if out of range. */
|
|
84
|
+
at(index) {
|
|
85
|
+
return this._items[index];
|
|
86
|
+
}
|
|
87
|
+
/** Replace the item at `index` in place. Accepts a live entity or a plain serialised object. */
|
|
88
|
+
replace(index, item) {
|
|
89
|
+
const next = item instanceof A_Entity ? item : new this._entityConstructor(item);
|
|
90
|
+
try {
|
|
91
|
+
this.ownScope.deregister(this._items[index]);
|
|
92
|
+
} catch {
|
|
93
|
+
}
|
|
94
|
+
this.ownScope.register(next);
|
|
95
|
+
this._items[index] = next;
|
|
96
|
+
return this;
|
|
97
|
+
}
|
|
98
|
+
/** Append an item to the end of the list. */
|
|
99
|
+
push(item) {
|
|
100
|
+
const next = item instanceof A_Entity ? item : new this._entityConstructor(item);
|
|
101
|
+
this.ownScope.register(next);
|
|
102
|
+
this._items.push(next);
|
|
103
|
+
return this;
|
|
104
|
+
}
|
|
105
|
+
/** Prepend an item to the beginning of the list. */
|
|
106
|
+
unshift(item) {
|
|
107
|
+
const next = item instanceof A_Entity ? item : new this._entityConstructor(item);
|
|
108
|
+
this.ownScope.register(next);
|
|
109
|
+
this._items.unshift(next);
|
|
110
|
+
return this;
|
|
111
|
+
}
|
|
112
|
+
/** Remove the item at `index` from the list. */
|
|
113
|
+
remove(index) {
|
|
114
|
+
const [removed] = this._items.splice(index, 1);
|
|
115
|
+
if (removed) {
|
|
116
|
+
try {
|
|
117
|
+
this.ownScope.deregister(removed);
|
|
118
|
+
} catch {
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return this;
|
|
122
|
+
}
|
|
123
|
+
/** Return the first item that satisfies `predicate`, or `undefined`. */
|
|
124
|
+
find(predicate) {
|
|
125
|
+
return this._items.find(predicate);
|
|
126
|
+
}
|
|
127
|
+
/** Return all items that satisfy `predicate` without mutating the list. */
|
|
128
|
+
filter(predicate) {
|
|
129
|
+
return this._items.filter(predicate);
|
|
130
|
+
}
|
|
131
|
+
// ── Caching ──────────────────────────────────────────────────────────────
|
|
74
132
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* @returns
|
|
133
|
+
* Mark this list as cached for `ttlMs` milliseconds from now.
|
|
134
|
+
* Callers can check `isCached()` to decide whether to skip `load()`.
|
|
78
135
|
*/
|
|
136
|
+
setCache(ttlMs) {
|
|
137
|
+
this.cacheState.set(ttlMs);
|
|
138
|
+
return this;
|
|
139
|
+
}
|
|
140
|
+
/** Returns `true` if the cache is still valid. */
|
|
141
|
+
isCached() {
|
|
142
|
+
return this.cacheState.isValid();
|
|
143
|
+
}
|
|
144
|
+
/** Invalidate the cache so the next `load()` call fetches fresh data. */
|
|
145
|
+
invalidateCache() {
|
|
146
|
+
this.cacheState.invalidate();
|
|
147
|
+
return this;
|
|
148
|
+
}
|
|
149
|
+
// ── Serialisation ────────────────────────────────────────────────────────
|
|
79
150
|
toJSON() {
|
|
151
|
+
const { total, page, pageSize } = this.pagination;
|
|
80
152
|
return {
|
|
81
153
|
...super.toJSON(),
|
|
82
154
|
items: this._items.map((i) => i.toJSON()),
|
|
83
|
-
|
|
155
|
+
type: this._entityConstructor.entity ?? "unknown",
|
|
156
|
+
pagination: { total, page, pageSize }
|
|
84
157
|
};
|
|
85
158
|
}
|
|
86
159
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/A-ServerEntityList/A-EntityList.entity.ts"],"names":[],"mappings":";;;AAiBO,MAAM,2BAEH,QAAA,CAGR;AAAA,EALK,WAAA,GAAA;AAAA,IAAA,KAAA,CAAA,GAAA,SAAA,CAAA;AAYH,IAAA,IAAA,CAAU,SAA4B,EAAC;AACvC,IAAA,IAAA,CAAU,WAAA,GAAsD;AAAA,MAC5D,KAAA,EAAO,CAAA;AAAA,MACP,IAAA,EAAM,CAAA;AAAA,MACN,QAAA,EAAU;AAAA,KACd;AAAA,EAAA;AAAA,EAVA,WAAW,KAAA,GAAgB;AACvB,IAAA,OAAO,UAAA;AAAA,EACX;AAAA;AAAA;AAAA;AAAA,EAcA,IAAI,iBAAA,GAAyF;AACzF,IAAA,OAAO,IAAA,CAAK,kBAAA;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,KAAA,GAA2B;AAC3B,IAAA,OAAO,IAAA,CAAK,MAAA;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,UAAA,GAAqD;AACrD,IAAA,OAAO,IAAA,CAAK,WAAA;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,QAAQ,SAAA,EAA0D;AAC9D,IAAA,IAAA,CAAK,KAAA,GAAQ,IAAI,K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, A_Entity,\n ASEID,\n} from \"@adaas/a-concept\";\nimport {\n A_SERVER_TYPES__A_EntityListConstructor,\n A_SERVER_TYPES__A_EntityListPagination,\n A_SERVER_TYPES__A_EntityListSerialized\n} from \"./A-EntityList.types\";\n\n\n\n/**\n * A-EntityList\n * \n * Entity that represents a list of entities with pagination of particular type\n */\nexport class A_ServerEntityList<\n EntityType extends A_Entity = A_Entity,\n> extends A_Entity<\n A_SERVER_TYPES__A_EntityListConstructor,\n A_SERVER_TYPES__A_EntityListSerialized\n> {\n\n static get scope(): string {\n return 'a-server';\n }\n\n protected _entityConstructor!: new (...args: ConstructorParameters<typeof A_Entity>) => EntityType;\n protected _items: Array<EntityType> = [];\n protected _pagination: A_SERVER_TYPES__A_EntityListPagination = {\n total: 0,\n page: 1,\n pageSize: 10\n };\n\n\n /**\n * Returns the entity constructor used for the list\n */\n get entityConstructor(): new (...args: ConstructorParameters<typeof A_Entity>) => EntityType {\n return this._entityConstructor;\n }\n\n /**\n * Returns the list of items contained in the entity list\n */\n get items(): Array<EntityType> {\n return this._items;\n }\n\n /**\n * Returns pagination information about the entity list\n */\n get pagination(): A_SERVER_TYPES__A_EntityListPagination {\n return this._pagination;\n }\n\n\n\n\n /**\n * Creates a new instance of A_EntityList\n * \n * @param newEntity \n */\n fromNew(newEntity: A_SERVER_TYPES__A_EntityListConstructor): void {\n this.aseid = new ASEID({\n concept: A_Context.root.name,\n scope: 'default',\n entity: 'a-list' + (newEntity.name ? `.${newEntity.name}` : ''),\n id: (new Date()).getTime().toString(),\n });\n\n this._entityConstructor = newEntity.constructor as new (...args: any[]) => EntityType;\n }\n\n\n\n /**\n * Allows to convert Repository Response data to EntityList instance\n * \n * [!] This method does not load the data from the repository, it only converts the data to the EntityList instance\n * \n * @param items \n * @param pagination \n */\n fromList(\n items: Array<EntityType> | Array<ReturnType<EntityType['toJSON']>>,\n pagination?: A_SERVER_TYPES__A_EntityListPagination\n ) {\n this._items = items.map(item => {\n if (item instanceof A_Entity) {\n return item as EntityType;\n } else {\n const entity = new this._entityConstructor(item);\n return entity;\n }\n });\n\n if (pagination) {\n this._pagination = {\n total: pagination.total,\n page: pagination.page,\n pageSize: pagination.pageSize\n }\n }\n }\n\n\n\n /**\n * Serializes the EntityList to a JSON object\n * \n * @returns \n */\n toJSON(): A_SERVER_TYPES__A_EntityListSerialized<EntityType> {\n return {\n ...super.toJSON(),\n items: this._items.map(i => i.toJSON()) as ReturnType<EntityType['toJSON']>[],\n pagination: this._pagination\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/A-ServerEntityList/A-EntityList.entity.ts"],"names":[],"mappings":";;;;;AA0BO,MAAM,2BAEH,QAAA,CAGR;AAAA,EALK,WAAA,GAAA;AAAA,IAAA,KAAA,CAAA,GAAA,SAAA,CAAA;AAkBH;AAAA;AAAA;AAAA;AAAA;AAAA,IAAA,IAAA,CAAU,SAA4B,EAAC;AAAA,EAAA;AAAA,EAXvC,WAAW,KAAA,GAAgB;AACvB,IAAA,OAAO,UAAA;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAsBA,IAAI,QAAA,GAAoB;AACpB,IAAA,IAAI,CAAC,KAAK,SAAA,EAAW;AACjB,MAAA,IAAA,CAAK,YAAY,SAAA,CAAU,QAAA;AAAA,QACvB,IAAA;AAAA,QACA,IAAI,QAAQ,EAAE,IAAA,EAAM,GAAG,IAAA,CAAK,KAAA,CAAM,EAAE,CAAA,MAAA,CAAA,EAAU;AAAA,OAClD;AAAA,IACJ;AACA,IAAA,OAAO,IAAA,CAAK,SAAA;AAAA,EAChB;AAAA,EAEA,IAAI,iBAAA,GAA6D;AAC7D,IAAA,OAAO,IAAA,CAAK,kBAAA;AAAA,EAChB;AAAA,EAEA,IAAI,KAAA,GAA2B;AAC3B,IAAA,OAAO,IAAA,CAAK,MAAA;AAAA,EAChB;AAAA;AAAA,EAGA,IAAI,UAAA,GAA2C;AAC3C,IAAA,OAAO,IAAA,CAAK,Q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AA;AAAA,MACjD,UAAA,EAAY,EAAE,KAAA,EAAO,IAAA,EAAM,QAAA;AAAS,KACxC;AAAA,EACJ;AACJ","file":"A-EntityList.entity.mjs","sourcesContent":["import {\n A_Context, A_Entity, A_Scope,\n A_TYPES__Entity_Constructor,\n ASEID,\n} from \"@adaas/a-concept\";\nimport {\n A_SERVER_TYPES__A_EntityListConstructor,\n A_SERVER_TYPES__A_EntityListPagination,\n A_SERVER_TYPES__A_EntityListSerialized\n} from \"./A-EntityList.types\";\nimport { A_ServerEntityListPagination } from \"./A-EntityListPagination.context\";\nimport { A_ServerEntityListCacheState } from \"./A-EntityListCacheState.context\";\n\n\n\n/**\n * A-EntityList\n *\n * Typed, paginated list of A-Concept entities.\n *\n * Construction (user-facing):\n * new A_ServerEntityList<User>({ entity: User, pagination: { page: 1, pageSize: 20 } })\n *\n * Construction (controller-internal, backward-compat):\n * new A_ServerEntityList({ name: 'user', scope: 'my-scope', constructor: User })\n */\nexport class A_ServerEntityList<\n EntityType extends A_Entity = A_Entity,\n> extends A_Entity<\n A_SERVER_TYPES__A_EntityListConstructor<EntityType>,\n A_SERVER_TYPES__A_EntityListSerialized<EntityType>\n> {\n\n static get scope(): string {\n return 'a-server';\n }\n\n protected _entityConstructor!: A_TYPES__Entity_Constructor<EntityType>;\n\n /**\n * Ordered item references for O(1) positional access.\n * The list's own scope is the authoritative store (enables @A_Inject and\n * feature chains on items); this array mirrors the same items in order.\n */\n protected _items: Array<EntityType> = [];\n\n /** Lazily allocated private scope — pagination and cache state live here. */\n private _ownScope?: A_Scope;\n\n\n // ── Getters ──────────────────────────────────────────────────────────────\n\n /**\n * The list's own scope, created on first access and bound to this entity\n * via A_Context.allocate. Items, pagination and cache state are registered\n * here so they participate in feature chains and @A_Inject resolution.\n */\n get ownScope(): A_Scope {\n if (!this._ownScope) {\n this._ownScope = A_Context.allocate(\n this,\n new A_Scope({ name: `${this.aseid.id}-scope` })\n );\n }\n return this._ownScope;\n }\n\n get entityConstructor(): A_TYPES__Entity_Constructor<EntityType> {\n return this._entityConstructor;\n }\n\n get items(): Array<EntityType> {\n return this._items;\n }\n\n /** Pagination state — lives as a Fragment in the list's own scope. */\n get pagination(): A_ServerEntityListPagination {\n return this.ownScope.resolveFlatOnce(A_ServerEntityListPagination)!;\n }\n\n private get cacheState(): A_ServerEntityListCacheState {\n return this.ownScope.resolveFlatOnce(A_ServerEntityListCacheState)!;\n }\n\n /** Total number of items currently held in memory. */\n get length(): number {\n return this._items.length;\n }\n\n\n // ── Initialisation ───────────────────────────────────────────────────────\n\n fromNew(newEntity: A_SERVER_TYPES__A_EntityListConstructor<EntityType>): void {\n this.aseid = this.generateASEID({\n concept: A_Context.root.name,\n entity: 'a-list.' + newEntity.entity.name,\n });\n\n this._entityConstructor = newEntity.entity;\n\n // Initialise state Fragments in the list's own scope\n this.ownScope.register(new A_ServerEntityListPagination(newEntity.pagination));\n this.ownScope.register(new A_ServerEntityListCacheState());\n }\n\n\n /**\n * Populate the list from raw repository data.\n * Items are registered in the list's own scope so they participate in\n * feature chains and @A_Inject resolution.\n */\n fromList(\n items: Array<EntityType> | Array<ReturnType<EntityType['toJSON']>>,\n pagination?: A_SERVER_TYPES__A_EntityListPagination\n ) {\n // Deregister previous items from own scope\n this._items.forEach(item => {\n try { this.ownScope.deregister(item); } catch { /* already gone */ }\n });\n\n this._items = items.map(item => {\n const entity = item instanceof A_Entity\n ? item as EntityType\n : new this._entityConstructor(item as any);\n this.ownScope.register(entity);\n return entity;\n });\n\n if (pagination) {\n this.pagination.update(pagination);\n }\n }\n\n\n // ── Collection access ────────────────────────────────────────────────────\n\n /** Return the item at `index`, or `undefined` if out of range. */\n at(index: number): EntityType | undefined {\n return this._items[index];\n }\n\n /** Replace the item at `index` in place. Accepts a live entity or a plain serialised object. */\n replace(index: number, item: EntityType | ReturnType<EntityType['toJSON']>): this {\n const next = item instanceof A_Entity\n ? item as EntityType\n : new this._entityConstructor(item as any);\n try { this.ownScope.deregister(this._items[index]); } catch { /* ok */ }\n this.ownScope.register(next);\n this._items[index] = next;\n return this;\n }\n\n /** Append an item to the end of the list. */\n push(item: EntityType | ReturnType<EntityType['toJSON']>): this {\n const next = item instanceof A_Entity\n ? item as EntityType\n : new this._entityConstructor(item as any);\n this.ownScope.register(next);\n this._items.push(next);\n return this;\n }\n\n /** Prepend an item to the beginning of the list. */\n unshift(item: EntityType | ReturnType<EntityType['toJSON']>): this {\n const next = item instanceof A_Entity\n ? item as EntityType\n : new this._entityConstructor(item as any);\n this.ownScope.register(next);\n this._items.unshift(next);\n return this;\n }\n\n /** Remove the item at `index` from the list. */\n remove(index: number): this {\n const [removed] = this._items.splice(index, 1);\n if (removed) {\n try { this.ownScope.deregister(removed); } catch { /* ok */ }\n }\n return this;\n }\n\n /** Return the first item that satisfies `predicate`, or `undefined`. */\n find(predicate: (item: EntityType, index: number) => boolean): EntityType | undefined {\n return this._items.find(predicate);\n }\n\n /** Return all items that satisfy `predicate` without mutating the list. */\n filter(predicate: (item: EntityType, index: number) => boolean): EntityType[] {\n return this._items.filter(predicate);\n }\n\n\n // ── Caching ──────────────────────────────────────────────────────────────\n\n /**\n * Mark this list as cached for `ttlMs` milliseconds from now.\n * Callers can check `isCached()` to decide whether to skip `load()`.\n */\n setCache(ttlMs: number): this {\n this.cacheState.set(ttlMs);\n return this;\n }\n\n /** Returns `true` if the cache is still valid. */\n isCached(): boolean {\n return this.cacheState.isValid();\n }\n\n /** Invalidate the cache so the next `load()` call fetches fresh data. */\n invalidateCache(): this {\n this.cacheState.invalidate();\n return this;\n }\n\n\n // ── Serialisation ────────────────────────────────────────────────────────\n\n toJSON(): A_SERVER_TYPES__A_EntityListSerialized<EntityType> {\n const { total, page, pageSize } = this.pagination;\n return {\n ...super.toJSON(),\n items: this._items.map(i => i.toJSON()) as ReturnType<EntityType['toJSON']>[],\n type: (this._entityConstructor as any).entity ?? 'unknown',\n pagination: { total, page, pageSize },\n };\n }\n}\n\n"]}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A_Entity, A_TYPES__Entity_Constructor, A_TYPES__Entity_Serialized } from '@adaas/a-concept';
|
|
2
2
|
|
|
3
|
-
type A_SERVER_TYPES__A_EntityListConstructor = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
type A_SERVER_TYPES__A_EntityListConstructor<T extends A_Entity = A_Entity> = {
|
|
4
|
+
/** User-facing: the entity class (e.g. `User`). Name and scope are derived from its statics. */
|
|
5
|
+
entity: A_TYPES__Entity_Constructor<T>;
|
|
6
|
+
/** Initial pagination request parameters. Defaults to page 1, pageSize 10. */
|
|
7
|
+
pagination?: {
|
|
8
|
+
page?: number;
|
|
9
|
+
pageSize?: number;
|
|
10
|
+
};
|
|
7
11
|
};
|
|
8
12
|
declare enum A_SERVER_TYPES__A_EntityListEvent {
|
|
9
13
|
Load = "load"
|
|
@@ -18,5 +22,9 @@ type A_SERVER_TYPES__A_EntityListPagination = {
|
|
|
18
22
|
page: number;
|
|
19
23
|
pageSize: number;
|
|
20
24
|
};
|
|
25
|
+
type A_SERVER_TYPES__A_EntityListCacheEntry = {
|
|
26
|
+
timestamp: number;
|
|
27
|
+
ttl: number;
|
|
28
|
+
};
|
|
21
29
|
|
|
22
|
-
export { type A_SERVER_TYPES__A_EntityListConstructor, A_SERVER_TYPES__A_EntityListEvent, type A_SERVER_TYPES__A_EntityListPagination, type A_SERVER_TYPES__A_EntityListSerialized };
|
|
30
|
+
export { type A_SERVER_TYPES__A_EntityListCacheEntry, type A_SERVER_TYPES__A_EntityListConstructor, A_SERVER_TYPES__A_EntityListEvent, type A_SERVER_TYPES__A_EntityListPagination, type A_SERVER_TYPES__A_EntityListSerialized };
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A_Entity, A_TYPES__Entity_Constructor, A_TYPES__Entity_Serialized } from '@adaas/a-concept';
|
|
2
2
|
|
|
3
|
-
type A_SERVER_TYPES__A_EntityListConstructor = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
type A_SERVER_TYPES__A_EntityListConstructor<T extends A_Entity = A_Entity> = {
|
|
4
|
+
/** User-facing: the entity class (e.g. `User`). Name and scope are derived from its statics. */
|
|
5
|
+
entity: A_TYPES__Entity_Constructor<T>;
|
|
6
|
+
/** Initial pagination request parameters. Defaults to page 1, pageSize 10. */
|
|
7
|
+
pagination?: {
|
|
8
|
+
page?: number;
|
|
9
|
+
pageSize?: number;
|
|
10
|
+
};
|
|
7
11
|
};
|
|
8
12
|
declare enum A_SERVER_TYPES__A_EntityListEvent {
|
|
9
13
|
Load = "load"
|
|
@@ -18,5 +22,9 @@ type A_SERVER_TYPES__A_EntityListPagination = {
|
|
|
18
22
|
page: number;
|
|
19
23
|
pageSize: number;
|
|
20
24
|
};
|
|
25
|
+
type A_SERVER_TYPES__A_EntityListCacheEntry = {
|
|
26
|
+
timestamp: number;
|
|
27
|
+
ttl: number;
|
|
28
|
+
};
|
|
21
29
|
|
|
22
|
-
export { type A_SERVER_TYPES__A_EntityListConstructor, A_SERVER_TYPES__A_EntityListEvent, type A_SERVER_TYPES__A_EntityListPagination, type A_SERVER_TYPES__A_EntityListSerialized };
|
|
30
|
+
export { type A_SERVER_TYPES__A_EntityListCacheEntry, type A_SERVER_TYPES__A_EntityListConstructor, A_SERVER_TYPES__A_EntityListEvent, type A_SERVER_TYPES__A_EntityListPagination, type A_SERVER_TYPES__A_EntityListSerialized };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/A-ServerEntityList/A-EntityList.types.ts"],"names":["A_SERVER_TYPES__A_EntityListEvent"],"mappings":";;
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/A-ServerEntityList/A-EntityList.types.ts"],"names":["A_SERVER_TYPES__A_EntityListEvent"],"mappings":";;AAeO,IAAK,iCAAA,qBAAAA,kCAAAA,KAAL;AACH,EAAAA,mCAAA,MAAA,CAAA,GAAO,MAAA;AADC,EAAA,OAAAA,kCAAAA;AAAA,CAAA,EAAA,iCAAA,IAAA,EAAA","file":"A-EntityList.types.js","sourcesContent":["import { A_Entity, A_TYPES__Entity_Constructor, A_TYPES__Entity_Serialized } from \"@adaas/a-concept\";\n\n\nexport type A_SERVER_TYPES__A_EntityListConstructor<\n T extends A_Entity = A_Entity\n> = {\n /** User-facing: the entity class (e.g. `User`). Name and scope are derived from its statics. */\n entity: A_TYPES__Entity_Constructor<T>;\n /** Initial pagination request parameters. Defaults to page 1, pageSize 10. */\n pagination?: {\n page?: number;\n pageSize?: number;\n };\n};\n\nexport enum A_SERVER_TYPES__A_EntityListEvent {\n Load = 'load',\n}\n\nexport type A_SERVER_TYPES__A_EntityListSerialized<EntityTypes extends A_Entity = A_Entity> = {\n items: Array<ReturnType<EntityTypes['toJSON']>>,\n type: string,\n pagination: A_SERVER_TYPES__A_EntityListPagination\n} & A_TYPES__Entity_Serialized;\n\n\nexport type A_SERVER_TYPES__A_EntityListPagination = {\n total: number,\n page: number,\n pageSize: number,\n};\n\nexport type A_SERVER_TYPES__A_EntityListCacheEntry = {\n timestamp: number;\n ttl: number;\n};\n\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/A-ServerEntityList/A-EntityList.types.ts"],"names":["A_SERVER_TYPES__A_EntityListEvent"],"mappings":";;
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/A-ServerEntityList/A-EntityList.types.ts"],"names":["A_SERVER_TYPES__A_EntityListEvent"],"mappings":";;AAeO,IAAK,iCAAA,qBAAAA,kCAAAA,KAAL;AACH,EAAAA,mCAAA,MAAA,CAAA,GAAO,MAAA;AADC,EAAA,OAAAA,kCAAAA;AAAA,CAAA,EAAA,iCAAA,IAAA,EAAA","file":"A-EntityList.types.mjs","sourcesContent":["import { A_Entity, A_TYPES__Entity_Constructor, A_TYPES__Entity_Serialized } from \"@adaas/a-concept\";\n\n\nexport type A_SERVER_TYPES__A_EntityListConstructor<\n T extends A_Entity = A_Entity\n> = {\n /** User-facing: the entity class (e.g. `User`). Name and scope are derived from its statics. */\n entity: A_TYPES__Entity_Constructor<T>;\n /** Initial pagination request parameters. Defaults to page 1, pageSize 10. */\n pagination?: {\n page?: number;\n pageSize?: number;\n };\n};\n\nexport enum A_SERVER_TYPES__A_EntityListEvent {\n Load = 'load',\n}\n\nexport type A_SERVER_TYPES__A_EntityListSerialized<EntityTypes extends A_Entity = A_Entity> = {\n items: Array<ReturnType<EntityTypes['toJSON']>>,\n type: string,\n pagination: A_SERVER_TYPES__A_EntityListPagination\n} & A_TYPES__Entity_Serialized;\n\n\nexport type A_SERVER_TYPES__A_EntityListPagination = {\n total: number,\n page: number,\n pageSize: number,\n};\n\nexport type A_SERVER_TYPES__A_EntityListCacheEntry = {\n timestamp: number;\n ttl: number;\n};\n\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { A_Fragment, A_TYPES__Fragment_Serialized } from '@adaas/a-concept';
|
|
2
|
+
|
|
3
|
+
declare class A_ServerEntityListCacheState extends A_Fragment<A_TYPES__Fragment_Serialized> {
|
|
4
|
+
protected _timestamp?: number;
|
|
5
|
+
protected _ttl?: number;
|
|
6
|
+
set(ttlMs: number): void;
|
|
7
|
+
invalidate(): void;
|
|
8
|
+
isValid(): boolean;
|
|
9
|
+
toJSON(): A_TYPES__Fragment_Serialized;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { A_ServerEntityListCacheState };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { A_Fragment, A_TYPES__Fragment_Serialized } from '@adaas/a-concept';
|
|
2
|
+
|
|
3
|
+
declare class A_ServerEntityListCacheState extends A_Fragment<A_TYPES__Fragment_Serialized> {
|
|
4
|
+
protected _timestamp?: number;
|
|
5
|
+
protected _ttl?: number;
|
|
6
|
+
set(ttlMs: number): void;
|
|
7
|
+
invalidate(): void;
|
|
8
|
+
isValid(): boolean;
|
|
9
|
+
toJSON(): A_TYPES__Fragment_Serialized;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { A_ServerEntityListCacheState };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var aConcept = require('@adaas/a-concept');
|
|
4
|
+
|
|
5
|
+
class A_ServerEntityListCacheState extends aConcept.A_Fragment {
|
|
6
|
+
set(ttlMs) {
|
|
7
|
+
this._timestamp = Date.now();
|
|
8
|
+
this._ttl = ttlMs;
|
|
9
|
+
}
|
|
10
|
+
invalidate() {
|
|
11
|
+
this._timestamp = void 0;
|
|
12
|
+
this._ttl = void 0;
|
|
13
|
+
}
|
|
14
|
+
isValid() {
|
|
15
|
+
if (this._timestamp === void 0 || this._ttl === void 0) return false;
|
|
16
|
+
return Date.now() - this._timestamp < this._ttl;
|
|
17
|
+
}
|
|
18
|
+
toJSON() {
|
|
19
|
+
return { name: this.name };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
exports.A_ServerEntityListCacheState = A_ServerEntityListCacheState;
|
|
24
|
+
//# sourceMappingURL=A-EntityListCacheState.context.js.map
|
|
25
|
+
//# sourceMappingURL=A-EntityListCacheState.context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/A-ServerEntityList/A-EntityListCacheState.context.ts"],"names":["A_Fragment"],"mappings":";;;;AAGO,MAAM,qCAAqCA,mBAAA,CAAyC;AAAA,EAKvF,IAAI,KAAA,EAAqB;AACrB,IAAA,IAAA,CAAK,UAAA,GAAa,KAAK,GAAA,EAAI;AAC3B,IAAA,IAAA,CAAK,IAAA,GAAO,KAAA;AAAA,EAChB;AAAA,EAEA,UAAA,GAAmB;AACf,IAAA,IAAA,CAAK,UAAA,GAAa,MAAA;AAClB,IAAA,IAAA,CAAK,IAAA,GAAO,MAAA;AAAA,EAChB;AAAA,EAEA,OAAA,GAAmB;AACf,IAAA,IAAI,KAAK,UAAA,KAAe,MAAA,IAAa,IAAA,CAAK,IAAA,KAAS,QAAW,OAAO,KAAA;AACrE,IAAA,OAAQ,IAAA,CAAK,GAAA,EAAI,GAAI,IAAA,CAAK,aAAc,IAAA,CAAK,IAAA;AAAA,EACjD;AAAA,EAEA,MAAA,GAAuC;AACnC,IAAA,OAAO,EAAE,IAAA,EAAM,IAAA,CAAK,IAAA,EAAK;AAAA,EAC7B;AACJ","file":"A-EntityListCacheState.context.js","sourcesContent":["import { A_Fragment, A_TYPES__Fragment_Serialized } from \"@adaas/a-concept\";\n\n\nexport class A_ServerEntityListCacheState extends A_Fragment<A_TYPES__Fragment_Serialized> {\n\n protected _timestamp?: number;\n protected _ttl?: number;\n\n set(ttlMs: number): void {\n this._timestamp = Date.now();\n this._ttl = ttlMs;\n }\n\n invalidate(): void {\n this._timestamp = undefined;\n this._ttl = undefined;\n }\n\n isValid(): boolean {\n if (this._timestamp === undefined || this._ttl === undefined) return false;\n return (Date.now() - this._timestamp) < this._ttl;\n }\n\n toJSON(): A_TYPES__Fragment_Serialized {\n return { name: this.name };\n }\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import '../../chunk-EQQGB2QZ.mjs';
|
|
2
|
+
import { A_Fragment } from '@adaas/a-concept';
|
|
3
|
+
|
|
4
|
+
class A_ServerEntityListCacheState extends A_Fragment {
|
|
5
|
+
set(ttlMs) {
|
|
6
|
+
this._timestamp = Date.now();
|
|
7
|
+
this._ttl = ttlMs;
|
|
8
|
+
}
|
|
9
|
+
invalidate() {
|
|
10
|
+
this._timestamp = void 0;
|
|
11
|
+
this._ttl = void 0;
|
|
12
|
+
}
|
|
13
|
+
isValid() {
|
|
14
|
+
if (this._timestamp === void 0 || this._ttl === void 0) return false;
|
|
15
|
+
return Date.now() - this._timestamp < this._ttl;
|
|
16
|
+
}
|
|
17
|
+
toJSON() {
|
|
18
|
+
return { name: this.name };
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { A_ServerEntityListCacheState };
|
|
23
|
+
//# sourceMappingURL=A-EntityListCacheState.context.mjs.map
|
|
24
|
+
//# sourceMappingURL=A-EntityListCacheState.context.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/A-ServerEntityList/A-EntityListCacheState.context.ts"],"names":[],"mappings":";;;AAGO,MAAM,qCAAqC,UAAA,CAAyC;AAAA,EAKvF,IAAI,KAAA,EAAqB;AACrB,IAAA,IAAA,CAAK,UAAA,GAAa,KAAK,GAAA,EAAI;AAC3B,IAAA,IAAA,CAAK,IAAA,GAAO,KAAA;AAAA,EAChB;AAAA,EAEA,UAAA,GAAmB;AACf,IAAA,IAAA,CAAK,UAAA,GAAa,MAAA;AAClB,IAAA,IAAA,CAAK,IAAA,GAAO,MAAA;AAAA,EAChB;AAAA,EAEA,OAAA,GAAmB;AACf,IAAA,IAAI,KAAK,UAAA,KAAe,MAAA,IAAa,IAAA,CAAK,IAAA,KAAS,QAAW,OAAO,KAAA;AACrE,IAAA,OAAQ,IAAA,CAAK,GAAA,EAAI,GAAI,IAAA,CAAK,aAAc,IAAA,CAAK,IAAA;AAAA,EACjD;AAAA,EAEA,MAAA,GAAuC;AACnC,IAAA,OAAO,EAAE,IAAA,EAAM,IAAA,CAAK,IAAA,EAAK;AAAA,EAC7B;AACJ","file":"A-EntityListCacheState.context.mjs","sourcesContent":["import { A_Fragment, A_TYPES__Fragment_Serialized } from \"@adaas/a-concept\";\n\n\nexport class A_ServerEntityListCacheState extends A_Fragment<A_TYPES__Fragment_Serialized> {\n\n protected _timestamp?: number;\n protected _ttl?: number;\n\n set(ttlMs: number): void {\n this._timestamp = Date.now();\n this._ttl = ttlMs;\n }\n\n invalidate(): void {\n this._timestamp = undefined;\n this._ttl = undefined;\n }\n\n isValid(): boolean {\n if (this._timestamp === undefined || this._ttl === undefined) return false;\n return (Date.now() - this._timestamp) < this._ttl;\n }\n\n toJSON(): A_TYPES__Fragment_Serialized {\n return { name: this.name };\n }\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { A_TYPES__Fragment_Serialized, A_Fragment } from '@adaas/a-concept';
|
|
2
|
+
import { A_SERVER_TYPES__A_EntityListPagination } from './A-EntityList.types.mjs';
|
|
3
|
+
|
|
4
|
+
type A_SERVER_TYPES__A_EntityListPaginationSerialized = A_SERVER_TYPES__A_EntityListPagination & A_TYPES__Fragment_Serialized;
|
|
5
|
+
declare class A_ServerEntityListPagination extends A_Fragment<A_SERVER_TYPES__A_EntityListPaginationSerialized> {
|
|
6
|
+
protected _total: number;
|
|
7
|
+
protected _page: number;
|
|
8
|
+
protected _pageSize: number;
|
|
9
|
+
constructor(init?: Partial<A_SERVER_TYPES__A_EntityListPagination>);
|
|
10
|
+
get total(): number;
|
|
11
|
+
get page(): number;
|
|
12
|
+
get pageSize(): number;
|
|
13
|
+
update(data: Partial<A_SERVER_TYPES__A_EntityListPagination>): void;
|
|
14
|
+
fromJSON(serialized: A_SERVER_TYPES__A_EntityListPaginationSerialized): void;
|
|
15
|
+
toJSON(): A_SERVER_TYPES__A_EntityListPaginationSerialized;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { type A_SERVER_TYPES__A_EntityListPaginationSerialized, A_ServerEntityListPagination };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { A_TYPES__Fragment_Serialized, A_Fragment } from '@adaas/a-concept';
|
|
2
|
+
import { A_SERVER_TYPES__A_EntityListPagination } from './A-EntityList.types.js';
|
|
3
|
+
|
|
4
|
+
type A_SERVER_TYPES__A_EntityListPaginationSerialized = A_SERVER_TYPES__A_EntityListPagination & A_TYPES__Fragment_Serialized;
|
|
5
|
+
declare class A_ServerEntityListPagination extends A_Fragment<A_SERVER_TYPES__A_EntityListPaginationSerialized> {
|
|
6
|
+
protected _total: number;
|
|
7
|
+
protected _page: number;
|
|
8
|
+
protected _pageSize: number;
|
|
9
|
+
constructor(init?: Partial<A_SERVER_TYPES__A_EntityListPagination>);
|
|
10
|
+
get total(): number;
|
|
11
|
+
get page(): number;
|
|
12
|
+
get pageSize(): number;
|
|
13
|
+
update(data: Partial<A_SERVER_TYPES__A_EntityListPagination>): void;
|
|
14
|
+
fromJSON(serialized: A_SERVER_TYPES__A_EntityListPaginationSerialized): void;
|
|
15
|
+
toJSON(): A_SERVER_TYPES__A_EntityListPaginationSerialized;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { type A_SERVER_TYPES__A_EntityListPaginationSerialized, A_ServerEntityListPagination };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var aConcept = require('@adaas/a-concept');
|
|
4
|
+
|
|
5
|
+
class A_ServerEntityListPagination extends aConcept.A_Fragment {
|
|
6
|
+
constructor(init) {
|
|
7
|
+
super();
|
|
8
|
+
this._total = 0;
|
|
9
|
+
this._page = 1;
|
|
10
|
+
this._pageSize = 10;
|
|
11
|
+
if (init) {
|
|
12
|
+
if (init.total !== void 0) this._total = init.total;
|
|
13
|
+
if (init.page !== void 0) this._page = init.page;
|
|
14
|
+
if (init.pageSize !== void 0) this._pageSize = init.pageSize;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
get total() {
|
|
18
|
+
return this._total;
|
|
19
|
+
}
|
|
20
|
+
get page() {
|
|
21
|
+
return this._page;
|
|
22
|
+
}
|
|
23
|
+
get pageSize() {
|
|
24
|
+
return this._pageSize;
|
|
25
|
+
}
|
|
26
|
+
update(data) {
|
|
27
|
+
if (data.total !== void 0) this._total = data.total;
|
|
28
|
+
if (data.page !== void 0) this._page = data.page;
|
|
29
|
+
if (data.pageSize !== void 0) this._pageSize = data.pageSize;
|
|
30
|
+
}
|
|
31
|
+
fromJSON(serialized) {
|
|
32
|
+
this._total = serialized.total;
|
|
33
|
+
this._page = serialized.page;
|
|
34
|
+
this._pageSize = serialized.pageSize;
|
|
35
|
+
}
|
|
36
|
+
toJSON() {
|
|
37
|
+
return {
|
|
38
|
+
name: this.name,
|
|
39
|
+
total: this._total,
|
|
40
|
+
page: this._page,
|
|
41
|
+
pageSize: this._pageSize
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
exports.A_ServerEntityListPagination = A_ServerEntityListPagination;
|
|
47
|
+
//# sourceMappingURL=A-EntityListPagination.context.js.map
|
|
48
|
+
//# sourceMappingURL=A-EntityListPagination.context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/A-ServerEntityList/A-EntityListPagination.context.ts"],"names":["A_Fragment"],"mappings":";;;;AAQO,MAAM,qCAAqCA,mBAAA,CAA6D;AAAA,EAM3G,YAAY,IAAA,EAAwD;AAChE,IAAA,KAAA,EAAM;AALV,IAAA,IAAA,CAAU,MAAA,GAAiB,CAAA;AAC3B,IAAA,IAAA,CAAU,KAAA,GAAgB,CAAA;AAC1B,IAAA,IAAA,CAAU,SAAA,GAAoB,EAAA;AAI1B,IAAA,IAAI,IAAA,EAAM;AACN,MAAA,IAAI,IAAA,CAAK,KAAA,KAAU,MAAA,EAAW,IAAA,CAAK,SAAS,IAAA,CAAK,KAAA;AACjD,MAAA,IAAI,IAAA,CAAK,IAAA,KAAS,MAAA,EAAW,IAAA,CAAK,QAAQ,IAAA,CAAK,IAAA;AAC/C,MAAA,IAAI,IAAA,CAAK,QAAA,KAAa,MAAA,EAAW,IAAA,CAAK,YAAY,IAAA,CAAK,QAAA;AAAA,IAC3D;AAAA,EACJ;AAAA,EAEA,IAAI,KAAA,GAAgB;AAAE,IAAA,OAAO,IAAA,CAAK,MAAA;AAAA,EAAQ;AAAA,EAC1C,IAAI,IAAA,GAAe;AAAE,IAAA,OAAO,IAAA,CAAK,KAAA;AAAA,EAAO;AAAA,EACxC,IAAI,QAAA,GAAmB;AAAE,IAAA,OAAO,IAAA,CAAK,SAAA;AAAA,EAAW;AAAA,EAEhD,OAAO,IAAA,EAA6D;AAChE,IAAA,IAAI,IAAA,CAAK,KAAA,KAAU,MAAA,EAAW,IAAA,CAAK,SAAS,IAAA,CAAK,KAAA;AACjD,IAAA,IAAI,IAAA,CAAK,IAAA,KAAS,MAAA,EAAW,IAAA,CAAK,QAAQ,IAAA,CAAK,IAAA;AAC/C,IAAA,IAAI,IAAA,CAAK,QAAA,KAAa,MAAA,EAAW,IAAA,CAAK,YAAY,IAAA,CAAK,QAAA;AAAA,EAC3D;AAAA,EAEA,SAAS,UAAA,EAAoE;AACzE,IAAA,IAAA,CAAK,SAAS,UAAA,CAAW,KAAA;AACzB,IAAA,IAAA,CAAK,QAAQ,UAAA,CAAW,IAAA;AACxB,IAAA,IAAA,CAAK,YAAY,UAAA,CAAW,QAAA;AAAA,EAChC;AAAA,EAEA,MAAA,GAA2D;AACvD,IAAA,OAAO;AAAA,MACH,MAAM,IAAA,CAAK,IAAA;AAAA,MACX,OAAO,IAAA,CAAK,MAAA;AAAA,MACZ,MAAM,IAAA,CAAK,KAAA;AAAA,MACX,UAAU,IAAA,CAAK;AAAA,KACnB;AAAA,EACJ;AACJ","file":"A-EntityListPagination.context.js","sourcesContent":["import { A_Fragment, A_TYPES__Fragment_Serialized } from \"@adaas/a-concept\";\nimport { A_SERVER_TYPES__A_EntityListPagination } from \"./A-EntityList.types\";\n\n\nexport type A_SERVER_TYPES__A_EntityListPaginationSerialized =\n A_SERVER_TYPES__A_EntityListPagination & A_TYPES__Fragment_Serialized;\n\n\nexport class A_ServerEntityListPagination extends A_Fragment<A_SERVER_TYPES__A_EntityListPaginationSerialized> {\n\n protected _total: number = 0;\n protected _page: number = 1;\n protected _pageSize: number = 10;\n\n constructor(init?: Partial<A_SERVER_TYPES__A_EntityListPagination>) {\n super();\n if (init) {\n if (init.total !== undefined) this._total = init.total;\n if (init.page !== undefined) this._page = init.page;\n if (init.pageSize !== undefined) this._pageSize = init.pageSize;\n }\n }\n\n get total(): number { return this._total; }\n get page(): number { return this._page; }\n get pageSize(): number { return this._pageSize; }\n\n update(data: Partial<A_SERVER_TYPES__A_EntityListPagination>): void {\n if (data.total !== undefined) this._total = data.total;\n if (data.page !== undefined) this._page = data.page;\n if (data.pageSize !== undefined) this._pageSize = data.pageSize;\n }\n\n fromJSON(serialized: A_SERVER_TYPES__A_EntityListPaginationSerialized): void {\n this._total = serialized.total;\n this._page = serialized.page;\n this._pageSize = serialized.pageSize;\n }\n\n toJSON(): A_SERVER_TYPES__A_EntityListPaginationSerialized {\n return {\n name: this.name,\n total: this._total,\n page: this._page,\n pageSize: this._pageSize,\n };\n }\n}\n"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import '../../chunk-EQQGB2QZ.mjs';
|
|
2
|
+
import { A_Fragment } from '@adaas/a-concept';
|
|
3
|
+
|
|
4
|
+
class A_ServerEntityListPagination extends A_Fragment {
|
|
5
|
+
constructor(init) {
|
|
6
|
+
super();
|
|
7
|
+
this._total = 0;
|
|
8
|
+
this._page = 1;
|
|
9
|
+
this._pageSize = 10;
|
|
10
|
+
if (init) {
|
|
11
|
+
if (init.total !== void 0) this._total = init.total;
|
|
12
|
+
if (init.page !== void 0) this._page = init.page;
|
|
13
|
+
if (init.pageSize !== void 0) this._pageSize = init.pageSize;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
get total() {
|
|
17
|
+
return this._total;
|
|
18
|
+
}
|
|
19
|
+
get page() {
|
|
20
|
+
return this._page;
|
|
21
|
+
}
|
|
22
|
+
get pageSize() {
|
|
23
|
+
return this._pageSize;
|
|
24
|
+
}
|
|
25
|
+
update(data) {
|
|
26
|
+
if (data.total !== void 0) this._total = data.total;
|
|
27
|
+
if (data.page !== void 0) this._page = data.page;
|
|
28
|
+
if (data.pageSize !== void 0) this._pageSize = data.pageSize;
|
|
29
|
+
}
|
|
30
|
+
fromJSON(serialized) {
|
|
31
|
+
this._total = serialized.total;
|
|
32
|
+
this._page = serialized.page;
|
|
33
|
+
this._pageSize = serialized.pageSize;
|
|
34
|
+
}
|
|
35
|
+
toJSON() {
|
|
36
|
+
return {
|
|
37
|
+
name: this.name,
|
|
38
|
+
total: this._total,
|
|
39
|
+
page: this._page,
|
|
40
|
+
pageSize: this._pageSize
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { A_ServerEntityListPagination };
|
|
46
|
+
//# sourceMappingURL=A-EntityListPagination.context.mjs.map
|
|
47
|
+
//# sourceMappingURL=A-EntityListPagination.context.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/A-ServerEntityList/A-EntityListPagination.context.ts"],"names":[],"mappings":";;;AAQO,MAAM,qCAAqC,UAAA,CAA6D;AAAA,EAM3G,YAAY,IAAA,EAAwD;AAChE,IAAA,KAAA,EAAM;AALV,IAAA,IAAA,CAAU,MAAA,GAAiB,CAAA;AAC3B,IAAA,IAAA,CAAU,KAAA,GAAgB,CAAA;AAC1B,IAAA,IAAA,CAAU,SAAA,GAAoB,EAAA;AAI1B,IAAA,IAAI,IAAA,EAAM;AACN,MAAA,IAAI,IAAA,CAAK,KAAA,KAAU,MAAA,EAAW,IAAA,CAAK,SAAS,IAAA,CAAK,KAAA;AACjD,MAAA,IAAI,IAAA,CAAK,IAAA,KAAS,MAAA,EAAW,IAAA,CAAK,QAAQ,IAAA,CAAK,IAAA;AAC/C,MAAA,IAAI,IAAA,CAAK,QAAA,KAAa,MAAA,EAAW,IAAA,CAAK,YAAY,IAAA,CAAK,QAAA;AAAA,IAC3D;AAAA,EACJ;AAAA,EAEA,IAAI,KAAA,GAAgB;AAAE,IAAA,OAAO,IAAA,CAAK,MAAA;AAAA,EAAQ;AAAA,EAC1C,IAAI,IAAA,GAAe;AAAE,IAAA,OAAO,IAAA,CAAK,KAAA;AAAA,EAAO;AAAA,EACxC,IAAI,QAAA,GAAmB;AAAE,IAAA,OAAO,IAAA,CAAK,SAAA;AAAA,EAAW;AAAA,EAEhD,OAAO,IAAA,EAA6D;AAChE,IAAA,IAAI,IAAA,CAAK,KAAA,KAAU,MAAA,EAAW,IAAA,CAAK,SAAS,IAAA,CAAK,KAAA;AACjD,IAAA,IAAI,IAAA,CAAK,IAAA,KAAS,MAAA,EAAW,IAAA,CAAK,QAAQ,IAAA,CAAK,IAAA;AAC/C,IAAA,IAAI,IAAA,CAAK,QAAA,KAAa,MAAA,EAAW,IAAA,CAAK,YAAY,IAAA,CAAK,QAAA;AAAA,EAC3D;AAAA,EAEA,SAAS,UAAA,EAAoE;AACzE,IAAA,IAAA,CAAK,SAAS,UAAA,CAAW,KAAA;AACzB,IAAA,IAAA,CAAK,QAAQ,UAAA,CAAW,IAAA;AACxB,IAAA,IAAA,CAAK,YAAY,UAAA,CAAW,QAAA;AAAA,EAChC;AAAA,EAEA,MAAA,GAA2D;AACvD,IAAA,OAAO;AAAA,MACH,MAAM,IAAA,CAAK,IAAA;AAAA,MACX,OAAO,IAAA,CAAK,MAAA;AAAA,MACZ,MAAM,IAAA,CAAK,KAAA;AAAA,MACX,UAAU,IAAA,CAAK;AAAA,KACnB;AAAA,EACJ;AACJ","file":"A-EntityListPagination.context.mjs","sourcesContent":["import { A_Fragment, A_TYPES__Fragment_Serialized } from \"@adaas/a-concept\";\nimport { A_SERVER_TYPES__A_EntityListPagination } from \"./A-EntityList.types\";\n\n\nexport type A_SERVER_TYPES__A_EntityListPaginationSerialized =\n A_SERVER_TYPES__A_EntityListPagination & A_TYPES__Fragment_Serialized;\n\n\nexport class A_ServerEntityListPagination extends A_Fragment<A_SERVER_TYPES__A_EntityListPaginationSerialized> {\n\n protected _total: number = 0;\n protected _page: number = 1;\n protected _pageSize: number = 10;\n\n constructor(init?: Partial<A_SERVER_TYPES__A_EntityListPagination>) {\n super();\n if (init) {\n if (init.total !== undefined) this._total = init.total;\n if (init.page !== undefined) this._page = init.page;\n if (init.pageSize !== undefined) this._pageSize = init.pageSize;\n }\n }\n\n get total(): number { return this._total; }\n get page(): number { return this._page; }\n get pageSize(): number { return this._pageSize; }\n\n update(data: Partial<A_SERVER_TYPES__A_EntityListPagination>): void {\n if (data.total !== undefined) this._total = data.total;\n if (data.page !== undefined) this._page = data.page;\n if (data.pageSize !== undefined) this._pageSize = data.pageSize;\n }\n\n fromJSON(serialized: A_SERVER_TYPES__A_EntityListPaginationSerialized): void {\n this._total = serialized.total;\n this._page = serialized.page;\n this._pageSize = serialized.pageSize;\n }\n\n toJSON(): A_SERVER_TYPES__A_EntityListPaginationSerialized {\n return {\n name: this.name,\n total: this._total,\n page: this._page,\n pageSize: this._pageSize,\n };\n }\n}\n"]}
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import { A_Error } from '@adaas/a-concept';
|
|
2
|
-
import { A_Server } from '../A-Server/A-Server.context.mjs';
|
|
1
|
+
import { A_Error, A_Scope } from '@adaas/a-concept';
|
|
3
2
|
import { A as A_Request } from '../../A-Request.entity-r905O60G.mjs';
|
|
4
3
|
import { A as A_Response } from '../../A-Response.entity-6qhiV7BE.mjs';
|
|
5
4
|
import { A_HttpServerRequestContext } from '../A-Request/A-HttpServerRequest.context.mjs';
|
|
6
5
|
import { A_Config } from '@adaas/a-utils/a-config';
|
|
7
6
|
import { A_Logger } from '@adaas/a-utils/a-logger';
|
|
8
|
-
import '../A-Server/A-Server.types.mjs';
|
|
9
|
-
import '../A-ServerRoute/A-ServerRoute.entity.mjs';
|
|
10
|
-
import '@adaas/a-utils/a-route';
|
|
11
|
-
import '../A-ServerRoute/A-ServerRoute.types.mjs';
|
|
12
|
-
import '../A-ServerRoute/A-ServerRoute.constants.mjs';
|
|
13
7
|
import 'http';
|
|
14
8
|
import '../A-Server/A-HttpServer.error.mjs';
|
|
15
9
|
import '../A-Server/A-HttpServer.types.mjs';
|
|
@@ -18,6 +12,10 @@ import '../A-Request/A-Request.constants.mjs';
|
|
|
18
12
|
import '../A-Request/A-Request.env.mjs';
|
|
19
13
|
import '../A-Request/A-HttpRequestData.context.mjs';
|
|
20
14
|
import '@adaas/a-utils/a-execution';
|
|
15
|
+
import '../A-ServerRoute/A-ServerRoute.entity.mjs';
|
|
16
|
+
import '@adaas/a-utils/a-route';
|
|
17
|
+
import '../A-ServerRoute/A-ServerRoute.types.mjs';
|
|
18
|
+
import '../A-ServerRoute/A-ServerRoute.constants.mjs';
|
|
21
19
|
import 'stream';
|
|
22
20
|
import '../A-Response/A-Response.constants.mjs';
|
|
23
21
|
import '@adaas/a-utils/a-operation';
|
|
@@ -26,7 +24,7 @@ declare class A_ServerLogger extends A_Logger {
|
|
|
26
24
|
protected config: A_Config<any>;
|
|
27
25
|
logRequestFinish(request: A_Request, response: A_Response, context: A_HttpServerRequestContext): void;
|
|
28
26
|
logResponseError(request: A_Request, response: A_Response, context: A_HttpServerRequestContext, error: A_Error): void;
|
|
29
|
-
logStop(
|
|
27
|
+
logStop(scope: A_Scope): void;
|
|
30
28
|
serverReady(params: {
|
|
31
29
|
port: number;
|
|
32
30
|
app: {
|