@suss/adapter-python 0.13.3 → 0.14.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
@@ -15757,7 +15757,7 @@ function date4(params) {
15757
15757
  // ../../../node_modules/zod/v4/classic/external.js
15758
15758
  config(en_default());
15759
15759
 
15760
- // ../../ir-core/dist/chunk-AQYS5AC6.js
15760
+ // ../../ir-core/dist/chunk-HSJYPBJU.js
15761
15761
  function gqlIdentityKey(typeName, fieldName) {
15762
15762
  return `gql:${typeName}.${fieldName}`;
15763
15763
  }
@@ -16030,6 +16030,13 @@ var metricSemantics = defineBoundarySemantics({
16030
16030
  }
16031
16031
  }
16032
16032
  });
16033
+ var SCHEME_ORIGIN = /^[a-zA-Z][a-zA-Z\d+.-]*:\/\/[^/]*/;
16034
+ var PROTOCOL_RELATIVE_ORIGIN = /^\/\/[^/]*/;
16035
+ function pathAfterOrigin(text) {
16036
+ const withoutOrigin = text.replace(SCHEME_ORIGIN, "").replace(PROTOCOL_RELATIVE_ORIGIN, "");
16037
+ const cut = withoutOrigin.search(/[?#]/);
16038
+ return cut === -1 ? withoutOrigin : withoutOrigin.slice(0, cut);
16039
+ }
16033
16040
  var RestSemanticsSchema = external_exports.object({
16034
16041
  name: external_exports.literal("rest"),
16035
16042
  /**
@@ -16048,6 +16055,11 @@ var RestSemanticsSchema = external_exports.object({
16048
16055
  */
16049
16056
  declaredResponses: external_exports.array(external_exports.number()).optional()
16050
16057
  });
16058
+ var OPENING_HOLE = /^\{([^{}]+)\}(.*)$/;
16059
+ function variableOf(label) {
16060
+ const parts = label.split(".");
16061
+ return parts[parts.length - 1] ?? label;
16062
+ }
16051
16063
  function normalizePath(path4) {
16052
16064
  let normalized = path4.replace(/:([a-zA-Z_]\w*)/g, "{$1}");
16053
16065
  if (normalized.length > 1 && normalized.endsWith("/")) {
@@ -16157,6 +16169,37 @@ var restSemantics = defineBoundarySemantics({
16157
16169
  }
16158
16170
  return routePathAdmits(semantics.path, path4) ? "match" : "nomatch";
16159
16171
  },
16172
+ /**
16173
+ * A call whose base URL the deployment fills in, resolved to the
16174
+ * path it reaches.
16175
+ *
16176
+ * The source cannot settle this on its own, which is why the
16177
+ * adapter leaves the hole in. `API_BASE` could be
16178
+ * `http://backend.internal`, and then the path is `/orders`. It
16179
+ * could equally be `/api/v2`, and then the path is
16180
+ * `/api/v2/orders`. Putting the deployed value in and reading the
16181
+ * path back out gets the right one either way.
16182
+ *
16183
+ * Only a hole at the front is a base URL. A hole further along is a
16184
+ * route parameter, and `/orders/{id}` means every id rather than a
16185
+ * variable somebody set.
16186
+ */
16187
+ groundName(semantics, deployedAs) {
16188
+ if (semantics.path === null) {
16189
+ return null;
16190
+ }
16191
+ const opening = OPENING_HOLE.exec(semantics.path);
16192
+ if (opening === null) {
16193
+ return null;
16194
+ }
16195
+ const [, label, rest] = opening;
16196
+ const base = deployedAs(variableOf(label));
16197
+ if (base === null) {
16198
+ return null;
16199
+ }
16200
+ const grounded = pathAfterOrigin(`${base}${rest}`);
16201
+ return { ...semantics, path: grounded === "" ? "/" : grounded };
16202
+ },
16160
16203
  ruleBoundary: {
16161
16204
  // "METHOD /path": one leading token, then an absolute path.
16162
16205
  claims(raw) {
package/dist/index.js CHANGED
@@ -15713,7 +15713,7 @@ function date4(params) {
15713
15713
  // ../../../node_modules/zod/v4/classic/external.js
15714
15714
  config(en_default());
15715
15715
 
15716
- // ../../ir-core/dist/chunk-AQYS5AC6.js
15716
+ // ../../ir-core/dist/chunk-HSJYPBJU.js
15717
15717
  function gqlIdentityKey(typeName, fieldName) {
15718
15718
  return `gql:${typeName}.${fieldName}`;
15719
15719
  }
@@ -15986,6 +15986,13 @@ var metricSemantics = defineBoundarySemantics({
15986
15986
  }
15987
15987
  }
15988
15988
  });
15989
+ var SCHEME_ORIGIN = /^[a-zA-Z][a-zA-Z\d+.-]*:\/\/[^/]*/;
15990
+ var PROTOCOL_RELATIVE_ORIGIN = /^\/\/[^/]*/;
15991
+ function pathAfterOrigin(text) {
15992
+ const withoutOrigin = text.replace(SCHEME_ORIGIN, "").replace(PROTOCOL_RELATIVE_ORIGIN, "");
15993
+ const cut = withoutOrigin.search(/[?#]/);
15994
+ return cut === -1 ? withoutOrigin : withoutOrigin.slice(0, cut);
15995
+ }
15989
15996
  var RestSemanticsSchema = external_exports.object({
15990
15997
  name: external_exports.literal("rest"),
15991
15998
  /**
@@ -16004,6 +16011,11 @@ var RestSemanticsSchema = external_exports.object({
16004
16011
  */
16005
16012
  declaredResponses: external_exports.array(external_exports.number()).optional()
16006
16013
  });
16014
+ var OPENING_HOLE = /^\{([^{}]+)\}(.*)$/;
16015
+ function variableOf(label) {
16016
+ const parts = label.split(".");
16017
+ return parts[parts.length - 1] ?? label;
16018
+ }
16007
16019
  function normalizePath(path4) {
16008
16020
  let normalized = path4.replace(/:([a-zA-Z_]\w*)/g, "{$1}");
16009
16021
  if (normalized.length > 1 && normalized.endsWith("/")) {
@@ -16113,6 +16125,37 @@ var restSemantics = defineBoundarySemantics({
16113
16125
  }
16114
16126
  return routePathAdmits(semantics.path, path4) ? "match" : "nomatch";
16115
16127
  },
16128
+ /**
16129
+ * A call whose base URL the deployment fills in, resolved to the
16130
+ * path it reaches.
16131
+ *
16132
+ * The source cannot settle this on its own, which is why the
16133
+ * adapter leaves the hole in. `API_BASE` could be
16134
+ * `http://backend.internal`, and then the path is `/orders`. It
16135
+ * could equally be `/api/v2`, and then the path is
16136
+ * `/api/v2/orders`. Putting the deployed value in and reading the
16137
+ * path back out gets the right one either way.
16138
+ *
16139
+ * Only a hole at the front is a base URL. A hole further along is a
16140
+ * route parameter, and `/orders/{id}` means every id rather than a
16141
+ * variable somebody set.
16142
+ */
16143
+ groundName(semantics, deployedAs) {
16144
+ if (semantics.path === null) {
16145
+ return null;
16146
+ }
16147
+ const opening = OPENING_HOLE.exec(semantics.path);
16148
+ if (opening === null) {
16149
+ return null;
16150
+ }
16151
+ const [, label, rest] = opening;
16152
+ const base = deployedAs(variableOf(label));
16153
+ if (base === null) {
16154
+ return null;
16155
+ }
16156
+ const grounded = pathAfterOrigin(`${base}${rest}`);
16157
+ return { ...semantics, path: grounded === "" ? "/" : grounded };
16158
+ },
16116
16159
  ruleBoundary: {
16117
16160
  // "METHOD /path": one leading token, then an absolute path.
16118
16161
  claims(raw) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suss/adapter-python",
3
- "version": "0.13.3",
3
+ "version": "0.14.0",
4
4
  "type": "module",
5
5
  "description": "Python language adapter for suss — parses source with tree-sitter (WASM), resolves names with a lexical binder, and emits raw extractions for the suss pipeline.",
6
6
  "keywords": [
@@ -47,10 +47,10 @@
47
47
  "typecheck": "tsc --noEmit"
48
48
  },
49
49
  "dependencies": {
50
- "@suss/behavioral-ir": "0.13.3",
51
- "@suss/datalog": "0.13.3",
52
- "@suss/extractor": "0.13.3",
53
- "@suss/sql": "0.13.3",
50
+ "@suss/behavioral-ir": "0.14.0",
51
+ "@suss/datalog": "0.14.0",
52
+ "@suss/extractor": "0.14.0",
53
+ "@suss/sql": "0.14.0",
54
54
  "web-tree-sitter": "^0.26.11"
55
55
  },
56
56
  "devDependencies": {