@yusr_systems/core 2.2.9 → 2.2.10
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/yusr-core.js +26 -149
- package/package.json +1 -1
package/dist/yusr-core.js
CHANGED
|
@@ -126,130 +126,7 @@ var n = class {
|
|
|
126
126
|
Unchanged: 0,
|
|
127
127
|
New: 1,
|
|
128
128
|
Delete: 2
|
|
129
|
-
}, g = class {
|
|
130
|
-
static LoggedInUserStorageItemName = "LoggedInUser";
|
|
131
|
-
static AuthCheckStorageItemName = "IsLoggedIn";
|
|
132
|
-
static SettingStorageItemName = "Setting";
|
|
133
|
-
static UnauthorizedEventName = "ApiUnauthorized";
|
|
134
|
-
}, _ = class {
|
|
135
|
-
id;
|
|
136
|
-
}, v = class {
|
|
137
|
-
static _baseUrl = "";
|
|
138
|
-
static get baseUrl() {
|
|
139
|
-
return this._baseUrl || console.warn("YusrCore: baseUrl has not been initialized. Defaults to empty string."), this._baseUrl;
|
|
140
|
-
}
|
|
141
|
-
static initialize(e) {
|
|
142
|
-
this._baseUrl = e;
|
|
143
|
-
}
|
|
144
|
-
}, y = class e {
|
|
145
|
-
static async Get(t, n) {
|
|
146
|
-
let r = await fetch(t, {
|
|
147
|
-
method: "GET",
|
|
148
|
-
credentials: "include",
|
|
149
|
-
...n
|
|
150
|
-
});
|
|
151
|
-
return e.handleResponse(r);
|
|
152
|
-
}
|
|
153
|
-
static async Post(t, n, r, i) {
|
|
154
|
-
let a = n instanceof FormData, o = {
|
|
155
|
-
...r?.headers || {},
|
|
156
|
-
...!a && n ? { "Content-Type": "application/json" } : {}
|
|
157
|
-
}, s = await fetch(t, {
|
|
158
|
-
method: "POST",
|
|
159
|
-
credentials: "include",
|
|
160
|
-
headers: o,
|
|
161
|
-
body: a ? n : JSON.stringify(n),
|
|
162
|
-
...r
|
|
163
|
-
});
|
|
164
|
-
return e.handleResponse(s, i);
|
|
165
|
-
}
|
|
166
|
-
static async Put(t, n, r, i) {
|
|
167
|
-
let a = n instanceof FormData, o = {
|
|
168
|
-
...r?.headers || {},
|
|
169
|
-
...!a && n ? { "Content-Type": "application/json" } : {}
|
|
170
|
-
}, s = await fetch(t, {
|
|
171
|
-
method: "PUT",
|
|
172
|
-
credentials: "include",
|
|
173
|
-
headers: o,
|
|
174
|
-
body: a ? n : JSON.stringify(n),
|
|
175
|
-
...r
|
|
176
|
-
});
|
|
177
|
-
return e.handleResponse(s, i);
|
|
178
|
-
}
|
|
179
|
-
static async Delete(t, n, r) {
|
|
180
|
-
let i = await fetch(t, {
|
|
181
|
-
method: "DELETE",
|
|
182
|
-
credentials: "include",
|
|
183
|
-
...n
|
|
184
|
-
});
|
|
185
|
-
return e.handleResponse(i, r);
|
|
186
|
-
}
|
|
187
|
-
static async PostBlob(e, n, r) {
|
|
188
|
-
let i = n instanceof FormData, a = {
|
|
189
|
-
...r?.headers || {},
|
|
190
|
-
...!i && n ? { "Content-Type": "application/json" } : {}
|
|
191
|
-
}, o = await fetch(e, {
|
|
192
|
-
method: "POST",
|
|
193
|
-
credentials: "include",
|
|
194
|
-
headers: a,
|
|
195
|
-
body: i ? n : JSON.stringify(n),
|
|
196
|
-
...r
|
|
197
|
-
});
|
|
198
|
-
if (!o.ok) {
|
|
199
|
-
let e = await o.json();
|
|
200
|
-
t.error(e.title || "حدث خطأ أثناء تحميل التقرير", { description: e.detail || "يرجى المحاولة مرة أخرى لاحقاً" });
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
return await o.blob();
|
|
204
|
-
}
|
|
205
|
-
static async handleResponse(e, n) {
|
|
206
|
-
if (e.status === 401) return window.dispatchEvent(new Event(g.UnauthorizedEventName)), t.error("انتهت صلاحية الدخول", { description: "سجل الدخول مجددًا." }), {
|
|
207
|
-
data: void 0,
|
|
208
|
-
status: 401,
|
|
209
|
-
errorTitle: "Unauthorized",
|
|
210
|
-
errorDetails: "Session expired"
|
|
211
|
-
};
|
|
212
|
-
if (e.status === 404) return t.error("لم يتم العثور على طلبك"), {
|
|
213
|
-
data: void 0,
|
|
214
|
-
status: 404,
|
|
215
|
-
errorTitle: "Not Found",
|
|
216
|
-
errorDetails: ""
|
|
217
|
-
};
|
|
218
|
-
if (!e.ok) {
|
|
219
|
-
let n = await e.json();
|
|
220
|
-
return t.error(n.title || "An error occurred", { description: n.detail }), {
|
|
221
|
-
data: void 0,
|
|
222
|
-
status: e.status,
|
|
223
|
-
errorTitle: n.title,
|
|
224
|
-
errorDetails: n.detail
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
let r = await e.json();
|
|
228
|
-
return n && t.success(n), {
|
|
229
|
-
data: r,
|
|
230
|
-
status: e.status,
|
|
231
|
-
errorTitle: "",
|
|
232
|
-
errorDetails: ""
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
}, b = class {
|
|
236
|
-
async Filter(e, t, n) {
|
|
237
|
-
return await y.Post(`${v.baseUrl}/${this.routeName}/Filter?pageNumber=${e}&rowsPerPage=${t}`, n);
|
|
238
|
-
}
|
|
239
|
-
}, x = class extends b {
|
|
240
|
-
async Get(e) {
|
|
241
|
-
return await y.Get(`${v.baseUrl}/${this.routeName}/${e}`);
|
|
242
|
-
}
|
|
243
|
-
async Add(e) {
|
|
244
|
-
return await y.Post(`${v.baseUrl}/${this.routeName}/Add`, e, void 0, "تم حفظ البيانات بنجاح");
|
|
245
|
-
}
|
|
246
|
-
async Update(e) {
|
|
247
|
-
return await y.Put(`${v.baseUrl}/${this.routeName}/Update`, e, void 0, "تم تحديث المعلومات بنجاح");
|
|
248
|
-
}
|
|
249
|
-
async Delete(e) {
|
|
250
|
-
return await y.Delete(`${v.baseUrl}/${this.routeName}/${e}`, void 0, "تمت إزالة السجل بنجاح");
|
|
251
|
-
}
|
|
252
|
-
}, S = class extends _ {
|
|
129
|
+
}, g = class extends o {
|
|
253
130
|
name;
|
|
254
131
|
cityId;
|
|
255
132
|
cityName;
|
|
@@ -260,7 +137,7 @@ var n = class {
|
|
|
260
137
|
constructor(e) {
|
|
261
138
|
super(), Object.assign(this, e);
|
|
262
139
|
}
|
|
263
|
-
},
|
|
140
|
+
}, _ = class {
|
|
264
141
|
static columnsNames = [{
|
|
265
142
|
label: "اسم الفرع",
|
|
266
143
|
value: "Name"
|
|
@@ -268,18 +145,18 @@ var n = class {
|
|
|
268
145
|
label: "رقم الفرع",
|
|
269
146
|
value: "Id"
|
|
270
147
|
}];
|
|
271
|
-
},
|
|
148
|
+
}, v = class extends o {
|
|
272
149
|
name;
|
|
273
150
|
permissions;
|
|
274
151
|
constructor(e) {
|
|
275
152
|
super(), Object.assign(this, e);
|
|
276
153
|
}
|
|
277
|
-
},
|
|
154
|
+
}, y = class {
|
|
278
155
|
static columnsNames = [{
|
|
279
156
|
label: "اسم الدور",
|
|
280
157
|
value: "Name"
|
|
281
158
|
}];
|
|
282
|
-
},
|
|
159
|
+
}, b = class extends o {
|
|
283
160
|
username;
|
|
284
161
|
password;
|
|
285
162
|
isActive;
|
|
@@ -290,7 +167,7 @@ var n = class {
|
|
|
290
167
|
constructor(e) {
|
|
291
168
|
super(), Object.assign(this, e);
|
|
292
169
|
}
|
|
293
|
-
},
|
|
170
|
+
}, x = class {
|
|
294
171
|
static columnsNames = [{
|
|
295
172
|
label: "رقم المستخدم",
|
|
296
173
|
value: "Id"
|
|
@@ -298,7 +175,7 @@ var n = class {
|
|
|
298
175
|
label: "اسم المستخدم",
|
|
299
176
|
value: "Username"
|
|
300
177
|
}];
|
|
301
|
-
},
|
|
178
|
+
}, S = class {
|
|
302
179
|
static _baseUrl = "";
|
|
303
180
|
static get baseUrl() {
|
|
304
181
|
return this._baseUrl || console.warn("YusrCore: baseUrl has not been initialized. Defaults to empty string."), this._baseUrl;
|
|
@@ -306,7 +183,7 @@ var n = class {
|
|
|
306
183
|
static initialize(e) {
|
|
307
184
|
this._baseUrl = e;
|
|
308
185
|
}
|
|
309
|
-
},
|
|
186
|
+
}, C = class e {
|
|
310
187
|
static async Get(t, n) {
|
|
311
188
|
let r = await fetch(t, {
|
|
312
189
|
method: "GET",
|
|
@@ -397,45 +274,45 @@ var n = class {
|
|
|
397
274
|
errorDetails: ""
|
|
398
275
|
};
|
|
399
276
|
}
|
|
400
|
-
},
|
|
277
|
+
}, w = class {
|
|
401
278
|
async Filter(e, t, n) {
|
|
402
|
-
return await
|
|
279
|
+
return await C.Post(`${S.baseUrl}/${this.routeName}/Filter?pageNumber=${e}&rowsPerPage=${t}`, n);
|
|
403
280
|
}
|
|
404
|
-
},
|
|
281
|
+
}, T = class extends w {
|
|
405
282
|
async Get(e) {
|
|
406
|
-
return await
|
|
283
|
+
return await C.Get(`${S.baseUrl}/${this.routeName}/${e}`);
|
|
407
284
|
}
|
|
408
285
|
async Add(e) {
|
|
409
|
-
return await
|
|
286
|
+
return await C.Post(`${S.baseUrl}/${this.routeName}/Add`, e, void 0, "تم حفظ البيانات بنجاح");
|
|
410
287
|
}
|
|
411
288
|
async Update(e) {
|
|
412
|
-
return await
|
|
289
|
+
return await C.Put(`${S.baseUrl}/${this.routeName}/Update`, e, void 0, "تم تحديث المعلومات بنجاح");
|
|
413
290
|
}
|
|
414
291
|
async Delete(e) {
|
|
415
|
-
return await
|
|
292
|
+
return await C.Delete(`${S.baseUrl}/${this.routeName}/${e}`, void 0, "تمت إزالة السجل بنجاح");
|
|
416
293
|
}
|
|
417
|
-
},
|
|
294
|
+
}, E = class extends T {
|
|
418
295
|
routeName = "Branches";
|
|
419
|
-
},
|
|
296
|
+
}, D = class extends w {
|
|
420
297
|
routeName = "Cities";
|
|
421
298
|
async Filter(e, t, n) {
|
|
422
|
-
return await
|
|
299
|
+
return await C.Post(`${S.baseUrl}/${this.routeName}/Filter?pageNumber=${e}&rowsPerPage=${t}`, n);
|
|
423
300
|
}
|
|
424
|
-
},
|
|
301
|
+
}, O = class extends w {
|
|
425
302
|
routeName = "Countries";
|
|
426
303
|
async Filter(e, t, n) {
|
|
427
|
-
return await
|
|
304
|
+
return await C.Post(`${S.baseUrl}/${this.routeName}/Filter?pageNumber=${e}&rowsPerPage=${t}`, n);
|
|
428
305
|
}
|
|
429
|
-
},
|
|
306
|
+
}, k = class extends w {
|
|
430
307
|
routeName = "Currencies";
|
|
431
308
|
async Filter(e, t, n) {
|
|
432
|
-
return await
|
|
309
|
+
return await C.Post(`${S.baseUrl}/${this.routeName}/Filter?pageNumber=${e}&rowsPerPage=${t}`, n);
|
|
433
310
|
}
|
|
434
|
-
},
|
|
311
|
+
}, A = class extends T {
|
|
435
312
|
routeName = "Roles";
|
|
436
|
-
},
|
|
313
|
+
}, j = class extends T {
|
|
437
314
|
routeName = "Users";
|
|
438
|
-
},
|
|
315
|
+
}, M = class {
|
|
439
316
|
static required(e = "هذا الحقل مطلوب") {
|
|
440
317
|
return (t) => t == null || t === "" || typeof t == "string" && t.trim() === "" ? e : null;
|
|
441
318
|
}
|
|
@@ -453,4 +330,4 @@ var n = class {
|
|
|
453
330
|
}
|
|
454
331
|
};
|
|
455
332
|
//#endregion
|
|
456
|
-
export {
|
|
333
|
+
export { S as ApiConstants, n as AuthConstants, T as BaseApiService, o as BaseEntity, w as BaseFilterableApiService, g as Branch, _ as BranchFilterColumns, E as BranchesApiService, D as CitiesApiService, s as City, c as CityFilterColumns, O as CountriesApiService, l as Country, u as CountryFilterColumns, k as CurrenciesApiService, d as Currency, f as FilterCondition, p as LoginRequest, v as Role, y as RoleFilterColumns, A as RolesApiService, m as StorageFile, h as StorageFileStatus, a as SystemPermissions, b as User, x as UserFilterColumns, j as UsersApiService, M as Validators, C as YusrApiHelper, i as createAuthSlice };
|