@po-ui/ng-sync 5.22.3 → 6.2.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 +22 -22
- package/{esm2015/lib/index.js → esm2020/lib/index.mjs} +15 -15
- package/{esm2015/lib/models/index.js → esm2020/lib/models/index.mjs} +6 -6
- package/{esm2015/lib/models/po-data-message.model.js → esm2020/lib/models/po-data-message.model.mjs} +57 -57
- package/esm2020/lib/models/po-data-transform.model.mjs +22 -0
- package/esm2020/lib/models/po-entity/po-entity.model.mjs +214 -0
- package/{esm2015/lib/models/po-event-sourcing-error-response.model.js → esm2020/lib/models/po-event-sourcing-error-response.model.mjs} +17 -17
- package/{esm2015/lib/models/po-network-status.model.js → esm2020/lib/models/po-network-status.model.mjs} +44 -44
- package/{esm2015/lib/models/po-network-type.enum.js → esm2020/lib/models/po-network-type.enum.mjs} +30 -30
- package/esm2020/lib/models/po-query-builder/po-query-builder.model.mjs +238 -0
- package/{esm2015/lib/models/po-request-type.enum.js → esm2020/lib/models/po-request-type.enum.mjs} +16 -16
- package/esm2020/lib/po-sync.module.mjs +45 -0
- package/{esm2015/lib/services/po-event-sourcing/enums/po-event-sourcing-operation.enum.js → esm2020/lib/services/po-event-sourcing/enums/po-event-sourcing-operation.enum.mjs} +17 -17
- package/{esm2015/lib/services/po-event-sourcing/index.js → esm2020/lib/services/po-event-sourcing/index.mjs} +4 -4
- package/esm2020/lib/services/po-event-sourcing/interfaces/po-event-sourcing-item.interface.mjs +2 -0
- package/esm2020/lib/services/po-event-sourcing/interfaces/po-event-sourcing-summary-item.interface.mjs +2 -0
- package/esm2020/lib/services/po-event-sourcing/po-event-sourcing.service.mjs +372 -0
- package/{esm2015/lib/services/po-http-client/interfaces/po-http-header-option.interface.js → esm2020/lib/services/po-http-client/interfaces/po-http-header-option.interface.mjs} +11 -11
- package/esm2020/lib/services/po-http-client/interfaces/po-http-request-data.interface.mjs +2 -0
- package/esm2020/lib/services/po-http-client/interfaces/po-response-api.interface.mjs +2 -0
- package/esm2020/lib/services/po-http-client/po-http-client.service.mjs +148 -0
- package/{esm2015/lib/services/po-http-client/po-http-request-type.enum.js → esm2020/lib/services/po-http-client/po-http-request-type.enum.mjs} +25 -25
- package/esm2020/lib/services/po-network/po-network.service.mjs +58 -0
- package/{esm2015/lib/services/po-schema/index.js → esm2020/lib/services/po-schema/index.mjs} +4 -4
- package/esm2020/lib/services/po-schema/po-schema-definition/po-schema-definition.service.mjs +77 -0
- package/{esm2015/lib/services/po-schema/po-schema-util/po-schema-util.model.js → esm2020/lib/services/po-schema/po-schema-util/po-schema-util.model.mjs} +124 -124
- package/esm2020/lib/services/po-schema/po-schema.service.mjs +174 -0
- package/esm2020/lib/services/po-sync/interfaces/po-sync-config.interface.mjs +2 -0
- package/esm2020/lib/services/po-sync/interfaces/po-sync-field-options.interface.mjs +2 -0
- package/esm2020/lib/services/po-sync/interfaces/po-sync-response.interface.mjs +2 -0
- package/esm2020/lib/services/po-sync/interfaces/po-sync-schema.interface.mjs +2 -0
- package/esm2020/lib/services/po-sync/po-sync.service.mjs +325 -0
- package/{esm2015/lib/utils/utils.js → esm2020/lib/utils/utils.mjs} +63 -63
- package/esm2020/po-ui-ng-sync.mjs +5 -0
- package/{esm2015/public-api.js → esm2020/public-api.mjs} +2 -2
- package/fesm2015/{po-ui-ng-sync.js → po-ui-ng-sync.mjs} +2074 -2058
- package/fesm2015/po-ui-ng-sync.mjs.map +1 -0
- package/fesm2020/po-ui-ng-sync.mjs +2018 -0
- package/fesm2020/po-ui-ng-sync.mjs.map +1 -0
- package/lib/index.d.ts +14 -14
- package/lib/models/index.d.ts +5 -5
- package/lib/models/po-data-message.model.d.ts +46 -46
- package/lib/models/po-data-transform.model.d.ts +52 -52
- package/lib/models/po-entity/po-entity.model.d.ts +122 -122
- package/lib/models/po-event-sourcing-error-response.model.d.ts +20 -20
- package/lib/models/po-network-status.model.d.ts +25 -25
- package/lib/models/po-network-type.enum.d.ts +28 -28
- package/lib/models/po-query-builder/po-query-builder.model.d.ts +126 -126
- package/lib/models/po-request-type.enum.d.ts +14 -14
- package/lib/po-sync.module.d.ts +12 -7
- package/lib/services/po-event-sourcing/enums/po-event-sourcing-operation.enum.d.ts +11 -11
- package/lib/services/po-event-sourcing/index.d.ts +3 -3
- package/lib/services/po-event-sourcing/interfaces/po-event-sourcing-item.interface.d.ts +26 -26
- package/lib/services/po-event-sourcing/interfaces/po-event-sourcing-summary-item.interface.d.ts +16 -16
- package/lib/services/po-event-sourcing/po-event-sourcing.service.d.ts +74 -71
- package/lib/services/po-http-client/interfaces/po-http-header-option.interface.d.ts +15 -15
- package/lib/services/po-http-client/interfaces/po-http-request-data.interface.d.ts +24 -24
- package/lib/services/po-http-client/interfaces/po-response-api.interface.d.ts +14 -14
- package/lib/services/po-http-client/po-http-client.service.d.ts +78 -75
- package/lib/services/po-http-client/po-http-request-type.enum.d.ts +23 -23
- package/lib/services/po-network/po-network.service.d.ts +36 -33
- package/lib/services/po-schema/index.d.ts +3 -3
- package/lib/services/po-schema/po-schema-definition/po-schema-definition.service.d.ts +51 -48
- package/lib/services/po-schema/po-schema-util/po-schema-util.model.d.ts +79 -79
- package/lib/services/po-schema/po-schema.service.d.ts +98 -95
- package/lib/services/po-sync/interfaces/po-sync-config.interface.d.ts +24 -24
- package/lib/services/po-sync/interfaces/po-sync-field-options.interface.d.ts +15 -15
- package/lib/services/po-sync/interfaces/po-sync-response.interface.d.ts +20 -20
- package/lib/services/po-sync/interfaces/po-sync-schema.interface.d.ts +37 -37
- package/lib/services/po-sync/po-sync.service.d.ts +162 -159
- package/lib/utils/utils.d.ts +36 -36
- package/package.json +30 -15
- package/po-ui-ng-sync-6.2.0.tgz +0 -0
- package/po-ui-ng-sync.d.ts +5 -8
- package/public-api.d.ts +1 -1
- package/schematics/README.md +169 -169
- package/schematics/collection.json +15 -15
- package/schematics/migrations.json +30 -25
- package/schematics/ng-add/index.d.ts +7 -7
- package/schematics/ng-add/index.js +33 -33
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics/ng-add/index.spec.d.ts +1 -1
- package/schematics/ng-add/index.spec.js +62 -62
- package/schematics/ng-add/index.spec.js.map +1 -1
- package/schematics/ng-add/schema.json +7 -7
- package/schematics/ng-generate/schema/files/__path__/__name@dasherize__/__name@dasherize__.constants.ts.template +13 -13
- package/schematics/ng-generate/schema/index.d.ts +4 -4
- package/schematics/ng-generate/schema/index.js +12 -12
- package/schematics/ng-generate/schema/index.js.map +1 -1
- package/schematics/ng-generate/schema/index.spec.d.ts +1 -1
- package/schematics/ng-generate/schema/index.spec.js +44 -44
- package/schematics/ng-generate/schema/index.spec.js.map +1 -1
- package/schematics/ng-generate/schema/schema.d.ts +3 -3
- package/schematics/ng-generate/schema/schema.js +2 -2
- package/schematics/ng-generate/schema/schema.json +31 -31
- package/schematics/ng-update/v2/changes.d.ts +8 -8
- package/schematics/ng-update/v2/changes.js +20 -20
- package/schematics/ng-update/v2/index.d.ts +5 -5
- package/schematics/ng-update/v2/index.js +101 -101
- package/schematics/ng-update/v2/index.js.map +1 -1
- package/schematics/ng-update/v3/changes.d.ts +2 -2
- package/schematics/ng-update/v3/changes.js +14 -14
- package/schematics/ng-update/v3/index.d.ts +1 -1
- package/schematics/ng-update/v3/index.js +16 -16
- package/schematics/ng-update/v3/index.js.map +1 -1
- package/schematics/ng-update/v4/changes.d.ts +2 -2
- package/schematics/ng-update/v4/changes.js +14 -14
- package/schematics/ng-update/v4/index.d.ts +1 -1
- package/schematics/ng-update/v4/index.js +15 -15
- package/schematics/ng-update/v4/index.js.map +1 -1
- package/schematics/ng-update/v5/changes.d.ts +2 -2
- package/schematics/ng-update/v5/changes.js +13 -13
- package/schematics/ng-update/v5/index.d.ts +1 -1
- package/schematics/ng-update/v5/index.js +15 -15
- package/schematics/ng-update/v5/index.js.map +1 -1
- package/schematics/ng-update/v6/changes.d.ts +2 -0
- package/schematics/ng-update/v6/changes.js +14 -0
- package/schematics/ng-update/v6/changes.js.map +1 -0
- package/schematics/ng-update/v6/index.d.ts +1 -0
- package/schematics/ng-update/v6/index.js +16 -0
- package/schematics/ng-update/v6/index.js.map +1 -0
- package/bundles/po-ui-ng-sync.umd.js +0 -3002
- package/bundles/po-ui-ng-sync.umd.js.map +0 -1
- package/esm2015/lib/models/po-data-transform.model.js +0 -22
- package/esm2015/lib/models/po-entity/po-entity.model.js +0 -229
- package/esm2015/lib/models/po-query-builder/po-query-builder.model.js +0 -241
- package/esm2015/lib/po-sync.module.js +0 -31
- package/esm2015/lib/services/po-event-sourcing/interfaces/po-event-sourcing-item.interface.js +0 -2
- package/esm2015/lib/services/po-event-sourcing/interfaces/po-event-sourcing-summary-item.interface.js +0 -2
- package/esm2015/lib/services/po-event-sourcing/po-event-sourcing.service.js +0 -411
- package/esm2015/lib/services/po-http-client/interfaces/po-http-request-data.interface.js +0 -2
- package/esm2015/lib/services/po-http-client/interfaces/po-response-api.interface.js +0 -2
- package/esm2015/lib/services/po-http-client/po-http-client.service.js +0 -147
- package/esm2015/lib/services/po-network/po-network.service.js +0 -58
- package/esm2015/lib/services/po-schema/po-schema-definition/po-schema-definition.service.js +0 -80
- package/esm2015/lib/services/po-schema/po-schema.service.js +0 -198
- package/esm2015/lib/services/po-sync/interfaces/po-sync-config.interface.js +0 -2
- package/esm2015/lib/services/po-sync/interfaces/po-sync-field-options.interface.js +0 -2
- package/esm2015/lib/services/po-sync/interfaces/po-sync-response.interface.js +0 -2
- package/esm2015/lib/services/po-sync/interfaces/po-sync-schema.interface.js +0 -2
- package/esm2015/lib/services/po-sync/po-sync.service.js +0 -336
- package/esm2015/po-ui-ng-sync.js +0 -9
- package/fesm2015/po-ui-ng-sync.js.map +0 -1
- package/po-ui-ng-sync-5.22.3.tgz +0 -0
- package/po-ui-ng-sync.metadata.json +0 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { HttpErrorResponse, HttpResponse } from '@angular/common/http';
|
|
2
|
-
import { PoEventSourcingErrorResponse } from '../../../models/po-event-sourcing-error-response.model';
|
|
3
|
-
import { PoHttpRequestData } from '../../po-http-client/interfaces/po-http-request-data.interface';
|
|
4
|
-
/**
|
|
5
|
-
* @usedBy PoSyncService
|
|
6
|
-
*
|
|
7
|
-
* @description
|
|
8
|
-
*
|
|
9
|
-
* Define a resposta dos eventos enviados ao servidor.
|
|
10
|
-
*/
|
|
11
|
-
export interface PoSyncResponse {
|
|
12
|
-
/** Identificador do evento na fila. */
|
|
13
|
-
id: number;
|
|
14
|
-
/** Identificador customizado do registro. */
|
|
15
|
-
customRequestId?: string;
|
|
16
|
-
/** Dados da requisição. */
|
|
17
|
-
request: PoHttpRequestData;
|
|
18
|
-
/** Resposta retornada após a tentativa de envio para o servidor. */
|
|
19
|
-
response: HttpResponse<Object> | HttpErrorResponse | PoEventSourcingErrorResponse;
|
|
20
|
-
}
|
|
1
|
+
import { HttpErrorResponse, HttpResponse } from '@angular/common/http';
|
|
2
|
+
import { PoEventSourcingErrorResponse } from '../../../models/po-event-sourcing-error-response.model';
|
|
3
|
+
import { PoHttpRequestData } from '../../po-http-client/interfaces/po-http-request-data.interface';
|
|
4
|
+
/**
|
|
5
|
+
* @usedBy PoSyncService
|
|
6
|
+
*
|
|
7
|
+
* @description
|
|
8
|
+
*
|
|
9
|
+
* Define a resposta dos eventos enviados ao servidor.
|
|
10
|
+
*/
|
|
11
|
+
export interface PoSyncResponse {
|
|
12
|
+
/** Identificador do evento na fila. */
|
|
13
|
+
id: number;
|
|
14
|
+
/** Identificador customizado do registro. */
|
|
15
|
+
customRequestId?: string;
|
|
16
|
+
/** Dados da requisição. */
|
|
17
|
+
request: PoHttpRequestData;
|
|
18
|
+
/** Resposta retornada após a tentativa de envio para o servidor. */
|
|
19
|
+
response: HttpResponse<Object> | HttpErrorResponse | PoEventSourcingErrorResponse;
|
|
20
|
+
}
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { PoSyncFieldOptions } from './po-sync-field-options.interface';
|
|
2
|
-
/**
|
|
3
|
-
* @usedBy PoSyncService
|
|
4
|
-
*
|
|
5
|
-
* @description
|
|
6
|
-
*
|
|
7
|
-
* Interface que irá mapear as informações dos recursos, principalmente sua origem e as informações que serão retornadas.
|
|
8
|
-
*/
|
|
9
|
-
export interface PoSyncSchema {
|
|
10
|
-
/** Nome da propriedade que informa a data de criação do registro. */
|
|
11
|
-
readonly createdAtField?: string;
|
|
12
|
-
/** Nome da propriedade que informa a data de deleção. */
|
|
13
|
-
readonly deletedAtField?: string;
|
|
14
|
-
/** Nome da propriedade que informa se o registro foi excluído. */
|
|
15
|
-
readonly deletedField: string;
|
|
16
|
-
/** Endereço do endpoint para excluir registros. */
|
|
17
|
-
readonly deleteUrlApi?: string;
|
|
18
|
-
/** Endereço do endpoint que proverá apenas dados alterados no servidor. */
|
|
19
|
-
readonly diffUrlApi: string;
|
|
20
|
-
/** Campos que serão retornados pela API. */
|
|
21
|
-
readonly fields: Array<string | PoSyncFieldOptions>;
|
|
22
|
-
/** Endereço do endpoint que utiliza o método GET que proverá os dados. */
|
|
23
|
-
readonly getUrlApi: string;
|
|
24
|
-
/** Nome da propriedade referente ao identificador único para os itens do *schema*. */
|
|
25
|
-
readonly idField: string;
|
|
26
|
-
/** Identifição para representar o *schema*. */
|
|
27
|
-
readonly name: string;
|
|
28
|
-
/** Quantidade de itens por página que será enviado pela API. */
|
|
29
|
-
readonly pageSize: number;
|
|
30
|
-
/** Endereço do endpoint que utiliza o método PUT para atualizar registros. */
|
|
31
|
-
readonly patchUrlApi?: string;
|
|
32
|
-
/** Endereço do endpoint que utiliza o método POST para incluir os registros. */
|
|
33
|
-
readonly postUrlApi?: string;
|
|
34
|
-
/** Nome da propriedade que informa a data de atualização do registro. */
|
|
35
|
-
readonly updatedAtField?: string;
|
|
36
|
-
lastSync?: string;
|
|
37
|
-
}
|
|
1
|
+
import { PoSyncFieldOptions } from './po-sync-field-options.interface';
|
|
2
|
+
/**
|
|
3
|
+
* @usedBy PoSyncService
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
*
|
|
7
|
+
* Interface que irá mapear as informações dos recursos, principalmente sua origem e as informações que serão retornadas.
|
|
8
|
+
*/
|
|
9
|
+
export interface PoSyncSchema {
|
|
10
|
+
/** Nome da propriedade que informa a data de criação do registro. */
|
|
11
|
+
readonly createdAtField?: string;
|
|
12
|
+
/** Nome da propriedade que informa a data de deleção. */
|
|
13
|
+
readonly deletedAtField?: string;
|
|
14
|
+
/** Nome da propriedade que informa se o registro foi excluído. */
|
|
15
|
+
readonly deletedField: string;
|
|
16
|
+
/** Endereço do endpoint para excluir registros. */
|
|
17
|
+
readonly deleteUrlApi?: string;
|
|
18
|
+
/** Endereço do endpoint que proverá apenas dados alterados no servidor. */
|
|
19
|
+
readonly diffUrlApi: string;
|
|
20
|
+
/** Campos que serão retornados pela API. */
|
|
21
|
+
readonly fields: Array<string | PoSyncFieldOptions>;
|
|
22
|
+
/** Endereço do endpoint que utiliza o método GET que proverá os dados. */
|
|
23
|
+
readonly getUrlApi: string;
|
|
24
|
+
/** Nome da propriedade referente ao identificador único para os itens do *schema*. */
|
|
25
|
+
readonly idField: string;
|
|
26
|
+
/** Identifição para representar o *schema*. */
|
|
27
|
+
readonly name: string;
|
|
28
|
+
/** Quantidade de itens por página que será enviado pela API. */
|
|
29
|
+
readonly pageSize: number;
|
|
30
|
+
/** Endereço do endpoint que utiliza o método PUT para atualizar registros. */
|
|
31
|
+
readonly patchUrlApi?: string;
|
|
32
|
+
/** Endereço do endpoint que utiliza o método POST para incluir os registros. */
|
|
33
|
+
readonly postUrlApi?: string;
|
|
34
|
+
/** Nome da propriedade que informa a data de atualização do registro. */
|
|
35
|
+
readonly updatedAtField?: string;
|
|
36
|
+
lastSync?: string;
|
|
37
|
+
}
|
|
@@ -1,159 +1,162 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
import { PoEntity } from '../../models';
|
|
3
|
-
import { PoEventSourcingService } from '../po-event-sourcing/po-event-sourcing.service';
|
|
4
|
-
import { PoHttpClientService } from '../po-http-client/po-http-client.service';
|
|
5
|
-
import { PoHttpRequestData } from '../po-http-client/interfaces/po-http-request-data.interface';
|
|
6
|
-
import { PoNetworkService } from '../po-network/po-network.service';
|
|
7
|
-
import { PoSchemaDefinitionService } from './../po-schema/po-schema-definition/po-schema-definition.service';
|
|
8
|
-
import { PoSchemaService } from './../po-schema/po-schema.service';
|
|
9
|
-
import { PoSyncConfig } from './interfaces/po-sync-config.interface';
|
|
10
|
-
import { PoSyncResponse } from '../po-sync/interfaces/po-sync-response.interface';
|
|
11
|
-
import { PoSyncSchema } from './interfaces/po-sync-schema.interface';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
private
|
|
22
|
-
private
|
|
23
|
-
private
|
|
24
|
-
private
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
private
|
|
28
|
-
private
|
|
29
|
-
private
|
|
30
|
-
private
|
|
31
|
-
private
|
|
32
|
-
private
|
|
33
|
-
private
|
|
34
|
-
private
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
* as
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* @
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* @param {
|
|
88
|
-
* @
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
* na
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
* @param {
|
|
119
|
-
* @
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
* @
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
private
|
|
151
|
-
private
|
|
152
|
-
private
|
|
153
|
-
private
|
|
154
|
-
private
|
|
155
|
-
private
|
|
156
|
-
private
|
|
157
|
-
private
|
|
158
|
-
private
|
|
159
|
-
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { PoEntity } from '../../models';
|
|
3
|
+
import { PoEventSourcingService } from '../po-event-sourcing/po-event-sourcing.service';
|
|
4
|
+
import { PoHttpClientService } from '../po-http-client/po-http-client.service';
|
|
5
|
+
import { PoHttpRequestData } from '../po-http-client/interfaces/po-http-request-data.interface';
|
|
6
|
+
import { PoNetworkService } from '../po-network/po-network.service';
|
|
7
|
+
import { PoSchemaDefinitionService } from './../po-schema/po-schema-definition/po-schema-definition.service';
|
|
8
|
+
import { PoSchemaService } from './../po-schema/po-schema.service';
|
|
9
|
+
import { PoSyncConfig } from './interfaces/po-sync-config.interface';
|
|
10
|
+
import { PoSyncResponse } from '../po-sync/interfaces/po-sync-response.interface';
|
|
11
|
+
import { PoSyncSchema } from './interfaces/po-sync-schema.interface';
|
|
12
|
+
import * as i0 from "@angular/core";
|
|
13
|
+
/**
|
|
14
|
+
* @description
|
|
15
|
+
*
|
|
16
|
+
* O `PoSyncService` é utilizado para configurar toda a base de dados que receberá as informações que serão
|
|
17
|
+
* armazenadas *offline* vindas do servidor. Nele ocorre toda a preparação dos modelos de dados retornados por
|
|
18
|
+
* cada consulta.
|
|
19
|
+
*/
|
|
20
|
+
export declare class PoSyncService {
|
|
21
|
+
private poEventSourcingService;
|
|
22
|
+
private poHttpClient;
|
|
23
|
+
private poNetworkService;
|
|
24
|
+
private poSchemaDefinitionService;
|
|
25
|
+
private poSchemaService;
|
|
26
|
+
models: Array<PoEntity>;
|
|
27
|
+
private config;
|
|
28
|
+
private emitter;
|
|
29
|
+
private eventSub;
|
|
30
|
+
private finishSyncSubject;
|
|
31
|
+
private isSyncEnabled;
|
|
32
|
+
private schemas;
|
|
33
|
+
private subscription;
|
|
34
|
+
private syncing;
|
|
35
|
+
private timer;
|
|
36
|
+
constructor(poEventSourcingService: PoEventSourcingService, poHttpClient: PoHttpClientService, poNetworkService: PoNetworkService, poSchemaDefinitionService: PoSchemaDefinitionService, poSchemaService: PoSchemaService);
|
|
37
|
+
/**
|
|
38
|
+
* Destrói todas as chaves do *storage* referentes ao `po-sync`, ou seja,
|
|
39
|
+
* as definições dos *schemas*, os registros de cada *schema* e a fila
|
|
40
|
+
* de eventos que estão para ser enviados ao servidor *(EventSourcing)*.
|
|
41
|
+
*
|
|
42
|
+
* > Para que não venham ocorrer erros em ações que dependam das definições dos *schemas*,
|
|
43
|
+
* recomenda-se utilizar o método `prepare()` em seguida.
|
|
44
|
+
*
|
|
45
|
+
* > Veja mais detalhes em [Fundamentos do PO Sync - Alterando as definições dos schemas](/guides/sync-fundamentals).
|
|
46
|
+
*
|
|
47
|
+
* @returns {Promise<any>} Promessa que é resolvida quando as chaves referentes ao `po-sync` forem destruídas.
|
|
48
|
+
*/
|
|
49
|
+
destroy(): Promise<any>;
|
|
50
|
+
/**
|
|
51
|
+
* Desabilita todos os tipos de sincronização de dados (periódica, reativa e manual).
|
|
52
|
+
*
|
|
53
|
+
* > Para habilitar novamente a sincronização utilize o método [`PoSyncService.enableSync()`](documentation/po-sync#enable-sync).
|
|
54
|
+
*/
|
|
55
|
+
disableSync(): void;
|
|
56
|
+
/**
|
|
57
|
+
* <a id="enable-sync"></a>
|
|
58
|
+
* Habilita todos os tipos de sincronização de dados (periódica, reativa e manual).
|
|
59
|
+
*
|
|
60
|
+
* Por padrão, sempre que se inicializa uma aplicação com PO Sync as sincronizações já estão habilitadas.
|
|
61
|
+
*/
|
|
62
|
+
enableSync(): void;
|
|
63
|
+
/**
|
|
64
|
+
* Método que disponibiliza a partir de sua inscrição o evento de retorno das operações da fila de eventos que
|
|
65
|
+
* foram enviadas ao servidor. A cada operação enviada para o servidor, será disparado um evento para a inscrição
|
|
66
|
+
* deste método.
|
|
67
|
+
*
|
|
68
|
+
* > Veja mais detalhes em [Fundamentos do PO Sync - Capturando respostas da sincronização](/guides/sync-fundamentals).
|
|
69
|
+
*
|
|
70
|
+
* @returns {Observable<PoSyncResponse>} Observable com um objeto do tipo `PoSyncResponse`.
|
|
71
|
+
*/
|
|
72
|
+
getResponses(): Observable<PoSyncResponse>;
|
|
73
|
+
/**
|
|
74
|
+
* Retorna uma instância de `PoEntity` para um determinado *schema*.
|
|
75
|
+
*
|
|
76
|
+
* > Veja mais detalhes em [Fundamentos do PO Sync - Manipulando os registros de um schema](/guides/sync-fundamentals).
|
|
77
|
+
*
|
|
78
|
+
* @param {string} schemaName Nome do *schema*.
|
|
79
|
+
* @returns {PoEntity} Objeto para efetuar consultas e alterações nos dados.
|
|
80
|
+
*/
|
|
81
|
+
getModel(schemaName: string): PoEntity;
|
|
82
|
+
/**
|
|
83
|
+
* Insere uma requisição HTTP na fila de eventos do `po-sync`.
|
|
84
|
+
*
|
|
85
|
+
* > Veja mais detalhes em [Fundamentos do PO Sync - Inserindo requisições HTTP na fila de eventos](/guides/sync-fundamentals).
|
|
86
|
+
*
|
|
87
|
+
* @param {PoHttpRequestData} poHttpRequestData Dados da requisição HTTP.
|
|
88
|
+
* @param {string} customRequestId Identificador customizado da requisição HTTP.
|
|
89
|
+
* @returns {Promise<number>} Promessa com o identificador da requisição HTTP criada.
|
|
90
|
+
*/
|
|
91
|
+
insertHttpCommand(requestData: PoHttpRequestData, customRequestId?: string): Promise<number>;
|
|
92
|
+
/**
|
|
93
|
+
* Efetua uma chamada na API do servidor para realizar a carga inicial dos dados. Deve ser chamado apenas uma vez
|
|
94
|
+
* na aplicação, após a preparação dos *schemas* realizada através do método `PoSyncService.prepare()`.
|
|
95
|
+
*
|
|
96
|
+
* > Veja mais detalhes em [Fundamentos do PO Sync - Carga inicial dos dados](/guides/sync-fundamentals).
|
|
97
|
+
*
|
|
98
|
+
* @returns {Observable<Array<{ entity: string, data: Array<any> }>>} Observable que notificará quando a
|
|
99
|
+
* carga inicial for concluída.
|
|
100
|
+
*/
|
|
101
|
+
loadData(): Observable<Array<{
|
|
102
|
+
entity: string;
|
|
103
|
+
data: Array<any>;
|
|
104
|
+
}>>;
|
|
105
|
+
/**
|
|
106
|
+
* Responsável por notificar sempre que houver sincronismo.
|
|
107
|
+
*
|
|
108
|
+
* > Veja mais detalhes em [Fundamentos do PO Sync - Notificação pós-sincronização](/guides/sync-fundamentals).
|
|
109
|
+
*
|
|
110
|
+
* @returns {Observable<any>} Observable que é disparado a cada sincronismo realizado.
|
|
111
|
+
*/
|
|
112
|
+
onSync(): Observable<any>;
|
|
113
|
+
/**
|
|
114
|
+
* Prepara a aplicação criando os schemas e aplica as configurações.
|
|
115
|
+
*
|
|
116
|
+
* > Veja mais detalhes em [Fundamentos do PO Sync - Preparando a aplicação](/guides/sync-fundamentals).
|
|
117
|
+
*
|
|
118
|
+
* @param {Array<PoSyncSchema>} schemas Lista de *schemas* a serem preparados.
|
|
119
|
+
* @param {PoSyncConfig} config Configurações adicionais.
|
|
120
|
+
* @returns {Promise<any>} Promessa que é resolvida quando a aplicação estiver preparada para a utilização do `po-sync`.
|
|
121
|
+
*/
|
|
122
|
+
prepare(schemas: Array<PoSyncSchema>, config?: PoSyncConfig): Promise<any>;
|
|
123
|
+
/**
|
|
124
|
+
* Remove um item da fila de eventos que espera a sincronização.
|
|
125
|
+
*
|
|
126
|
+
* > Veja mais detalhes em [Fundamentos do PO Sync - Capturando respostas da sincronização](/guides/sync-fundamentals).
|
|
127
|
+
*
|
|
128
|
+
* @param {any} idEventSourcing Identificador do item da fila de eventos.
|
|
129
|
+
* @returns {Promise<any>} Promessa que é resolvida quando o item da fila de eventos é removido.
|
|
130
|
+
*/
|
|
131
|
+
removeItemOfSync(idEventSourcing: any): Promise<any>;
|
|
132
|
+
/**
|
|
133
|
+
* Reenvia os comandos pendentes na fila (inclusão, alteração e exclusão) e busca novos dados do servidor.
|
|
134
|
+
*
|
|
135
|
+
* > Veja mais detalhes em [Fundamentos do PO Sync - Capturando respostas da sincronização](/guides/sync-fundamentals).
|
|
136
|
+
*
|
|
137
|
+
* @returns {Promise<any>} Promessa que resolve o sincronismo disparado.
|
|
138
|
+
*/
|
|
139
|
+
resumeSync(): Promise<any>;
|
|
140
|
+
/**
|
|
141
|
+
* Dispara o sincronismo enviando os eventos pendentes (inclusão, alteração e exclusão) e buscando novos dados do servidor.
|
|
142
|
+
*
|
|
143
|
+
* O sincronismo somente será executado depois que o acesso a base de dados local do dispositivo for liberada.
|
|
144
|
+
*
|
|
145
|
+
* > Veja mais detalhes em [Fundamentos do PO Sync - Sincronização manual](/guides/sync-fundamentals).
|
|
146
|
+
*
|
|
147
|
+
* @returns {Promise<any>} Promessa que é resolvida quando o sincronismo for finalizado.
|
|
148
|
+
*/
|
|
149
|
+
sync(): Promise<any>;
|
|
150
|
+
private canSync;
|
|
151
|
+
private createSubscribe;
|
|
152
|
+
private finishSync;
|
|
153
|
+
private getOnePage;
|
|
154
|
+
private loadEntityData;
|
|
155
|
+
private reactiveSync;
|
|
156
|
+
private saveSchemas;
|
|
157
|
+
private startSync;
|
|
158
|
+
private startTimer;
|
|
159
|
+
private syncError;
|
|
160
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PoSyncService, never>;
|
|
161
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<PoSyncService>;
|
|
162
|
+
}
|
package/lib/utils/utils.d.ts
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Retorna um *array* contendo os pares `[chave, valor]` do objeto.
|
|
3
|
-
*
|
|
4
|
-
* Semelhante ao método `Object.entries()` nativo do javascript.
|
|
5
|
-
*
|
|
6
|
-
* > Veja mais em: https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Object/entries
|
|
7
|
-
*
|
|
8
|
-
* @param object Objeto que será extraído os pares [chave, valor].
|
|
9
|
-
*/
|
|
10
|
-
export declare const getObjectEntries: (object: object) => any[];
|
|
11
|
-
/**
|
|
12
|
-
* Recebe um objeto e valida se o seu valor é diferente de *undefined* ou *null*.
|
|
13
|
-
*
|
|
14
|
-
* @param {object} parameter Objeto contento o nome do parâmetro que está sendo validado
|
|
15
|
-
* e o seu valor.
|
|
16
|
-
*/
|
|
17
|
-
export declare const validateParameter: (parameter: object) => void;
|
|
18
|
-
/**
|
|
19
|
-
* Recebe um objeto e valida se o seu valor é uma instância de *Array* e se não
|
|
20
|
-
* está vazio.
|
|
21
|
-
*
|
|
22
|
-
* @param value Objeto contento o nome da propriedade que está sendo validada e o seu valor.
|
|
23
|
-
*/
|
|
24
|
-
export declare const validateArray: (value: object) => void;
|
|
25
|
-
/**
|
|
26
|
-
* Recebe um arquivo e converte para uma string base64
|
|
27
|
-
*
|
|
28
|
-
* @param Objeto do tipo file.
|
|
29
|
-
*/
|
|
30
|
-
export declare const toBase64: (file: File) => Promise<string>;
|
|
31
|
-
/**
|
|
32
|
-
* Recebe uma string base64 e converte para um arquivo
|
|
33
|
-
*
|
|
34
|
-
* @param string base64.
|
|
35
|
-
*/
|
|
36
|
-
export declare const toFile: (url: string, fileName: string, mimeType: string) => Promise<File>;
|
|
1
|
+
/**
|
|
2
|
+
* Retorna um *array* contendo os pares `[chave, valor]` do objeto.
|
|
3
|
+
*
|
|
4
|
+
* Semelhante ao método `Object.entries()` nativo do javascript.
|
|
5
|
+
*
|
|
6
|
+
* > Veja mais em: https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Object/entries
|
|
7
|
+
*
|
|
8
|
+
* @param object Objeto que será extraído os pares [chave, valor].
|
|
9
|
+
*/
|
|
10
|
+
export declare const getObjectEntries: (object: object) => any[];
|
|
11
|
+
/**
|
|
12
|
+
* Recebe um objeto e valida se o seu valor é diferente de *undefined* ou *null*.
|
|
13
|
+
*
|
|
14
|
+
* @param {object} parameter Objeto contento o nome do parâmetro que está sendo validado
|
|
15
|
+
* e o seu valor.
|
|
16
|
+
*/
|
|
17
|
+
export declare const validateParameter: (parameter: object) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Recebe um objeto e valida se o seu valor é uma instância de *Array* e se não
|
|
20
|
+
* está vazio.
|
|
21
|
+
*
|
|
22
|
+
* @param value Objeto contento o nome da propriedade que está sendo validada e o seu valor.
|
|
23
|
+
*/
|
|
24
|
+
export declare const validateArray: (value: object) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Recebe um arquivo e converte para uma string base64
|
|
27
|
+
*
|
|
28
|
+
* @param Objeto do tipo file.
|
|
29
|
+
*/
|
|
30
|
+
export declare const toBase64: (file: File) => Promise<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Recebe uma string base64 e converte para um arquivo
|
|
33
|
+
*
|
|
34
|
+
* @param string base64.
|
|
35
|
+
*/
|
|
36
|
+
export declare const toFile: (url: string, fileName: string, mimeType: string) => Promise<File>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@po-ui/ng-sync",
|
|
3
|
-
"version": "
|
|
4
|
-
"tag": "
|
|
3
|
+
"version": "6.2.0",
|
|
4
|
+
"tag": "next",
|
|
5
5
|
"description": "PO UI - Sync",
|
|
6
6
|
"author": "PO UI",
|
|
7
7
|
"license": "MIT",
|
|
@@ -21,27 +21,42 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@ionic-native/core": "5.33.0",
|
|
23
23
|
"@ionic-native/network": "5.33.0",
|
|
24
|
-
"@po-ui/ng-storage": "
|
|
24
|
+
"@po-ui/ng-storage": "6.2.0",
|
|
25
25
|
"http-status-codes": "^2.1.4",
|
|
26
|
-
"@po-ui/ng-schematics": "
|
|
27
|
-
"tslib": "^2.
|
|
26
|
+
"@po-ui/ng-schematics": "6.2.0",
|
|
27
|
+
"tslib": "^2.3.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@angular/core": "^
|
|
30
|
+
"@angular/core": "^13.0.2",
|
|
31
31
|
"@ionic-native/core": "5.33.0",
|
|
32
32
|
"@ionic-native/network": "5.33.0",
|
|
33
|
-
"@po-ui/ng-storage": "
|
|
33
|
+
"@po-ui/ng-storage": "6.2.0",
|
|
34
34
|
"http-status-codes": "^2.1.4",
|
|
35
|
-
"rxjs": "~
|
|
35
|
+
"rxjs": "~7.4.0",
|
|
36
36
|
"rxjs-compat": "~6.6.0",
|
|
37
37
|
"zone.js": "~0.11.4"
|
|
38
38
|
},
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"fesm2015": "fesm2015/po-ui-ng-sync.
|
|
39
|
+
"module": "fesm2015/po-ui-ng-sync.mjs",
|
|
40
|
+
"es2020": "fesm2020/po-ui-ng-sync.mjs",
|
|
41
|
+
"esm2020": "esm2020/po-ui-ng-sync.mjs",
|
|
42
|
+
"fesm2020": "fesm2020/po-ui-ng-sync.mjs",
|
|
43
|
+
"fesm2015": "fesm2015/po-ui-ng-sync.mjs",
|
|
44
44
|
"typings": "po-ui-ng-sync.d.ts",
|
|
45
|
-
"
|
|
46
|
-
|
|
45
|
+
"exports": {
|
|
46
|
+
"./package.json": {
|
|
47
|
+
"default": "./package.json"
|
|
48
|
+
},
|
|
49
|
+
".": {
|
|
50
|
+
"types": "./po-ui-ng-sync.d.ts",
|
|
51
|
+
"esm2020": "./esm2020/po-ui-ng-sync.mjs",
|
|
52
|
+
"es2020": "./fesm2020/po-ui-ng-sync.mjs",
|
|
53
|
+
"es2015": "./fesm2015/po-ui-ng-sync.mjs",
|
|
54
|
+
"node": "./fesm2015/po-ui-ng-sync.mjs",
|
|
55
|
+
"default": "./fesm2020/po-ui-ng-sync.mjs"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"sideEffects": false,
|
|
59
|
+
"scripts": {
|
|
60
|
+
"prepublishOnly": "node --eval \"console.error('ERROR: Trying to publish a package that has been compiled by Ivy in full compilation mode. This is not allowed.\\nPlease delete and rebuild the package with Ivy partial compilation mode, before attempting to publish.\\n')\" && exit 1"
|
|
61
|
+
}
|
|
47
62
|
}
|
|
Binary file
|
package/po-ui-ng-sync.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated bundle index. Do not edit.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
export { PoSchemaService as ɵb } from './lib/services/po-schema';
|
|
7
|
-
export { PoSchemaDefinitionService as ɵc } from './lib/services/po-schema/po-schema-definition/po-schema-definition.service';
|
|
8
|
-
export { PoSchemaService as ɵd } from './lib/services/po-schema/po-schema.service';
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
/// <amd-module name="@po-ui/ng-sync" />
|
|
5
|
+
export * from './public-api';
|
package/public-api.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './lib/index';
|
|
1
|
+
export * from './lib/index';
|