pasika 0.10.11 → 0.10.13

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.
@@ -1865,6 +1865,12 @@ function expectedSupportFolder(kinds) {
1865
1865
  }
1866
1866
  return void 0;
1867
1867
  }
1868
+ function mixedSupportKinds(folder, kinds) {
1869
+ if (folder === "types") return kinds.has("type") && (kinds.has("constant") || kinds.has("schema"));
1870
+ if (folder === "schemas") return kinds.has("schema") && kinds.has("constant");
1871
+ if (folder === "constants") return kinds.has("constant") && kinds.has("schema");
1872
+ return false;
1873
+ }
1868
1874
  function configModuleRoot(filename, sourceRoot) {
1869
1875
  const segments = segmentsOf(filename, sourceRoot);
1870
1876
  if (segments[0] !== "config" || segments.length < 3) return void 0;
@@ -1991,6 +1997,12 @@ var applicationStructureRule = {
1991
1997
  `A support folder must not contain a component; move ${path13.basename(filename)} beside ${currentFolder}/.`
1992
1998
  );
1993
1999
  }
2000
+ if (mixedSupportKinds(currentFolder, kinds)) {
2001
+ return report2(
2002
+ context,
2003
+ `A ${currentFolder}/ folder must not mix unrelated support kinds; keep types, schemas, and constants in their matching folders.`
2004
+ );
2005
+ }
1994
2006
  const expected = expectedSupportFolder(kinds);
1995
2007
  if (expected !== void 0 && expected !== currentFolder) {
1996
2008
  return report2(
@@ -1,8 +1,9 @@
1
1
  import { ZodType, z } from 'zod';
2
2
 
3
- interface ZodFetchOptions<TSchema extends ZodType = never> {
3
+ interface ZodFetchOptions<TSchema extends ZodType = never, TRequestSchema extends ZodType = ZodType> {
4
4
  url: string | URL;
5
5
  init?: RequestInit;
6
+ requestSchema?: TRequestSchema;
6
7
  responseSchema?: TSchema;
7
8
  }
8
9
  /** The response itself, for a caller whose own response relays a body nothing has read. */
@@ -15,6 +15,11 @@ function decodeFailureBody(body) {
15
15
  }
16
16
  }
17
17
  async function zodFetch(options) {
18
+ if (options.requestSchema !== void 0) {
19
+ const rawBody = options.init?.body;
20
+ const body2 = typeof rawBody === "string" ? JSON.parse(rawBody) : rawBody;
21
+ options.requestSchema.parse(body2);
22
+ }
18
23
  const response = await fetch(options.url, options.init);
19
24
  if (!response.ok) {
20
25
  const body2 = await response.text();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pasika",
3
- "version": "0.10.11",
3
+ "version": "0.10.13",
4
4
  "description": "Reusable agent setup package",
5
5
  "repository": {
6
6
  "type": "git",