@suss/extractor 0.18.0 → 0.20.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
@@ -866,6 +866,7 @@ function assembleSummary(raw, options = DEFAULT_OPTIONS) {
866
866
  location: {
867
867
  file: raw.identity.file,
868
868
  range: raw.identity.range,
869
+ ...raw.identity.span !== void 0 ? { span: raw.identity.span } : {},
869
870
  exportName: raw.identity.exportName
870
871
  },
871
872
  identity: {
@@ -899,6 +900,9 @@ function buildMetadata(raw) {
899
900
  label: raw.sourceDocumentLabel
900
901
  });
901
902
  }
903
+ if (raw.mount !== void 0) {
904
+ metadata = (0, import_behavioral_ir2.withMountMetadata)(metadata, raw.mount);
905
+ }
902
906
  return Object.keys(metadata).length > 0 ? metadata : null;
903
907
  }
904
908
  function buildHttpMetadataValue(raw) {
package/dist/index.d.cts CHANGED
@@ -1292,6 +1292,16 @@ interface DiscoveredCustomUnit {
1292
1292
  kind: string;
1293
1293
  /** Discovered name (e.g. "UserCard"). */
1294
1294
  name: string;
1295
+ /**
1296
+ * The unit's callable identity, when the pack states one: the module
1297
+ * it lives in and the name it goes by there. A server action is the
1298
+ * case, so intent and the keyed pairing pass can refer to it. The
1299
+ * adapter puts both on the unit's function-call binding.
1300
+ */
1301
+ functionCallInfo?: {
1302
+ module: string;
1303
+ exportName: string;
1304
+ };
1295
1305
  /**
1296
1306
  * Terminal patterns to extract from this unit's body. Defaults to
1297
1307
  * the pack-level `terminals` when unset.
@@ -2017,6 +2027,20 @@ interface CallOps {
2017
2027
  * `model("User", schema)` call it was declared as says everything.
2018
2028
  */
2019
2029
  callee(): CallOps | null;
2030
+ /**
2031
+ * Whether the call goes to a name the program bound, rather than to
2032
+ * an expression written in place. `useAppStore(...)` does;
2033
+ * `create()(...)` does not, even though both are bare calls.
2034
+ */
2035
+ namedCallee?(): boolean;
2036
+ /**
2037
+ * The properties the function argument in this position reads off
2038
+ * its first parameter, one per distinct first segment: `(s) =>
2039
+ * s.bears.count` reads `bears`, and a parameter used whole reads
2040
+ * `*`. Null when the argument is not a function of one plain
2041
+ * parameter.
2042
+ */
2043
+ parameterReadsAt?(index: number): readonly string[] | null;
2020
2044
  /**
2021
2045
  * What a named property of the object an argument states says. A
2022
2046
  * property bag is not a call, so nothing else here reaches into one.
@@ -2029,6 +2053,15 @@ interface CallOps {
2029
2053
  * for a pack whose rule has to walk it.
2030
2054
  */
2031
2055
  valueAt(index: number): ValueOps | null;
2056
+ /**
2057
+ * The one call behind the receiver the origin accepts, however many
2058
+ * name, construction, or query hops separate them. Mongoose's
2059
+ * `model(...)` behind a document is the picture. Null when nothing
2060
+ * behind the receiver matches, when two distinct calls do (picking
2061
+ * one would depend on the order facts arrived), and for an origin
2062
+ * kind with no construction to hand back.
2063
+ */
2064
+ anchorCall?(origin: ReceiverOrigin): CallOps | null;
2032
2065
  }
2033
2066
  /**
2034
2067
  * The property an adapter puts its ops on, in the context it hands a
@@ -2251,6 +2284,11 @@ interface RawCodeStructure {
2251
2284
  start: number;
2252
2285
  end: number;
2253
2286
  };
2287
+ /** Character offsets of the unit, when a source position backs it. */
2288
+ span?: {
2289
+ start: number;
2290
+ end: number;
2291
+ };
2254
2292
  exportName: string | null;
2255
2293
  exportPath: string[] | null;
2256
2294
  };
