@mondaydotcomorg/z2h-shared-utils 0.10.0 → 0.11.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.
@@ -1,4 +1,4 @@
1
1
  export * from './constants';
2
- export { ALWAYS_ON_CHANNELS, CUSTOM_INTEGRATION_ALLOWED_HOSTS, DECLARED_INTEGRATIONS, isAllowedCustomIntegrationHost, type AlwaysOnChannel, type DeclaredIntegration, } from './integrations';
2
+ export { ALWAYS_ON_CHANNELS, CUSTOM_INTEGRATION_HOST_STATUSES, DECLARED_INTEGRATIONS, type AlwaysOnChannel, type CustomIntegrationHostStatus, 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,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
+ {"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,KAAK,eAAe,EACpB,KAAK,2BAA2B,EAChC,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, CUSTOM_INTEGRATION_ALLOWED_HOSTS, DECLARED_INTEGRATIONS, isAllowedCustomIntegrationHost } from './integrations.mjs';
2
+ export { ALWAYS_ON_CHANNELS, CUSTOM_INTEGRATION_HOST_STATUSES, DECLARED_INTEGRATIONS } from './integrations.mjs';
@@ -13,11 +13,9 @@ export type AlwaysOnChannel = (typeof ALWAYS_ON_CHANNELS)[number];
13
13
  export declare const DECLARED_INTEGRATIONS: readonly ["monday"];
14
14
  export type DeclaredIntegration = (typeof DECLARED_INTEGRATIONS)[number];
15
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.
16
+ * Review state of a host a custom integration may target. Only `approved`
17
+ * hosts can be called; shared so every service compares against the same list.
19
18
  */
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;
19
+ export declare const CUSTOM_INTEGRATION_HOST_STATUSES: readonly ["requested", "approved", "rejected", "revoked"];
20
+ export type CustomIntegrationHostStatus = (typeof CUSTOM_INTEGRATION_HOST_STATUSES)[number];
23
21
  //# 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;AAEzE;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,EAAE,SAAS,MAAM,EAc7D,CAAC;AAEF,gHAAgH;AAChH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpE"}
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;;;GAGG;AACH,eAAO,MAAM,gCAAgC,2DAA4D,CAAC;AAC1G,MAAM,MAAM,2BAA2B,GAAG,CAAC,OAAO,gCAAgC,CAAC,CAAC,MAAM,CAAC,CAAC"}
@@ -11,28 +11,9 @@ const ALWAYS_ON_CHANNELS = ['db', 'llm', 'snowflake', 'customIntegration'];
11
11
  */
12
12
  const DECLARED_INTEGRATIONS = ['monday'];
13
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.
14
+ * Review state of a host a custom integration may target. Only `approved`
15
+ * hosts can be called; shared so every service compares against the same list.
17
16
  */
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
- }
17
+ const CUSTOM_INTEGRATION_HOST_STATUSES = ['requested', 'approved', 'rejected', 'revoked'];
37
18
 
38
- export { ALWAYS_ON_CHANNELS, CUSTOM_INTEGRATION_ALLOWED_HOSTS, DECLARED_INTEGRATIONS, isAllowedCustomIntegrationHost };
19
+ export { ALWAYS_ON_CHANNELS, CUSTOM_INTEGRATION_HOST_STATUSES, DECLARED_INTEGRATIONS };
@@ -38,6 +38,9 @@ export declare const BackendRunnerEvents: {
38
38
  readonly revokeFailedMetric: "z2h.integration_oauth.revoke.error";
39
39
  readonly tokenRequestMetric: "z2h.integration_oauth.token_request";
40
40
  };
41
+ readonly customIntegration: {
42
+ readonly hostDeniedMetric: "z2h.custom_integration.host_denied";
43
+ };
41
44
  readonly integrationToken: {
42
45
  readonly decryptFailedMetric: "z2h.integration_token.decrypt_failed";
43
46
  readonly unexpectedShapeMetric: "z2h.integration_token.unexpected_shape";
@@ -55,6 +58,10 @@ export declare const Z2hServiceEvents: {
55
58
  readonly npmProxy: {
56
59
  readonly failure: "z2h_npm_proxy_failure";
57
60
  };
61
+ readonly customIntegrationHosts: {
62
+ readonly requested: "z2h_custom_integration_host_requested";
63
+ readonly reviewed: "z2h_custom_integration_host_reviewed";
64
+ };
58
65
  readonly apps: {
59
66
  readonly deleted: "z2h_app_deleted";
60
67
  readonly grantChanged: "z2h_grant_changed";
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/observability/events.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCtB,CAAC;AAEX,iEAAiE;AACjE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;CAmBnB,CAAC;AAEX,oDAAoD;AACpD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;CAuBjB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;CAWf,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC"}
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/observability/events.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CtB,CAAC;AAEX,iEAAiE;AACjE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;CAuBnB,CAAC;AAEX,oDAAoD;AACpD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;CAuBjB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;CAWf,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC"}
@@ -38,6 +38,9 @@ const BackendRunnerEvents = {
38
38
  revokeFailedMetric: 'z2h.integration_oauth.revoke.error',
39
39
  tokenRequestMetric: 'z2h.integration_oauth.token_request',
40
40
  },
41
+ customIntegration: {
42
+ hostDeniedMetric: 'z2h.custom_integration.host_denied',
43
+ },
41
44
  integrationToken: {
42
45
  decryptFailedMetric: 'z2h.integration_token.decrypt_failed',
43
46
  unexpectedShapeMetric: 'z2h.integration_token.unexpected_shape',
@@ -55,6 +58,10 @@ const Z2hServiceEvents = {
55
58
  npmProxy: {
56
59
  failure: 'z2h_npm_proxy_failure',
57
60
  },
61
+ customIntegrationHosts: {
62
+ requested: 'z2h_custom_integration_host_requested',
63
+ reviewed: 'z2h_custom_integration_host_reviewed',
64
+ },
58
65
  apps: {
59
66
  deleted: 'z2h_app_deleted',
60
67
  grantChanged: 'z2h_grant_changed',
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export * from './constants';
2
- export { ALWAYS_ON_CHANNELS, CUSTOM_INTEGRATION_ALLOWED_HOSTS, DECLARED_INTEGRATIONS, isAllowedCustomIntegrationHost, type AlwaysOnChannel, type DeclaredIntegration, } from './integrations';
2
+ export { ALWAYS_ON_CHANNELS, CUSTOM_INTEGRATION_HOST_STATUSES, DECLARED_INTEGRATIONS, type AlwaysOnChannel, type CustomIntegrationHostStatus, 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,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
+ {"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,KAAK,eAAe,EACpB,KAAK,2BAA2B,EAChC,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -21,6 +21,5 @@ 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
+ exports.CUSTOM_INTEGRATION_HOST_STATUSES = integrations.CUSTOM_INTEGRATION_HOST_STATUSES;
25
25
  exports.DECLARED_INTEGRATIONS = integrations.DECLARED_INTEGRATIONS;
26
- exports.isAllowedCustomIntegrationHost = integrations.isAllowedCustomIntegrationHost;
@@ -13,11 +13,9 @@ export type AlwaysOnChannel = (typeof ALWAYS_ON_CHANNELS)[number];
13
13
  export declare const DECLARED_INTEGRATIONS: readonly ["monday"];
14
14
  export type DeclaredIntegration = (typeof DECLARED_INTEGRATIONS)[number];
15
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.
16
+ * Review state of a host a custom integration may target. Only `approved`
17
+ * hosts can be called; shared so every service compares against the same list.
19
18
  */
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;
19
+ export declare const CUSTOM_INTEGRATION_HOST_STATUSES: readonly ["requested", "approved", "rejected", "revoked"];
20
+ export type CustomIntegrationHostStatus = (typeof CUSTOM_INTEGRATION_HOST_STATUSES)[number];
23
21
  //# 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;AAEzE;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,EAAE,SAAS,MAAM,EAc7D,CAAC;AAEF,gHAAgH;AAChH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpE"}
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;;;GAGG;AACH,eAAO,MAAM,gCAAgC,2DAA4D,CAAC;AAC1G,MAAM,MAAM,2BAA2B,GAAG,CAAC,OAAO,gCAAgC,CAAC,CAAC,MAAM,CAAC,CAAC"}
@@ -13,31 +13,11 @@ const ALWAYS_ON_CHANNELS = ['db', 'llm', 'snowflake', 'customIntegration'];
13
13
  */
14
14
  const DECLARED_INTEGRATIONS = ['monday'];
15
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.
16
+ * Review state of a host a custom integration may target. Only `approved`
17
+ * hosts can be called; shared so every service compares against the same list.
19
18
  */
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
- }
19
+ const CUSTOM_INTEGRATION_HOST_STATUSES = ['requested', 'approved', 'rejected', 'revoked'];
39
20
 
40
21
  exports.ALWAYS_ON_CHANNELS = ALWAYS_ON_CHANNELS;
41
- exports.CUSTOM_INTEGRATION_ALLOWED_HOSTS = CUSTOM_INTEGRATION_ALLOWED_HOSTS;
22
+ exports.CUSTOM_INTEGRATION_HOST_STATUSES = CUSTOM_INTEGRATION_HOST_STATUSES;
42
23
  exports.DECLARED_INTEGRATIONS = DECLARED_INTEGRATIONS;
43
- exports.isAllowedCustomIntegrationHost = isAllowedCustomIntegrationHost;
@@ -38,6 +38,9 @@ export declare const BackendRunnerEvents: {
38
38
  readonly revokeFailedMetric: "z2h.integration_oauth.revoke.error";
39
39
  readonly tokenRequestMetric: "z2h.integration_oauth.token_request";
40
40
  };
41
+ readonly customIntegration: {
42
+ readonly hostDeniedMetric: "z2h.custom_integration.host_denied";
43
+ };
41
44
  readonly integrationToken: {
42
45
  readonly decryptFailedMetric: "z2h.integration_token.decrypt_failed";
43
46
  readonly unexpectedShapeMetric: "z2h.integration_token.unexpected_shape";
@@ -55,6 +58,10 @@ export declare const Z2hServiceEvents: {
55
58
  readonly npmProxy: {
56
59
  readonly failure: "z2h_npm_proxy_failure";
57
60
  };
61
+ readonly customIntegrationHosts: {
62
+ readonly requested: "z2h_custom_integration_host_requested";
63
+ readonly reviewed: "z2h_custom_integration_host_reviewed";
64
+ };
58
65
  readonly apps: {
59
66
  readonly deleted: "z2h_app_deleted";
60
67
  readonly grantChanged: "z2h_grant_changed";
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/observability/events.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCtB,CAAC;AAEX,iEAAiE;AACjE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;CAmBnB,CAAC;AAEX,oDAAoD;AACpD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;CAuBjB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;CAWf,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC"}
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/observability/events.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CtB,CAAC;AAEX,iEAAiE;AACjE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;CAuBnB,CAAC;AAEX,oDAAoD;AACpD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;CAuBjB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;CAWf,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC"}
@@ -40,6 +40,9 @@ const BackendRunnerEvents = {
40
40
  revokeFailedMetric: 'z2h.integration_oauth.revoke.error',
41
41
  tokenRequestMetric: 'z2h.integration_oauth.token_request',
42
42
  },
43
+ customIntegration: {
44
+ hostDeniedMetric: 'z2h.custom_integration.host_denied',
45
+ },
43
46
  integrationToken: {
44
47
  decryptFailedMetric: 'z2h.integration_token.decrypt_failed',
45
48
  unexpectedShapeMetric: 'z2h.integration_token.unexpected_shape',
@@ -57,6 +60,10 @@ const Z2hServiceEvents = {
57
60
  npmProxy: {
58
61
  failure: 'z2h_npm_proxy_failure',
59
62
  },
63
+ customIntegrationHosts: {
64
+ requested: 'z2h_custom_integration_host_requested',
65
+ reviewed: 'z2h_custom_integration_host_reviewed',
66
+ },
60
67
  apps: {
61
68
  deleted: 'z2h_app_deleted',
62
69
  grantChanged: 'z2h_grant_changed',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mondaydotcomorg/z2h-shared-utils",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {
package/src/index.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  export * from './constants';
2
2
  export {
3
3
  ALWAYS_ON_CHANNELS,
4
- CUSTOM_INTEGRATION_ALLOWED_HOSTS,
4
+ CUSTOM_INTEGRATION_HOST_STATUSES,
5
5
  DECLARED_INTEGRATIONS,
6
- isAllowedCustomIntegrationHost,
7
6
  type AlwaysOnChannel,
7
+ type CustomIntegrationHostStatus,
8
8
  type DeclaredIntegration,
9
9
  } from './integrations';
10
10
  export type { AppVersionSummary, AppVersionsResponse, DeployVersion } from './appVersions';
@@ -15,27 +15,8 @@ export const DECLARED_INTEGRATIONS = ['monday'] as const;
15
15
  export type DeclaredIntegration = (typeof DECLARED_INTEGRATIONS)[number];
16
16
 
17
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.
18
+ * Review state of a host a custom integration may target. Only `approved`
19
+ * hosts can be called; shared so every service compares against the same list.
21
20
  */
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
- }
21
+ export const CUSTOM_INTEGRATION_HOST_STATUSES = ['requested', 'approved', 'rejected', 'revoked'] as const;
22
+ export type CustomIntegrationHostStatus = (typeof CUSTOM_INTEGRATION_HOST_STATUSES)[number];
@@ -38,6 +38,9 @@ export const BackendRunnerEvents = {
38
38
  revokeFailedMetric: 'z2h.integration_oauth.revoke.error',
39
39
  tokenRequestMetric: 'z2h.integration_oauth.token_request',
40
40
  },
41
+ customIntegration: {
42
+ hostDeniedMetric: 'z2h.custom_integration.host_denied',
43
+ },
41
44
  integrationToken: {
42
45
  decryptFailedMetric: 'z2h.integration_token.decrypt_failed',
43
46
  unexpectedShapeMetric: 'z2h.integration_token.unexpected_shape',
@@ -56,6 +59,10 @@ export const Z2hServiceEvents = {
56
59
  npmProxy: {
57
60
  failure: 'z2h_npm_proxy_failure',
58
61
  },
62
+ customIntegrationHosts: {
63
+ requested: 'z2h_custom_integration_host_requested',
64
+ reviewed: 'z2h_custom_integration_host_reviewed',
65
+ },
59
66
  apps: {
60
67
  deleted: 'z2h_app_deleted',
61
68
  grantChanged: 'z2h_grant_changed',
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=integrations.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"integrations.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/integrations.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=integrations.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"integrations.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integrations.test.ts"],"names":[],"mappings":""}
@@ -1,24 +0,0 @@
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
- });