jsegd-fluig-types 1.0.13 → 1.0.15

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # jsegd-fluig-types
2
2
 
3
- ![Version](https://img.shields.io/badge/version-1.0.13-blue.svg)
3
+ ![Version](https://img.shields.io/badge/version-1.0.15-blue.svg)
4
4
  ![License](https://img.shields.io/badge/license-CC--BY--NC--ND--4.0-green.svg)
5
5
 
6
6
  Pacote de tipos TypeScript para desenvolvimento com a plataforma Fluig. Este pacote fornece tipagens completas para APIs do Fluig, facilitando o desenvolvimento tanto no frontend quanto no backend, incluindo suporte para webservices e implementações duais de DatasetFactory.
@@ -7,12 +7,34 @@ declare enum DatasetFieldType {
7
7
  }
8
8
 
9
9
  declare enum Status {
10
- SUCCESS = "success",
11
- ERROR = "error",
12
- WARNING = "warning",
13
- FAIL = "fail",
10
+ SUCCESS = "SUCCESS",
11
+ ERROR = "ERROR",
12
+ WARNING = "WARNING",
13
+ FAIL = "FAIL",
14
14
  }
15
15
  declare global {
16
+ enum ConstraintType {
17
+ MUST = 1,
18
+ SHOULD = 2,
19
+ MUST_NOT = 3,
20
+ }
21
+
22
+ interface SearchConstraintBase {
23
+ fieldName: string;
24
+ initialValue: string;
25
+ finalValue: string;
26
+ constraintType: ConstraintType;
27
+ likeSearch: boolean;
28
+ }
29
+
30
+ interface SearchConstraintBackend extends SearchConstraintBase {
31
+ setLikeSearch(likeSearch: boolean): void;
32
+ }
33
+
34
+ type SearchConstraint = typeof window extends undefined
35
+ ? SearchConstraintBackend
36
+ : SearchConstraintBase;
37
+
16
38
  interface ErrorDetail {
17
39
  code: string;
18
40
  message: string;
@@ -25,23 +47,20 @@ declare global {
25
47
  data?: unknown;
26
48
  errors?: ErrorDetail[];
27
49
  }
28
- interface DatasetRequest {
29
- wkValues: WKValues;
30
- cardData: { [key: string]: string };
31
- }
32
50
 
33
51
  interface DatasetWcmResult<T = unknown> {
34
52
  columns: string[];
35
53
  values: T[];
36
54
  }
37
55
 
38
- interface DatasetWcmCallback {
39
- success: (result: DatasetWcmResult) => unknown;
40
- error: (error: object, message: string, details: string) => void;
56
+ interface DatasetCallback {
57
+ success: (data: DatasetWcmResult) => void;
58
+ error?: (jqXHR?: any, textStatus?: string, errorThrown?: any) => void;
41
59
  }
42
60
 
43
61
  // Classe que representa um Dataset padrão do Fluig
44
62
  class DefaultDataset {
63
+ rowsCount: number;
45
64
  // Implementação para adicionar uma coluna ao Dataset
46
65
  addColumn(colName: keyof DatasetResponse): void;
47
66
  addColumn(colName: java.lang.String): void;
@@ -101,64 +120,40 @@ declare global {
101
120
  static newDataset(): DefaultDataset;
102
121
  }
103
122
 
104
- enum ConstraintType {
105
- MUST = 1,
106
- SHOULD = 2,
107
- MUST_NOT = 3,
108
- }
109
-
110
123
  class DatasetFactory {
111
- // Cria uma nova constraint para a seleção de registros do Dataset.
124
+ // backend
112
125
  static createConstraint(
113
126
  field: java.lang.String,
114
127
  initialValue: java.lang.String,
115
128
  finalValue: java.lang.String,
116
129
  type: ConstraintType
117
130
  ): SearchConstraint;
131
+ // frontend
118
132
  static createConstraint(
119
133
  field: string,
120
134
  initialValue: string,
121
135
  finalValue: string,
122
- type: ConstraintType
123
- ): Constraint;
124
-
125
- // Retorna uma lista de todos os Datasets disponíveis no sistema.
126
- static getAvailableDatasets(): java.util.List<java.lang.String>;
136
+ type: ConstraintType,
137
+ likeSearch?: boolean
138
+ ): SearchConstraint;
127
139
 
128
- // Carrega os dados de um Dataset.
140
+ // backend
129
141
  static getDataset(
130
142
  name: java.lang.String,
131
143
  fields: java.lang.String[],
132
144
  constraints: SearchConstraint[],
133
145
  order: java.lang.String[]
134
146
  ): DefaultDataset;
147
+ // frontend
135
148
  static getDataset(
136
149
  name: string,
137
150
  fields: string[],
138
151
  constraints: SearchConstraint[],
139
- order: string[]
152
+ order: string[],
153
+ callback?: DatasetCallback
140
154
  ): DatasetWcmResult<unknown>;
141
- }
142
155
 
143
- class SearchConstraint {
144
- fieldName: string;
145
- initialValue: string;
146
- finalValue: string;
147
- constraintType: ConstraintType;
148
- likeSearch: boolean;
149
-
150
- getFieldName(): string;
151
- getInitialValue(): string;
152
- getFinalValue(): string;
153
- setLikeSearch(likeSearch: boolean): void;
154
- }
155
-
156
- class Constraint {
157
- fieldName: string;
158
- initialValue: string;
159
- finalValue: string;
160
- constraintType: ConstraintType;
161
- likeSearch: boolean;
156
+ getAvailableDatasets(): java.util.List<java.lang.String>;
162
157
  }
163
158
 
164
159
  // Cria um campo na tabela com o nome e tipo informados. O nome sempre deve ser informado em caracteres maiúsculos. O tipo de campo pode ser omitido e neste caso o campo será criado com o tipo String
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsegd-fluig-types",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "description": "Pacote de tipos para fluig",
5
5
  "license": "CC-BY-NC-ND-4.0",
6
6
  "author": "Elemar Deckmann",