@po-ui/ng-sync 20.13.0 → 21.0.0-rc.0
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/README.md +3 -3
- package/fesm2022/po-ui-ng-sync.mjs +42 -35
- package/fesm2022/po-ui-ng-sync.mjs.map +1 -1
- package/package.json +10 -10
- package/po-ui-ng-sync-21.0.0-rc.0.tgz +0 -0
- package/schematics/README.md +2 -2
- package/schematics/migrations.json +8 -3
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-update/v14/index.js +1 -1
- package/schematics/ng-update/v15/index.js +1 -1
- package/schematics/ng-update/v16/index.js +1 -1
- package/schematics/ng-update/v17/index.js +1 -1
- package/schematics/ng-update/v18/index.js +1 -1
- package/schematics/ng-update/v19/index.js +1 -1
- package/schematics/ng-update/v2/index.js +1 -1
- package/schematics/ng-update/v20/index.js +1 -1
- package/schematics/ng-update/v21/changes.d.ts +2 -0
- package/schematics/ng-update/v21/changes.js +14 -0
- package/schematics/ng-update/v21/changes.js.map +1 -0
- package/schematics/ng-update/v21/index.d.ts +1 -0
- package/schematics/ng-update/v21/index.js +16 -0
- package/schematics/ng-update/v21/index.js.map +1 -0
- package/schematics/ng-update/v3/index.js +1 -1
- package/schematics/ng-update/v4/index.js +1 -1
- package/schematics/ng-update/v5/index.js +1 -1
- package/schematics/ng-update/v6/index.js +1 -1
- package/po-ui-ng-sync-20.13.0.tgz +0 -0
- /package/{index.d.ts → types/po-ui-ng-sync.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -6,17 +6,17 @@ O **PO Sync** é uma biblioteca para aplicações Angular que possibilita armaze
|
|
|
6
6
|
|
|
7
7
|
Instalando com schematic(recomendado):
|
|
8
8
|
```
|
|
9
|
-
ng add @po-ui/ng-sync
|
|
9
|
+
ng add @po-ui/ng-sync@next
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
Instalando com npm:
|
|
13
13
|
```
|
|
14
|
-
npm install @po-ui/ng-sync
|
|
14
|
+
npm install @po-ui/ng-sync@next
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
Caso prefira instalar com o yarn:
|
|
18
18
|
```
|
|
19
|
-
yarn add @po-ui/ng-sync
|
|
19
|
+
yarn add @po-ui/ng-sync@next
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
Para informações complementares sobre instalação, acesse **[começando com o PO Sync](https://po-ui.io/guides/sync-get-started)** e **[fundamentos do PO Sync](https://po-ui.io/guides/sync-fundamentals)**.
|
|
@@ -64,8 +64,8 @@ const validateParameter = (parameter) => {
|
|
|
64
64
|
* @param value Objeto contento o nome da propriedade que está sendo validada e o seu valor.
|
|
65
65
|
*/
|
|
66
66
|
const validateArray = (value) => {
|
|
67
|
-
validateParameter(value);
|
|
68
|
-
const [paramName, paramValue] = getObjectEntries(value);
|
|
67
|
+
PoUtils.validateParameter(value);
|
|
68
|
+
const [paramName, paramValue] = PoUtils.getObjectEntries(value);
|
|
69
69
|
if (!(paramValue instanceof Array)) {
|
|
70
70
|
throw new Error(`${paramName} is not an Array instance`);
|
|
71
71
|
}
|
|
@@ -93,6 +93,13 @@ const toBase64 = (file) => new Promise((resolve, reject) => {
|
|
|
93
93
|
const toFile = (url, fileName, mimeType) => fetch(url)
|
|
94
94
|
.then(result => result.arrayBuffer())
|
|
95
95
|
.then(buffer => new File([buffer], fileName, { type: mimeType }));
|
|
96
|
+
const PoUtils = {
|
|
97
|
+
getObjectEntries,
|
|
98
|
+
toBase64,
|
|
99
|
+
toFile,
|
|
100
|
+
validateArray,
|
|
101
|
+
validateParameter
|
|
102
|
+
};
|
|
96
103
|
|
|
97
104
|
/**
|
|
98
105
|
* @description
|
|
@@ -364,10 +371,10 @@ class PoSchemaDefinitionService {
|
|
|
364
371
|
schemas = schemas.map(replaceUpdatedSchema);
|
|
365
372
|
return this.saveAll(schemas);
|
|
366
373
|
}
|
|
367
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
368
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
374
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: PoSchemaDefinitionService, deps: [{ token: i1.PoStorageService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
375
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: PoSchemaDefinitionService, providedIn: 'root' });
|
|
369
376
|
}
|
|
370
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
377
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: PoSchemaDefinitionService, decorators: [{
|
|
371
378
|
type: Injectable,
|
|
372
379
|
args: [{
|
|
373
380
|
providedIn: 'root'
|
|
@@ -538,10 +545,10 @@ class PoSchemaService {
|
|
|
538
545
|
await this.remove(schemaName, recordId);
|
|
539
546
|
return Object.assign(record, localRecord);
|
|
540
547
|
}
|
|
541
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
542
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
548
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: PoSchemaService, deps: [{ token: PoSchemaDefinitionService }, { token: i1.PoStorageService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
549
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: PoSchemaService, providedIn: 'root' });
|
|
543
550
|
}
|
|
544
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
551
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: PoSchemaService, decorators: [{
|
|
545
552
|
type: Injectable,
|
|
546
553
|
args: [{
|
|
547
554
|
providedIn: 'root'
|
|
@@ -685,10 +692,10 @@ class PoHttpClientService {
|
|
|
685
692
|
}
|
|
686
693
|
return httpHeaders;
|
|
687
694
|
}
|
|
688
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
689
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
695
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: PoHttpClientService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
696
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: PoHttpClientService, providedIn: 'root' });
|
|
690
697
|
}
|
|
691
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
698
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: PoHttpClientService, decorators: [{
|
|
692
699
|
type: Injectable,
|
|
693
700
|
args: [{
|
|
694
701
|
providedIn: 'root'
|
|
@@ -808,7 +815,7 @@ class PoEventSourcingService {
|
|
|
808
815
|
bodyType = 'File';
|
|
809
816
|
mimeType = body.type;
|
|
810
817
|
fileName = body.name;
|
|
811
|
-
body = await toBase64(body);
|
|
818
|
+
body = await PoUtils.toBase64(body);
|
|
812
819
|
}
|
|
813
820
|
return { ...requestData, body, mimeType, bodyType, fileName };
|
|
814
821
|
}
|
|
@@ -985,7 +992,7 @@ class PoEventSourcingService {
|
|
|
985
992
|
return { url, method, body, headers };
|
|
986
993
|
}
|
|
987
994
|
async createFormData(body, fileName, mimeType, formField = 'file') {
|
|
988
|
-
const file = await toFile(body, fileName, mimeType);
|
|
995
|
+
const file = await PoUtils.toFile(body, fileName, mimeType);
|
|
989
996
|
const formData = new FormData();
|
|
990
997
|
formData.append(formField, file, fileName);
|
|
991
998
|
return formData;
|
|
@@ -1052,10 +1059,10 @@ class PoEventSourcingService {
|
|
|
1052
1059
|
updateStorageSchemas(schemas) {
|
|
1053
1060
|
return schemas.map((schema) => this.updateStorageBySchema(schema));
|
|
1054
1061
|
}
|
|
1055
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1056
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
1062
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: PoEventSourcingService, deps: [{ token: PoSchemaDefinitionService }, { token: PoSchemaService }, { token: i1.PoStorageService }, { token: PoHttpClientService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1063
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: PoEventSourcingService, providedIn: 'root' });
|
|
1057
1064
|
}
|
|
1058
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1065
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: PoEventSourcingService, decorators: [{
|
|
1059
1066
|
type: Injectable,
|
|
1060
1067
|
args: [{
|
|
1061
1068
|
providedIn: 'root'
|
|
@@ -1172,7 +1179,7 @@ class PoQueryBuilder {
|
|
|
1172
1179
|
* @returns {PoQueryBuilder} Objeto que possibilita encadear um novo método do `PoQueryBuilder`.
|
|
1173
1180
|
*/
|
|
1174
1181
|
page(page) {
|
|
1175
|
-
validateParameter({ page });
|
|
1182
|
+
PoUtils.validateParameter({ page });
|
|
1176
1183
|
this._page = page;
|
|
1177
1184
|
return this;
|
|
1178
1185
|
}
|
|
@@ -1183,7 +1190,7 @@ class PoQueryBuilder {
|
|
|
1183
1190
|
* @returns {PoQueryBuilder} Objeto que possibilita encadear um novo método do `PoQueryBuilder`.
|
|
1184
1191
|
*/
|
|
1185
1192
|
pageSize(pageSize) {
|
|
1186
|
-
validateParameter({ pageSize });
|
|
1193
|
+
PoUtils.validateParameter({ pageSize });
|
|
1187
1194
|
this._pageSize = pageSize;
|
|
1188
1195
|
return this;
|
|
1189
1196
|
}
|
|
@@ -1206,7 +1213,7 @@ class PoQueryBuilder {
|
|
|
1206
1213
|
* @returns {PoQueryBuilder} Objeto que possibilita encadear um novo método do `PoQueryBuilder`.
|
|
1207
1214
|
*/
|
|
1208
1215
|
select(fields) {
|
|
1209
|
-
validateParameter({ fields });
|
|
1216
|
+
PoUtils.validateParameter({ fields });
|
|
1210
1217
|
this.fields = fields;
|
|
1211
1218
|
return this;
|
|
1212
1219
|
}
|
|
@@ -1222,7 +1229,7 @@ class PoQueryBuilder {
|
|
|
1222
1229
|
* @returns {PoQueryBuilder} Objeto que possibilita encadear um novo método do `PoQueryBuilder`.
|
|
1223
1230
|
*/
|
|
1224
1231
|
sort(field) {
|
|
1225
|
-
validateParameter({ field });
|
|
1232
|
+
PoUtils.validateParameter({ field });
|
|
1226
1233
|
this._sort = field;
|
|
1227
1234
|
return this;
|
|
1228
1235
|
}
|
|
@@ -1414,7 +1421,7 @@ class PoEntity {
|
|
|
1414
1421
|
* @returns {Promise} Promessa que é concluída após o registro ser removido.
|
|
1415
1422
|
*/
|
|
1416
1423
|
async remove(record, customRequestId) {
|
|
1417
|
-
validateParameter({ record });
|
|
1424
|
+
PoUtils.validateParameter({ record });
|
|
1418
1425
|
const remove = async () => {
|
|
1419
1426
|
const idField = record[this.schema.idField] ? this.schema.idField : PoSchemaUtil.syncInternalIdFieldName;
|
|
1420
1427
|
const serverRecord = PoSchemaUtil.separateSchemaFields(this.schema, record)['serverRecord'];
|
|
@@ -1433,7 +1440,7 @@ class PoEntity {
|
|
|
1433
1440
|
* @returns {Promise} Promessa que é concluída após o registro ser alterado ou incluído.
|
|
1434
1441
|
*/
|
|
1435
1442
|
async save(record, customRequestId) {
|
|
1436
|
-
validateParameter({ record });
|
|
1443
|
+
PoUtils.validateParameter({ record });
|
|
1437
1444
|
return this.poSchemaService.limitedCallWrap(this.selectSaveType.bind(this, record, true, customRequestId));
|
|
1438
1445
|
}
|
|
1439
1446
|
/**
|
|
@@ -1450,7 +1457,7 @@ class PoEntity {
|
|
|
1450
1457
|
* @returns {Promise<any>} Promessa que é concluída após os registros serem alterados ou incluídos.
|
|
1451
1458
|
*/
|
|
1452
1459
|
async saveAll(records, customRequestIds) {
|
|
1453
|
-
validateParameter({ records });
|
|
1460
|
+
PoUtils.validateParameter({ records });
|
|
1454
1461
|
const saveAll = async () => {
|
|
1455
1462
|
const batchEvents = [];
|
|
1456
1463
|
for (let index = 0; index < records.length; index++) {
|
|
@@ -1697,10 +1704,10 @@ class PoNetworkService {
|
|
|
1697
1704
|
this.networkTypeNow.next({ status: status.connected, type: this.networkType });
|
|
1698
1705
|
});
|
|
1699
1706
|
}
|
|
1700
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1701
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
1707
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: PoNetworkService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1708
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: PoNetworkService, providedIn: 'root' });
|
|
1702
1709
|
}
|
|
1703
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1710
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: PoNetworkService, decorators: [{
|
|
1704
1711
|
type: Injectable,
|
|
1705
1712
|
args: [{
|
|
1706
1713
|
providedIn: 'root'
|
|
@@ -1815,7 +1822,7 @@ class PoSyncService {
|
|
|
1815
1822
|
* @returns {Promise<number>} Promessa com o identificador da requisição HTTP criada.
|
|
1816
1823
|
*/
|
|
1817
1824
|
insertHttpCommand(requestData, customRequestId) {
|
|
1818
|
-
validateParameter({ requestData });
|
|
1825
|
+
PoUtils.validateParameter({ requestData });
|
|
1819
1826
|
return this.poEventSourcingService.httpCommand(requestData, customRequestId);
|
|
1820
1827
|
}
|
|
1821
1828
|
/**
|
|
@@ -1857,7 +1864,7 @@ class PoSyncService {
|
|
|
1857
1864
|
* @returns {Promise<any>} Promessa que é resolvida quando a aplicação estiver preparada para a utilização do `po-sync`.
|
|
1858
1865
|
*/
|
|
1859
1866
|
prepare(schemas, config) {
|
|
1860
|
-
validateArray({ schemas });
|
|
1867
|
+
PoUtils.validateArray({ schemas });
|
|
1861
1868
|
const defaultSyncConfig = {
|
|
1862
1869
|
type: this.poNetworkService.getConnectionStatus().type,
|
|
1863
1870
|
period: 60,
|
|
@@ -2023,10 +2030,10 @@ class PoSyncService {
|
|
|
2023
2030
|
syncError() {
|
|
2024
2031
|
this.finishSync();
|
|
2025
2032
|
}
|
|
2026
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2027
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
2033
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: PoSyncService, deps: [{ token: PoEventSourcingService }, { token: PoHttpClientService }, { token: PoNetworkService }, { token: PoSchemaDefinitionService }, { token: PoSchemaService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2034
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: PoSyncService, providedIn: 'root' });
|
|
2028
2035
|
}
|
|
2029
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2036
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: PoSyncService, decorators: [{
|
|
2030
2037
|
type: Injectable,
|
|
2031
2038
|
args: [{
|
|
2032
2039
|
providedIn: 'root'
|
|
@@ -2039,9 +2046,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
|
|
|
2039
2046
|
* Módulo do componente PoSync responsável pela sincronia de dados com backends
|
|
2040
2047
|
*/
|
|
2041
2048
|
class PoSyncModule {
|
|
2042
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2043
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
2044
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
2049
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: PoSyncModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2050
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.0.9", ngImport: i0, type: PoSyncModule });
|
|
2051
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: PoSyncModule, providers: [
|
|
2045
2052
|
PoEventSourcingService,
|
|
2046
2053
|
PoNetworkService,
|
|
2047
2054
|
PoSchemaDefinitionService,
|
|
@@ -2050,7 +2057,7 @@ class PoSyncModule {
|
|
|
2050
2057
|
PoHttpClientService
|
|
2051
2058
|
] });
|
|
2052
2059
|
}
|
|
2053
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2060
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: PoSyncModule, decorators: [{
|
|
2054
2061
|
type: NgModule,
|
|
2055
2062
|
args: [{
|
|
2056
2063
|
providers: [
|