@suss/extractor 0.5.7 → 0.5.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/dist/index.cjs CHANGED
@@ -969,7 +969,7 @@ var terminalConverters = {
969
969
  return { type: "response", statusCode, body, headers: {} };
970
970
  },
971
971
  throw: (t) => {
972
- if (t.statusCode) {
972
+ if (t.statusCode && t.producesResponse === true) {
973
973
  const statusCode = t.statusCode.type === "literal" ? { type: "literal", value: t.statusCode.value } : { type: "unresolved", sourceText: t.statusCode.sourceText };
974
974
  return {
975
975
  type: "response",
package/dist/index.d.cts CHANGED
@@ -922,6 +922,13 @@ interface TerminalPattern {
922
922
  kind: "response" | "throw" | "return" | "render";
923
923
  match: TerminalMatch;
924
924
  extraction: TerminalExtraction;
925
+ /**
926
+ * On a throw terminal: the framework turns the thrown status into
927
+ * the wire response, so a resolved status makes the output a
928
+ * response. HTTP packs state this; a pack reading a non-HTTP code
929
+ * space off throws leaves it off and the throw stays a throw (#149).
930
+ */
931
+ producesResponse?: boolean;
925
932
  }
926
933
  interface ContractPattern {
927
934
  /** How to find the contract object. A contract is a data structure rather
@@ -938,6 +945,19 @@ interface ContractPattern {
938
945
  paramsExtraction?: {
939
946
  property: string;
940
947
  };
948
+ /**
949
+ * Where the reader finds one endpoint's contract object. Left out,
950
+ * the ts-rest shape applies: one contract object contains every
951
+ * endpoint keyed by handler name, and the reader walks up from the
952
+ * handler to the enclosing router call. With `registrationArgument`,
953
+ * the zod-openapi shape applies instead: `app.openapi(route, handler)`
954
+ * passes the endpoint's own contract as the handler's sibling
955
+ * argument.
956
+ */
957
+ endpoint?: {
958
+ from: "registrationArgument";
959
+ position: number;
960
+ };
941
961
  }
942
962
  type InputMappingPattern = {
943
963
  /** Single object parameter, e.g. React Router LoaderFunctionArgs */
@@ -1227,6 +1247,24 @@ interface PatternPack {
1227
1247
  * available without importing anything).
1228
1248
  */
1229
1249
  requiresImport?: string[];
1250
+ /**
1251
+ * Environment variables the pack's library reads from inside
1252
+ * node_modules, where no walk ever looks. Declaring them keeps the
1253
+ * checker from telling a template that a variable is unused when the
1254
+ * library reads it on every invocation. The adapter emits one marker
1255
+ * summary per entry whose `module` some project file imports, and
1256
+ * the runtime-config pairing consults the markers before it accuses.
1257
+ * The module match is a specifier prefix, so one entry covers a
1258
+ * scoped family like `@aws-lambda-powertools/`.
1259
+ */
1260
+ libraryEnvVars?: Array<{
1261
+ /** Module-specifier prefix the library's imports start with. */
1262
+ module: string;
1263
+ /** Env-var name prefixes the library reads, e.g. "POWERTOOLS_". */
1264
+ prefixes?: string[];
1265
+ /** Exact env-var names the library reads. */
1266
+ names?: string[];
1267
+ }>;
1230
1268
  /**
1231
1269
  * Library wrappers that return the function they wrapped. The adapter
1232
1270
  * works this out on its own for a factory inside the project by reading
@@ -1596,6 +1634,8 @@ interface RawTerminal {
1596
1634
  } | null;
1597
1635
  exceptionType: string | null;
1598
1636
  message: string | null;
1637
+ /** Set on a throw whose pack declared the thrown status is the wire response. */
1638
+ producesResponse?: boolean;
1599
1639
  component: string | null;
1600
1640
  /** Null when the pack read only the root element name, not the tree under it. */
1601
1641
  renderTree: RenderNode | null;
package/dist/index.d.ts CHANGED
@@ -922,6 +922,13 @@ interface TerminalPattern {
922
922
  kind: "response" | "throw" | "return" | "render";
923
923
  match: TerminalMatch;
924
924
  extraction: TerminalExtraction;
925
+ /**
926
+ * On a throw terminal: the framework turns the thrown status into
927
+ * the wire response, so a resolved status makes the output a
928
+ * response. HTTP packs state this; a pack reading a non-HTTP code
929
+ * space off throws leaves it off and the throw stays a throw (#149).
930
+ */
931
+ producesResponse?: boolean;
925
932
  }
926
933
  interface ContractPattern {
927
934
  /** How to find the contract object. A contract is a data structure rather
@@ -938,6 +945,19 @@ interface ContractPattern {
938
945
  paramsExtraction?: {
939
946
  property: string;
940
947
  };
948
+ /**
949
+ * Where the reader finds one endpoint's contract object. Left out,
950
+ * the ts-rest shape applies: one contract object contains every
951
+ * endpoint keyed by handler name, and the reader walks up from the
952
+ * handler to the enclosing router call. With `registrationArgument`,
953
+ * the zod-openapi shape applies instead: `app.openapi(route, handler)`
954
+ * passes the endpoint's own contract as the handler's sibling
955
+ * argument.
956
+ */
957
+ endpoint?: {
958
+ from: "registrationArgument";
959
+ position: number;
960
+ };
941
961
  }
942
962
  type InputMappingPattern = {
943
963
  /** Single object parameter, e.g. React Router LoaderFunctionArgs */
@@ -1227,6 +1247,24 @@ interface PatternPack {
1227
1247
  * available without importing anything).
1228
1248
  */
1229
1249
  requiresImport?: string[];
1250
+ /**
1251
+ * Environment variables the pack's library reads from inside
1252
+ * node_modules, where no walk ever looks. Declaring them keeps the
1253
+ * checker from telling a template that a variable is unused when the
1254
+ * library reads it on every invocation. The adapter emits one marker
1255
+ * summary per entry whose `module` some project file imports, and
1256
+ * the runtime-config pairing consults the markers before it accuses.
1257
+ * The module match is a specifier prefix, so one entry covers a
1258
+ * scoped family like `@aws-lambda-powertools/`.
1259
+ */
1260
+ libraryEnvVars?: Array<{
1261
+ /** Module-specifier prefix the library's imports start with. */
1262
+ module: string;
1263
+ /** Env-var name prefixes the library reads, e.g. "POWERTOOLS_". */
1264
+ prefixes?: string[];
1265
+ /** Exact env-var names the library reads. */
1266
+ names?: string[];
1267
+ }>;
1230
1268
  /**
1231
1269
  * Library wrappers that return the function they wrapped. The adapter
1232
1270
  * works this out on its own for a factory inside the project by reading
@@ -1596,6 +1634,8 @@ interface RawTerminal {
1596
1634
  } | null;
1597
1635
  exceptionType: string | null;
1598
1636
  message: string | null;
1637
+ /** Set on a throw whose pack declared the thrown status is the wire response. */
1638
+ producesResponse?: boolean;
1599
1639
  component: string | null;
1600
1640
  /** Null when the pack read only the root element name, not the tree under it. */
1601
1641
  renderTree: RenderNode | null;
package/dist/index.js CHANGED
@@ -927,7 +927,7 @@ var terminalConverters = {
927
927
  return { type: "response", statusCode, body, headers: {} };
928
928
  },
929
929
  throw: (t) => {
930
- if (t.statusCode) {
930
+ if (t.statusCode && t.producesResponse === true) {
931
931
  const statusCode = t.statusCode.type === "literal" ? { type: "literal", value: t.statusCode.value } : { type: "unresolved", sourceText: t.statusCode.sourceText };
932
932
  return {
933
933
  type: "response",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suss/extractor",
3
- "version": "0.5.7",
3
+ "version": "0.5.9",
4
4
  "type": "module",
5
5
  "description": "Framework-agnostic extraction pipeline that turns raw extractions into suss behavioral summaries.",
6
6
  "keywords": [
@@ -45,7 +45,7 @@
45
45
  "typecheck": "tsc --noEmit"
46
46
  },
47
47
  "dependencies": {
48
- "@suss/behavioral-ir": "0.5.7"
48
+ "@suss/behavioral-ir": "0.5.9"
49
49
  },
50
50
  "devDependencies": {
51
51
  "tsup": "*",