@trpc-panel/core 1.0.1 → 1.0.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/README.md CHANGED
@@ -25,13 +25,13 @@ Check out our [test app](https://app.trpcpanel.io)
25
25
  Install with your preferred package manager:
26
26
 
27
27
  ```sh
28
- yarn add trpc-panel
28
+ npm install @trpc-panel/core
29
29
  ```
30
30
 
31
31
  render your panel and return it from your backend (express example):
32
32
 
33
33
  ```js
34
- import { renderTrpcPanel } from "trpc-panel";
34
+ import { renderTrpcPanel } from "@trpc-panel/core";
35
35
  // ...
36
36
  app.use("/panel", (_, res) => {
37
37
  return res.send(
@@ -48,7 +48,7 @@ In Nextjs you'd want to create an api route somewhere like `src/pages/api/panel.
48
48
 
49
49
  ```ts
50
50
  import type { NextApiRequest, NextApiResponse } from "next";
51
- import { renderTrpcPanel } from "trpc-panel";
51
+ import { renderTrpcPanel } from "@trpc-panel/core";
52
52
  import { appRouter } from "../../server/api/root";
53
53
 
54
54
  export default async function handler(_: NextApiRequest, res: NextApiResponse) {
@@ -77,7 +77,7 @@ Documentation is opt-in, meaning you only need to set it up if you want to use i
77
77
 
78
78
  ```ts
79
79
  import { initTRPC } from "@trpc/server";
80
- import { TRPCPanelMeta } from "trpc-panel";
80
+ import { TRPCPanelMeta } from "@trpc-panel/core";
81
81
 
82
82
  const t = initTRPC.meta<TRPCPanelMeta>().create();
83
83
  ```
package/lib/index.js CHANGED
@@ -280,28 +280,22 @@ function nodeAndInputSchemaFromInputs(inputs, _routerPath, options, addDataFunct
280
280
  };
281
281
  }
282
282
  if (inputs.length !== 1) {
283
- return { parseInputResult: "failure", error: `Inputs length is ${inputs.length}` };
283
+ return { parseInputResult: "failure" };
284
284
  }
285
285
  const input = inputs[0];
286
- try {
287
- return {
288
- parseInputResult: "success",
289
- schema: zodToJsonSchema.zodToJsonSchema(input, {
290
- errorMessages: true,
291
- $refStrategy: "none",
292
- target: "jsonSchema7"
293
- }),
294
- node: zodSelectorFunction(input._def, {
295
- path: [],
296
- options,
297
- addDataFunctions,
298
- }),
299
- };
300
- }
301
- catch (e) {
302
- console.error("Error parsing input schema:", e);
303
- return { parseInputResult: "failure", error: "Exception in zodToJsonSchema or zodSelectorFunction" };
304
- }
286
+ return {
287
+ parseInputResult: "success",
288
+ schema: zodToJsonSchema.zodToJsonSchema(input, {
289
+ errorMessages: true,
290
+ $refStrategy: "none",
291
+ target: "jsonSchema7"
292
+ }),
293
+ node: zodSelectorFunction(input._def, {
294
+ path: [],
295
+ options,
296
+ addDataFunctions,
297
+ }),
298
+ };
305
299
  }
306
300
  function parseProcedure(procedure, path, options) {
307
301
  var _a, _b;
@@ -319,7 +313,6 @@ function parseProcedure(procedure, path, options) {
319
313
  },
320
314
  });
321
315
  if (nodeAndInput.parseInputResult === "failure") {
322
- console.warn(`parseProcedure failed for ${path.join(".")}: nodeAndInput failed. Error: ${nodeAndInput.error}`);
323
316
  return null;
324
317
  }
325
318
  const t = (() => {
@@ -332,7 +325,6 @@ function parseProcedure(procedure, path, options) {
332
325
  return null;
333
326
  })();
334
327
  if (!t) {
335
- console.warn(`parseProcedure failed for ${path.join(".")}: could not determine procedure type.`);
336
328
  return null;
337
329
  }
338
330
  return {
package/lib/index.mjs CHANGED
@@ -277,28 +277,22 @@ function nodeAndInputSchemaFromInputs(inputs, _routerPath, options, addDataFunct
277
277
  };
278
278
  }
279
279
  if (inputs.length !== 1) {
280
- return { parseInputResult: "failure", error: `Inputs length is ${inputs.length}` };
280
+ return { parseInputResult: "failure" };
281
281
  }
282
282
  const input = inputs[0];
283
- try {
284
- return {
285
- parseInputResult: "success",
286
- schema: zodToJsonSchema(input, {
287
- errorMessages: true,
288
- $refStrategy: "none",
289
- target: "jsonSchema7"
290
- }),
291
- node: zodSelectorFunction(input._def, {
292
- path: [],
293
- options,
294
- addDataFunctions,
295
- }),
296
- };
297
- }
298
- catch (e) {
299
- console.error("Error parsing input schema:", e);
300
- return { parseInputResult: "failure", error: "Exception in zodToJsonSchema or zodSelectorFunction" };
301
- }
283
+ return {
284
+ parseInputResult: "success",
285
+ schema: zodToJsonSchema(input, {
286
+ errorMessages: true,
287
+ $refStrategy: "none",
288
+ target: "jsonSchema7"
289
+ }),
290
+ node: zodSelectorFunction(input._def, {
291
+ path: [],
292
+ options,
293
+ addDataFunctions,
294
+ }),
295
+ };
302
296
  }
303
297
  function parseProcedure(procedure, path, options) {
304
298
  var _a, _b;
@@ -316,7 +310,6 @@ function parseProcedure(procedure, path, options) {
316
310
  },
317
311
  });
318
312
  if (nodeAndInput.parseInputResult === "failure") {
319
- console.warn(`parseProcedure failed for ${path.join(".")}: nodeAndInput failed. Error: ${nodeAndInput.error}`);
320
313
  return null;
321
314
  }
322
315
  const t = (() => {
@@ -329,7 +322,6 @@ function parseProcedure(procedure, path, options) {
329
322
  return null;
330
323
  })();
331
324
  if (!t) {
332
- console.warn(`parseProcedure failed for ${path.join(".")}: could not determine procedure type.`);
333
325
  return null;
334
326
  }
335
327
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc-panel/core",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "UI for testing tRPC backends",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.mjs",