@@ -2292,6 +2330,11 @@ interface RawCodeStructure {
2292
2330
  /** The document this unit was read out of, when something else read out of
2293
2331
  * the same document states what this one relies on. */
2294
2332
  sourceDocumentLabel?: string;
2333
+ /** Set when several mounts serve the declaration and this unit is one of them. */
2334
+ mount?: {
2335
+ siblings: number;
2336
+ prefix: string;
2337
+ };
2295
2338
  /** The extractor cannot derive this. An adapter that has the SDL and knows
2296
2339
  * which field the resolver serves fills it in. */
2297
2340
  graphqlDeclaredContract?: GraphqlDeclaredContract;
package/dist/index.d.ts CHANGED
@@ -1292,6 +1292,16 @@ interface DiscoveredCustomUnit {
1292
1292
  kind: string;
1293
1293
  /** Discovered name (e.g. "UserCard"). */
1294
1294
  name: string;
1295
+ /**
1296
+ * The unit's callable identity, when the pack states one: the module
1297
+ * it lives in and the name it goes by there. A server action is the
1298
+ * case, so intent and the keyed pairing pass can refer to it. The
1299
+ * adapter puts both on the unit's function-call binding.
1300
+ */
1301
+ functionCallInfo?: {
1302
+ module: string;
1303
+ exportName: string;
1304
+ };
1295
1305
  /**
1296
1306
  * Terminal patterns to extract from this unit's body. Defaults to
1297
1307
  * the pack-level `terminals` when unset.
@@ -2017,6 +2027,20 @@ interface CallOps {
2017
2027
  * `model("User", schema)` call it was declared as says everything.
2018
2028
  */
2019
2029
  callee(): CallOps | null;
2030
+ /**
2031
+ * Whether the call goes to a name the program bound, rather than to
2032
+ * an expression written in place. `useAppStore(...)` does;
2033
+ * `create()(...)` does not, even though both are bare calls.
2034
+ */
2035
+ namedCallee?(): boolean;
2036
+ /**
2037
+ * The properties the function argument in this position reads off
2038
+ * its first parameter, one per distinct first segment: `(s) =>
2039
+ * s.bears.count` reads `bears`, and a parameter used whole reads
2040
+ * `*`. Null when the argument is not a function of one plain
2041
+ * parameter.
2042
+ */
2043
+ parameterReadsAt?(index: number): readonly string[] | null;
2020
2044
  /**
2021
2045
  * What a named property of the object an argument states says. A
2022
2046
  * property bag is not a call, so nothing else here reaches into one.
@@ -2029,6 +2053,15 @@ interface CallOps {
2029
2053
  * for a pack whose rule has to walk it.
2030
2054
  */
2031
2055
  valueAt(index: number): ValueOps | null;
2056
+ /**
2057
+ * The one call behind the receiver the origin accepts, however many
2058
+ * name, construction, or query hops separate them. Mongoose's
2059
+ * `model(...)` behind a document is the picture. Null when nothing
2060
+ * behind the receiver matches, when two distinct calls do (picking
2061
+ * one would depend on the order facts arrived), and for an origin
2062
+ * kind with no construction to hand back.
2063
+ */
2064
+ anchorCall?(origin: ReceiverOrigin): CallOps | null;
2032
2065
  }
2033
2066
  /**
2034
2067
  * The property an adapter puts its ops on, in the context it hands a
@@ -2251,6 +2284,11 @@ interface RawCodeStructure {
2251
2284
  start: number;
2252
2285
  end: number;
2253
2286
  };
2287
+ /** Character offsets of the unit, when a source position backs it. */
2288
+ span?: {
2289
+ start: number;
2290
+ end: number;
2291
+ };
2254
2292
  exportName: string | null;
2255
2293
  exportPath: string[] | null;
2256
2294
  };
@@ -2292,6 +2330,11 @@ interface RawCodeStructure {
2292
2330
  /** The document this unit was read out of, when something else read out of
2293
2331
  * the same document states what this one relies on. */
2294
2332
  sourceDocumentLabel?: string;
2333
+ /** Set when several mounts serve the declaration and this unit is one of them. */
2334
+ mount?: {
2335
+ siblings: number;
2336
+ prefix: string;
2337
+ };
2295
2338
  /** The extractor cannot derive this. An adapter that has the SDL and knows
2296
2339
  * which field the resolver serves fills it in. */
2297
2340
  graphqlDeclaredContract?: GraphqlDeclaredContract;
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@ import {
4
4
  exchangesHttpResponses,
5
5
  withGraphqlMetadata,
6
6
  withHttpMetadata,
7
+ withMountMetadata,
7
8
  withSourceDocumentMetadata
8
9
  } from "@suss/behavioral-ir";
9
10
 
@@ -823,6 +824,7 @@ function assembleSummary(raw, options = DEFAULT_OPTIONS) {
823
824
  location: {
824
825
  file: raw.identity.file,
825
826
  range: raw.identity.range,
827
+ ...raw.identity.span !== void 0 ? { span: raw.identity.span } : {},
826
828
  exportName: raw.identity.exportName
827
829
  },
828
830
  identity: {
@@ -856,6 +858,9 @@ function buildMetadata(raw) {
856
858
  label: raw.sourceDocumentLabel
857
859
  });
858
860
  }
861
+ if (raw.mount !== void 0) {
862
+ metadata = withMountMetadata(metadata, raw.mount);
863
+ }
859
864
  return Object.keys(metadata).length > 0 ? metadata : null;
860
865
  }
861
866
  function buildHttpMetadataValue(raw) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suss/extractor",
3
- "version": "0.18.0",
3
+ "version": "0.20.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.18.0"
48
+ "@suss/behavioral-ir": "0.20.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "tsup": "*",