@lls/offline 24.37.0-e4928d15 → 24.37.0-ea0002a6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lls/offline",
3
- "version": "24.37.0-e4928d15",
3
+ "version": "24.37.0-ea0002a6",
4
4
  "description": "offline",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",
@@ -42,7 +42,7 @@
42
42
  "@types/react": "18.3.12",
43
43
  "@types/react-dom": "18.3.1",
44
44
  "@vitejs/plugin-react": "5.1.1",
45
- "esbuild": "0.27.1",
45
+ "esbuild": "0.27.2",
46
46
  "happy-dom": "15.11.1",
47
47
  "lodash": "4.17.21",
48
48
  "nock": "14.0.10",
@@ -53,14 +53,14 @@
53
53
  "vite": "npm:rolldown-vite@7.2.10",
54
54
  "vite-tsconfig-paths": "5.1.4",
55
55
  "zod": "3.25.50",
56
- "@lls/vitescripts": "24.37.0-e4928d15"
56
+ "@lls/vitescripts": "24.37.0-ea0002a6"
57
57
  },
58
58
  "dependencies": {
59
59
  "redux-persist": "6.0.0"
60
60
  },
61
61
  "scripts": {
62
62
  "start": "pnpm ladle serve",
63
- "dts": "pnpm tsc --project tsconfig.production.json",
63
+ "dts": "pnpm tsgo --project tsconfig.production.json",
64
64
  "build": "NODE_ENV=production node build.js",
65
65
  "deploy-ladle": "PUBLISH=1 pnpm ladle build",
66
66
  "deploy-ladle-pr": "pnpm ladle build && s5cmd sync --delete --acl public-read --destination-region eu-west-1 'dist/*' s3://build.lelivrescolaire.fr/storybook/viewer-pr-$PR_NUMBER/",
@@ -1,33 +0,0 @@
1
- type UseOfflineProps = {
2
- skipLoadBooks?: boolean;
3
- primaryOnly?: boolean;
4
- nativeReadFile?: (arg: {
5
- fname: string;
6
- }) => Promise<ArrayBuffer>;
7
- nativeWriteFile?: (arg: {
8
- fname: string;
9
- buffer: ArrayBuffer;
10
- }) => Promise<void>;
11
- nativeListZips?: () => Promise<Array<{
12
- name: string;
13
- }>>;
14
- checkUpdates?: boolean;
15
- storage?: 'opfs' | 'native' | 'cache';
16
- zipBaseUrl?: string;
17
- confEnv?: 'development' | 'production';
18
- };
19
- declare const _default: ({ skipLoadBooks, primaryOnly, nativeReadFile, nativeWriteFile, nativeListZips, checkUpdates, storage, zipBaseUrl, confEnv }?: UseOfflineProps) => {
20
- ready: boolean;
21
- loadBook: ({ forceRefresh, ...idOrUri }: {
22
- forceRefresh?: boolean;
23
- } & ({
24
- id: number;
25
- } | {
26
- uri: string;
27
- }), cbk?: (arg: {
28
- bytes: number;
29
- total: number;
30
- }) => void) => Promise<void>;
31
- reset: () => Promise<void>;
32
- };
33
- export default _default;
@@ -1,3 +0,0 @@
1
- export { default as useOfflineWorker } from '#offline/hooks/useOfflineWorker';
2
- export * from '#offline/store/index';
3
- export * from '#offline/store/offlinePersist';
@@ -1,3 +0,0 @@
1
- import type { AnyFunction } from '@lls/typings/utils';
2
- import type { Reducer } from 'redux';
3
- export declare const persistEntitiesReducer: (entitiesReducer: AnyFunction, CONF_ENV: string) => Reducer;
@@ -1,8 +0,0 @@
1
- import { persistStore } from 'redux-persist';
2
- type Store = Parameters<typeof persistStore>[0];
3
- import { type ReactNode } from 'react';
4
- export declare const OfflinePersist: ({ store, children }: {
5
- store: Store;
6
- children: ReactNode;
7
- }) => import("react/jsx-runtime").JSX.Element;
8
- export {};
@@ -1,2 +0,0 @@
1
- import type { AnyFunction } from '@lls/typings/utils';
2
- export declare const tryCatch: (fn: (...args: any[]) => Promise<unknown>) => (resolve: AnyFunction) => Promise<void> | undefined;
@@ -1,5 +0,0 @@
1
- export declare const parseRange: (range: string, size: number) => {
2
- start: number;
3
- end: number;
4
- chunkSize: number;
5
- };
@@ -1,29 +0,0 @@
1
- import type { AnyFunction } from '@lls/typings/utils';
2
- type OnMessageEvent = (m: MessageEvent) => void;
3
- type Handler = {
4
- canHandle: (methodName: string) => boolean;
5
- handle: OnMessageEvent;
6
- };
7
- export declare const makeSyncWorker: <WorkerApi extends {
8
- [k: string]: AnyFunction;
9
- }>(offlineWorker: {
10
- postMessage: Worker["postMessage"];
11
- }, methodNames: string[], dbg?: string) => WorkerApi & {
12
- on: (key: string, fn: AnyFunction) => void;
13
- } & {
14
- handler: Handler;
15
- };
16
- export declare const makeSyncHandler: (services: {
17
- [k: string]: (...args: any[]) => any;
18
- }) => {
19
- canHandle: (methodName: string) => boolean;
20
- handle: OnMessageEvent;
21
- };
22
- export declare const bufToJson: (buf: ArrayBuffer) => any;
23
- export declare const jsonToBuf: (json: {}) => Uint8Array<ArrayBuffer>;
24
- export declare const combineHandlers: (...handlers: Handler[]) => (message: MessageEvent) => void;
25
- export declare const openCache: (mode: string) => Promise<Cache>;
26
- export declare const clearCache: (mode: string) => Promise<boolean>;
27
- export declare const isValidZipName: (name: string) => boolean;
28
- export declare const isValidS3Zip: (response: Response) => boolean;
29
- export {};
@@ -1,7 +0,0 @@
1
- type Record = {
2
- sofh: number;
3
- name: Uint8Array;
4
- };
5
- export declare const readRecordData: (buf: Uint8Array, { sofh }: Record) => Uint8Array<ArrayBuffer>;
6
- export declare const getHeaders: (buf: Uint8Array) => Record[];
7
- export {};
@@ -1,16 +0,0 @@
1
- import { setKnownLinks as handleSetKnownLinks } from '#offline/worker/swFetchScreenCall.ts';
2
- declare const setKnownLinks: (arg: Parameters<typeof handleSetKnownLinks>[1]) => void;
3
- export type FetchWorkerSync = {
4
- setKnownLinks: typeof setKnownLinks;
5
- };
6
- declare const configure: ({ storage, confEnv }?: {
7
- storage?: "native" | "opfs" | "cache";
8
- confEnv?: "development" | "production";
9
- }) => void;
10
- export type FetchWorkerMain = {
11
- initChannel: (d: {
12
- ports: [MessagePort];
13
- }) => void;
14
- configure: typeof configure;
15
- };
16
- export {};
@@ -1,67 +0,0 @@
1
- import type { EntryId } from './types.js';
2
- import { searchBooks } from './wwApi.js';
3
- import { readZipEntry } from './wwZip.js';
4
- declare const slugToFileMeta: ({ slug }: {
5
- slug: string;
6
- }) => Promise<{
7
- pageId: number | undefined;
8
- chapterId: number | undefined;
9
- }>;
10
- type BookId = number | string;
11
- declare const loadBook: ({ id: bookId, forceRefresh }: {
12
- id: BookId;
13
- forceRefresh?: boolean;
14
- }) => Promise<void>;
15
- declare const loadPageContent: ({ bookId: iBookId, chapterId, pageId, entryId }: {
16
- bookId?: number;
17
- chapterId?: number;
18
- pageId?: number;
19
- entryId?: EntryId;
20
- }) => Promise<{
21
- viewer: {
22
- pages: {
23
- hits: [{
24
- id: number;
25
- book: {
26
- slug: string;
27
- urlLite: string;
28
- };
29
- chapter: {
30
- id: number;
31
- };
32
- }];
33
- };
34
- };
35
- }>;
36
- declare const ensureAppReady: () => void;
37
- export type OfflineWorkerSync = {
38
- readZipEntry: typeof readZipEntry;
39
- loadBook: typeof loadBook;
40
- slugToFileMeta: typeof slugToFileMeta;
41
- loadPageContent: typeof loadPageContent;
42
- searchBooks: typeof searchBooks;
43
- ensureAppReady: typeof ensureAppReady;
44
- };
45
- declare const loadBooks: ({ primaryOnly }?: {
46
- primaryOnly?: boolean | undefined;
47
- }) => Promise<void>;
48
- declare const configure: ({ storage, checkUpdates, zipBaseUrl, confEnv }: {
49
- storage?: "native" | "opfs" | "cache";
50
- checkUpdates?: boolean;
51
- zipBaseUrl?: string;
52
- confEnv?: "development" | "production";
53
- }) => void;
54
- declare const loadPreload: () => Promise<void>;
55
- declare const reset: () => Promise<void>;
56
- export type OfflineWorkerSyncMain = {
57
- initChannel: (d: {
58
- ports: [MessagePort];
59
- }) => void;
60
- loadPreload: typeof loadPreload;
61
- readZipEntry: typeof readZipEntry;
62
- loadBooks: typeof loadBooks;
63
- loadBook: typeof loadBook;
64
- configure: typeof configure;
65
- reset: typeof reset;
66
- };
67
- export {};
@@ -1,14 +0,0 @@
1
- import type { OfflineWorkerSync } from './offline-worker';
2
- import type { EntryId, SwEvent } from './types';
3
- export declare const canHandleScreenCall: (url: string) => boolean;
4
- export declare const handleScreenCall: (ev: SwEvent, { offlineWorkerSync, knownLinks }: {
5
- offlineWorkerSync: OfflineWorkerSync;
6
- knownLinks: Map<string, EntryId>;
7
- }) => Promise<{
8
- status: number;
9
- json: any;
10
- }>;
11
- export declare const setKnownLinks: (knownLinks: Map<string, EntryId>, { entryNames, bookId }: {
12
- entryNames: string[];
13
- bookId: number | string;
14
- }) => void;
@@ -1,58 +0,0 @@
1
- type Book = {
2
- id: number;
3
- chapters: {
4
- id: number;
5
- }[];
6
- uri: string;
7
- slug: string;
8
- urlLite: string;
9
- };
10
- type Page = {
11
- id: number;
12
- book: {
13
- slug: string;
14
- urlLite: string;
15
- };
16
- chapter: {
17
- id: number;
18
- };
19
- };
20
- type GqlBook = {
21
- viewer: {
22
- books: {
23
- hits: [Book];
24
- };
25
- };
26
- };
27
- type GqlPage = {
28
- viewer: {
29
- pages: {
30
- hits: [Page];
31
- };
32
- };
33
- };
34
- export declare const loadBook: (json: GqlBook) => void;
35
- type SlugFile = {
36
- [pageId: string]: `${number};${number}`;
37
- };
38
- export declare const slugToFileMeta: ({ slug, json }: {
39
- slug: string;
40
- json: SlugFile;
41
- }) => Promise<{
42
- pageId: number | undefined;
43
- chapterId: number | undefined;
44
- }>;
45
- export declare const loadPageContent: ({ chapterId, json }: {
46
- chapterId?: number;
47
- json: GqlPage;
48
- }) => Promise<GqlPage>;
49
- export declare const searchBooks: ({ uris, slugs, ids, chapterIds }: {
50
- uris?: string[];
51
- slugs?: string[];
52
- ids?: number[];
53
- chapterIds?: (number | undefined)[];
54
- }) => Promise<(Omit<Book, "chapters"> & {
55
- chapters: number[];
56
- })[]>;
57
- export declare const loadPreload: (json: GqlBook) => void;
58
- export {};
@@ -1,9 +0,0 @@
1
- type BookId = number | string;
2
- export declare const readZipEntry: ({ bookId, entryName, asJson }: {
3
- bookId: number | string;
4
- entryName: string;
5
- asJson?: boolean;
6
- }) => Promise<any>;
7
- export declare const hasZip: (bookId: BookId | string) => boolean;
8
- export declare const loadZip: (buf: Uint8Array, bookId: BookId) => Promise<string[]>;
9
- export {};