@rolster/vinegar 2.1.0 → 2.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/dist/cjs/index.js +213 -225
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.js +213 -225
- package/dist/es/index.js.map +1 -1
- package/dist/esm/database.d.ts +7 -7
- package/dist/esm/database.js +2 -2
- package/dist/esm/datasource.d.ts +9 -9
- package/dist/esm/datasource.js +2 -2
- package/dist/esm/entity-manager.d.ts +48 -48
- package/dist/esm/entity-manager.js +101 -113
- package/dist/esm/entity-manager.js.map +1 -1
- package/dist/esm/entity.d.ts +29 -29
- package/dist/esm/entity.js +54 -54
- package/dist/esm/entity.js.map +1 -1
- package/dist/esm/index.d.ts +8 -8
- package/dist/esm/index.js +8 -8
- package/dist/esm/persistent-unit.d.ts +3 -3
- package/dist/esm/persistent-unit.js +2 -2
- package/dist/esm/procedure.d.ts +3 -3
- package/dist/esm/procedure.js +2 -2
- package/dist/esm/repository.d.ts +8 -8
- package/dist/esm/repository.js +2 -2
- package/dist/esm/types.d.ts +21 -21
- package/dist/esm/types.js +1 -1
- package/package.json +4 -4
package/dist/cjs/index.js
CHANGED
|
@@ -2,248 +2,236 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
class AbstractEntityDatabase {
|
|
5
|
+
class AbstractEntityDatabase {
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
class AbstractEntityDataSource {
|
|
8
|
+
class AbstractEntityDataSource {
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
function itIsDefined(object) {
|
|
12
|
-
return typeof object !== 'undefined' && object !== null;
|
|
11
|
+
function itIsDefined(object) {
|
|
12
|
+
return typeof object !== 'undefined' && object !== null;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
class Optional {
|
|
16
|
-
constructor(value) {
|
|
17
|
-
this.value = value;
|
|
18
|
-
}
|
|
19
|
-
present(callback) {
|
|
20
|
-
return this.isPresent() ? callback(this.get()) : undefined;
|
|
21
|
-
}
|
|
22
|
-
empty(callback) {
|
|
23
|
-
return this.isEmpty() ? callback() : undefined;
|
|
24
|
-
}
|
|
25
|
-
when(present, empty) {
|
|
26
|
-
return this.isPresent() ? present(this.get()) : empty();
|
|
27
|
-
}
|
|
28
|
-
static build(value) {
|
|
29
|
-
return itIsDefined(value) ? this.of(value) : this.empty();
|
|
30
|
-
}
|
|
31
|
-
static of(value) {
|
|
32
|
-
if (itIsDefined(value)) {
|
|
33
|
-
return new PresentOptional(value);
|
|
34
|
-
}
|
|
35
|
-
throw new Error('The passed value was null or undefined.');
|
|
36
|
-
}
|
|
37
|
-
static empty() {
|
|
38
|
-
return new EmptyOptional();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
class PresentOptional extends Optional {
|
|
42
|
-
constructor(presentValue) {
|
|
43
|
-
super(presentValue);
|
|
44
|
-
this.presentValue = presentValue;
|
|
45
|
-
}
|
|
46
|
-
isPresent() {
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
isEmpty() {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
get() {
|
|
53
|
-
return this.presentValue;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
class EmptyOptional extends Optional {
|
|
57
|
-
isPresent() {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
isEmpty() {
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
get() {
|
|
64
|
-
throw new Error('The optional is not present.');
|
|
65
|
-
}
|
|
15
|
+
class Optional {
|
|
16
|
+
constructor(value) {
|
|
17
|
+
this.value = value;
|
|
18
|
+
}
|
|
19
|
+
present(callback) {
|
|
20
|
+
return this.isPresent() ? callback(this.get()) : undefined;
|
|
21
|
+
}
|
|
22
|
+
empty(callback) {
|
|
23
|
+
return this.isEmpty() ? callback() : undefined;
|
|
24
|
+
}
|
|
25
|
+
when(present, empty) {
|
|
26
|
+
return this.isPresent() ? present(this.get()) : empty();
|
|
27
|
+
}
|
|
28
|
+
static build(value) {
|
|
29
|
+
return itIsDefined(value) ? this.of(value) : this.empty();
|
|
30
|
+
}
|
|
31
|
+
static of(value) {
|
|
32
|
+
if (itIsDefined(value)) {
|
|
33
|
+
return new PresentOptional(value);
|
|
34
|
+
}
|
|
35
|
+
throw new Error('The passed value was null or undefined.');
|
|
36
|
+
}
|
|
37
|
+
static empty() {
|
|
38
|
+
return new EmptyOptional();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
class PresentOptional extends Optional {
|
|
42
|
+
constructor(presentValue) {
|
|
43
|
+
super(presentValue);
|
|
44
|
+
this.presentValue = presentValue;
|
|
45
|
+
}
|
|
46
|
+
isPresent() {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
isEmpty() {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
get() {
|
|
53
|
+
return this.presentValue;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
class EmptyOptional extends Optional {
|
|
57
|
+
isPresent() {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
isEmpty() {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
get() {
|
|
64
|
+
throw new Error('The optional is not present.');
|
|
65
|
+
}
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
function fromPromise(value) {
|
|
69
|
-
return value instanceof Promise ? value : Promise.resolve(value);
|
|
68
|
+
function fromPromise(value) {
|
|
69
|
+
return value instanceof Promise ? value : Promise.resolve(value);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
function
|
|
73
|
-
return typeof model === 'object' && 'hidden' in model && 'hiddenAt' in model;
|
|
74
|
-
}
|
|
75
|
-
class AbstractEntityManager {
|
|
76
|
-
}
|
|
77
|
-
class EntityManager {
|
|
78
|
-
constructor(source) {
|
|
79
|
-
this.source = source;
|
|
80
|
-
this.links = [];
|
|
81
|
-
this.
|
|
82
|
-
this.syncs = [];
|
|
83
|
-
this.destroys = [];
|
|
84
|
-
this.hiddens = [];
|
|
85
|
-
this.procedures = [];
|
|
86
|
-
this.relations = new Map();
|
|
87
|
-
}
|
|
88
|
-
persist(
|
|
89
|
-
this.links.push(
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
this.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
this.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
this.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
this.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
this.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
destroyAll() {
|
|
172
|
-
const { destroys, source } = this;
|
|
173
|
-
return Promise.all(destroys.map((destroy) => source.delete(destroy)));
|
|
174
|
-
}
|
|
175
|
-
hiddenAll() {
|
|
176
|
-
const { hiddens, source } = this;
|
|
177
|
-
return Promise.all(hiddens.map((hidden) => source.hidden(hidden)));
|
|
178
|
-
}
|
|
179
|
-
procedureAll() {
|
|
180
|
-
const { procedures, source } = this;
|
|
181
|
-
return Promise.all(procedures.map((procedure) => source.procedure(procedure)));
|
|
182
|
-
}
|
|
72
|
+
function itIsModelHidden(model) {
|
|
73
|
+
return typeof model === 'object' && 'hidden' in model && 'hiddenAt' in model;
|
|
74
|
+
}
|
|
75
|
+
class AbstractEntityManager {
|
|
76
|
+
}
|
|
77
|
+
class EntityManager {
|
|
78
|
+
constructor(source) {
|
|
79
|
+
this.source = source;
|
|
80
|
+
this.links = [];
|
|
81
|
+
this.refreshs = [];
|
|
82
|
+
this.syncs = [];
|
|
83
|
+
this.destroys = [];
|
|
84
|
+
this.hiddens = [];
|
|
85
|
+
this.procedures = [];
|
|
86
|
+
this.relations = new Map();
|
|
87
|
+
}
|
|
88
|
+
persist(options) {
|
|
89
|
+
this.links.push(options);
|
|
90
|
+
}
|
|
91
|
+
refresh(options) {
|
|
92
|
+
options.bindable && this.relation(options.entity, options.model);
|
|
93
|
+
this.refreshs.push(options);
|
|
94
|
+
}
|
|
95
|
+
sync(options) {
|
|
96
|
+
options.bindable && this.relation(options.entity, options.model);
|
|
97
|
+
this.syncs.push(options);
|
|
98
|
+
}
|
|
99
|
+
destroy(entity) {
|
|
100
|
+
this.select(entity).present((model) => {
|
|
101
|
+
itIsModelHidden(model)
|
|
102
|
+
? this.hiddens.push(model)
|
|
103
|
+
: this.destroys.push(model);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
procedure(procedure) {
|
|
107
|
+
this.procedures.push(procedure);
|
|
108
|
+
}
|
|
109
|
+
relation({ uuid }, model) {
|
|
110
|
+
this.relations.set(uuid, model);
|
|
111
|
+
}
|
|
112
|
+
link(entity, model) {
|
|
113
|
+
this.relation(entity, model);
|
|
114
|
+
return entity;
|
|
115
|
+
}
|
|
116
|
+
select({ uuid }) {
|
|
117
|
+
return Optional.build(this.relations.has(uuid) ? this.relations.get(uuid) : undefined);
|
|
118
|
+
}
|
|
119
|
+
async flush() {
|
|
120
|
+
await this.persistAll();
|
|
121
|
+
await this.refreshAll();
|
|
122
|
+
await this.syncAll();
|
|
123
|
+
await this.hiddenAll();
|
|
124
|
+
await this.destroyAll();
|
|
125
|
+
await this.procedureAll();
|
|
126
|
+
this.dispose();
|
|
127
|
+
}
|
|
128
|
+
dispose() {
|
|
129
|
+
this.relations.clear();
|
|
130
|
+
this.links = [];
|
|
131
|
+
this.refreshs = [];
|
|
132
|
+
this.syncs = [];
|
|
133
|
+
this.destroys = [];
|
|
134
|
+
this.hiddens = [];
|
|
135
|
+
this.procedures = [];
|
|
136
|
+
}
|
|
137
|
+
persistAll() {
|
|
138
|
+
const { links, source } = this;
|
|
139
|
+
return Promise.all(links.map((link) => fromPromise(link.create(this)).then((model) => {
|
|
140
|
+
const { bindable, entity } = link;
|
|
141
|
+
if (bindable) {
|
|
142
|
+
this.relation(entity, model);
|
|
143
|
+
}
|
|
144
|
+
return source.insert(model);
|
|
145
|
+
})));
|
|
146
|
+
}
|
|
147
|
+
refreshAll() {
|
|
148
|
+
return Promise.all(this.refreshs.map(({ model }) => this.source.refresh(model)));
|
|
149
|
+
}
|
|
150
|
+
syncAll() {
|
|
151
|
+
return Promise.all(this.syncs
|
|
152
|
+
.filter(({ model }) => !this.destroys.includes(model))
|
|
153
|
+
.reduce((syncs, sync) => {
|
|
154
|
+
const dirty = sync.verify();
|
|
155
|
+
dirty && syncs.push([sync.model, dirty]);
|
|
156
|
+
return syncs;
|
|
157
|
+
}, [])
|
|
158
|
+
.map(([model, dirty]) => {
|
|
159
|
+
return this.source.refresh(model, dirty);
|
|
160
|
+
}));
|
|
161
|
+
}
|
|
162
|
+
destroyAll() {
|
|
163
|
+
return Promise.all(this.destroys.map((destroy) => this.source.delete(destroy)));
|
|
164
|
+
}
|
|
165
|
+
hiddenAll() {
|
|
166
|
+
return Promise.all(this.hiddens.map((hidden) => this.source.hidden(hidden)));
|
|
167
|
+
}
|
|
168
|
+
procedureAll() {
|
|
169
|
+
return Promise.all(this.procedures.map((procedure) => this.source.procedure(procedure)));
|
|
170
|
+
}
|
|
183
171
|
}
|
|
184
172
|
|
|
185
|
-
function
|
|
186
|
-
return typeof model === 'object' && 'updatedAt' in model;
|
|
187
|
-
}
|
|
188
|
-
class Entity {
|
|
189
|
-
constructor(uuid) {
|
|
190
|
-
this.uuid = uuid;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
class
|
|
194
|
-
constructor(entity, model, bindable = true) {
|
|
195
|
-
this.entity = entity;
|
|
196
|
-
this.model = model;
|
|
197
|
-
this.bindable = bindable;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
class EntityLink {
|
|
201
|
-
constructor(entity, bindable = true) {
|
|
202
|
-
this.entity = entity;
|
|
203
|
-
this.bindable = bindable;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
class EntitySync {
|
|
207
|
-
constructor(entity, model, bindable = true) {
|
|
208
|
-
this.entity = entity;
|
|
209
|
-
this.model = model;
|
|
210
|
-
this.bindable = bindable;
|
|
211
|
-
this.firstDirty = this.createDirtyFromModel(model);
|
|
212
|
-
}
|
|
213
|
-
verify() {
|
|
214
|
-
this.sync();
|
|
215
|
-
return this.createDirty();
|
|
216
|
-
}
|
|
217
|
-
createDirtyFromModel(model) {
|
|
218
|
-
const dirty = {};
|
|
219
|
-
Object.keys(model).forEach((key) => {
|
|
220
|
-
dirty[key] = model[key];
|
|
221
|
-
});
|
|
222
|
-
return dirty;
|
|
223
|
-
}
|
|
224
|
-
createDirty() {
|
|
225
|
-
const currentDirty = this.createDirtyFromModel(this.model);
|
|
226
|
-
const finalDirty = {};
|
|
227
|
-
Object.keys(currentDirty).forEach((key) => {
|
|
228
|
-
if (currentDirty[key] !== this.firstDirty[key]) {
|
|
229
|
-
finalDirty[key] = currentDirty[key];
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
const requiredUpdate = Object.keys(finalDirty).length > 0;
|
|
233
|
-
if (requiredUpdate &&
|
|
234
|
-
finalDirty['updatedAt'] = new Date();
|
|
235
|
-
}
|
|
236
|
-
return requiredUpdate ? finalDirty : undefined;
|
|
237
|
-
}
|
|
173
|
+
function itIsModelEditable(model) {
|
|
174
|
+
return typeof model === 'object' && 'updatedAt' in model;
|
|
175
|
+
}
|
|
176
|
+
class Entity {
|
|
177
|
+
constructor(uuid) {
|
|
178
|
+
this.uuid = uuid;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
class EntityRefresh {
|
|
182
|
+
constructor(entity, model, bindable = true) {
|
|
183
|
+
this.entity = entity;
|
|
184
|
+
this.model = model;
|
|
185
|
+
this.bindable = bindable;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
class EntityLink {
|
|
189
|
+
constructor(entity, bindable = true) {
|
|
190
|
+
this.entity = entity;
|
|
191
|
+
this.bindable = bindable;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
class EntitySync {
|
|
195
|
+
constructor(entity, model, bindable = true) {
|
|
196
|
+
this.entity = entity;
|
|
197
|
+
this.model = model;
|
|
198
|
+
this.bindable = bindable;
|
|
199
|
+
this.firstDirty = this.createDirtyFromModel(model);
|
|
200
|
+
}
|
|
201
|
+
verify() {
|
|
202
|
+
this.sync();
|
|
203
|
+
return this.createDirty();
|
|
204
|
+
}
|
|
205
|
+
createDirtyFromModel(model) {
|
|
206
|
+
const dirty = {};
|
|
207
|
+
Object.keys(model).forEach((key) => {
|
|
208
|
+
dirty[key] = model[key];
|
|
209
|
+
});
|
|
210
|
+
return dirty;
|
|
211
|
+
}
|
|
212
|
+
createDirty() {
|
|
213
|
+
const currentDirty = this.createDirtyFromModel(this.model);
|
|
214
|
+
const finalDirty = {};
|
|
215
|
+
Object.keys(currentDirty).forEach((key) => {
|
|
216
|
+
if (currentDirty[key] !== this.firstDirty[key]) {
|
|
217
|
+
finalDirty[key] = currentDirty[key];
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
const requiredUpdate = Object.keys(finalDirty).length > 0;
|
|
221
|
+
if (requiredUpdate && itIsModelEditable(this.model)) {
|
|
222
|
+
finalDirty['updatedAt'] = new Date();
|
|
223
|
+
}
|
|
224
|
+
return requiredUpdate ? finalDirty : undefined;
|
|
225
|
+
}
|
|
238
226
|
}
|
|
239
227
|
|
|
240
|
-
class AbstractPersistentUnit {
|
|
228
|
+
class AbstractPersistentUnit {
|
|
241
229
|
}
|
|
242
230
|
|
|
243
|
-
class AbstractProcedure {
|
|
231
|
+
class AbstractProcedure {
|
|
244
232
|
}
|
|
245
233
|
|
|
246
|
-
class AbstractRepository {
|
|
234
|
+
class AbstractRepository {
|
|
247
235
|
}
|
|
248
236
|
|
|
249
237
|
exports.AbstractEntityDataSource = AbstractEntityDataSource;
|
|
@@ -255,6 +243,6 @@ exports.AbstractRepository = AbstractRepository;
|
|
|
255
243
|
exports.Entity = Entity;
|
|
256
244
|
exports.EntityLink = EntityLink;
|
|
257
245
|
exports.EntityManager = EntityManager;
|
|
246
|
+
exports.EntityRefresh = EntityRefresh;
|
|
258
247
|
exports.EntitySync = EntitySync;
|
|
259
|
-
exports.EntityUpdate = EntityUpdate;
|
|
260
248
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../esm/database.js","../esm/datasource.js","../../node_modules/@rolster/commons/dist/esm/helpers.js","../../node_modules/@rolster/commons/dist/esm/optional.js","../../node_modules/@rolster/commons/dist/esm/promises.js","../esm/entity-manager.js","../esm/entity.js","../esm/persistent-unit.js","../esm/procedure.js","../esm/repository.js"],"sourcesContent":["export class AbstractEntityDatabase {\r\n}\r\n//# sourceMappingURL=database.js.map","export class AbstractEntityDataSource {\r\n}\r\n//# sourceMappingURL=datasource.js.map","const PRIMITIVES = [Date, RegExp, Function, String, Boolean, Number];\r\nconst SLICE_SIZE = 512;\r\nconst FALSY_VALUE = ['false', 'undefined', '0', 0];\r\nconst prototypeToString = Object.prototype.toString;\r\nfunction clone(object, caches) {\r\n if (typeof object !== 'object') {\r\n return object;\r\n }\r\n if (prototypeToString.call(object) === '[object Object]') {\r\n const [cacheObject] = caches.filter((cacheObject) => cacheObject === object);\r\n /* istanbul ignore if */\r\n if (cacheObject) {\r\n return cacheObject;\r\n }\r\n caches.push(object);\r\n }\r\n const prototypeObject = Object.getPrototypeOf(object);\r\n const ConstructorObject = prototypeObject.constructor;\r\n if (PRIMITIVES.includes(ConstructorObject)) {\r\n return new ConstructorObject(object);\r\n }\r\n const cloneObject = new ConstructorObject();\r\n for (const prop in object) {\r\n cloneObject[prop] = clone(object[prop], caches);\r\n }\r\n return cloneObject;\r\n}\r\nexport function itIsDefined(object) {\r\n return typeof object !== 'undefined' && object !== null;\r\n}\r\nexport function itIsUndefined(object) {\r\n return !itIsDefined(object);\r\n}\r\nexport function parseBoolean(value) {\r\n return !(itIsUndefined(value) ||\r\n value === false ||\r\n FALSY_VALUE.includes(value));\r\n}\r\nexport function parse(value) {\r\n try {\r\n return JSON.parse(value);\r\n }\r\n catch {\r\n return value;\r\n }\r\n}\r\nexport function evalValueOrFunction(value) {\r\n return typeof value === 'function' ? value() : value;\r\n}\r\nexport function deepClone(object) {\r\n return clone(object, []);\r\n}\r\nexport function deepFreeze(object) {\r\n for (const prop in object) {\r\n const value = object[prop];\r\n if (typeof value === 'object' && !Object.isFrozen(value)) {\r\n deepFreeze(value);\r\n }\r\n }\r\n return Object.freeze(object);\r\n}\r\nexport function callback(call, ...args) {\r\n return typeof call !== 'function' ? undefined : call.apply(call, args);\r\n}\r\n/* istanbul ignore next */\r\nexport function base64ToBlob(data64, mimeType) {\r\n const result64 = data64.replace(/^[^,]+,/, '').replace(/\\s/g, '');\r\n const byteCharacters = window.atob(result64);\r\n const byteArrays = [];\r\n for (let offset = 0; offset < byteCharacters.length; offset += SLICE_SIZE) {\r\n const slice = byteCharacters.slice(offset, offset + SLICE_SIZE);\r\n const byteNumbers = new Array(slice.length);\r\n for (let i = 0; i < slice.length; i++) {\r\n byteNumbers[i] = slice.charCodeAt(i);\r\n }\r\n const byteArray = new Uint8Array(byteNumbers);\r\n byteArrays.push(byteArray);\r\n }\r\n return new Blob(byteArrays, { type: mimeType });\r\n}\r\n//# sourceMappingURL=helpers.js.map","import { itIsDefined } from './helpers';\r\nexport class Optional {\r\n constructor(value) {\r\n this.value = value;\r\n }\r\n present(callback) {\r\n return this.isPresent() ? callback(this.get()) : undefined;\r\n }\r\n empty(callback) {\r\n return this.isEmpty() ? callback() : undefined;\r\n }\r\n when(present, empty) {\r\n return this.isPresent() ? present(this.get()) : empty();\r\n }\r\n static build(value) {\r\n return itIsDefined(value) ? this.of(value) : this.empty();\r\n }\r\n static of(value) {\r\n if (itIsDefined(value)) {\r\n return new PresentOptional(value);\r\n }\r\n throw new Error('The passed value was null or undefined.');\r\n }\r\n static empty() {\r\n return new EmptyOptional();\r\n }\r\n}\r\nclass PresentOptional extends Optional {\r\n constructor(presentValue) {\r\n super(presentValue);\r\n this.presentValue = presentValue;\r\n }\r\n isPresent() {\r\n return true;\r\n }\r\n isEmpty() {\r\n return false;\r\n }\r\n get() {\r\n return this.presentValue;\r\n }\r\n}\r\nclass EmptyOptional extends Optional {\r\n isPresent() {\r\n return false;\r\n }\r\n isEmpty() {\r\n return true;\r\n }\r\n get() {\r\n throw new Error('The optional is not present.');\r\n }\r\n}\r\n//# sourceMappingURL=optional.js.map","import { itIsDefined } from './helpers';\r\nexport function fromPromise(value) {\r\n return value instanceof Promise ? value : Promise.resolve(value);\r\n}\r\nexport function thenPromise(promise, printError = false) {\r\n return promise\r\n .then(() => undefined)\r\n .catch((err) => {\r\n /* istanbul ignore if */\r\n if (printError) {\r\n console.log(err);\r\n }\r\n throw err;\r\n });\r\n}\r\nexport function voidPromise(promise, printError = false) {\r\n return promise\r\n .then(() => undefined)\r\n .catch((err) => {\r\n /* istanbul ignore if */\r\n if (printError) {\r\n console.log(err);\r\n }\r\n return undefined;\r\n });\r\n}\r\nexport function catchPromise(promise, printError = false) {\r\n return promise.catch((err) => {\r\n /* istanbul ignore if */\r\n if (printError) {\r\n console.log(err);\r\n }\r\n return undefined;\r\n });\r\n}\r\nfunction zipResolveCallbacks(options) {\r\n const { callbacks, catchError, index, resolve, result } = options;\r\n if (index === callbacks.length) {\r\n return resolve(result);\r\n }\r\n new Promise(() => {\r\n callbacks[index]()\r\n .then((value) => {\r\n result.push(value);\r\n return zipResolveCallbacks({\r\n ...options,\r\n index: index + 1,\r\n result\r\n });\r\n })\r\n .catch((err) => {\r\n return catchError(err);\r\n });\r\n });\r\n}\r\nexport function zipPromise(callbacks) {\r\n const result = [];\r\n return new Promise((resolve, reject) => {\r\n zipResolveCallbacks({\r\n callbacks,\r\n catchError: (err) => {\r\n reject(err);\r\n },\r\n index: 0,\r\n resolve: (result) => {\r\n resolve(result);\r\n },\r\n result\r\n });\r\n });\r\n}\r\nexport function securePromise(callback, catchError) {\r\n let promise$ = undefined;\r\n function itIsInstanced() {\r\n return itIsDefined(promise$);\r\n }\r\n function resolve() {\r\n if (!promise$) {\r\n promise$ = callback().catch((err) => {\r\n const errorValue = catchError && catchError(err);\r\n reset();\r\n if (errorValue) {\r\n return errorValue;\r\n }\r\n throw err;\r\n });\r\n }\r\n return promise$;\r\n }\r\n function reset() {\r\n promise$ = undefined;\r\n }\r\n return { itIsInstanced, reset, resolve };\r\n}\r\n//# sourceMappingURL=promises.js.map","import { Optional, fromPromise } from '@rolster/commons';\r\nfunction modelIsHidden(model) {\r\n return typeof model === 'object' && 'hidden' in model && 'hiddenAt' in model;\r\n}\r\nexport class AbstractEntityManager {\r\n}\r\nexport class EntityManager {\r\n constructor(source) {\r\n this.source = source;\r\n this.links = [];\r\n this.updates = [];\r\n this.syncs = [];\r\n this.destroys = [];\r\n this.hiddens = [];\r\n this.procedures = [];\r\n this.relations = new Map();\r\n }\r\n persist(link) {\r\n this.links.push(link);\r\n }\r\n update(update) {\r\n const { bindable, entity, model } = update;\r\n if (bindable) {\r\n this.relation(entity, model);\r\n }\r\n this.updates.push(update);\r\n }\r\n sync(sync) {\r\n const { bindable, entity, model } = sync;\r\n if (bindable) {\r\n this.relation(entity, model);\r\n }\r\n this.syncs.push(sync);\r\n }\r\n destroy(entity) {\r\n this.select(entity).present((model) => {\r\n modelIsHidden(model)\r\n ? this.hiddens.push(model)\r\n : this.destroys.push(model);\r\n });\r\n }\r\n procedure(procedure) {\r\n this.procedures.push(procedure);\r\n }\r\n relation({ uuid }, model) {\r\n this.relations.set(uuid, model);\r\n }\r\n link(entity, model) {\r\n this.relation(entity, model);\r\n return entity;\r\n }\r\n select({ uuid }) {\r\n return Optional.build(this.relations.has(uuid) ? this.relations.get(uuid) : undefined);\r\n }\r\n async flush() {\r\n await this.persistAll();\r\n await this.updateAll();\r\n await this.syncAll();\r\n await this.hiddenAll();\r\n await this.destroyAll();\r\n await this.procedureAll();\r\n this.dispose();\r\n }\r\n dispose() {\r\n this.relations.clear();\r\n this.links = [];\r\n this.updates = [];\r\n this.syncs = [];\r\n this.destroys = [];\r\n this.hiddens = [];\r\n this.procedures = [];\r\n }\r\n persistAll() {\r\n const { links, source } = this;\r\n return Promise.all(links.map((link) => fromPromise(link.create(this)).then((model) => {\r\n const { bindable, entity } = link;\r\n if (bindable) {\r\n this.relation(entity, model);\r\n }\r\n return source.insert(model);\r\n })));\r\n }\r\n updateAll() {\r\n const { source, updates } = this;\r\n return Promise.all(updates.map(({ model }) => source.update(model)));\r\n }\r\n syncAll() {\r\n const { destroys, source, syncs } = this;\r\n return Promise.all(syncs\r\n .filter(({ model }) => !destroys.includes(model))\r\n .reduce((syncs, sync) => {\r\n const dirty = sync.verify();\r\n if (dirty) {\r\n const { model } = sync;\r\n syncs.push([model, dirty]);\r\n }\r\n return syncs;\r\n }, [])\r\n .map(([model, dirty]) => source.update(model, dirty)));\r\n }\r\n destroyAll() {\r\n const { destroys, source } = this;\r\n return Promise.all(destroys.map((destroy) => source.delete(destroy)));\r\n }\r\n hiddenAll() {\r\n const { hiddens, source } = this;\r\n return Promise.all(hiddens.map((hidden) => source.hidden(hidden)));\r\n }\r\n procedureAll() {\r\n const { procedures, source } = this;\r\n return Promise.all(procedures.map((procedure) => source.procedure(procedure)));\r\n }\r\n}\r\n//# sourceMappingURL=entity-manager.js.map","function modelIsUpdated(model) {\r\n return typeof model === 'object' && 'updatedAt' in model;\r\n}\r\nexport class Entity {\r\n constructor(uuid) {\r\n this.uuid = uuid;\r\n }\r\n}\r\nexport class EntityUpdate {\r\n constructor(entity, model, bindable = true) {\r\n this.entity = entity;\r\n this.model = model;\r\n this.bindable = bindable;\r\n }\r\n}\r\nexport class EntityLink {\r\n constructor(entity, bindable = true) {\r\n this.entity = entity;\r\n this.bindable = bindable;\r\n }\r\n}\r\nexport class EntitySync {\r\n constructor(entity, model, bindable = true) {\r\n this.entity = entity;\r\n this.model = model;\r\n this.bindable = bindable;\r\n this.firstDirty = this.createDirtyFromModel(model);\r\n }\r\n verify() {\r\n this.sync();\r\n return this.createDirty();\r\n }\r\n createDirtyFromModel(model) {\r\n const dirty = {};\r\n Object.keys(model).forEach((key) => {\r\n dirty[key] = model[key];\r\n });\r\n return dirty;\r\n }\r\n createDirty() {\r\n const currentDirty = this.createDirtyFromModel(this.model);\r\n const finalDirty = {};\r\n Object.keys(currentDirty).forEach((key) => {\r\n if (currentDirty[key] !== this.firstDirty[key]) {\r\n finalDirty[key] = currentDirty[key];\r\n }\r\n });\r\n const requiredUpdate = Object.keys(finalDirty).length > 0;\r\n if (requiredUpdate && modelIsUpdated(this.model)) {\r\n finalDirty['updatedAt'] = new Date();\r\n }\r\n return requiredUpdate ? finalDirty : undefined;\r\n }\r\n}\r\n//# sourceMappingURL=entity.js.map","export class AbstractPersistentUnit {\r\n}\r\n//# sourceMappingURL=persistent-unit.js.map","export class AbstractProcedure {\r\n}\r\n//# sourceMappingURL=procedure.js.map","export class AbstractRepository {\r\n}\r\n//# sourceMappingURL=repository.js.map"],"names":[],"mappings":";;;;AAAO,MAAM,sBAAsB,CAAC;AACpC;;ACDO,MAAM,wBAAwB,CAAC;AACtC;;AC0BO,SAAS,WAAW,CAAC,MAAM,EAAE;AACpC,IAAI,OAAO,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,KAAK,IAAI,CAAC;AAC5D;;AC5BO,MAAM,QAAQ,CAAC;AACtB,IAAI,WAAW,CAAC,KAAK,EAAE;AACvB,QAAQ,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AAC3B,KAAK;AACL,IAAI,OAAO,CAAC,QAAQ,EAAE;AACtB,QAAQ,OAAO,IAAI,CAAC,SAAS,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC;AACnE,KAAK;AACL,IAAI,KAAK,CAAC,QAAQ,EAAE;AACpB,QAAQ,OAAO,IAAI,CAAC,OAAO,EAAE,GAAG,QAAQ,EAAE,GAAG,SAAS,CAAC;AACvD,KAAK;AACL,IAAI,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE;AACzB,QAAQ,OAAO,IAAI,CAAC,SAAS,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC;AAChE,KAAK;AACL,IAAI,OAAO,KAAK,CAAC,KAAK,EAAE;AACxB,QAAQ,OAAO,WAAW,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;AAClE,KAAK;AACL,IAAI,OAAO,EAAE,CAAC,KAAK,EAAE;AACrB,QAAQ,IAAI,WAAW,CAAC,KAAK,CAAC,EAAE;AAChC,YAAY,OAAO,IAAI,eAAe,CAAC,KAAK,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,IAAI,IAAI,EAAE,CAAC;AACjD,SAAS;AACT,QAAQ,OAAO,cAAc,GAAG,UAAU,GAAG,SAAS,CAAC;AACvD,KAAK;AACL;;ACrDO,MAAM,sBAAsB,CAAC;AACpC;;ACDO,MAAM,iBAAiB,CAAC;AAC/B;;ACDO,MAAM,kBAAkB,CAAC;AAChC;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../esm/database.js","../esm/datasource.js","../../node_modules/@rolster/commons/dist/esm/helpers.js","../../node_modules/@rolster/commons/dist/esm/optional.js","../../node_modules/@rolster/commons/dist/esm/promises.js","../esm/entity-manager.js","../esm/entity.js","../esm/persistent-unit.js","../esm/procedure.js","../esm/repository.js"],"sourcesContent":["export class AbstractEntityDatabase {\n}\n//# sourceMappingURL=database.js.map","export class AbstractEntityDataSource {\n}\n//# sourceMappingURL=datasource.js.map","const PRIMITIVES = [Date, RegExp, Function, String, Boolean, Number];\nconst SLICE_SIZE = 512;\nconst FALSY_VALUE = ['false', 'undefined', '0', 0];\nconst prototypeToString = Object.prototype.toString;\nfunction clone(object, caches) {\n if (typeof object !== 'object') {\n return object;\n }\n if (prototypeToString.call(object) === '[object Object]') {\n const [cacheObject] = caches.filter((cacheObject) => cacheObject === object);\n /* istanbul ignore if */\n if (cacheObject) {\n return cacheObject;\n }\n caches.push(object);\n }\n const prototypeObject = Object.getPrototypeOf(object);\n const ConstructorObject = prototypeObject.constructor;\n if (PRIMITIVES.includes(ConstructorObject)) {\n return new ConstructorObject(object);\n }\n const cloneObject = new ConstructorObject();\n for (const prop in object) {\n cloneObject[prop] = clone(object[prop], caches);\n }\n return cloneObject;\n}\nexport function itIsDefined(object) {\n return typeof object !== 'undefined' && object !== null;\n}\nexport function itIsUndefined(object) {\n return !itIsDefined(object);\n}\nexport function parseBoolean(value) {\n return !(itIsUndefined(value) ||\n value === false ||\n FALSY_VALUE.includes(value));\n}\nexport function parse(value) {\n try {\n return JSON.parse(value);\n }\n catch {\n return value;\n }\n}\nexport function evalValueOrFunction(value) {\n return typeof value === 'function' ? value() : value;\n}\nexport function deepClone(object) {\n return clone(object, []);\n}\nexport function deepFreeze(object) {\n for (const prop in object) {\n const value = object[prop];\n if (typeof value === 'object' && !Object.isFrozen(value)) {\n deepFreeze(value);\n }\n }\n return Object.freeze(object);\n}\nexport function callback(call, ...args) {\n return typeof call !== 'function' ? undefined : call.apply(call, args);\n}\nfunction normalizeValue(value) {\n return typeof value === 'object'\n ? Array.isArray(value)\n ? value.map((value) => normalizeValue(value))\n : normalizeJson(value)\n : value;\n}\nexport function normalizeJson(payload) {\n return Object.entries(payload).reduce((result, [key, value]) => {\n if (itIsDefined(value)) {\n result[key] = normalizeValue(value);\n }\n return result;\n }, {});\n}\n/* istanbul ignore next */\nexport function base64ToBlob(data64, mimeType) {\n const result64 = data64.replace(/^[^,]+,/, '').replace(/\\s/g, '');\n const byteCharacters = window.atob(result64);\n const byteArrays = [];\n for (let offset = 0; offset < byteCharacters.length; offset += SLICE_SIZE) {\n const slice = byteCharacters.slice(offset, offset + SLICE_SIZE);\n const byteNumbers = new Array(slice.length);\n for (let i = 0; i < slice.length; i++) {\n byteNumbers[i] = slice.charCodeAt(i);\n }\n const byteArray = new Uint8Array(byteNumbers);\n byteArrays.push(byteArray);\n }\n return new Blob(byteArrays, { type: mimeType });\n}\n//# sourceMappingURL=helpers.js.map","import { itIsDefined } from './helpers';\nexport class Optional {\n constructor(value) {\n this.value = value;\n }\n present(callback) {\n return this.isPresent() ? callback(this.get()) : undefined;\n }\n empty(callback) {\n return this.isEmpty() ? callback() : undefined;\n }\n when(present, empty) {\n return this.isPresent() ? present(this.get()) : empty();\n }\n static build(value) {\n return itIsDefined(value) ? this.of(value) : this.empty();\n }\n static of(value) {\n if (itIsDefined(value)) {\n return new PresentOptional(value);\n }\n throw new Error('The passed value was null or undefined.');\n }\n static empty() {\n return new EmptyOptional();\n }\n}\nclass PresentOptional extends Optional {\n constructor(presentValue) {\n super(presentValue);\n this.presentValue = presentValue;\n }\n isPresent() {\n return true;\n }\n isEmpty() {\n return false;\n }\n get() {\n return this.presentValue;\n }\n}\nclass EmptyOptional extends Optional {\n isPresent() {\n return false;\n }\n isEmpty() {\n return true;\n }\n get() {\n throw new Error('The optional is not present.');\n }\n}\n//# sourceMappingURL=optional.js.map","import { itIsDefined } from './helpers';\nexport function fromPromise(value) {\n return value instanceof Promise ? value : Promise.resolve(value);\n}\nexport function thenPromise(promise, canLogError = false) {\n return promise\n .then(() => undefined)\n .catch((err) => {\n /* istanbul ignore next */\n canLogError && console.log(err);\n throw err;\n });\n}\nexport function voidPromise(promise, canLogError = false) {\n return promise\n .then(() => undefined)\n .catch((err) => {\n /* istanbul ignore next */\n canLogError && console.log(err);\n return undefined;\n });\n}\nexport function catchPromise(promise, canLogError = false) {\n return promise.catch((err) => {\n /* istanbul ignore next */\n canLogError && console.log(err);\n return undefined;\n });\n}\nfunction zipResolveCallbacks(options) {\n const { callbacks, catchError, index, resolve, result } = options;\n if (index === callbacks.length) {\n return resolve(result);\n }\n const promise = callbacks[index];\n new Promise(() => {\n promise()\n .then((value) => {\n result.push(value);\n return zipResolveCallbacks({\n ...options,\n index: index + 1,\n result\n });\n })\n .catch((err) => {\n return catchError(err);\n });\n });\n}\nexport function zipPromise(callbacks) {\n const result = [];\n return new Promise((resolve, reject) => {\n zipResolveCallbacks({\n callbacks,\n catchError: (err) => {\n reject(err);\n },\n index: 0,\n resolve: (result) => {\n resolve(result);\n },\n result\n });\n });\n}\nexport function securePromise(callback, catchError) {\n let promise$ = undefined;\n function itIsInstanced() {\n return itIsDefined(promise$);\n }\n function resolve() {\n if (!promise$) {\n promise$ = callback().catch((err) => {\n const errorValue = catchError && catchError(err);\n reset();\n if (errorValue) {\n return errorValue;\n }\n throw err;\n });\n }\n return promise$;\n }\n function reset() {\n promise$ = undefined;\n }\n function refresh() {\n promise$ = undefined;\n return resolve();\n }\n return { itIsInstanced, refresh, reset, resolve };\n}\n//# sourceMappingURL=promises.js.map","import { Optional, fromPromise } from '@rolster/commons';\nfunction itIsModelHidden(model) {\n return typeof model === 'object' && 'hidden' in model && 'hiddenAt' in model;\n}\nexport class AbstractEntityManager {\n}\nexport class EntityManager {\n constructor(source) {\n this.source = source;\n this.links = [];\n this.refreshs = [];\n this.syncs = [];\n this.destroys = [];\n this.hiddens = [];\n this.procedures = [];\n this.relations = new Map();\n }\n persist(options) {\n this.links.push(options);\n }\n refresh(options) {\n options.bindable && this.relation(options.entity, options.model);\n this.refreshs.push(options);\n }\n sync(options) {\n options.bindable && this.relation(options.entity, options.model);\n this.syncs.push(options);\n }\n destroy(entity) {\n this.select(entity).present((model) => {\n itIsModelHidden(model)\n ? this.hiddens.push(model)\n : this.destroys.push(model);\n });\n }\n procedure(procedure) {\n this.procedures.push(procedure);\n }\n relation({ uuid }, model) {\n this.relations.set(uuid, model);\n }\n link(entity, model) {\n this.relation(entity, model);\n return entity;\n }\n select({ uuid }) {\n return Optional.build(this.relations.has(uuid) ? this.relations.get(uuid) : undefined);\n }\n async flush() {\n await this.persistAll();\n await this.refreshAll();\n await this.syncAll();\n await this.hiddenAll();\n await this.destroyAll();\n await this.procedureAll();\n this.dispose();\n }\n dispose() {\n this.relations.clear();\n this.links = [];\n this.refreshs = [];\n this.syncs = [];\n this.destroys = [];\n this.hiddens = [];\n this.procedures = [];\n }\n persistAll() {\n const { links, source } = this;\n return Promise.all(links.map((link) => fromPromise(link.create(this)).then((model) => {\n const { bindable, entity } = link;\n if (bindable) {\n this.relation(entity, model);\n }\n return source.insert(model);\n })));\n }\n refreshAll() {\n return Promise.all(this.refreshs.map(({ model }) => this.source.refresh(model)));\n }\n syncAll() {\n return Promise.all(this.syncs\n .filter(({ model }) => !this.destroys.includes(model))\n .reduce((syncs, sync) => {\n const dirty = sync.verify();\n dirty && syncs.push([sync.model, dirty]);\n return syncs;\n }, [])\n .map(([model, dirty]) => {\n return this.source.refresh(model, dirty);\n }));\n }\n destroyAll() {\n return Promise.all(this.destroys.map((destroy) => this.source.delete(destroy)));\n }\n hiddenAll() {\n return Promise.all(this.hiddens.map((hidden) => this.source.hidden(hidden)));\n }\n procedureAll() {\n return Promise.all(this.procedures.map((procedure) => this.source.procedure(procedure)));\n }\n}\n//# sourceMappingURL=entity-manager.js.map","function itIsModelEditable(model) {\n return typeof model === 'object' && 'updatedAt' in model;\n}\nexport class Entity {\n constructor(uuid) {\n this.uuid = uuid;\n }\n}\nexport class EntityRefresh {\n constructor(entity, model, bindable = true) {\n this.entity = entity;\n this.model = model;\n this.bindable = bindable;\n }\n}\nexport class EntityLink {\n constructor(entity, bindable = true) {\n this.entity = entity;\n this.bindable = bindable;\n }\n}\nexport class EntitySync {\n constructor(entity, model, bindable = true) {\n this.entity = entity;\n this.model = model;\n this.bindable = bindable;\n this.firstDirty = this.createDirtyFromModel(model);\n }\n verify() {\n this.sync();\n return this.createDirty();\n }\n createDirtyFromModel(model) {\n const dirty = {};\n Object.keys(model).forEach((key) => {\n dirty[key] = model[key];\n });\n return dirty;\n }\n createDirty() {\n const currentDirty = this.createDirtyFromModel(this.model);\n const finalDirty = {};\n Object.keys(currentDirty).forEach((key) => {\n if (currentDirty[key] !== this.firstDirty[key]) {\n finalDirty[key] = currentDirty[key];\n }\n });\n const requiredUpdate = Object.keys(finalDirty).length > 0;\n if (requiredUpdate && itIsModelEditable(this.model)) {\n finalDirty['updatedAt'] = new Date();\n }\n return requiredUpdate ? finalDirty : undefined;\n }\n}\n//# sourceMappingURL=entity.js.map","export class AbstractPersistentUnit {\n}\n//# sourceMappingURL=persistent-unit.js.map","export class AbstractProcedure {\n}\n//# sourceMappingURL=procedure.js.map","export class AbstractRepository {\n}\n//# sourceMappingURL=repository.js.map"],"names":[],"mappings":";;;;AAAO,MAAM,sBAAsB,CAAC;AACpC;;ACDO,MAAM,wBAAwB,CAAC;AACtC;;AC0BO,SAAS,WAAW,CAAC,MAAM,EAAE;AACpC,IAAI,OAAO,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,KAAK,IAAI,C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