@mui/toolpad-core
Advanced tools
Comparing version 0.1.23 to 0.1.24
@@ -8,2 +8,1 @@ export type { PlaceholderProps, SlotsProps, NodeRuntime, NodeErrorProps, Components, } from './runtime'; | ||
export * from './types'; | ||
export * from './server'; |
@@ -1,5 +0,1 @@ | ||
import { | ||
createFunction, | ||
createQuery | ||
} from "./chunk-OLNJQTJM.js"; | ||
import "./chunk-55J6XMHW.js"; | ||
@@ -44,4 +40,2 @@ import { | ||
createComponent, | ||
createFunction, | ||
createQuery, | ||
createToolpadComponentThatThrows, | ||
@@ -48,0 +42,0 @@ getArgTypeDefaultValue, |
import { | ||
TOOLPAD_LOADING_MARKER | ||
} from "./chunk-I4THMYD4.js"; | ||
} from "./chunk-37XWBP4F.js"; | ||
@@ -5,0 +5,0 @@ // src/jsBrowserRuntime.tsx |
import { | ||
TOOLPAD_LOADING_MARKER, | ||
evaluateBindable | ||
} from "./chunk-I4THMYD4.js"; | ||
} from "./chunk-37XWBP4F.js"; | ||
export { | ||
@@ -6,0 +6,0 @@ TOOLPAD_LOADING_MARKER, |
/// <reference path="../src/serverModules.d.ts" /> | ||
/// <reference types="node" /> | ||
import { IncomingMessage } from 'node:http'; | ||
import { TOOLPAD_FUNCTION } from './constants'; | ||
@@ -46,2 +48,8 @@ import { InferParameterType, PrimitiveValueType } from './types'; | ||
export declare const createQuery: typeof createFunction; | ||
export interface ServerContext { | ||
cookies: Record<string, string>; | ||
} | ||
export declare function getContext(): ServerContext; | ||
export declare function createServerContext(req: IncomingMessage): ServerContext; | ||
export declare function withContext<R = void>(ctx: ServerContext, doWork: () => Promise<R>): Promise<R>; | ||
export {}; |
import { | ||
createFunction, | ||
createQuery | ||
} from "./chunk-OLNJQTJM.js"; | ||
import "./chunk-4TRYSV22.js"; | ||
TOOLPAD_FUNCTION | ||
} from "./chunk-4TRYSV22.js"; | ||
// src/server.ts | ||
import { AsyncLocalStorage } from "async_hooks"; | ||
import * as cookie from "cookie"; | ||
function createFunction(resolver, config) { | ||
if (config?.parameters) { | ||
for (const [name, argType] of Object.entries(config.parameters)) { | ||
const maybeLegacyParamtype = argType; | ||
if (maybeLegacyParamtype.typeDef) { | ||
console.warn(`Detected deprecated parameter definition for "${name}".`); | ||
Object.assign(maybeLegacyParamtype, maybeLegacyParamtype.typeDef); | ||
if (!("default" in maybeLegacyParamtype)) { | ||
maybeLegacyParamtype.default = maybeLegacyParamtype.defaultValue; | ||
} | ||
delete maybeLegacyParamtype.defaultValue; | ||
delete maybeLegacyParamtype.typeDef; | ||
} | ||
} | ||
} | ||
return Object.assign(resolver, { | ||
[TOOLPAD_FUNCTION]: config || { parameters: {} } | ||
}); | ||
} | ||
var createQuery = createFunction; | ||
var asyncLocalStorage = new AsyncLocalStorage(); | ||
function getContext() { | ||
const ctx = asyncLocalStorage.getStore(); | ||
if (!ctx) { | ||
throw new Error("getContext() must be called from within a Toolpad function."); | ||
} | ||
return ctx; | ||
} | ||
function createServerContext(req) { | ||
const cookies = cookie.parse(req.headers.cookie || ""); | ||
return { | ||
cookies | ||
}; | ||
} | ||
function withContext(ctx, doWork) { | ||
return asyncLocalStorage.run(ctx, doWork); | ||
} | ||
export { | ||
createFunction, | ||
createQuery | ||
createQuery, | ||
createServerContext, | ||
getContext, | ||
withContext | ||
}; | ||
//# sourceMappingURL=server.js.map |
{ | ||
"name": "@mui/toolpad-core", | ||
"version": "0.1.23", | ||
"version": "0.1.24", | ||
"description": "Build MUI apps quickly", | ||
@@ -44,12 +44,14 @@ "author": "MUI Toolpad team", | ||
"dependencies": { | ||
"@mui/material": "5.14.4", | ||
"@mui/toolpad-utils": "0.1.23", | ||
"@mui/material": "5.14.5", | ||
"@mui/toolpad-utils": "0.1.24", | ||
"@tanstack/react-query": "4.32.6", | ||
"@types/json-schema": "^7.0.12", | ||
"cookie": "0.5.0", | ||
"invariant": "2.2.4", | ||
"quickjs-emscripten": "0.23.0", | ||
"react-error-boundary": "4.0.10", | ||
"react-error-boundary": "4.0.11", | ||
"react-is": "18.2.0" | ||
}, | ||
"devDependencies": { | ||
"@types/cookie": "0.5.1", | ||
"@types/react-is": "18.2.1", | ||
@@ -64,3 +66,3 @@ "concurrently": "8.2.0" | ||
}, | ||
"gitHead": "927af37171a21f04c69e5cc5c5e8745bdf584137" | ||
"gitHead": "02f3e1819b3da86f142dd47fc6b2226cea867fa8" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
229948
10
3
82
4
+ Addedcookie@0.5.0
+ Added@mui/base@5.0.0-beta.11(transitive)
+ Added@mui/material@5.14.5(transitive)
+ Added@mui/toolpad-utils@0.1.24(transitive)
+ Addedcookie@0.5.0(transitive)
+ Addedreact-error-boundary@4.0.11(transitive)
- Removed@mui/base@5.0.0-beta.10(transitive)
- Removed@mui/material@5.14.4(transitive)
- Removed@mui/toolpad-utils@0.1.23(transitive)
- Removedreact-error-boundary@4.0.10(transitive)
Updated@mui/material@5.14.5
Updated@mui/toolpad-utils@0.1.24
Updatedreact-error-boundary@4.0.11