@mondaydotcomorg/z2h-shared-utils 0.9.0 → 0.10.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.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=integrations.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integrations.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/integrations.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=integrations.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integrations.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integrations.test.ts"],"names":[],"mappings":""}
@@ -1,4 +1,4 @@
1
1
  export * from './constants';
2
- export { ALWAYS_ON_CHANNELS, DECLARED_INTEGRATIONS, type AlwaysOnChannel, type DeclaredIntegration, } from './integrations';
2
+ export { ALWAYS_ON_CHANNELS, CUSTOM_INTEGRATION_ALLOWED_HOSTS, DECLARED_INTEGRATIONS, isAllowedCustomIntegrationHost, type AlwaysOnChannel, type DeclaredIntegration, } from './integrations';
3
3
  export type { AppVersionSummary, AppVersionsResponse, DeployVersion } from './appVersions';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,KAAK,eAAe,EACpB,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,gCAAgC,EAChC,qBAAqB,EACrB,8BAA8B,EAC9B,KAAK,eAAe,EACpB,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC"}
@@ -1,2 +1,2 @@
1
1
  export { APP_NAME_PATTERN, APP_USAGE_BUCKET_NAME, APP_USAGE_PREFIX, BUCKET_READ_DNS_NAME, BUCKET_READ_DNS_URL, BUCKET_WRITE_NAME, BUCKET_WRITE_URL, DATAVIZ_SKILLS_PREFIX, MANIFEST_KEY, MANIFEST_READ_URL, PREVIEW_APP_NAME_PREFIX, REGION, S3_PREVIEWS_FOLDER, S3_SKILLS_BUCKET_NAME, appUsageFolder } from './constants.mjs';
2
- export { ALWAYS_ON_CHANNELS, DECLARED_INTEGRATIONS } from './integrations.mjs';
2
+ export { ALWAYS_ON_CHANNELS, CUSTOM_INTEGRATION_ALLOWED_HOSTS, DECLARED_INTEGRATIONS, isAllowedCustomIntegrationHost } from './integrations.mjs';
@@ -12,4 +12,12 @@ export type AlwaysOnChannel = (typeof ALWAYS_ON_CHANNELS)[number];
12
12
  */
13
13
  export declare const DECLARED_INTEGRATIONS: readonly ["monday"];
14
14
  export type DeclaredIntegration = (typeof DECLARED_INTEGRATIONS)[number];
15
+ /**
16
+ * Exact hostnames a custom integration may target. Enforced on every call by
17
+ * zth-backend-runner (not on save — registration is currently disabled), so
18
+ * removing a host here breaks every app using it on its next invoke.
19
+ */
20
+ export declare const CUSTOM_INTEGRATION_ALLOWED_HOSTS: readonly string[];
21
+ /** Case-insensitive, like DNS; stored hosts (`app_custom_integrations.allowed_host`) are already lowercased. */
22
+ export declare function isAllowedCustomIntegrationHost(host: string): boolean;
15
23
  //# sourceMappingURL=integrations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../../src/integrations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,0DAA2D,CAAC;AAC3F,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE;;;GAGG;AACH,eAAO,MAAM,qBAAqB,qBAAsB,CAAC;AACzD,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../../src/integrations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,0DAA2D,CAAC;AAC3F,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE;;;GAGG;AACH,eAAO,MAAM,qBAAqB,qBAAsB,CAAC;AACzD,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzE;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,EAAE,SAAS,MAAM,EAc7D,CAAC;AAEF,gHAAgH;AAChH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpE"}
@@ -10,5 +10,29 @@ const ALWAYS_ON_CHANNELS = ['db', 'llm', 'snowflake', 'customIntegration'];
10
10
  * sources and the broker validates on register/update.
11
11
  */
12
12
  const DECLARED_INTEGRATIONS = ['monday'];
13
+ /**
14
+ * Exact hostnames a custom integration may target. Enforced on every call by
15
+ * zth-backend-runner (not on save — registration is currently disabled), so
16
+ * removing a host here breaks every app using it on its next invoke.
17
+ */
18
+ const CUSTOM_INTEGRATION_ALLOWED_HOSTS = [
19
+ 'api.ads.openai.com',
20
+ 'api.ashbyhq.com',
21
+ 'api.datadoghq.eu', // gitleaks:allow
22
+ 'api.eu1.coralogix.com',
23
+ 'api.gdeltproject.org',
24
+ 'api.linkedin.com',
25
+ 'api.monday.com',
26
+ 'api.twilio.com',
27
+ 'hooks.slack.com',
28
+ 'n8n-hr.bigbrain.me',
29
+ 'redash.bigbrain.me',
30
+ 'reqres.in',
31
+ 'sdlc-agent-factory.monday.beer',
32
+ ];
33
+ /** Case-insensitive, like DNS; stored hosts (`app_custom_integrations.allowed_host`) are already lowercased. */
34
+ function isAllowedCustomIntegrationHost(host) {
35
+ return CUSTOM_INTEGRATION_ALLOWED_HOSTS.includes(host.toLowerCase());
36
+ }
13
37
 
