ngrx-entity-crud 19.0.0 → 19.2.1-beta.5
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/{fesm2020 → fesm2022}/ngrx-entity-crud.mjs +146 -133
- package/fesm2022/ngrx-entity-crud.mjs.map +1 -0
- package/lib/actions.d.ts.map +1 -1
- package/lib/base-crud-gql.service.d.ts.map +1 -1
- package/lib/base-crud.service.d.ts.map +1 -1
- package/lib/base-singular-crud.service.d.ts.map +1 -1
- package/lib/create_adapter.d.ts.map +1 -1
- package/lib/effect-create-many.d.ts.map +1 -1
- package/lib/effect-create.d.ts.map +1 -1
- package/lib/effect-delete-many.d.ts.map +1 -1
- package/lib/effect-delete.d.ts.map +1 -1
- package/lib/effect-edit-many.d.ts.map +1 -1
- package/lib/effect-edit.d.ts.map +1 -1
- package/lib/effect-search.d.ts.map +1 -1
- package/lib/effect-select.d.ts.map +1 -1
- package/lib/entity_state.d.ts.map +1 -1
- package/lib/ibase-crud-service.d.ts.map +1 -1
- package/lib/j-ngrx-filter.d.ts.map +1 -1
- package/lib/models.d.ts +3 -3
- package/lib/models.d.ts.map +1 -1
- package/lib/reducer.d.ts +1 -1
- package/lib/reducer.d.ts.map +1 -1
- package/lib/state_selectors.d.ts.map +1 -1
- package/lib/utils.d.ts.map +1 -1
- package/ngrx-entity-crud.d.ts.map +1 -1
- package/package.json +5 -13
- package/public-api.d.ts.map +1 -1
- package/schematics/auth/index.ts +87 -0
- package/schematics/auth/schema.d.ts +21 -0
- package/schematics/auth0/index.ts +76 -0
- package/schematics/auth0/schema.d.ts +21 -0
- package/schematics/my-utility.ts +323 -0
- package/schematics/ng-add/files/src/app/core/directive/ng-let.directive.ts +0 -0
- package/schematics/ng-add/files/src/app/core/pipe/json-form.pipe.ts +0 -0
- package/schematics/ng-add/files/src/app/core/pipe/pipes.module.ts +0 -0
- package/schematics/ng-add/files/src/app/main/components/search/search.component.ts +0 -0
- package/schematics/ng-add/files/src/app/main/components/search/search.module.ts +0 -0
- package/schematics/ng-add/index.ts +76 -0
- package/schematics/ng-add/schema.d.ts +13 -0
- package/schematics/section/index.ts +69 -0
- package/schematics/section/schema.d.ts +21 -0
- package/schematics/store/index.ts +123 -0
- package/schematics/store/schema.d.ts +26 -0
- package/tsconfig.schematics.json +36 -0
- package/esm2020/lib/actions.mjs +0 -88
- package/esm2020/lib/base-crud-gql.service.mjs +0 -73
- package/esm2020/lib/base-crud.service.mjs +0 -135
- package/esm2020/lib/base-singular-crud.service.mjs +0 -31
- package/esm2020/lib/create_adapter.mjs +0 -14
- package/esm2020/lib/effect-create-many.mjs +0 -41
- package/esm2020/lib/effect-create.mjs +0 -41
- package/esm2020/lib/effect-delete-many.mjs +0 -44
- package/esm2020/lib/effect-delete.mjs +0 -44
- package/esm2020/lib/effect-edit-many.mjs +0 -41
- package/esm2020/lib/effect-edit.mjs +0 -43
- package/esm2020/lib/effect-search.mjs +0 -41
- package/esm2020/lib/effect-select.mjs +0 -41
- package/esm2020/lib/entity_state.mjs +0 -34
- package/esm2020/lib/ibase-crud-service.mjs +0 -2
- package/esm2020/lib/j-ngrx-filter.mjs +0 -133
- package/esm2020/lib/models.mjs +0 -17
- package/esm2020/lib/reducer.mjs +0 -422
- package/esm2020/lib/state_selectors.mjs +0 -80
- package/esm2020/lib/utils.mjs +0 -19
- package/esm2020/ngrx-entity-crud.mjs +0 -5
- package/esm2020/public-api.mjs +0 -18
- package/fesm2015/ngrx-entity-crud.mjs +0 -1274
- package/fesm2015/ngrx-entity-crud.mjs.map +0 -1
- package/fesm2020/ngrx-entity-crud.mjs.map +0 -1
- package/schematics/auth/index.d.ts +0 -2
- package/schematics/auth/index.js +0 -77
- package/schematics/auth/index.js.map +0 -1
- package/schematics/auth0/index.d.ts +0 -2
- package/schematics/auth0/index.js +0 -67
- package/schematics/auth0/index.js.map +0 -1
- package/schematics/my-utility.d.ts +0 -58
- package/schematics/my-utility.js +0 -254
- package/schematics/my-utility.js.map +0 -1
- package/schematics/ng-add/index.d.ts +0 -2
- package/schematics/ng-add/index.js +0 -70
- package/schematics/ng-add/index.js.map +0 -1
- package/schematics/section/index.d.ts +0 -2
- package/schematics/section/index.js +0 -56
- package/schematics/section/index.js.map +0 -1
- package/schematics/store/index.d.ts +0 -2
- package/schematics/store/index.js +0 -116
- package/schematics/store/index.js.map +0 -1
- /package/{ngrx-entity-crud.d.ts → index.d.ts} +0 -0
|
@@ -75,72 +75,69 @@ function jNgrxFilter(items, filters) {
|
|
|
75
75
|
return new JNgrxFilter().jNgrxFilter(items, filters);
|
|
76
76
|
}
|
|
77
77
|
class JNgrxFilter {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (value === undefined || value === null) {
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
const filterValue = filter.toLowerCase();
|
|
88
|
-
return value.toString().toLowerCase().slice(0, filterValue.length) === filterValue;
|
|
89
|
-
},
|
|
90
|
-
contains(value, filter) {
|
|
91
|
-
if (filter === undefined || filter === null || (typeof filter === 'string' && filter.trim() === '')) {
|
|
92
|
-
return true;
|
|
93
|
-
}
|
|
94
|
-
if (value === undefined || value === null) {
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
return value.toString().toLowerCase().indexOf(filter.toLowerCase()) !== -1;
|
|
98
|
-
},
|
|
99
|
-
endsWith(value, filter) {
|
|
100
|
-
if (filter === undefined || filter === null || filter.trim() === '') {
|
|
101
|
-
return true;
|
|
102
|
-
}
|
|
103
|
-
if (value === undefined || value === null) {
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
|
-
const filterValue = filter.toString().toLowerCase();
|
|
107
|
-
return value.toString().toLowerCase().indexOf(filterValue, value.toString().length - filterValue.length) !== -1;
|
|
108
|
-
},
|
|
109
|
-
equals(value, filter) {
|
|
110
|
-
if (filter === undefined || filter === null || (typeof filter === 'string' && filter.trim() === '')) {
|
|
111
|
-
return true;
|
|
112
|
-
}
|
|
113
|
-
if (value === undefined || value === null) {
|
|
114
|
-
return false;
|
|
115
|
-
}
|
|
116
|
-
return value.toString().toLowerCase() === filter.toString().toLowerCase();
|
|
117
|
-
},
|
|
118
|
-
notEquals(value, filter) {
|
|
119
|
-
if (filter === undefined || filter === null || (typeof filter === 'string' && filter.trim() === '')) {
|
|
120
|
-
return false;
|
|
121
|
-
}
|
|
122
|
-
if (value === undefined || value === null) {
|
|
123
|
-
return true;
|
|
124
|
-
}
|
|
125
|
-
return value.toString().toLowerCase() !== filter.toString().toLowerCase();
|
|
126
|
-
},
|
|
127
|
-
in(value, filters) {
|
|
128
|
-
if (filters === undefined || filters === null || filters.length === 0) {
|
|
129
|
-
return true;
|
|
130
|
-
}
|
|
131
|
-
if (value === undefined || value === null) {
|
|
132
|
-
return false;
|
|
133
|
-
}
|
|
134
|
-
filters.forEach(filter => {
|
|
135
|
-
if (filter === value) {
|
|
136
|
-
return true;
|
|
137
|
-
}
|
|
138
|
-
});
|
|
78
|
+
filterConstraints = {
|
|
79
|
+
startsWith(value, filter) {
|
|
80
|
+
if (filter === undefined || filter === null || filter.trim() === '') {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
if (value === undefined || value === null) {
|
|
139
84
|
return false;
|
|
140
85
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
86
|
+
const filterValue = filter.toLowerCase();
|
|
87
|
+
return value.toString().toLowerCase().slice(0, filterValue.length) === filterValue;
|
|
88
|
+
},
|
|
89
|
+
contains(value, filter) {
|
|
90
|
+
if (filter === undefined || filter === null || (typeof filter === 'string' && filter.trim() === '')) {
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
if (value === undefined || value === null) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
return value.toString().toLowerCase().indexOf(filter.toLowerCase()) !== -1;
|
|
97
|
+
},
|
|
98
|
+
endsWith(value, filter) {
|
|
99
|
+
if (filter === undefined || filter === null || filter.trim() === '') {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
if (value === undefined || value === null) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
const filterValue = filter.toString().toLowerCase();
|
|
106
|
+
return value.toString().toLowerCase().indexOf(filterValue, value.toString().length - filterValue.length) !== -1;
|
|
107
|
+
},
|
|
108
|
+
equals(value, filter) {
|
|
109
|
+
if (filter === undefined || filter === null || (typeof filter === 'string' && filter.trim() === '')) {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
if (value === undefined || value === null) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
return value.toString().toLowerCase() === filter.toString().toLowerCase();
|
|
116
|
+
},
|
|
117
|
+
notEquals(value, filter) {
|
|
118
|
+
if (filter === undefined || filter === null || (typeof filter === 'string' && filter.trim() === '')) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
if (value === undefined || value === null) {
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
return value.toString().toLowerCase() !== filter.toString().toLowerCase();
|
|
125
|
+
},
|
|
126
|
+
in(value, filters) {
|
|
127
|
+
if (filters === undefined || filters === null || filters.length === 0) {
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
if (value === undefined || value === null) {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
filters.forEach(filter => {
|
|
134
|
+
if (filter === value) {
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
};
|
|
144
141
|
jNgrxFilter(items, filters) {
|
|
145
142
|
if (isEmpty(filters)) {
|
|
146
143
|
return items;
|
|
@@ -190,6 +187,7 @@ class JNgrxFilter {
|
|
|
190
187
|
return null;
|
|
191
188
|
}
|
|
192
189
|
}
|
|
190
|
+
isFunction = (obj) => !!(obj && obj.constructor && obj.call && obj.apply);
|
|
193
191
|
}
|
|
194
192
|
|
|
195
193
|
const getError = (state) => state.error;
|
|
@@ -1114,24 +1112,23 @@ const selectCatchError = (actions) => pipe(catchError((error, caught) => {
|
|
|
1114
1112
|
const selectRequest = (actions, service, optEffect) => pipe(ofType(actions.SelectRequest), selectCall(service), selectResponse(actions, optEffect), selectCatchError(actions), repeat());
|
|
1115
1113
|
|
|
1116
1114
|
class BaseCrudService {
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
this.debug = false;
|
|
1122
|
-
this.httpOptions = () => {
|
|
1123
|
-
return {
|
|
1124
|
-
headers: new HttpHeaders({ 'Content-Type': 'application/json' })
|
|
1125
|
-
};
|
|
1126
|
-
};
|
|
1127
|
-
this.searchMap = res => res;
|
|
1128
|
-
this.getId = (value) => value[this.id];
|
|
1129
|
-
}
|
|
1115
|
+
http;
|
|
1116
|
+
service = '';
|
|
1117
|
+
id = 'id';
|
|
1118
|
+
debug = false;
|
|
1130
1119
|
debugMode() {
|
|
1131
1120
|
this.debug = true;
|
|
1132
1121
|
}
|
|
1122
|
+
constructor(http) {
|
|
1123
|
+
this.http = http;
|
|
1124
|
+
}
|
|
1125
|
+
httpOptions = () => {
|
|
1126
|
+
return {
|
|
1127
|
+
headers: new HttpHeaders({ 'Content-Type': 'application/json' }),
|
|
1128
|
+
};
|
|
1129
|
+
};
|
|
1133
1130
|
create(opt) {
|
|
1134
|
-
if (typeof
|
|
1131
|
+
if (typeof console !== 'undefined' && this.debug) {
|
|
1135
1132
|
console.log('%c BaseCrudService.create()', 'color: #777777');
|
|
1136
1133
|
console.log('%c Extended from: ' + this.constructor.name, 'color: #777777');
|
|
1137
1134
|
}
|
|
@@ -1140,12 +1137,12 @@ class BaseCrudService {
|
|
|
1140
1137
|
}
|
|
1141
1138
|
createMany(opt) {
|
|
1142
1139
|
this.checkOptRequest(opt);
|
|
1143
|
-
const result = opt.mutationParams.map(mutationParams => {
|
|
1140
|
+
const result = opt.mutationParams.map((mutationParams) => {
|
|
1144
1141
|
const optB = { ...opt, mutationParams };
|
|
1145
|
-
return this.create(optB).pipe(map(value => ({ ...value, data: [value.data] })) // trasformo la singola risposta da {data:T} in {data:T[]}
|
|
1142
|
+
return this.create(optB).pipe(map((value) => ({ ...value, data: [value.data] })) // trasformo la singola risposta da {data:T} in {data:T[]}
|
|
1146
1143
|
);
|
|
1147
1144
|
});
|
|
1148
|
-
return of(...result).pipe(mergeMap(value => value));
|
|
1145
|
+
return of(...result).pipe(mergeMap((value) => value));
|
|
1149
1146
|
}
|
|
1150
1147
|
/**
|
|
1151
1148
|
* metodo introdotto per la verifica di OptRequest
|
|
@@ -1154,40 +1151,51 @@ class BaseCrudService {
|
|
|
1154
1151
|
* @param opt
|
|
1155
1152
|
*/
|
|
1156
1153
|
checkOptRequest(opt) {
|
|
1157
|
-
if (opt &&
|
|
1154
|
+
if (opt &&
|
|
1155
|
+
Object.prototype.hasOwnProperty.call(opt, 'item') &&
|
|
1156
|
+
!!opt.item) {
|
|
1158
1157
|
throw new Error('Error, in new versions of the library the "items" or "item" attribute have been replaced by "mutationParams". all project attributes must be renamed.');
|
|
1159
1158
|
}
|
|
1160
|
-
if (opt &&
|
|
1159
|
+
if (opt &&
|
|
1160
|
+
Object.prototype.hasOwnProperty.call(opt, 'items') &&
|
|
1161
|
+
!!opt.items) {
|
|
1161
1162
|
throw new Error('Error, in new versions of the library the "items" or "item" attribute have been replaced by "mutationParams". all project attributes must be renamed.');
|
|
1162
1163
|
}
|
|
1163
1164
|
return true;
|
|
1164
1165
|
}
|
|
1165
1166
|
search(value) {
|
|
1166
|
-
if (typeof
|
|
1167
|
+
if (typeof console !== 'undefined' && this.debug) {
|
|
1167
1168
|
console.log('BaseCrudService.search()');
|
|
1168
1169
|
console.log('Extended from: ' + this.constructor.name);
|
|
1169
1170
|
}
|
|
1170
|
-
const url = value &&
|
|
1171
|
+
const url = value &&
|
|
1172
|
+
Object.prototype.hasOwnProperty.call(value, 'path') &&
|
|
1173
|
+
!!value.path
|
|
1174
|
+
? value.path.join('/')
|
|
1175
|
+
: '';
|
|
1171
1176
|
let httpOptions = this.httpOptions();
|
|
1172
|
-
if (value &&
|
|
1173
|
-
|
|
1177
|
+
if (value &&
|
|
1178
|
+
Object.prototype.hasOwnProperty.call(value, 'queryParams') &&
|
|
1179
|
+
!!value.queryParams) {
|
|
1180
|
+
httpOptions = { ...httpOptions, ...{ params: value.queryParams } };
|
|
1174
1181
|
}
|
|
1175
|
-
return this.http
|
|
1182
|
+
return this.http
|
|
1183
|
+
.get(this.getUrl() + url, httpOptions)
|
|
1184
|
+
.pipe(map(this.searchMap));
|
|
1176
1185
|
}
|
|
1186
|
+
searchMap = (res) => res;
|
|
1177
1187
|
select(opt) {
|
|
1178
|
-
if (typeof
|
|
1188
|
+
if (typeof console !== 'undefined' && this.debug) {
|
|
1179
1189
|
console.log('%c BaseCrudService.select()', 'color: #777777');
|
|
1180
1190
|
console.log('%c Extended from: ' + this.constructor.name, 'color: #777777');
|
|
1181
1191
|
}
|
|
1182
1192
|
const id = this.getId(opt.queryParams);
|
|
1183
1193
|
const path = !!opt && !!opt.path ? opt.path : null;
|
|
1184
|
-
return this
|
|
1185
|
-
.http
|
|
1186
|
-
.get(`${this.getUrl(path)}/${id}`, this.httpOptions());
|
|
1194
|
+
return this.http.get(`${this.getUrl(path)}/${id}`, this.httpOptions());
|
|
1187
1195
|
}
|
|
1188
1196
|
update(opt) {
|
|
1189
1197
|
this.checkOptRequest(opt);
|
|
1190
|
-
if (typeof
|
|
1198
|
+
if (typeof console !== 'undefined' && this.debug) {
|
|
1191
1199
|
console.log('%c BaseCrudService.update()', 'color: #777777');
|
|
1192
1200
|
console.log('%c Extended from: ' + this.constructor.name, 'color: #777777');
|
|
1193
1201
|
}
|
|
@@ -1197,16 +1205,16 @@ class BaseCrudService {
|
|
|
1197
1205
|
}
|
|
1198
1206
|
updateMany(opt) {
|
|
1199
1207
|
this.checkOptRequest(opt);
|
|
1200
|
-
const result = opt.mutationParams.map(mutationParams => {
|
|
1208
|
+
const result = opt.mutationParams.map((mutationParams) => {
|
|
1201
1209
|
const optB = { ...opt, mutationParams };
|
|
1202
|
-
return this.update(optB).pipe(map(value => ({ ...value, data: [value.data] })) // trasformo la singola risposta da {data:T} in {data:T[]}
|
|
1210
|
+
return this.update(optB).pipe(map((value) => ({ ...value, data: [value.data] })) // trasformo la singola risposta da {data:T} in {data:T[]}
|
|
1203
1211
|
);
|
|
1204
1212
|
});
|
|
1205
|
-
return of(...result).pipe(mergeMap(value => value));
|
|
1213
|
+
return of(...result).pipe(mergeMap((value) => value));
|
|
1206
1214
|
}
|
|
1207
1215
|
delete(opt) {
|
|
1208
1216
|
this.checkOptRequest(opt);
|
|
1209
|
-
if (typeof
|
|
1217
|
+
if (typeof console !== 'undefined' && this.debug) {
|
|
1210
1218
|
console.log('%c BaseCrudService.delete()', 'color: #777777');
|
|
1211
1219
|
console.log('%c Extended from: ' + this.constructor.name, 'color: #777777');
|
|
1212
1220
|
}
|
|
@@ -1216,15 +1224,16 @@ class BaseCrudService {
|
|
|
1216
1224
|
}
|
|
1217
1225
|
deleteMany(opt) {
|
|
1218
1226
|
this.checkOptRequest(opt);
|
|
1219
|
-
const result = opt.mutationParams.map(mutationParams => {
|
|
1227
|
+
const result = opt.mutationParams.map((mutationParams) => {
|
|
1220
1228
|
const optB = { ...opt, mutationParams };
|
|
1221
1229
|
return this.delete(optB);
|
|
1222
1230
|
});
|
|
1223
|
-
return of(...result).pipe(mergeMap(value => value));
|
|
1231
|
+
return of(...result).pipe(mergeMap((value) => value));
|
|
1224
1232
|
}
|
|
1233
|
+
getId = (value) => value[this.id];
|
|
1225
1234
|
getUrl(path) {
|
|
1226
|
-
const result =
|
|
1227
|
-
if (typeof
|
|
1235
|
+
const result = path ? `${this.service}/${path.join('/')}` : this.service;
|
|
1236
|
+
if (typeof console !== 'undefined' && this.debug) {
|
|
1228
1237
|
console.log('%c BaseCrudService.getUrl(path?:string[]): string', 'color: #777777');
|
|
1229
1238
|
console.log('%c path: ' + path, 'color: #777777');
|
|
1230
1239
|
console.log('%c Extended from: ' + this.constructor.name, 'color: #777777');
|
|
@@ -1232,44 +1241,52 @@ class BaseCrudService {
|
|
|
1232
1241
|
}
|
|
1233
1242
|
return result;
|
|
1234
1243
|
}
|
|
1244
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: BaseCrudService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1245
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: BaseCrudService, providedIn: 'root' });
|
|
1235
1246
|
}
|
|
1236
|
-
|
|
1237
|
-
BaseCrudService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: BaseCrudService, providedIn: 'root' });
|
|
1238
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: BaseCrudService, decorators: [{
|
|
1247
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: BaseCrudService, decorators: [{
|
|
1239
1248
|
type: Injectable,
|
|
1240
1249
|
args: [{
|
|
1241
|
-
providedIn: 'root'
|
|
1250
|
+
providedIn: 'root',
|
|
1242
1251
|
}]
|
|
1243
|
-
}], ctorParameters:
|
|
1252
|
+
}], ctorParameters: () => [{ type: i1.HttpClient }] });
|
|
1244
1253
|
|
|
1245
1254
|
class BaseSingularCrudService extends BaseCrudService {
|
|
1246
1255
|
select(opt) {
|
|
1247
1256
|
console.log('BaseSingularCrudService.select()');
|
|
1248
|
-
if (typeof
|
|
1257
|
+
if (typeof console !== 'undefined' && this.debug) {
|
|
1249
1258
|
console.log('BaseCrudService.search()');
|
|
1250
1259
|
console.log('Extended from: ' + this.constructor.name);
|
|
1251
1260
|
}
|
|
1252
|
-
const url = opt &&
|
|
1261
|
+
const url = opt && Object.prototype.hasOwnProperty.call(opt, 'path') && !!opt.path
|
|
1262
|
+
? opt.path.join('/')
|
|
1263
|
+
: '';
|
|
1253
1264
|
let httpOptions = this.httpOptions();
|
|
1254
|
-
if (opt &&
|
|
1255
|
-
|
|
1265
|
+
if (opt &&
|
|
1266
|
+
Object.prototype.hasOwnProperty.call(opt, 'queryParams') &&
|
|
1267
|
+
!!opt.queryParams) {
|
|
1268
|
+
httpOptions = { ...httpOptions, ...{ params: opt.queryParams } };
|
|
1256
1269
|
}
|
|
1257
1270
|
console.log('httpOptions', httpOptions);
|
|
1258
1271
|
console.log('url', url);
|
|
1259
1272
|
console.log('this.getUrl()', this.getUrl());
|
|
1260
|
-
return this.http
|
|
1273
|
+
return this.http
|
|
1274
|
+
.get(this.getUrl() + url, httpOptions)
|
|
1275
|
+
.pipe(map(this.searchMap));
|
|
1261
1276
|
}
|
|
1277
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: BaseSingularCrudService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1278
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: BaseSingularCrudService, providedIn: 'root' });
|
|
1262
1279
|
}
|
|
1263
|
-
|
|
1264
|
-
BaseSingularCrudService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: BaseSingularCrudService, providedIn: 'root' });
|
|
1265
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: BaseSingularCrudService, decorators: [{
|
|
1280
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: BaseSingularCrudService, decorators: [{
|
|
1266
1281
|
type: Injectable,
|
|
1267
1282
|
args: [{
|
|
1268
|
-
providedIn: 'root'
|
|
1283
|
+
providedIn: 'root',
|
|
1269
1284
|
}]
|
|
1270
1285
|
}] });
|
|
1271
1286
|
|
|
1272
1287
|
class BaseCrudGqlService {
|
|
1288
|
+
service;
|
|
1289
|
+
apollo;
|
|
1273
1290
|
search(value) {
|
|
1274
1291
|
return this.query(value);
|
|
1275
1292
|
}
|
|
@@ -1297,45 +1314,41 @@ class BaseCrudGqlService {
|
|
|
1297
1314
|
//todo tolgo tipizzazione MutationOptions mutateMany(opt: OptRequest<MutationOptions>): Observable<Response<string[]>> {
|
|
1298
1315
|
mutateMany(opt) {
|
|
1299
1316
|
return this.apollo.mutate(opt.mutationParams).pipe(map((response) => {
|
|
1300
|
-
|
|
1301
|
-
return ({
|
|
1317
|
+
return {
|
|
1302
1318
|
message: '',
|
|
1303
1319
|
hasError: false,
|
|
1304
|
-
data: response.data.allCoins
|
|
1305
|
-
}
|
|
1320
|
+
data: response.data.allCoins,
|
|
1321
|
+
};
|
|
1306
1322
|
}));
|
|
1307
1323
|
}
|
|
1308
1324
|
//todo tolgo tipizzazione MutationOptions mutate(opt: OptRequest<MutationOptions>): Observable<Response<string[]>> {
|
|
1309
1325
|
mutate(opt) {
|
|
1310
1326
|
return this.apollo.mutate(opt.mutationParams).pipe(map((response) => {
|
|
1311
|
-
|
|
1312
|
-
return ({
|
|
1327
|
+
return {
|
|
1313
1328
|
message: '',
|
|
1314
1329
|
hasError: false,
|
|
1315
|
-
data: response.data.allCoins
|
|
1316
|
-
}
|
|
1330
|
+
data: response.data.allCoins,
|
|
1331
|
+
};
|
|
1317
1332
|
}));
|
|
1318
1333
|
}
|
|
1319
1334
|
//todo tolgo tipizzazione QueryOptions query(value?: ICriteria<QueryOptions>): Observable<Response<T[]>> {
|
|
1320
1335
|
query(value) {
|
|
1321
1336
|
console.log('CoinService.search()');
|
|
1322
|
-
return this.apollo
|
|
1323
|
-
|
|
1324
|
-
debugger;
|
|
1325
|
-
return ({
|
|
1337
|
+
return this.apollo.query(value.queryParams).pipe(map((response) => {
|
|
1338
|
+
return {
|
|
1326
1339
|
message: '',
|
|
1327
1340
|
hasError: false,
|
|
1328
|
-
data: response.data.allCoins
|
|
1329
|
-
}
|
|
1341
|
+
data: response.data.allCoins,
|
|
1342
|
+
};
|
|
1330
1343
|
}));
|
|
1331
1344
|
}
|
|
1345
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: BaseCrudGqlService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1346
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: BaseCrudGqlService, providedIn: 'root' });
|
|
1332
1347
|
}
|
|
1333
|
-
|
|
1334
|
-
BaseCrudGqlService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: BaseCrudGqlService, providedIn: 'root' });
|
|
1335
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: BaseCrudGqlService, decorators: [{
|
|
1348
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: BaseCrudGqlService, decorators: [{
|
|
1336
1349
|
type: Injectable,
|
|
1337
1350
|
args: [{
|
|
1338
|
-
providedIn: 'root'
|
|
1351
|
+
providedIn: 'root',
|
|
1339
1352
|
}]
|
|
1340
1353
|
}] });
|
|
1341
1354
|
|