@suss/extractor 0.12.0 → 0.13.0

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
@@ -148,7 +148,7 @@ function httpRouteDiscovery(opts) {
148
148
  position: "methodName",
149
149
  nameMap: { all: "*" }
150
150
  },
151
- path: { type: "fromRegistration", position: 0 }
151
+ path: { type: "fromArgument", position: 0 }
152
152
  },
153
153
  ...opts.mount !== void 0 ? { mount: opts.mount } : {},
154
154
  requiresImport: [opts.importModule]
package/dist/index.d.cts CHANGED
@@ -23,10 +23,6 @@ type DiscoveryMatch = {
23
23
  importModule: string;
24
24
  importName: string;
25
25
  registrationChain: string[];
26
- } | {
27
- type: "decorator";
28
- decoratorModule: string;
29
- decoratorName: string;
30
26
  } | {
31
27
  type: "fileConvention";
32
28
  filePattern: string;
@@ -471,7 +467,7 @@ type BindingExtraction = {
471
467
  value: string;
472
468
  };
473
469
  path: {
474
- type: "fromRegistration";
470
+ type: "fromArgument";
475
471
  position: number;
476
472
  } | {
477
473
  type: "fromArgumentProperty";
@@ -521,9 +517,6 @@ type BindingExtraction = {
521
517
  type: "fromContract";
522
518
  } | {
523
519
  type: "fromClientMethod";
524
- } | {
525
- type: "fromArgumentLiteral";
526
- position: number;
527
520
  };
528
521
  };
529
522
  interface DiscoveryPattern {
@@ -727,12 +720,6 @@ interface ContractPattern {
727
720
  };
728
721
  }
729
722
  type InputMappingPattern = {
730
- /** Single object parameter, e.g. React Router LoaderFunctionArgs */
731
- type: "singleObjectParam";
732
- paramPosition: number;
733
- /** Property name → role, e.g. { params: "pathParams", request: "request" } */
734
- knownProperties: Record<string, string>;
735
- } | {
736
723
  /** Positional parameters, e.g. Express (req, res, next) */
737
724
  type: "positionalParams";
738
725
  params: Array<{
@@ -740,10 +727,21 @@ type InputMappingPattern = {
740
727
  role: string;
741
728
  }>;
742
729
  } | {
743
- /** Destructured from framework call, e.g. ts-rest { params, body, query } */
744
- type: "destructuredObject";
745
- /** Property name → role, e.g. { params: "pathParams", body: "requestBody" } */
730
+ /**
731
+ * One object parameter whose properties are the inputs, the way
732
+ * ts-rest passes `{ params, body, query }` and React Router passes
733
+ * `{ params, request }`. A handler that destructures it gets one
734
+ * input per name it binds; a handler that takes it whole gets a
735
+ * single input, since the source does not say which properties it
736
+ * reads.
737
+ */
738
+ type: "objectParam";
739
+ /** Defaults to the first parameter. */
740
+ paramPosition?: number;
741
+ /** Property name mapped to the role it takes, e.g. `{ params: "pathParams" }`. A name not here keeps the name it was bound under. */
746
742
  knownProperties: Record<string, string>;
743
+ /** The role for a parameter taken whole. Defaults to "request". */
744
+ wholeParamRole?: string;
747
745
  } | {
748
746
  /**
749
747
  * Component props, React / Vue / Svelte-style: one parameter that
@@ -753,10 +751,10 @@ type InputMappingPattern = {
753
751
  * not destructured (`function X(props) {...}`), a single Input comes
754
752
  * out with `wholeParamRole`, which defaults to `"props"`.
755
753
  *
756
- * This differs from `destructuredObject` because the pack does not
757
- * declare the prop names up front; they are whatever the component
758
- * author wrote. It differs from `singleObjectParam` because the
759
- * destructuring pattern is respected when there is one.
754
+ * This differs from `objectParam` in two ways. The pack declares no
755
+ * prop names up front, since they are whatever the component author
756
+ * wrote, and each input records the type text of the prop, which a
757
+ * component's shape comparison reads.
760
758
  */
761
759
  type: "componentProps";
762
760
  paramPosition: number;
@@ -769,7 +767,7 @@ type InputMappingPattern = {
769
767
  * reachable-closure pass for internal library functions, where no
770
768
  * framework declares a set of roles, so the name a caller sees IS
771
769
  * the role. Destructured parameters are captured the
772
- * same way `destructuredObject` captures them, so `(ctx, { userId })`
770
+ * same way `objectParam` captures them, so `(ctx, { userId })`
773
771
  * gives two inputs, `ctx` and `userId`.
774
772
  */
775
773
  type: "allPositional";
package/dist/index.d.ts CHANGED
@@ -23,10 +23,6 @@ type DiscoveryMatch = {
23
23
  importModule: string;
24
24
  importName: string;
25
25
  registrationChain: string[];
26
- } | {
27
- type: "decorator";
28
- decoratorModule: string;
29
- decoratorName: string;
30
26
  } | {
31
27
  type: "fileConvention";
32
28
  filePattern: string;
@@ -471,7 +467,7 @@ type BindingExtraction = {
471
467
  value: string;
472
468
  };
473
469
  path: {
474
- type: "fromRegistration";
470
+ type: "fromArgument";
475
471
  position: number;
476
472
  } | {
477
473
  type: "fromArgumentProperty";
@@ -521,9 +517,6 @@ type BindingExtraction = {
521
517
  type: "fromContract";
522
518
  } | {
523
519
  type: "fromClientMethod";
524
- } | {
525
- type: "fromArgumentLiteral";
526
- position: number;
527
520
  };
528
521
  };
529
522
  interface DiscoveryPattern {
@@ -727,12 +720,6 @@ interface ContractPattern {
727
720
  };
728
721
  }
729
722
  type InputMappingPattern = {
730
- /** Single object parameter, e.g. React Router LoaderFunctionArgs */
731
- type: "singleObjectParam";
732
- paramPosition: number;
733
- /** Property name → role, e.g. { params: "pathParams", request: "request" } */
734
- knownProperties: Record<string, string>;
735
- } | {
736
723
  /** Positional parameters, e.g. Express (req, res, next) */
737
724
  type: "positionalParams";
738
725
  params: Array<{
@@ -740,10 +727,21 @@ type InputMappingPattern = {
740
727
  role: string;
741
728
  }>;
742
729
  } | {
743
- /** Destructured from framework call, e.g. ts-rest { params, body, query } */
744
- type: "destructuredObject";
745
- /** Property name → role, e.g. { params: "pathParams", body: "requestBody" } */
730
+ /**
731
+ * One object parameter whose properties are the inputs, the way
732
+ * ts-rest passes `{ params, body, query }` and React Router passes
733
+ * `{ params, request }`. A handler that destructures it gets one
734
+ * input per name it binds; a handler that takes it whole gets a
735
+ * single input, since the source does not say which properties it
736
+ * reads.
737
+ */
738
+ type: "objectParam";
739
+ /** Defaults to the first parameter. */
740
+ paramPosition?: number;
741
+ /** Property name mapped to the role it takes, e.g. `{ params: "pathParams" }`. A name not here keeps the name it was bound under. */
746
742
  knownProperties: Record<string, string>;
743
+ /** The role for a parameter taken whole. Defaults to "request". */
744
+ wholeParamRole?: string;
747
745
  } | {
748
746
  /**
749
747
  * Component props, React / Vue / Svelte-style: one parameter that
@@ -753,10 +751,10 @@ type InputMappingPattern = {
753
751
  * not destructured (`function X(props) {...}`), a single Input comes
754
752
  * out with `wholeParamRole`, which defaults to `"props"`.
755
753
  *
756
- * This differs from `destructuredObject` because the pack does not
757
- * declare the prop names up front; they are whatever the component
758
- * author wrote. It differs from `singleObjectParam` because the
759
- * destructuring pattern is respected when there is one.
754
+ * This differs from `objectParam` in two ways. The pack declares no
755
+ * prop names up front, since they are whatever the component author
756
+ * wrote, and each input records the type text of the prop, which a
757
+ * component's shape comparison reads.
760
758
  */
761
759
  type: "componentProps";
762
760
  paramPosition: number;
@@ -769,7 +767,7 @@ type InputMappingPattern = {
769
767
  * reachable-closure pass for internal library functions, where no
770
768
  * framework declares a set of roles, so the name a caller sees IS
771
769
  * the role. Destructured parameters are captured the
772
- * same way `destructuredObject` captures them, so `(ctx, { userId })`
770
+ * same way `objectParam` captures them, so `(ctx, { userId })`
773
771
  * gives two inputs, `ctx` and `userId`.
774
772
  */
775
773
  type: "allPositional";
package/dist/index.js CHANGED
@@ -106,7 +106,7 @@ function httpRouteDiscovery(opts) {
106
106
  position: "methodName",
107
107
  nameMap: { all: "*" }
108
108
  },
109
- path: { type: "fromRegistration", position: 0 }
109
+ path: { type: "fromArgument", position: 0 }
110
110
  },
111
111
  ...opts.mount !== void 0 ? { mount: opts.mount } : {},
112
112
  requiresImport: [opts.importModule]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suss/extractor",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
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.12.0"
48
+ "@suss/behavioral-ir": "0.13.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "tsup": "*",