@friggframework/devtools 2.0.0--canary.596.6355e72.0 → 2.0.0--canary.596.97a5c6b.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.
@@ -386,9 +386,24 @@ class IntegrationBuilder extends InfrastructureBuilder {
386
386
  binding.useDatabase ??
387
387
  (extension && extension.useDatabase) ??
388
388
  false;
389
+ // fnName is the wire contract with core's integration-defined-routers
390
+ // (it exports handlers[`${name}__${sanitizeBindingKey(binding)}`]).
391
+ // Keep this derivation IN SYNC with that file.
389
392
  const fnName = `${integrationName}__${sanitizeBindingKey(
390
393
  bindingKey
391
394
  )}`;
395
+ // Guard the same silent-overwrite the runtime router guards: two
396
+ // binding keys that sanitize to the same value would clobber one
397
+ // function definition while leaving both httpApi paths live.
398
+ if (
399
+ Object.prototype.hasOwnProperty.call(result.functions, fnName)
400
+ ) {
401
+ throw new Error(
402
+ `Integration "${integrationName}" extension function conflict: ` +
403
+ `binding "${bindingKey}" sanitizes to "${fnName}", which is already taken. ` +
404
+ `Use binding keys that are distinct after stripping non-alphanumeric characters.`
405
+ );
406
+ }
392
407
  result.functions[fnName] = {
393
408
  handler: `node_modules/@friggframework/core/handlers/routers/integration-defined-routers.handlers.${fnName}.handler`,
394
409
  skipEsbuild: true,
@@ -668,6 +668,30 @@ describe('IntegrationBuilder', () => {
668
668
  expect(withoutDb.functions.hs__wh.layers).toBeUndefined();
669
669
  });
670
670
 
671
+ it('throws when two binding keys sanitize to the same function name', async () => {
672
+ const mkExt = (name, event) => ({
673
+ name,
674
+ routes: [{ path: '/w', method: 'POST', event }],
675
+ events: { [event]: { handler: () => {} } },
676
+ });
677
+ const appDefinition = {
678
+ integrations: [
679
+ {
680
+ Definition: {
681
+ name: 'hs',
682
+ extensions: {
683
+ 'hub-spot': { extension: mkExt('a', 'A') }, // → hs__hubspot
684
+ hubspot: { extension: mkExt('b', 'B') }, // → hs__hubspot
685
+ },
686
+ },
687
+ },
688
+ ],
689
+ };
690
+ await expect(
691
+ integrationBuilder.build(appDefinition, {})
692
+ ).rejects.toThrow(/extension function conflict.*hs__hubspot/);
693
+ });
694
+
671
695
  it('should only have the catch-all proxy route when no extensions are declared', async () => {
672
696
  const appDefinition = {
673
697
  integrations: [{ Definition: { name: 'plain' } }],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@friggframework/devtools",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "2.0.0--canary.596.6355e72.0",
4
+ "version": "2.0.0--canary.596.97a5c6b.0",
5
5
  "bin": {
6
6
  "frigg": "./frigg-cli/index.js"
7
7
  },
@@ -25,9 +25,9 @@
25
25
  "@babel/eslint-parser": "^7.18.9",
26
26
  "@babel/parser": "^7.25.3",
27
27
  "@babel/traverse": "^7.25.3",
28
- "@friggframework/core": "2.0.0--canary.596.6355e72.0",
29
- "@friggframework/schemas": "2.0.0--canary.596.6355e72.0",
30
- "@friggframework/test": "2.0.0--canary.596.6355e72.0",
28
+ "@friggframework/core": "2.0.0--canary.596.97a5c6b.0",
29
+ "@friggframework/schemas": "2.0.0--canary.596.97a5c6b.0",
30
+ "@friggframework/test": "2.0.0--canary.596.97a5c6b.0",
31
31
  "@hapi/boom": "^10.0.1",
32
32
  "@inquirer/prompts": "^5.3.8",
33
33
  "axios": "^1.7.2",
@@ -55,8 +55,8 @@
55
55
  "validate-npm-package-name": "^5.0.0"
56
56
  },
57
57
  "devDependencies": {
58
- "@friggframework/eslint-config": "2.0.0--canary.596.6355e72.0",
59
- "@friggframework/prettier-config": "2.0.0--canary.596.6355e72.0",
58
+ "@friggframework/eslint-config": "2.0.0--canary.596.97a5c6b.0",
59
+ "@friggframework/prettier-config": "2.0.0--canary.596.97a5c6b.0",
60
60
  "aws-sdk-client-mock": "^4.1.0",
61
61
  "aws-sdk-client-mock-jest": "^4.1.0",
62
62
  "jest": "^30.1.3",
@@ -88,5 +88,5 @@
88
88
  "publishConfig": {
89
89
  "access": "public"
90
90
  },
91
- "gitHead": "6355e7230ef1f29f10e5336c88d4ddd257dffe18"
91
+ "gitHead": "97a5c6bc4217a0fcaaa6e6fa7baeb4b179f06d41"
92
92
  }