@goralys/core 1.1.2 → 1.1.3

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/index.d.ts CHANGED
@@ -27,6 +27,12 @@ interface CookiesAdapter {
27
27
  setCookies(key: string, value: CookieValue, path: string, maxAge: number): void;
28
28
  removeCookies(key: string): void;
29
29
  }
30
+ declare function configureCookies(customAdapter: CookiesAdapter): void;
31
+ declare function cookiesGet(key: string): string | null;
32
+ declare function cookiesSet(key: string, value: string, path?: string, maxAge?: number): void;
33
+ declare function cookiesRemove(key: string): void;
34
+ declare function cookiesOnChange(callback: () => void): () => void;
35
+ declare function setCookiesExpire(duration: number): void;
30
36
 
31
37
  type CheckAuthImpl = () => boolean;
32
38
  declare function configureCheckAuth(impl: CheckAuthImpl): void;
@@ -273,4 +279,4 @@ declare function fetchVirtualUsersClient(): Promise<Response>;
273
279
  declare function fetchAdminsClient(): Promise<Response>;
274
280
  declare function fetchVirtualAdminsClient(): Promise<Response>;
275
281
 
276
- export { ADMIN_CACHE_RADIX, ADMIN_SYNC_RADIX, type AuthEvent, type CheckAuthImpl, type ConfirmOptions, type CookieValue, type DraftModalResult, EMAIL_KEY, FULL_NAME_KEY, GoralysActionHandler, type GoralysClientConfig, HTTP_METHODS, type HttpMethod, LOGO_PATH, PERSISTANT_COOKIES, PERSISTANT_LOCALS, type PHPDateTime, PUB_ID_KEY, ROLE_KEY, SUBJECT_CACHES, SUBJECT_CACHE_RADIX, SUBJECT_SYNCS, SUBJECT_SYNC_RADIX, SUPPORT_TICKET_CACHE, SUPPORT_TICKET_SYNC, type StorageAdapter, type Subject, type SubjectStatus, SubjectStatusConfig, type SubjectsSearchField, type SupportReasons, type SupportTicket, type Toast, type ToastFn, USERNAME_KEY, USER_CACHES, USER_CACHE_RADIX, USER_ROLES, USER_SYNCS, USER_SYNC_RADIX, type User, type UserData, type UserEvent, type UserRole, type UserType, buildApiUrl, buildArray, cacheUserDataClient, configGoralysCore, configureCheckAuth, configureGoralysClient, configureStorage, configureUserCacheCallbacks, emitAuthEvent, emitNavigationEvent, emitUserEvent, emptyUserCacheClient, fetchAdminsClient, fetchCsrfClient, fetchSubjectsForRoleClient, fetchUsersClient, fetchVirtualAdminsClient, fetchVirtualUsersClient, getGoralysClientConfig, getLongFromShort, getStatusHelper, getStatusLabel, goralysFetchClient, handleToastRequest, helpContent, isAuthenticated, isFoolsDay, isHTTPMethod, onAuthEvent, onNavigationEvent, onUserEvent, parsePhpDateTime, reasonsConfig, searchFields, storageGet, storageRemove, storageSet, useAdmins, useSubjects, useSupportTickets, useUsers, useVirtualAdmins, useVirtualUsers };
282
+ export { ADMIN_CACHE_RADIX, ADMIN_SYNC_RADIX, type AuthEvent, type CheckAuthImpl, type ConfirmOptions, type CookieValue, type CookiesAdapter, type DraftModalResult, EMAIL_KEY, FULL_NAME_KEY, GoralysActionHandler, type GoralysClientConfig, HTTP_METHODS, type HttpMethod, LOGO_PATH, PERSISTANT_COOKIES, PERSISTANT_LOCALS, type PHPDateTime, PUB_ID_KEY, ROLE_KEY, SUBJECT_CACHES, SUBJECT_CACHE_RADIX, SUBJECT_SYNCS, SUBJECT_SYNC_RADIX, SUPPORT_TICKET_CACHE, SUPPORT_TICKET_SYNC, type StorageAdapter, type Subject, type SubjectStatus, SubjectStatusConfig, type SubjectsSearchField, type SupportReasons, type SupportTicket, type Toast, type ToastFn, USERNAME_KEY, USER_CACHES, USER_CACHE_RADIX, USER_ROLES, USER_SYNCS, USER_SYNC_RADIX, type User, type UserData, type UserEvent, type UserRole, type UserType, buildApiUrl, buildArray, cacheUserDataClient, configGoralysCore, configureCheckAuth, configureCookies, configureGoralysClient, configureStorage, configureUserCacheCallbacks, cookiesGet, cookiesOnChange, cookiesRemove, cookiesSet, emitAuthEvent, emitNavigationEvent, emitUserEvent, emptyUserCacheClient, fetchAdminsClient, fetchCsrfClient, fetchSubjectsForRoleClient, fetchUsersClient, fetchVirtualAdminsClient, fetchVirtualUsersClient, getGoralysClientConfig, getLongFromShort, getStatusHelper, getStatusLabel, goralysFetchClient, handleToastRequest, helpContent, isAuthenticated, isFoolsDay, isHTTPMethod, onAuthEvent, onNavigationEvent, onUserEvent, parsePhpDateTime, reasonsConfig, searchFields, setCookiesExpire, storageGet, storageRemove, storageSet, useAdmins, useSubjects, useSupportTickets, useUsers, useVirtualAdmins, useVirtualUsers };
package/dist/index.js CHANGED
@@ -48,9 +48,15 @@ function cookiesGet(key) {
48
48
  function cookiesSet(key, value, path = "/", maxAge = 1.5 * 60) {
49
49
  getAdapter2().setCookies(key, value, path, maxAge);
50
50
  }
51
+ function cookiesRemove(key) {
52
+ getAdapter2().removeCookies(key);
53
+ }
51
54
  function cookiesOnChange(callback) {
52
55
  return getAdapter2().onChange(callback);
53
56
  }
57
+ function setCookiesExpire(duration) {
58
+ storageSet("goralys-cookies-expire", String(Date.now() + duration * 1e3)).then();
59
+ }
54
60
 
55
61
  // src/lib/auth/check-auth.ts
56
62
  var checkAuthImpl;
@@ -901,9 +907,14 @@ export {
901
907
  cacheUserDataClient,
902
908
  configGoralysCore,
903
909
  configureCheckAuth,
910
+ configureCookies,
904
911
  configureGoralysClient,
905
912
  configureStorage,
906
913
  configureUserCacheCallbacks,
914
+ cookiesGet,
915
+ cookiesOnChange,
916
+ cookiesRemove,
917
+ cookiesSet,
907
918
  emitAuthEvent,
908
919
  emitNavigationEvent,
909
920
  emitUserEvent,
@@ -929,6 +940,7 @@ export {
929
940
  parsePhpDateTime,
930
941
  reasonsConfig,
931
942
  searchFields,
943
+ setCookiesExpire,
932
944
  storageGet,
933
945
  storageRemove,
934
946
  storageSet,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goralys/core",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "license": "LGPL-2.1-or-later",
5
5
  "description": "Shared business logic for the Goralys web application",
6
6
  "repository": {