14
- export { ALWAYS_ON_CHANNELS, DECLARED_INTEGRATIONS };
38
+ export { ALWAYS_ON_CHANNELS, CUSTOM_INTEGRATION_ALLOWED_HOSTS, DECLARED_INTEGRATIONS, isAllowedCustomIntegrationHost };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export * from './constants';
2
- export { ALWAYS_ON_CHANNELS, DECLARED_INTEGRATIONS, type AlwaysOnChannel, type DeclaredIntegration, } from './integrations';
2
+ export { ALWAYS_ON_CHANNELS, CUSTOM_INTEGRATION_ALLOWED_HOSTS, DECLARED_INTEGRATIONS, isAllowedCustomIntegrationHost, type AlwaysOnChannel, type DeclaredIntegration, } from './integrations';
3
3
  export type { AppVersionSummary, AppVersionsResponse, DeployVersion } from './appVersions';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,KAAK,eAAe,EACpB,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,gCAAgC,EAChC,qBAAqB,EACrB,8BAA8B,EAC9B,KAAK,eAAe,EACpB,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -21,4 +21,6 @@ exports.S3_PREVIEWS_FOLDER = constants.S3_PREVIEWS_FOLDER;
21
21
  exports.S3_SKILLS_BUCKET_NAME = constants.S3_SKILLS_BUCKET_NAME;
22
22
  exports.appUsageFolder = constants.appUsageFolder;
23
23
  exports.ALWAYS_ON_CHANNELS = integrations.ALWAYS_ON_CHANNELS;
24
+ exports.CUSTOM_INTEGRATION_ALLOWED_HOSTS = integrations.CUSTOM_INTEGRATION_ALLOWED_HOSTS;
24
25
  exports.DECLARED_INTEGRATIONS = integrations.DECLARED_INTEGRATIONS;
26
+ exports.isAllowedCustomIntegrationHost = integrations.isAllowedCustomIntegrationHost;
@@ -12,4 +12,12 @@ export type AlwaysOnChannel = (typeof ALWAYS_ON_CHANNELS)[number];
12
12
  */
13
13
  export declare const DECLARED_INTEGRATIONS: readonly ["monday"];
14
14
  export type DeclaredIntegration = (typeof DECLARED_INTEGRATIONS)[number];
15
+ /**
16
+ * Exact hostnames a custom integration may target. Enforced on every call by
17
+ * zth-backend-runner (not on save — registration is currently disabled), so
18
+ * removing a host here breaks every app using it on its next invoke.
19
+ */
20
+ export declare const CUSTOM_INTEGRATION_ALLOWED_HOSTS: readonly string[];
21
+ /** Case-insensitive, like DNS; stored hosts (`app_custom_integrations.allowed_host`) are already lowercased. */
22
+ export declare function isAllowedCustomIntegrationHost(host: string): boolean;
15
23
  //# sourceMappingURL=integrations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../src/integrations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,0DAA2D,CAAC;AAC3F,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE;;;GAGG;AACH,eAAO,MAAM,qBAAqB,qBAAsB,CAAC;AACzD,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../src/integrations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,0DAA2D,CAAC;AAC3F,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE;;;GAGG;AACH,eAAO,MAAM,qBAAqB,qBAAsB,CAAC;AACzD,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzE;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,EAAE,SAAS,MAAM,EAc7D,CAAC;AAEF,gHAAgH;AAChH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpE"}
@@ -12,6 +12,32 @@ const ALWAYS_ON_CHANNELS = ['db', 'llm', 'snowflake', 'customIntegration'];
12
12
  * sources and the broker validates on register/update.
13
13
  */
14
14
  const DECLARED_INTEGRATIONS = ['monday'];
