@inertiajs/core 2.0.7 → 2.0.9

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": "@inertiajs/core",
3
- "version": "2.0.7",
3
+ "version": "2.0.9",
4
4
  "license": "MIT",
5
5
  "description": "A framework for creating server-driven single page apps.",
6
6
  "contributors": [
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "axios": "^1.8.2",
55
- "deepmerge": "^4.0.0",
55
+ "es-toolkit": "^1.34.1",
56
56
  "qs": "^6.9.0"
57
57
  },
58
58
  "devDependencies": {
@@ -7,7 +7,7 @@ declare const _default: {
7
7
  remove: () => void;
8
8
  start: () => void;
9
9
  status: null;
10
- show: () => HTMLStyleElement | undefined;
10
+ show: () => void;
11
11
  hide: () => void;
12
12
  };
13
13
  export default _default;
@@ -9,7 +9,7 @@ export declare class RequestParams {
9
9
  protected params: InternalActiveVisit;
10
10
  constructor(params: InternalActiveVisit);
11
11
  static create(params: ActiveVisit): RequestParams;
12
- data(): import("./types").RequestPayload;
12
+ data(): import("./types").RequestPayload | null;
13
13
  queryParams(): import("./types").RequestPayload;
14
14
  isPartial(): boolean;
15
15
  onCancelToken(cb: VoidFunction): void;
package/types/router.d.ts CHANGED
@@ -4,12 +4,12 @@ export declare class Router {
4
4
  protected syncRequestStream: RequestStream;
5
5
  protected asyncRequestStream: RequestStream;
6
6
  init({ initialPage, resolveComponent, swapComponent }: RouterInitParams): void;
7
- get(url: URL | string, data?: RequestPayload, options?: VisitHelperOptions): void;
8
- post(url: URL | string, data?: RequestPayload, options?: VisitHelperOptions): void;
9
- put(url: URL | string, data?: RequestPayload, options?: VisitHelperOptions): void;
10
- patch(url: URL | string, data?: RequestPayload, options?: VisitHelperOptions): void;
11
- delete(url: URL | string, options?: Omit<VisitOptions, 'method'>): void;
12
- reload(options?: ReloadOptions): void;
7
+ get<T extends RequestPayload = RequestPayload>(url: URL | string, data?: T, options?: VisitHelperOptions<T>): void;
8
+ post<T extends RequestPayload = RequestPayload>(url: URL | string, data?: T, options?: VisitHelperOptions<T>): void;
9
+ put<T extends RequestPayload = RequestPayload>(url: URL | string, data?: T, options?: VisitHelperOptions<T>): void;
10
+ patch<T extends RequestPayload = RequestPayload>(url: URL | string, data?: T, options?: VisitHelperOptions<T>): void;
11
+ delete<T extends RequestPayload = RequestPayload>(url: URL | string, options?: Omit<VisitOptions<T>, 'method'>): void;
12
+ reload<T extends RequestPayload = RequestPayload>(options?: ReloadOptions<T>): void;
13
13
  remember(data: unknown, key?: string): void;
14
14
  restore(key?: string): unknown;
15
15
  on<TEventName extends GlobalEventNames>(type: TEventName, callback: (event: GlobalEvent<TEventName>) => GlobalEventResult<TEventName>): VoidFunction;
@@ -19,12 +19,12 @@ export declare class Router {
19
19
  stop: VoidFunction;
20
20
  start: VoidFunction;
21
21
  };
22
- visit(href: string | URL, options?: VisitOptions): void;
22
+ visit<T extends RequestPayload = RequestPayload>(href: string | URL, options?: VisitOptions<T>): void;
23
23
  getCached(href: string | URL, options?: VisitOptions): InFlightPrefetch | PrefetchedResponse | null;
24
24
  flush(href: string | URL, options?: VisitOptions): void;
25
25
  flushAll(): void;
26
26
  getPrefetching(href: string | URL, options?: VisitOptions): InFlightPrefetch | PrefetchedResponse | null;
27
- prefetch(href: string | URL, options: Partial<Visit & VisitCallbacks> | undefined, { cacheFor }: PrefetchOptions): void;
27
+ prefetch(href: string | URL, options: Partial<Visit<RequestPayload> & VisitCallbacks> | undefined, { cacheFor }: PrefetchOptions): void;
28
28
  clearHistory(): void;
29
29
  decryptHistory(): Promise<Page>;
30
30
  replace(params: ClientSideVisitOptions): void;
package/types/types.d.ts CHANGED
@@ -29,6 +29,7 @@ export interface Page<SharedProps extends PageProps = PageProps> {
29
29
  encryptHistory: boolean;
30
30
  deferredProps?: Record<string, VisitOptions['only']>;
31
31
  mergeProps?: string[];
32
+ deepMergeProps?: string[];
32
33
  /** @internal */
33
34
  rememberedState: Record<string, unknown>;
34
35
  }
@@ -56,9 +57,9 @@ export type Progress = AxiosProgressEvent;
56
57
  export type LocationVisit = {
57
58
  preserveScroll: boolean;
58
59
  };
59
- export type Visit = {
60
+ export type Visit<T extends RequestPayload = RequestPayload> = {
60
61
  method: Method;
61
- data: RequestPayload;
62
+ data: T;
62
63
  replace: boolean;
63
64
  preserveScroll: PreserveStateOption;
64
65
  preserveState: PreserveStateOption;
@@ -186,13 +187,13 @@ export type VisitCallbacks = {
186
187
  onPrefetched: GlobalEventCallback<'prefetched'>;
187
188
  onPrefetching: GlobalEventCallback<'prefetching'>;
188
189
  };
189
- export type VisitOptions = Partial<Visit & VisitCallbacks>;
190
- export type ReloadOptions = Omit<VisitOptions, 'preserveScroll' | 'preserveState'>;
190
+ export type VisitOptions<T extends RequestPayload = RequestPayload> = Partial<Visit<T> & VisitCallbacks>;
191
+ export type ReloadOptions<T extends RequestPayload = RequestPayload> = Omit<VisitOptions<T>, 'preserveScroll' | 'preserveState'>;
191
192
  export type PollOptions = {
192
193
  keepAlive?: boolean;
193
194
  autoStart?: boolean;
194
195
  };
195
- export type VisitHelperOptions = Omit<VisitOptions, 'method' | 'data'>;
196
+ export type VisitHelperOptions<T extends RequestPayload = RequestPayload> = Omit<VisitOptions<T>, 'method' | 'data'>;
196
197
  export type RouterInitParams = {
197
198
  initialPage: Page;
198
199
  resolveComponent: PageResolver;