@abcagency/hire-control-sdk 1.0.12 → 1.0.14
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/controllers/appendListingsController.ts +46 -0
- package/dist/controllers/appendListingsController.d.ts +10 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +16 -1
- package/dist/types/AppendListing.d.ts +41 -0
- package/index.ts +12 -0
- package/package.json +1 -1
- package/types/appendListing.ts +43 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import FetchHandler from "../handlers/fetchHandler";
|
|
2
|
+
import { API_URL } from "../constants/config";
|
|
3
|
+
import AppendListingDto from "../types/appendListing";
|
|
4
|
+
|
|
5
|
+
const fetchHandler = new FetchHandler(API_URL);
|
|
6
|
+
|
|
7
|
+
class AppendListingsController {
|
|
8
|
+
async getAppendListings(authToken: string | null = null): Promise<AppendListingDto[]> {
|
|
9
|
+
return fetchHandler.get<AppendListingDto[]>("/appendListings", true, authToken);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async getAppendListing(id: string, authToken: string | null = null): Promise<AppendListingDto> {
|
|
13
|
+
return fetchHandler.get<AppendListingDto>(`/appendListings/${id}`, true, authToken);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async createAppendListing(
|
|
17
|
+
appendListingDto: AppendListingDto,
|
|
18
|
+
authToken: string | null = null
|
|
19
|
+
): Promise<AppendListingDto> {
|
|
20
|
+
return fetchHandler.post<AppendListingDto, AppendListingDto>(
|
|
21
|
+
"/appendListings",
|
|
22
|
+
appendListingDto,
|
|
23
|
+
true,
|
|
24
|
+
authToken
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async updateAppendListing(
|
|
29
|
+
id: string,
|
|
30
|
+
appendListingDto: AppendListingDto,
|
|
31
|
+
authToken: string | null = null
|
|
32
|
+
): Promise<void> {
|
|
33
|
+
return fetchHandler.put<AppendListingDto, void>(
|
|
34
|
+
`/appendListings/${id}`,
|
|
35
|
+
appendListingDto,
|
|
36
|
+
true,
|
|
37
|
+
authToken
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async deleteAppendListing(id: string, authToken: string | null = null): Promise<void> {
|
|
42
|
+
return fetchHandler.delete(`/appendListings/${id}`, true, authToken);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default new AppendListingsController();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import AppendListingDto from "../types/appendListing";
|
|
2
|
+
declare class AppendListingsController {
|
|
3
|
+
getAppendListings(authToken?: string | null): Promise<AppendListingDto[]>;
|
|
4
|
+
getAppendListing(id: string, authToken?: string | null): Promise<AppendListingDto>;
|
|
5
|
+
createAppendListing(appendListingDto: AppendListingDto, authToken?: string | null): Promise<AppendListingDto>;
|
|
6
|
+
updateAppendListing(id: string, appendListingDto: AppendListingDto, authToken?: string | null): Promise<void>;
|
|
7
|
+
deleteAppendListing(id: string, authToken?: string | null): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: AppendListingsController;
|
|
10
|
+
export default _default;
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib");class e{constructor(t){this.apiUrl=t}get(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,r=null){const n={method:"GET",credentials:"include"};return e?this.fetchWithAuth(t,n,r):this.fetchWithoutAuth(t,n)}))}post(e,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,r=!1,n=null,i=!1){const o={method:"POST",credentials:"include"};return i?o.body=this.convertToFormData(e):(o.headers={"Content-Type":"application/json"},o.body=JSON.stringify(e)),r?this.fetchWithAuth(t,o,n):this.fetchWithoutAuth(t,o)}))}put(e,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,r=!1,n=null,i=!1){const o={method:"PUT",credentials:"include"};return i?o.body=this.convertToFormData(e):(o.headers={"Content-Type":"application/json"},o.body=JSON.stringify(e)),r?this.fetchWithAuth(t,o,n):this.fetchWithoutAuth(t,o)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,r=null){const n={method:"DELETE",credentials:"include"};return e?this.fetchWithAuth(t,n,r):this.fetchWithoutAuth(t,n)}))}convertToFormData(t,e=new FormData,r=""){return t instanceof File||"string"==typeof t||"number"==typeof t||"boolean"==typeof t?e.append(r,t):t instanceof Array?t.forEach(((t,n)=>{this.convertToFormData(t,e,`${r}[${n}]`)})):t instanceof Object&&Object.keys(t).forEach((n=>{const i=t[n],o=r?`${r}[${n}]`:n;this.convertToFormData(i,e,o)})),e}fetchWithoutAuth(e,r){return t.__awaiter(this,void 0,void 0,(function*(){const t=yield fetch(`${this.apiUrl}${e}`,r);return this.handleResponse(t)}))}fetchWithAuth(e,r,n){return t.__awaiter(this,void 0,void 0,(function*(){n&&(r.headers=Object.assign(Object.assign({},r.headers),{Authorization:`Bearer ${n}`}));let t=yield fetch(`${this.apiUrl}${e}`,r);if(401===t.status){if(!(yield this.refreshToken()))throw new Error("Token refresh failed");t=yield fetch(`${this.apiUrl}${e}`,r)}return this.handleResponse(t)}))}handleResponse(e){return t.__awaiter(this,void 0,void 0,(function*(){if(!e.ok||!e.status.toString().startsWith("2")){let t=`Error: ${e.status} ${e.statusText}`;try{const r=yield e.json();console.log(r),r&&r.message&&(t=r.message)}catch(t){console.error("Failed to parse error response:",t)}throw{statusCode:e.status,errorMessage:t}}return 200===e.status?e.json():null}))}refreshToken(){return t.__awaiter(this,void 0,void 0,(function*(){return!!(yield fetch(`${this.apiUrl}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"})).ok||(console.error("Failed to refresh token"),!1)}))}}const r="https://api.myhirecontrol.com",n=new e(r);var i=new class{login(e){return t.__awaiter(this,void 0,void 0,(function*(){return n.post("/auth/login",e,!1)}))}nextLogin(e){return t.__awaiter(this,void 0,void 0,(function*(){return yield n.post("/auth/nextLogin",e,!1)}))}refreshToken(e){return t.__awaiter(this,void 0,void 0,(function*(){const t=yield n.post("/auth/refresh",e,!1);return t&&(sessionStorage.setItem("token",t.token),sessionStorage.setItem("refreshToken",t.refreshToken),sessionStorage.setItem("expiration",t.expiration)),t}))}changeCompany(e){return t.__awaiter(this,void 0,void 0,(function*(){return n.post("/auth/changeCompany",e,!0)}))}register(e){return t.__awaiter(this,void 0,void 0,(function*(){return n.post("/auth/register",e,!1)}))}getCompanies(){return t.__awaiter(this,void 0,void 0,(function*(){return n.get("/auth/companies",!0)}))}getCompany(){return t.__awaiter(this,void 0,void 0,(function*(){return n.get("/auth/company",!0)}))}getRoles(){return t.__awaiter(this,void 0,void 0,(function*(){return n.get("/auth/roles",!0)}))}isAuthenticated(){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield n.get("/auth/authenticated",!0)}catch(t){return!1}}))}getUser(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield n.get("/auth/user",!0,t)}catch(t){throw t}}))}logout(){return t.__awaiter(this,void 0,void 0,(function*(){try{const t=yield n.post("/auth/logout",{},!0);return sessionStorage.removeItem("token"),sessionStorage.removeItem("refreshToken"),sessionStorage.removeItem("expiration"),t}catch(t){throw t}}))}getPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield n.get("/auth/permissions",!0,t)}catch(t){throw t}}))}};const o=new e(r);var s=new class{getEvents(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return o.get("/events",!0,t)}))}getEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.get(`/events/${t}`,!0,e)}))}createEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.post("/events",t,!0,e)}))}updateEvent(e,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,r=null){return o.put(`/events/${t}`,e,!0,r)}))}deleteEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.delete(`/events/${t}`,!0,e)}))}};const a=new e(r);var u=new class{getAllRolesWithClaims(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return a.get("/roles",!0,t)}))}addRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return a.post("/roles",t,!0,e)}))}updateRole(e,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,r=null){return a.put(`/roles/${t}`,e,!0,r)}))}deleteRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return a.delete(`/roles/${t}`,!0,e)}))}};const l=new e(r);var h=new class{getAllUsers(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield l.get("/users",!0,t)}catch(t){throw t}}))}getUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield l.get(`/users/${t}`,!0,e)}catch(t){throw t}}))}createUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield l.post("/users",t,!0,e)}catch(t){throw t}}))}updateUser(e,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,r=null){try{yield l.put(`/users/${t}`,e,!0,r)}catch(t){throw t}}))}updateLoggedInUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield l.put("/users",t,!0,e)}catch(t){throw t}}))}deleteUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield l.delete(`/users/${t}`,!0,e)}catch(t){throw t}}))}};const c=new e(r);var d=new class{forgotPassword(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield c.post("/account/forgotPassword",e,!1)}catch(t){throw t}}))}resetPasswordWithToken(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield c.post("/account/resetPasswordWithToken",e,!1)}catch(t){throw t}}))}resetPassword(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield c.post("/account/resetPassword",t,!0,e)}catch(t){throw t}}))}};const g=new e(r);var f=new class{getMapConfig(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield g.get("/mapconfig",!0,t)}catch(t){throw t}}))}updateMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return g.put("/mapconfig",t,!0,e)}))}createMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return g.post("/mapconfig",t,!0,e)}))}};const p=new e(r);var _=new class{getAllPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return p.get("/permissions",!0,t)}))}};const w=new e(r);var v=new class{getClientAuthConfigById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield w.get(`/clientAuthConfig/${t}`,!0,e)}catch(t){throw t}}))}getAllClientAuthConfigs(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield w.get("/clientAuthConfig",!0,t)}catch(t){throw t}}))}createClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return w.post("/clientAuthConfig",t,!0,e)}))}updateClientAuthConfig(e,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,r=null){return w.put(`/clientAuthConfig/${t}`,e,!0,r)}))}deleteClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return w.delete(`/clientAuthConfig/${t}`,!0,e)}))}};const y=new e(r);var m=new class{getListings(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield y.get("/listings",!0,t)}catch(t){throw t}}))}getListingDetails(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield y.get(`/listings/${t}`,!0,e)}catch(t){throw t}}))}};const C=new e(r);var A=new class{uploadMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return C.post("/media/upload",t,!0,e,!0)}))}listMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){const r=new URLSearchParams({folderKey:t});return C.get(`/media/list?${r.toString()}`,!0,e)}))}deleteMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){const r=new URLSearchParams({key:t});return C.delete(`/media/delete?${r.toString()}`,!0,e)}))}};const $=new e(r);var T=new class{getFilters(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return $.get("/filters",!0,t)}))}getFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return $.get(`/filters/${t}`,!0,e)}))}createFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return $.post("/filters",t,!0,e)}))}updateFilter(e,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,r=null){return $.put(`/filters/${t}`,e,!0,r)}))}deleteFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return $.delete(`/filters/${t}`,!0,e)}))}};const P={login:i.login,nextLogin:i.nextLogin,refreshToken:i.refreshToken,changeCompany:i.changeCompany,register:i.register,isAuthenticated:i.isAuthenticated,getCompany:i.getCompany,getCompanies:i.getCompanies,getRoles:i.getRoles,getPermissions:i.getPermissions,logout:i.logout,getUser:i.getUser},k={getAll:s.getEvents,get:s.getEvent,create:s.createEvent,update:s.updateEvent,delete:s.deleteEvent},x={get:u.getAllRolesWithClaims,create:u.addRole,update:u.updateRole,delete:u.deleteRole},F=h,E=m,U={resetPassword:d.resetPassword,resetPasswordWithToken:d.resetPasswordWithToken,forgotPassword:d.forgotPassword},W={get:f.getMapConfig,update:f.updateMapConfig,create:f.createMapConfig},R={get:v.getClientAuthConfigById,getAll:v.getAllClientAuthConfigs,update:v.updateClientAuthConfig,create:v.createClientAuthConfig,delete:v.deleteClientAuthConfig},S={upload:A.uploadMedia,get:A.listMedia,delete:A.deleteMedia},M={getList:T.getFilters,get:T.getFilter,update:T.updateFilter,create:T.createFilter,delete:T.deleteFilter},b={get:_.getAllPermissions},L={auth:P,events:k,roles:x,users:F,account:U,mapConfig:W,permissions:b,clientAuthConfig:R,filters:M,listings:E,media:S};exports.account=U,exports.auth=P,exports.clientAuthConfig=R,exports.default=L,exports.events=k,exports.filters=M,exports.listings=E,exports.mapConfig=W,exports.media=S,exports.permissions=b,exports.roles=x,exports.users=F;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib");class e{constructor(t){this.apiUrl=t}get(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,r=null){const n={method:"GET",credentials:"include"};return e?this.fetchWithAuth(t,n,r):this.fetchWithoutAuth(t,n)}))}post(e,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,r=!1,n=null,i=!1){const o={method:"POST",credentials:"include"};return i?o.body=this.convertToFormData(e):(o.headers={"Content-Type":"application/json"},o.body=JSON.stringify(e)),r?this.fetchWithAuth(t,o,n):this.fetchWithoutAuth(t,o)}))}put(e,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,r=!1,n=null,i=!1){const o={method:"PUT",credentials:"include"};return i?o.body=this.convertToFormData(e):(o.headers={"Content-Type":"application/json"},o.body=JSON.stringify(e)),r?this.fetchWithAuth(t,o,n):this.fetchWithoutAuth(t,o)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,r=null){const n={method:"DELETE",credentials:"include"};return e?this.fetchWithAuth(t,n,r):this.fetchWithoutAuth(t,n)}))}convertToFormData(t,e=new FormData,r=""){return t instanceof File||"string"==typeof t||"number"==typeof t||"boolean"==typeof t?e.append(r,t):t instanceof Array?t.forEach(((t,n)=>{this.convertToFormData(t,e,`${r}[${n}]`)})):t instanceof Object&&Object.keys(t).forEach((n=>{const i=t[n],o=r?`${r}[${n}]`:n;this.convertToFormData(i,e,o)})),e}fetchWithoutAuth(e,r){return t.__awaiter(this,void 0,void 0,(function*(){const t=yield fetch(`${this.apiUrl}${e}`,r);return this.handleResponse(t)}))}fetchWithAuth(e,r,n){return t.__awaiter(this,void 0,void 0,(function*(){n&&(r.headers=Object.assign(Object.assign({},r.headers),{Authorization:`Bearer ${n}`}));let t=yield fetch(`${this.apiUrl}${e}`,r);if(401===t.status){if(!(yield this.refreshToken()))throw new Error("Token refresh failed");t=yield fetch(`${this.apiUrl}${e}`,r)}return this.handleResponse(t)}))}handleResponse(e){return t.__awaiter(this,void 0,void 0,(function*(){if(!e.ok||!e.status.toString().startsWith("2")){let t=`Error: ${e.status} ${e.statusText}`;try{const r=yield e.json();console.log(r),r&&r.message&&(t=r.message)}catch(t){console.error("Failed to parse error response:",t)}throw{statusCode:e.status,errorMessage:t}}return 200===e.status?e.json():null}))}refreshToken(){return t.__awaiter(this,void 0,void 0,(function*(){return!!(yield fetch(`${this.apiUrl}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"})).ok||(console.error("Failed to refresh token"),!1)}))}}const r="https://api.myhirecontrol.com",n=new e(r);var i=new class{login(e){return t.__awaiter(this,void 0,void 0,(function*(){return n.post("/auth/login",e,!1)}))}nextLogin(e){return t.__awaiter(this,void 0,void 0,(function*(){return yield n.post("/auth/nextLogin",e,!1)}))}refreshToken(e){return t.__awaiter(this,void 0,void 0,(function*(){const t=yield n.post("/auth/refresh",e,!1);return t&&(sessionStorage.setItem("token",t.token),sessionStorage.setItem("refreshToken",t.refreshToken),sessionStorage.setItem("expiration",t.expiration)),t}))}changeCompany(e){return t.__awaiter(this,void 0,void 0,(function*(){return n.post("/auth/changeCompany",e,!0)}))}register(e){return t.__awaiter(this,void 0,void 0,(function*(){return n.post("/auth/register",e,!1)}))}getCompanies(){return t.__awaiter(this,void 0,void 0,(function*(){return n.get("/auth/companies",!0)}))}getCompany(){return t.__awaiter(this,void 0,void 0,(function*(){return n.get("/auth/company",!0)}))}getRoles(){return t.__awaiter(this,void 0,void 0,(function*(){return n.get("/auth/roles",!0)}))}isAuthenticated(){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield n.get("/auth/authenticated",!0)}catch(t){return!1}}))}getUser(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield n.get("/auth/user",!0,t)}catch(t){throw t}}))}logout(){return t.__awaiter(this,void 0,void 0,(function*(){try{const t=yield n.post("/auth/logout",{},!0);return sessionStorage.removeItem("token"),sessionStorage.removeItem("refreshToken"),sessionStorage.removeItem("expiration"),t}catch(t){throw t}}))}getPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield n.get("/auth/permissions",!0,t)}catch(t){throw t}}))}};const o=new e(r);var s=new class{getEvents(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return o.get("/events",!0,t)}))}getEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.get(`/events/${t}`,!0,e)}))}createEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.post("/events",t,!0,e)}))}updateEvent(e,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,r=null){return o.put(`/events/${t}`,e,!0,r)}))}deleteEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.delete(`/events/${t}`,!0,e)}))}};const a=new e(r);var u=new class{getAllRolesWithClaims(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return a.get("/roles",!0,t)}))}addRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return a.post("/roles",t,!0,e)}))}updateRole(e,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,r=null){return a.put(`/roles/${t}`,e,!0,r)}))}deleteRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return a.delete(`/roles/${t}`,!0,e)}))}};const l=new e(r);var d=new class{getAllUsers(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield l.get("/users",!0,t)}catch(t){throw t}}))}getUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield l.get(`/users/${t}`,!0,e)}catch(t){throw t}}))}createUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield l.post("/users",t,!0,e)}catch(t){throw t}}))}updateUser(e,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,r=null){try{yield l.put(`/users/${t}`,e,!0,r)}catch(t){throw t}}))}updateLoggedInUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield l.put("/users",t,!0,e)}catch(t){throw t}}))}deleteUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield l.delete(`/users/${t}`,!0,e)}catch(t){throw t}}))}};const c=new e(r);var h=new class{forgotPassword(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield c.post("/account/forgotPassword",e,!1)}catch(t){throw t}}))}resetPasswordWithToken(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield c.post("/account/resetPasswordWithToken",e,!1)}catch(t){throw t}}))}resetPassword(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield c.post("/account/resetPassword",t,!0,e)}catch(t){throw t}}))}};const g=new e(r);var p=new class{getMapConfig(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield g.get("/mapconfig",!0,t)}catch(t){throw t}}))}updateMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return g.put("/mapconfig",t,!0,e)}))}createMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return g.post("/mapconfig",t,!0,e)}))}};const f=new e(r);var _=new class{getAllPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return f.get("/permissions",!0,t)}))}};const w=new e(r);var v=new class{getClientAuthConfigById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield w.get(`/clientAuthConfig/${t}`,!0,e)}catch(t){throw t}}))}getAllClientAuthConfigs(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield w.get("/clientAuthConfig",!0,t)}catch(t){throw t}}))}createClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return w.post("/clientAuthConfig",t,!0,e)}))}updateClientAuthConfig(e,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,r=null){return w.put(`/clientAuthConfig/${t}`,e,!0,r)}))}deleteClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return w.delete(`/clientAuthConfig/${t}`,!0,e)}))}};const y=new e(r);var m=new class{getListings(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield y.get("/listings",!0,t)}catch(t){throw t}}))}getListingDetails(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield y.get(`/listings/${t}`,!0,e)}catch(t){throw t}}))}};const A=new e(r);var C=new class{uploadMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return A.post("/media/upload",t,!0,e,!0)}))}listMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){const r=new URLSearchParams({folderKey:t});return A.get(`/media/list?${r.toString()}`,!0,e)}))}deleteMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){const r=new URLSearchParams({key:t});return A.delete(`/media/delete?${r.toString()}`,!0,e)}))}};const $=new e(r);var L=new class{getFilters(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return $.get("/filters",!0,t)}))}getFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return $.get(`/filters/${t}`,!0,e)}))}createFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return $.post("/filters",t,!0,e)}))}updateFilter(e,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,r=null){return $.put(`/filters/${t}`,e,!0,r)}))}deleteFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return $.delete(`/filters/${t}`,!0,e)}))}};const T=new e(r);var P=new class{getAppendListings(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return T.get("/appendListings",!0,t)}))}getAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return T.get(`/appendListings/${t}`,!0,e)}))}createAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return T.post("/appendListings",t,!0,e)}))}updateAppendListing(e,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,r=null){return T.put(`/appendListings/${t}`,e,!0,r)}))}deleteAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return T.delete(`/appendListings/${t}`,!0,e)}))}};const x={login:i.login,nextLogin:i.nextLogin,refreshToken:i.refreshToken,changeCompany:i.changeCompany,register:i.register,isAuthenticated:i.isAuthenticated,getCompany:i.getCompany,getCompanies:i.getCompanies,getRoles:i.getRoles,getPermissions:i.getPermissions,logout:i.logout,getUser:i.getUser},k={getAll:s.getEvents,get:s.getEvent,create:s.createEvent,update:s.updateEvent,delete:s.deleteEvent},F={get:u.getAllRolesWithClaims,create:u.addRole,update:u.updateRole,delete:u.deleteRole},E=d,U=m,W={resetPassword:h.resetPassword,resetPasswordWithToken:h.resetPasswordWithToken,forgotPassword:h.forgotPassword},R={get:p.getMapConfig,update:p.updateMapConfig,create:p.createMapConfig},S={get:v.getClientAuthConfigById,getAll:v.getAllClientAuthConfigs,update:v.updateClientAuthConfig,create:v.createClientAuthConfig,delete:v.deleteClientAuthConfig},M={upload:C.uploadMedia,get:C.listMedia,delete:C.deleteMedia},b={getList:L.getFilters,get:L.getFilter,update:L.updateFilter,create:L.createFilter,delete:L.deleteFilter},j={get:P.getAppendListings,getAppendListing:P.getAppendListing,create:P.createAppendListing,update:P.updateAppendListing,delete:P.deleteAppendListing},I={get:_.getAllPermissions},O={auth:x,events:k,roles:F,users:E,account:W,mapConfig:R,permissions:I,clientAuthConfig:S,filters:b,listings:U,media:M,appendListings:j};exports.account=W,exports.appendListings=j,exports.auth=x,exports.clientAuthConfig=S,exports.default=O,exports.events=k,exports.filters=b,exports.listings=U,exports.mapConfig=R,exports.media=M,exports.permissions=I,exports.roles=F,exports.users=E;
|
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import MediaType from "./types/media/media";
|
|
|
10
10
|
import Event, { EventDates, EventDateType, EventInstance } from "./types/event";
|
|
11
11
|
import { Listing } from "./types/listing";
|
|
12
12
|
import Filters from "./types/filters/filters";
|
|
13
|
+
import AppendListing from "./types/appendListing";
|
|
13
14
|
export declare const auth: {
|
|
14
15
|
login: (clientLogInRequest: import("./types/clientLoginRequest").default) => Promise<any>;
|
|
15
16
|
nextLogin: (credentials: import("./types/credentials").default) => Promise<any>;
|
|
@@ -70,10 +71,17 @@ export declare const filters: {
|
|
|
70
71
|
create: (filtersDto: Filters, authToken?: string | null) => Promise<Filters>;
|
|
71
72
|
delete: (id: string, authToken?: string | null) => Promise<void>;
|
|
72
73
|
};
|
|
74
|
+
export declare const appendListings: {
|
|
75
|
+
get: (authToken?: string | null) => Promise<AppendListing[]>;
|
|
76
|
+
getAppendListing: (id: string, authToken?: string | null) => Promise<AppendListing>;
|
|
77
|
+
create: (appendListingDto: AppendListing, authToken?: string | null) => Promise<AppendListing>;
|
|
78
|
+
update: (id: string, appendListingDto: AppendListing, authToken?: string | null) => Promise<void>;
|
|
79
|
+
delete: (id: string, authToken?: string | null) => Promise<void>;
|
|
80
|
+
};
|
|
73
81
|
export declare const permissions: {
|
|
74
82
|
get: (authToken?: string | null) => Promise<string[]>;
|
|
75
83
|
};
|
|
76
|
-
export type { Register, User, Company, Role, HireControlConfig, ClientAuthConfig, Event, Listing, EventDates, EventDateType, EventInstance, MediaType, Filters, };
|
|
84
|
+
export type { Register, User, Company, Role, HireControlConfig, ClientAuthConfig, Event, Listing, EventDates, EventDateType, EventInstance, MediaType, Filters, AppendListing };
|
|
77
85
|
declare const hcApi: {
|
|
78
86
|
auth: {
|
|
79
87
|
login: (clientLogInRequest: import("./types/clientLoginRequest").default) => Promise<any>;
|
|
@@ -138,5 +146,12 @@ declare const hcApi: {
|
|
|
138
146
|
get: (folderKey: string, authToken?: string | null) => Promise<MediaType[]>;
|
|
139
147
|
delete: (key: string, authToken?: string | null) => Promise<void>;
|
|
140
148
|
};
|
|
149
|
+
appendListings: {
|
|
150
|
+
get: (authToken?: string | null) => Promise<AppendListing[]>;
|
|
151
|
+
getAppendListing: (id: string, authToken?: string | null) => Promise<AppendListing>;
|
|
152
|
+
create: (appendListingDto: AppendListing, authToken?: string | null) => Promise<AppendListing>;
|
|
153
|
+
update: (id: string, appendListingDto: AppendListing, authToken?: string | null) => Promise<void>;
|
|
154
|
+
delete: (id: string, authToken?: string | null) => Promise<void>;
|
|
155
|
+
};
|
|
141
156
|
};
|
|
142
157
|
export default hcApi;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import FiltersDto from "./filters/filters";
|
|
2
|
+
type AppendListing = {
|
|
3
|
+
id?: string;
|
|
4
|
+
companyId: number;
|
|
5
|
+
filtersId?: string;
|
|
6
|
+
filters?: FiltersDto;
|
|
7
|
+
title: string;
|
|
8
|
+
contentPlainText: string;
|
|
9
|
+
contentHtml: string;
|
|
10
|
+
contentJson: string;
|
|
11
|
+
createdBy: {
|
|
12
|
+
userId: string;
|
|
13
|
+
firstName: string;
|
|
14
|
+
lastName: string;
|
|
15
|
+
dateTime: string;
|
|
16
|
+
};
|
|
17
|
+
lastUpdatedBy: {
|
|
18
|
+
userId: string;
|
|
19
|
+
firstName: string;
|
|
20
|
+
lastName: string;
|
|
21
|
+
dateTime: string;
|
|
22
|
+
};
|
|
23
|
+
images: {
|
|
24
|
+
imageUrl: string;
|
|
25
|
+
focalPoint: {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
};
|
|
29
|
+
}[];
|
|
30
|
+
videos: {
|
|
31
|
+
videoUrl: string;
|
|
32
|
+
thumbnail: {
|
|
33
|
+
imageUrl: string;
|
|
34
|
+
focalPoint: {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
}[];
|
|
40
|
+
};
|
|
41
|
+
export default AppendListing;
|
package/index.ts
CHANGED
|
@@ -12,6 +12,7 @@ import clientAuthConfigController from "./controllers/clientAuthConfigController
|
|
|
12
12
|
import listingscontroller from "./controllers/listingsController";
|
|
13
13
|
import mediaController from "./controllers/mediaController";
|
|
14
14
|
import filtersController from "./controllers/filtersController";
|
|
15
|
+
import appendListingsController from "./controllers/appendListingsController";
|
|
15
16
|
|
|
16
17
|
import Register from "./types/register";
|
|
17
18
|
import User from "./types/user";
|
|
@@ -23,6 +24,7 @@ import MediaType from "./types/media/media";
|
|
|
23
24
|
import Event, { EventDates, EventDateType, EventInstance } from "./types/event";
|
|
24
25
|
import { Listing } from "./types/listing";
|
|
25
26
|
import Filters from "./types/filters/filters";
|
|
27
|
+
import AppendListing from "./types/appendListing";
|
|
26
28
|
|
|
27
29
|
export const auth = {
|
|
28
30
|
login: authController.login,
|
|
@@ -91,6 +93,14 @@ export const filters = {
|
|
|
91
93
|
delete: filtersController.deleteFilter,
|
|
92
94
|
};
|
|
93
95
|
|
|
96
|
+
export const appendListings = {
|
|
97
|
+
get: appendListingsController.getAppendListings,
|
|
98
|
+
getAppendListing: appendListingsController.getAppendListing,
|
|
99
|
+
create: appendListingsController.createAppendListing,
|
|
100
|
+
update: appendListingsController.updateAppendListing,
|
|
101
|
+
delete: appendListingsController.deleteAppendListing,
|
|
102
|
+
};
|
|
103
|
+
|
|
94
104
|
export const permissions = {
|
|
95
105
|
get: permissionsController.getAllPermissions,
|
|
96
106
|
};
|
|
@@ -110,6 +120,7 @@ export type {
|
|
|
110
120
|
EventInstance,
|
|
111
121
|
MediaType,
|
|
112
122
|
Filters,
|
|
123
|
+
AppendListing
|
|
113
124
|
};
|
|
114
125
|
|
|
115
126
|
const hcApi = {
|
|
@@ -124,6 +135,7 @@ const hcApi = {
|
|
|
124
135
|
filters,
|
|
125
136
|
listings,
|
|
126
137
|
media,
|
|
138
|
+
appendListings,
|
|
127
139
|
};
|
|
128
140
|
|
|
129
141
|
export default hcApi;
|
package/package.json
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import FiltersDto from "./filters/filters";
|
|
2
|
+
|
|
3
|
+
type AppendListing = {
|
|
4
|
+
id?: string;
|
|
5
|
+
companyId: number;
|
|
6
|
+
filtersId?: string;
|
|
7
|
+
filters?: FiltersDto;
|
|
8
|
+
title: string;
|
|
9
|
+
contentPlainText: string;
|
|
10
|
+
contentHtml: string;
|
|
11
|
+
contentJson: string;
|
|
12
|
+
createdBy: {
|
|
13
|
+
userId: string;
|
|
14
|
+
firstName: string;
|
|
15
|
+
lastName: string;
|
|
16
|
+
dateTime: string;
|
|
17
|
+
};
|
|
18
|
+
lastUpdatedBy: {
|
|
19
|
+
userId: string;
|
|
20
|
+
firstName: string;
|
|
21
|
+
lastName: string;
|
|
22
|
+
dateTime: string;
|
|
23
|
+
};
|
|
24
|
+
images: {
|
|
25
|
+
imageUrl: string;
|
|
26
|
+
focalPoint: {
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
};
|
|
30
|
+
}[];
|
|
31
|
+
videos: {
|
|
32
|
+
videoUrl: string;
|
|
33
|
+
thumbnail: {
|
|
34
|
+
imageUrl: string;
|
|
35
|
+
focalPoint: {
|
|
36
|
+
x: number;
|
|
37
|
+
y: number;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
}[];
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default AppendListing;
|