15
+ /**
16
+ * Exact hostnames a custom integration may target. Enforced on every call by
17
+ * zth-backend-runner (not on save — registration is currently disabled), so
18
+ * removing a host here breaks every app using it on its next invoke.
19
+ */
20
+ const CUSTOM_INTEGRATION_ALLOWED_HOSTS = [
21
+ 'api.ads.openai.com',
22
+ 'api.ashbyhq.com',
23
+ 'api.datadoghq.eu', // gitleaks:allow
24
+ 'api.eu1.coralogix.com',
25
+ 'api.gdeltproject.org',
26
+ 'api.linkedin.com',
27
+ 'api.monday.com',
28
+ 'api.twilio.com',
29
+ 'hooks.slack.com',
30
+ 'n8n-hr.bigbrain.me',
31
+ 'redash.bigbrain.me',
32
+ 'reqres.in',
33
+ 'sdlc-agent-factory.monday.beer',
34
+ ];
35
+ /** Case-insensitive, like DNS; stored hosts (`app_custom_integrations.allowed_host`) are already lowercased. */
36
+ function isAllowedCustomIntegrationHost(host) {
37
+ return CUSTOM_INTEGRATION_ALLOWED_HOSTS.includes(host.toLowerCase());
38
+ }
15
39
 
16
40
  exports.ALWAYS_ON_CHANNELS = ALWAYS_ON_CHANNELS;
41
+ exports.CUSTOM_INTEGRATION_ALLOWED_HOSTS = CUSTOM_INTEGRATION_ALLOWED_HOSTS;
17
42
  exports.DECLARED_INTEGRATIONS = DECLARED_INTEGRATIONS;
43
+ exports.isAllowedCustomIntegrationHost = isAllowedCustomIntegrationHost;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mondaydotcomorg/z2h-shared-utils",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {
@@ -0,0 +1,24 @@
1
+ import { describe, expect, it } from 'vitest';
2
+
3
+ import { CUSTOM_INTEGRATION_ALLOWED_HOSTS, isAllowedCustomIntegrationHost } from '../integrations';
4
+
5
+ describe('isAllowedCustomIntegrationHost', () => {
6
+ it.each(CUSTOM_INTEGRATION_ALLOWED_HOSTS)('allows %s', host => {
7
+ expect(isAllowedCustomIntegrationHost(host)).toBe(true);
8
+ });
9
+
10
+ it('is case-insensitive', () => {
11
+ expect(isAllowedCustomIntegrationHost('API.Monday.com')).toBe(true);
12
+ });
13
+
14
+ it.each(['api.github.com', 'github.com', 'evil.com', 'api.monday.com.evil.com', 'monday.com', ''])(
15
+ 'rejects %j',
16
+ host => {
17
+ expect(isAllowedCustomIntegrationHost(host)).toBe(false);
18
+ }
19
+ );
20
+
21
+ it('keeps every host lowercase, matching how hosts are stored', () => {
22
+ expect(CUSTOM_INTEGRATION_ALLOWED_HOSTS.filter(host => host !== host.toLowerCase())).toEqual([]);
23
+ });
24
+ });
package/src/index.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  export * from './constants';
2
2
  export {
3
3
  ALWAYS_ON_CHANNELS,
4
+ CUSTOM_INTEGRATION_ALLOWED_HOSTS,
4
5
  DECLARED_INTEGRATIONS,
6
+ isAllowedCustomIntegrationHost,
5
7
  type AlwaysOnChannel,
6
8
  type DeclaredIntegration,
7
9
  } from './integrations';
@@ -13,3 +13,29 @@ export type AlwaysOnChannel = (typeof ALWAYS_ON_CHANNELS)[number];
13
13
  */
14
14
  export const DECLARED_INTEGRATIONS = ['monday'] as const;
15
15
  export type DeclaredIntegration = (typeof DECLARED_INTEGRATIONS)[number];
16
+
17
+ /**
18
+ * Exact hostnames a custom integration may target. Enforced on every call by
19
+ * zth-backend-runner (not on save — registration is currently disabled), so
20
+ * removing a host here breaks every app using it on its next invoke.
21
+ */
22
+ export const CUSTOM_INTEGRATION_ALLOWED_HOSTS: readonly string[] = [
23
+ 'api.ads.openai.com',
24
+ 'api.ashbyhq.com',
25
+ 'api.datadoghq.eu', // gitleaks:allow
26
+ 'api.eu1.coralogix.com',
27
+ 'api.gdeltproject.org',
28
+ 'api.linkedin.com',
29
+ 'api.monday.com',
30
+ 'api.twilio.com',
31
+ 'hooks.slack.com',
32
+ 'n8n-hr.bigbrain.me',
33
+ 'redash.bigbrain.me',
34
+ 'reqres.in',
35
+ 'sdlc-agent-factory.monday.beer',
36
+ ];
37
+
38
+ /** Case-insensitive, like DNS; stored hosts (`app_custom_integrations.allowed_host`) are already lowercased. */
39
+ export function isAllowedCustomIntegrationHost(host: string): boolean {
40
+ return CUSTOM_INTEGRATION_ALLOWED_HOSTS.includes(host.toLowerCase());
41
+ }