@adonisjs/inertia 2.1.1 → 2.1.2
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/build/{chunk-3SVIWNBM.js → chunk-DLEGZFQ5.js} +12 -5
- package/build/config.stub +1 -1
- package/build/index.d.ts +1 -1
- package/build/providers/inertia_provider.js +1 -1
- package/build/src/inertia_middleware.d.ts +1 -1
- package/build/src/inertia_middleware.js +1 -1
- package/build/src/plugins/japa/api_client.d.ts +1 -1
- package/build/src/types.d.ts +1 -1
- package/build/{types-AyvioK68.d.ts → types-D6QX_SeH.d.ts} +2 -2
- package/package.json +1 -1
|
@@ -146,6 +146,15 @@ var Inertia = class {
|
|
|
146
146
|
}
|
|
147
147
|
return newProps;
|
|
148
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Resolve a single prop
|
|
151
|
+
*/
|
|
152
|
+
async #resolveProp(key, value) {
|
|
153
|
+
if (value instanceof OptionalProp || value instanceof MergeProp || value instanceof DeferProp || value instanceof AlwaysProp) {
|
|
154
|
+
return [key, await value.callback()];
|
|
155
|
+
}
|
|
156
|
+
return [key, value];
|
|
157
|
+
}
|
|
149
158
|
/**
|
|
150
159
|
* Resolve a single prop by calling the callback or resolving the promise
|
|
151
160
|
*/
|
|
@@ -154,12 +163,10 @@ var Inertia = class {
|
|
|
154
163
|
await Promise.all(
|
|
155
164
|
Object.entries(props).map(async ([key, value]) => {
|
|
156
165
|
if (typeof value === "function") {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
if (value instanceof OptionalProp || value instanceof MergeProp || value instanceof DeferProp || value instanceof AlwaysProp) {
|
|
160
|
-
return [key, await value.callback()];
|
|
166
|
+
const result = await value(this.ctx);
|
|
167
|
+
return this.#resolveProp(key, result);
|
|
161
168
|
}
|
|
162
|
-
return
|
|
169
|
+
return this.#resolveProp(key, value);
|
|
163
170
|
})
|
|
164
171
|
)
|
|
165
172
|
);
|
package/build/config.stub
CHANGED
|
@@ -14,7 +14,7 @@ const inertiaConfig = defineConfig({
|
|
|
14
14
|
* Data that should be shared with all rendered pages
|
|
15
15
|
*/
|
|
16
16
|
sharedData: {
|
|
17
|
-
errors: (ctx) => ctx.session?.flashMessages.get('errors'),
|
|
17
|
+
errors: (ctx) => ctx.inertia.always(() => ctx.session?.flashMessages.get('errors')),
|
|
18
18
|
},
|
|
19
19
|
|
|
20
20
|
/**
|
package/build/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Configure from '@adonisjs/core/commands/configure';
|
|
2
2
|
import { ConfigProvider } from '@adonisjs/core/types';
|
|
3
|
-
import { S as SharedData, I as InertiaConfig, R as ResolvedConfig } from './types-
|
|
3
|
+
import { S as SharedData, I as InertiaConfig, R as ResolvedConfig } from './types-D6QX_SeH.js';
|
|
4
4
|
import '@adonisjs/core/http';
|
|
5
5
|
import '@tuyau/utils/types';
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Vite } from '@adonisjs/vite';
|
|
2
2
|
import { HttpContext } from '@adonisjs/core/http';
|
|
3
3
|
import { NextFn } from '@adonisjs/core/types/http';
|
|
4
|
-
import { R as ResolvedConfig, D as Data, P as PageObject, M as MaybePromise, O as OptionalProp, a as MergeProp, A as AlwaysProp, b as DeferProp } from '../types-
|
|
4
|
+
import { R as ResolvedConfig, D as Data, P as PageObject, M as MaybePromise, O as OptionalProp, a as MergeProp, A as AlwaysProp, b as DeferProp } from '../types-D6QX_SeH.js';
|
|
5
5
|
import '@adonisjs/core/types';
|
|
6
6
|
import '@tuyau/utils/types';
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PluginFn } from '@japa/runner/types';
|
|
2
2
|
import { ApplicationService } from '@adonisjs/core/types';
|
|
3
|
-
import { c as PageProps } from '../../../types-
|
|
3
|
+
import { c as PageProps } from '../../../types-D6QX_SeH.js';
|
|
4
4
|
import '@adonisjs/core/http';
|
|
5
5
|
import '@tuyau/utils/types';
|
|
6
6
|
|
package/build/src/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '@adonisjs/core/types';
|
|
2
2
|
import '@adonisjs/core/http';
|
|
3
3
|
import '@tuyau/utils/types';
|
|
4
|
-
export { e as AssetsVersion, D as Data, I as InertiaConfig, h as InferPageProps, f as InferSharedProps, M as MaybePromise, P as PageObject, c as PageProps, i as RenderInertiaSsrApp, R as ResolvedConfig, S as SharedData, d as SharedDatumFactory, g as SharedProps } from '../types-
|
|
4
|
+
export { e as AssetsVersion, D as Data, I as InertiaConfig, h as InferPageProps, f as InferSharedProps, M as MaybePromise, P as PageObject, c as PageProps, i as RenderInertiaSsrApp, R as ResolvedConfig, S as SharedData, d as SharedDatumFactory, g as SharedProps } from '../types-D6QX_SeH.js';
|
|
@@ -196,9 +196,9 @@ type InferProps<T> = {
|
|
|
196
196
|
callback: () => MaybePromise<infer U>;
|
|
197
197
|
} ? U : T[K];
|
|
198
198
|
};
|
|
199
|
-
type ReturnsTypesSharedData<T extends SharedData> = {} extends T ? {} : {
|
|
199
|
+
type ReturnsTypesSharedData<T extends SharedData> = {} extends T ? {} : InferProps<{
|
|
200
200
|
[K in keyof T]: T[K] extends (...args: any[]) => MaybePromise<infer U> ? U : T[K];
|
|
201
|
-
}
|
|
201
|
+
}>;
|
|
202
202
|
/**
|
|
203
203
|
* Infer shared data types from the config provider
|
|
204
204
|
*/
|