@suss/adapter-ruby 0.13.2 → 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
@@ -15296,7 +15296,7 @@ function date4(params) {
15296
15296
  // ../../../node_modules/zod/v4/classic/external.js
15297
15297
  config(en_default());
15298
15298
 
15299
- // ../../ir-core/dist/chunk-AQYS5AC6.js
15299
+ // ../../ir-core/dist/chunk-HSJYPBJU.js
15300
15300
  function gqlIdentityKey(typeName, fieldName) {
15301
15301
  return `gql:${typeName}.${fieldName}`;
15302
15302
  }
@@ -15569,6 +15569,13 @@ var metricSemantics = defineBoundarySemantics({
15569
15569
  }
15570
15570
  }
15571
15571
  });
15572
+ var SCHEME_ORIGIN = /^[a-zA-Z][a-zA-Z\d+.-]*:\/\/[^/]*/;
15573
+ var PROTOCOL_RELATIVE_ORIGIN = /^\/\/[^/]*/;
15574
+ function pathAfterOrigin(text) {
15575
+ const withoutOrigin = text.replace(SCHEME_ORIGIN, "").replace(PROTOCOL_RELATIVE_ORIGIN, "");
15576
+ const cut = withoutOrigin.search(/[?#]/);
15577
+ return cut === -1 ? withoutOrigin : withoutOrigin.slice(0, cut);
15578
+ }
15572
15579
  var RestSemanticsSchema = external_exports.object({
15573
15580
  name: external_exports.literal("rest"),
15574
15581
  /**
@@ -15587,6 +15594,11 @@ var RestSemanticsSchema = external_exports.object({
15587
15594
  */
15588
15595
  declaredResponses: external_exports.array(external_exports.number()).optional()
15589
15596
  });
15597
+ var OPENING_HOLE = /^\{([^{}]+)\}(.*)$/;
15598
+ function variableOf(label) {
15599
+ const parts = label.split(".");
15600
+ return parts[parts.length - 1] ?? label;
15601
+ }
15590
15602
  function normalizePath(path4) {
15591
15603
  let normalized = path4.replace(/:([a-zA-Z_]\w*)/g, "{$1}");
15592
15604
  if (normalized.length > 1 && normalized.endsWith("/")) {
@@ -15696,6 +15708,37 @@ var restSemantics = defineBoundarySemantics({
15696
15708
  }
15697
15709
  return routePathAdmits(semantics.path, path4) ? "match" : "nomatch";
15698
15710
  },
15711
+ /**
15712
+ * A call whose base URL the deployment fills in, resolved to the
15713
+ * path it reaches.
15714
+ *
15715
+ * The source cannot settle this on its own, which is why the
15716
+ * adapter leaves the hole in. `API_BASE` could be
15717
+ * `http://backend.internal`, and then the path is `/orders`. It
15718
+ * could equally be `/api/v2`, and then the path is
15719
+ * `/api/v2/orders`. Putting the deployed value in and reading the
15720
+ * path back out gets the right one either way.
15721
+ *
15722
+ * Only a hole at the front is a base URL. A hole further along is a
15723
+ * route parameter, and `/orders/{id}` means every id rather than a
15724
+ * variable somebody set.
15725
+ */
15726
+ groundName(semantics, deployedAs) {
15727
+ if (semantics.path === null) {
15728
+ return null;
15729
+ }
15730
+ const opening = OPENING_HOLE.exec(semantics.path);
15731
+ if (opening === null) {
15732
+ return null;
15733
+ }
15734
+ const [, label, rest] = opening;
15735
+ const base = deployedAs(variableOf(label));
15736
+ if (base === null) {
15737
+ return null;
15738
+ }
15739
+ const grounded = pathAfterOrigin(`${base}${rest}`);
15740
+ return { ...semantics, path: grounded === "" ? "/" : grounded };
15741
+ },
15699
15742
  ruleBoundary: {
15700
15743
  // "METHOD /path": one leading token, then an absolute path.
15701
15744
  claims(raw) {
package/dist/index.js CHANGED
@@ -15245,7 +15245,7 @@ function date4(params) {
15245
15245
  // ../../../node_modules/zod/v4/classic/external.js
15246
15246
  config(en_default());
15247
15247
 
15248
- // ../../ir-core/dist/chunk-AQYS5AC6.js
15248
+ // ../../ir-core/dist/chunk-HSJYPBJU.js
15249
15249
  function gqlIdentityKey(typeName, fieldName) {
15250
15250
  return `gql:${typeName}.${fieldName}`;
15251
15251
  }
@@ -15518,6 +15518,13 @@ var metricSemantics = defineBoundarySemantics({
15518
15518
  }
15519
15519
  }
15520
15520
  });
15521
+ var SCHEME_ORIGIN = /^[a-zA-Z][a-zA-Z\d+.-]*:\/\/[^/]*/;
15522
+ var PROTOCOL_RELATIVE_ORIGIN = /^\/\/[^/]*/;
15523
+ function pathAfterOrigin(text) {
15524
+ const withoutOrigin = text.replace(SCHEME_ORIGIN, "").replace(PROTOCOL_RELATIVE_ORIGIN, "");
15525
+ const cut = withoutOrigin.search(/[?#]/);
15526
+ return cut === -1 ? withoutOrigin : withoutOrigin.slice(0, cut);
15527
+ }
15521
15528
  var RestSemanticsSchema = external_exports.object({
15522
15529
  name: external_exports.literal("rest"),
15523
15530
  /**
@@ -15536,6 +15543,11 @@ var RestSemanticsSchema = external_exports.object({
15536
15543
  */
15537
15544
  declaredResponses: external_exports.array(external_exports.number()).optional()
15538
15545
  });
15546
+ var OPENING_HOLE = /^\{([^{}]+)\}(.*)$/;
15547
+ function variableOf(label) {
15548
+ const parts = label.split(".");
15549
+ return parts[parts.length - 1] ?? label;
15550
+ }
15539
15551
  function normalizePath(path4) {
15540
15552
  let normalized = path4.replace(/:([a-zA-Z_]\w*)/g, "{$1}");
15541
15553
  if (normalized.length > 1 && normalized.endsWith("/")) {
@@ -15645,6 +15657,37 @@ var restSemantics = defineBoundarySemantics({
15645
15657
  }
15646
15658
  return routePathAdmits(semantics.path, path4) ? "match" : "nomatch";
15647
15659
  },
15660
+ /**
15661
+ * A call whose base URL the deployment fills in, resolved to the
15662
+ * path it reaches.
15663
+ *
15664
+ * The source cannot settle this on its own, which is why the
15665
+ * adapter leaves the hole in. `API_BASE` could be
15666
+ * `http://backend.internal`, and then the path is `/orders`. It
15667
+ * could equally be `/api/v2`, and then the path is
15668
+ * `/api/v2/orders`. Putting the deployed value in and reading the
15669
+ * path back out gets the right one either way.
15670
+ *
15671
+ * Only a hole at the front is a base URL. A hole further along is a
15672
+ * route parameter, and `/orders/{id}` means every id rather than a
15673
+ * variable somebody set.
15674
+ */
15675
+ groundName(semantics, deployedAs) {
15676
+ if (semantics.path === null) {
15677
+ return null;
15678
+ }
15679
+ const opening = OPENING_HOLE.exec(semantics.path);
15680
+ if (opening === null) {
15681
+ return null;
15682
+ }
15683
+ const [, label, rest] = opening;
15684
+ const base = deployedAs(variableOf(label));
15685
+ if (base === null) {
15686
+ return null;
15687
+ }
15688
+ const grounded = pathAfterOrigin(`${base}${rest}`);
15689
+ return { ...semantics, path: grounded === "" ? "/" : grounded };
15690
+ },
15648
15691
  ruleBoundary: {
15649
15692
  // "METHOD /path": one leading token, then an absolute path.
15650
15693
  claims(raw) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suss/adapter-ruby",
3
- "version": "0.13.2",
3
+ "version": "0.14.0",
4
4
  "type": "module",
5
5
  "description": "Ruby language adapter for suss, parsing source with tree-sitter (WASM), resolving constant nesting with a lexical binder, and emitting raw extractions for the suss pipeline.",
6
6
  "keywords": [
@@ -47,9 +47,9 @@
47
47
  "typecheck": "tsc --noEmit"
48
48
  },
49
49
  "dependencies": {
50
- "@suss/behavioral-ir": "0.13.2",
51
- "@suss/datalog": "0.13.2",
52
- "@suss/extractor": "0.13.2",
50
+ "@suss/behavioral-ir": "0.14.0",
51
+ "@suss/datalog": "0.14.0",
52
+ "@suss/extractor": "0.14.0",
53
53
  "web-tree-sitter": "^0.26.11"
54
54
  },
55
55
  "devDependencies": {