@goralys/core 1.6.3 → 1.6.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/dist/index.d.ts CHANGED
@@ -132,8 +132,13 @@ type Subject = {
132
132
  teacher: string;
133
133
  teacherToken: string;
134
134
  topic: string;
135
+ topicCode: string;
135
136
  interdisciplinary: boolean;
136
137
  };
138
+ type SubjectsFilterOptions = {
139
+ classrooms: Record<string, string[]>;
140
+ topics: Record<string, string[]>;
141
+ };
137
142
  declare const searchFields: {
138
143
  readonly all: "Tout";
139
144
  readonly student: "Élèves";
@@ -243,6 +248,8 @@ declare const SUPPORT_TICKET_CACHE = "support-tickets-cache";
243
248
  declare const SUPPORT_TICKET_SYNC = "support-tickets-synced";
244
249
  declare const SUBJECT_SYNCS: Record<UserRole["role"], string>;
245
250
  declare const SUBJECT_CACHES: Record<UserRole["role"], string>;
251
+ declare const FILTER_OPTIONS_SYNC = "filter-options-synced";
252
+ declare const FILTER_OPTIONS_CACHE = "filter-options-cache";
246
253
  declare const AUTH_TOKEN_SYNCS: Record<AuthTokenContext, string | undefined>;
247
254
  declare const AUTH_TOKEN_CACHES: Record<AuthTokenContext, string | undefined>;
248
255
  type UserType = {
@@ -307,8 +314,11 @@ declare function isHTTPMethod(maybeMethod: string): maybeMethod is HttpMethod;
307
314
  type GoralysFetchOptions = RequestInit & {
308
315
  suppressRedirect?: boolean;
309
316
  };
317
+ type Json = string | number | boolean | null | Json[] | {
318
+ [k: string]: Json;
319
+ };
310
320
 
311
- declare function goralysFetchClient(method: HttpMethod, input: string | URL | Request, payload?: Record<string, string | number | boolean | null> | FormData, requestOptions?: GoralysFetchOptions): Promise<Response>;
321
+ declare function goralysFetchClient(method: HttpMethod, input: string | URL | Request, payload?: Record<string, Json> | FormData, requestOptions?: GoralysFetchOptions): Promise<Response>;
312
322
  declare function fetchCsrfClient(formId: string): Promise<string | null>;
313
323
  declare function buildApiUrl(endpoint: string, params: Record<string, string | null>, domain?: boolean): string;
314
324
  declare function handleToastRequest(r: Response, showToast: ToastFn, redirect?: boolean, duration?: number): Promise<boolean>;
@@ -351,10 +361,11 @@ declare function getShortFromLong(long: string): string;
351
361
  declare function fetchSubjectsForRoleClient(role: UserRole): Promise<Response | null>;
352
362
 
353
363
  declare function cacheUserDataClient(): Promise<void>;
364
+ declare function arrayAny<T>(arr: T[], cond: (v: T) => boolean): boolean;
354
365
  declare function emptyUserCacheClient(): void;
355
366
  declare function fetchUsersClient(): Promise<Response>;
356
367
  declare function fetchVirtualUsersClient(): Promise<Response>;
357
368
  declare function fetchAdminsClient(): Promise<Response>;
358
369
  declare function fetchVirtualAdminsClient(): Promise<Response>;
359
370
 
360
- export { ADMIN_CACHE_RADIX, ADMIN_SYNC_RADIX, AUTH_TOKEN_CACHES, AUTH_TOKEN_CACHE_RADIX, AUTH_TOKEN_SYNCS, AUTH_TOKEN_SYNC_RADIX, type AuthEvent, type AuthToken, type AuthTokenContext, COOKIES_DISMISSED_KEY, type CheckAuthImpl, type ConfirmOptions, type CookieValue, type CookiesAdapter, type DraftModalResult, EMAIL_KEY, FLASH_TOAST_KEY, FULL_NAME_KEY, GoralysActionHandler, type GoralysClientConfig, type GoralysFetchOptions, 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 ToastConfig, type ToastFn, USERNAME_KEY, USER_CACHES, USER_CACHE_RADIX, USER_ROLES, USER_SYNCS, USER_SYNC_RADIX, type UseSyncedResourceOptions, type User, type UserData, type UserEvent, type UserProfile, type UserRole, type UserType, buildApiUrl, buildArray, cacheUserDataClient, configGoralysCore, configureCheckAuth, configureCookies, configureGoralysClient, configureStorage, configureToast, cookiesGet, cookiesGetAll, cookiesOnChange, cookiesRemove, cookiesSet, emitAuthEvent, emitNavigationEvent, emitUserEvent, emptyUserCacheClient, fetchAdminsClient, fetchAuthTokensForContext, fetchCsrfClient, fetchSubjectsForRoleClient, fetchTokensAdminPanel, fetchTokensProfile, fetchUsersClient, fetchVirtualAdminsClient, fetchVirtualUsersClient, fromPhpDate, getGoralysClientConfig, getLongFromShort, getShortFromLong, getStatusHelper, getStatusLabel, getToastConfig, goralysFetchClient, handleToastRequest, helpContent, isAuthenticated, isFoolsDay, isHTTPMethod, onAuthEvent, onNavigationEvent, onUserEvent, parsePhpDateTime, reasonsConfig, searchFields, separateNames, storageGet, storageKeyAt, storageKeys, storageRemove, storageSet, storageSize, useAdmins, useAuthTokens, useSubjects, useSupportTickets, useSyncedResource, useUsers, useVirtualAdmins, useVirtualUsers };
371
+ export { ADMIN_CACHE_RADIX, ADMIN_SYNC_RADIX, AUTH_TOKEN_CACHES, AUTH_TOKEN_CACHE_RADIX, AUTH_TOKEN_SYNCS, AUTH_TOKEN_SYNC_RADIX, type AuthEvent, type AuthToken, type AuthTokenContext, COOKIES_DISMISSED_KEY, type CheckAuthImpl, type ConfirmOptions, type CookieValue, type CookiesAdapter, type DraftModalResult, EMAIL_KEY, FILTER_OPTIONS_CACHE, FILTER_OPTIONS_SYNC, FLASH_TOAST_KEY, FULL_NAME_KEY, GoralysActionHandler, type GoralysClientConfig, type GoralysFetchOptions, HTTP_METHODS, type HttpMethod, type Json, 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 SubjectsFilterOptions, type SubjectsSearchField, type SupportReasons, type SupportTicket, type Toast, type ToastConfig, type ToastFn, USERNAME_KEY, USER_CACHES, USER_CACHE_RADIX, USER_ROLES, USER_SYNCS, USER_SYNC_RADIX, type UseSyncedResourceOptions, type User, type UserData, type UserEvent, type UserProfile, type UserRole, type UserType, arrayAny, buildApiUrl, buildArray, cacheUserDataClient, configGoralysCore, configureCheckAuth, configureCookies, configureGoralysClient, configureStorage, configureToast, cookiesGet, cookiesGetAll, cookiesOnChange, cookiesRemove, cookiesSet, emitAuthEvent, emitNavigationEvent, emitUserEvent, emptyUserCacheClient, fetchAdminsClient, fetchAuthTokensForContext, fetchCsrfClient, fetchSubjectsForRoleClient, fetchTokensAdminPanel, fetchTokensProfile, fetchUsersClient, fetchVirtualAdminsClient, fetchVirtualUsersClient, fromPhpDate, getGoralysClientConfig, getLongFromShort, getShortFromLong, getStatusHelper, getStatusLabel, getToastConfig, goralysFetchClient, handleToastRequest, helpContent, isAuthenticated, isFoolsDay, isHTTPMethod, onAuthEvent, onNavigationEvent, onUserEvent, parsePhpDateTime, reasonsConfig, searchFields, separateNames, storageGet, storageKeyAt, storageKeys, storageRemove, storageSet, storageSize, useAdmins, useAuthTokens, useSubjects, useSupportTickets, useSyncedResource, useUsers, useVirtualAdmins, useVirtualUsers };
package/dist/index.js CHANGED
@@ -111,6 +111,8 @@ var SUBJECT_CACHES = {
111
111
  admin: SUBJECT_CACHE_RADIX + "admin",
112
112
  none: SUBJECT_CACHE_RADIX + "unknown"
113
113
  };
114
+ var FILTER_OPTIONS_SYNC = "filter-options-synced";
115
+ var FILTER_OPTIONS_CACHE = "filter-options-cache";
114
116
  var AUTH_TOKEN_SYNCS = {
115
117
  "admin-panel": void 0,
116
118
  profile: AUTH_TOKEN_SYNC_RADIX + "profile"
@@ -605,6 +607,8 @@ function useSyncedResource({ name, cacheKey, syncKey, fetcher, parse, requireAut
605
607
  const res = await fetcher();
606
608
  if (res)
607
609
  await handleToastRequest(res, showToastRef.current, false);
610
+ if (!res?.ok)
611
+ return;
608
612
  const raw = await res?.json();
609
613
  if (caching) {
610
614
  cookiesSet(syncKey, "1");
@@ -896,7 +900,7 @@ var SubjectStatusConfig = {
896
900
  submitted: {
897
901
  label: "Envoy\xE9e",
898
902
  helper: {
899
- student: "Cette question est en attente de validation, vous ne pouvez plus la modifi\xE9e.",
903
+ student: "Cette question est en attente de validation, vous ne pouvez plus la modifier.",
900
904
  teacher: "Cette question est en attente de validation.",
901
905
  admin: "Cette question est en attente de validation.",
902
906
  none: "Role invalide"
@@ -949,6 +953,8 @@ export {
949
953
  AUTH_TOKEN_SYNC_RADIX,
950
954
  COOKIES_DISMISSED_KEY,
951
955
  EMAIL_KEY,
956
+ FILTER_OPTIONS_CACHE,
957
+ FILTER_OPTIONS_SYNC,
952
958
  FLASH_TOAST_KEY,
953
959
  FULL_NAME_KEY,
954
960
  GoralysActionHandler,
@@ -970,6 +976,7 @@ export {
970
976
  USER_ROLES,
971
977
  USER_SYNCS,
972
978
  USER_SYNC_RADIX,
979
+ arrayAny,
973
980
  buildApiUrl,
974
981
  buildArray,
975
982
  cacheUserDataClient,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goralys/core",
3
- "version": "1.6.3",
3
+ "version": "1.6.5",
4
4
  "license": "LGPL-2.1-or-later",
5
5
  "description": "Shared business logic for the Goralys web application",
6
6
  "repository": {
@@ -29,7 +29,7 @@
29
29
  "scripts": {
30
30
  "prebuild": "pnpm barrel",
31
31
  "build": "tsup",
32
- "typeCheck": "tsgo --noEmit",
32
+ "typeCheck": "node ./node_modules/typescript-native/bin/tsc --noEmit",
33
33
  "dev": "tsup --watch",
34
34
  "barrel": "node -e \"require('fs').rmSync('./src/index.ts',{force:true})\" && barrelsby -d ./src -l top"
35
35
  },
@@ -37,11 +37,11 @@
37
37
  "react": ">=18"
38
38
  },
39
39
  "devDependencies": {
40
- "@typescript/native-preview": "7.0.0-dev.20260705.1",
40
+ "typescript": "^6.0.3",
41
+ "typescript-native": "npm:typescript@^7.0.2",
41
42
  "barrelsby": "^2.8.1",
42
43
  "esbuild-plugin-tsconfig-paths": "^1.0.2",
43
44
  "react": "^18.0.0",
44
- "tsup": "^8.0.0",
45
- "typescript": "^5.0.0"
45
+ "tsup": "^8.0.0"
46
46
  }
47
47
  }