Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Sentry npm packages to v8 (major) #4817

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion apps/hash-ai-worker-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"@local/hash-isomorphic-utils": "0.0.0-private",
"@local/hash-subgraph": "0.0.0-private",
"@local/status": "0.0.0-private",
"@sentry/node": "7.118.0",
"@sentry/node": "8.23.0",
"@temporalio/activity": "1.10.1",
"@temporalio/common": "1.10.1",
"@temporalio/worker": "1.10.1",
Expand Down
7 changes: 7 additions & 0 deletions apps/hash-ai-worker-ts/src/instrument.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import * as Sentry from "@sentry/node";

Sentry.init({
dsn: process.env.HASH_TEMPORAL_WORKER_AI_SENTRY_DSN,
enabled: !!process.env.HASH_TEMPORAL_WORKER_AI_SENTRY_DSN,
tracesSampleRate: 1.0,
});
10 changes: 1 addition & 9 deletions apps/hash-ai-worker-ts/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
/* eslint-disable import/first */

import * as Sentry from "@sentry/node";

Sentry.init({
dsn: process.env.HASH_TEMPORAL_WORKER_AI_SENTRY_DSN,
enabled: !!process.env.HASH_TEMPORAL_WORKER_AI_SENTRY_DSN,
tracesSampleRate: 1.0,
});
import "./instrument";

import * as http from "node:http";
import { createRequire } from "node:module";
Expand Down
7 changes: 4 additions & 3 deletions apps/hash-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"license": "AGPL-3.0",
"type": "module",
"scripts": {
"build": "rimraf dist && tsc --build tsconfig.build.json",
"build:docker": "docker buildx build --tag hash-api --file ../../infra/docker/api/prod/Dockerfile ../../ --load",
"codegen": "rimraf './src/**/*.gen.*'; graphql-codegen --config codegen.config.ts",
"dev": "NODE_ENV=development NODE_OPTIONS=--max-old-space-size=2048 tsx watch --clear-screen=false ./src/index.ts",
Expand All @@ -14,10 +15,10 @@
"generate-ontology-type-ids": "tsx ./src/generate-ontology-type-ids.ts; yarn prettier --write ../../libs/@local/hash-isomorphic-utils/src/ontology-type-ids.ts",
"lint:eslint": "eslint --report-unused-disable-directives .",
"lint:tsc": "tsc --noEmit",
"start": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=2048 tsx ./src/index.ts",
"start": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=2048 node --import ./dist/sentry.js ./dist/index.js",
"start:healthcheck": "wait-on --timeout 300000 http://0.0.0.0:5001",
"start:migrate": "NODE_ENV=production tsx ./src/ensure-system-graph-is-initialized.ts",
"start:test": "cross-env NODE_ENV=test NODE_OPTIONS=--max-old-space-size=2048 tsx ./src/index.ts",
"start:test": "cross-env NODE_ENV=test NODE_OPTIONS=--max-old-space-size=2048 node --import ./dist/sentry.js ./dist/index.js",
"start:test:healthcheck": "wait-on --timeout 300000 http://0.0.0.0:5001",
"start:test:migrate": "NODE_ENV=test tsx ./src/ensure-system-graph-is-initialized.ts",
"test:unit": "vitest --run"
Expand Down Expand Up @@ -55,7 +56,7 @@
"@ory/hydra-client": "2.2.0-rc.3",
"@ory/kratos-client": "1.0.0",
"@rudderstack/rudder-sdk-node": "2.0.3",
"@sentry/node": "7.118.0",
"@sentry/node": "8.23.0",
"@snowplow/node-tracker": "3.3.1",
"@temporalio/client": "1.10.1",
"@temporalio/proto": "1.10.1",
Expand Down
4 changes: 2 additions & 2 deletions apps/hash-api/src/ai/gpt/gpt-get-user-webs.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { RequestHandler } from "express";

import type { SimpleWeb } from "./shared/webs";
import { getUserSimpleWebs } from "./shared/webs";
import type { SimpleWeb } from "./shared/webs.js";
import { getUserSimpleWebs } from "./shared/webs.js";

export type GptGetUserWebsResponseBody =
| { error: string }
Expand Down
8 changes: 4 additions & 4 deletions apps/hash-api/src/ai/gpt/gpt-query-entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ import {
} from "@local/hash-subgraph";
import type { RequestHandler } from "express";

import { getLatestEntityById } from "../../graph/knowledge/primitive/entity";
import { stringifyResults } from "./shared/stringify-results";
import type { SimpleWeb } from "./shared/webs";
import { getUserSimpleWebs } from "./shared/webs";
import { getLatestEntityById } from "../../graph/knowledge/primitive/entity.js";
import { stringifyResults } from "./shared/stringify-results.js";
import type { SimpleWeb } from "./shared/webs.js";
import { getUserSimpleWebs } from "./shared/webs.js";

export type GptQueryEntitiesRequestBody = {
/**
Expand Down
2 changes: 1 addition & 1 deletion apps/hash-api/src/ai/gpt/gpt-query-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { currentTimeInstantTemporalAxes } from "@local/hash-isomorphic-utils/gra
import { mapGraphApiSubgraphToSubgraph } from "@local/hash-isomorphic-utils/subgraph-mapping";
import type { RequestHandler } from "express";

import { stringifyResults } from "./shared/stringify-results";
import { stringifyResults } from "./shared/stringify-results.js";

export type GptQueryTypesRequestBody = {
/**
Expand Down
8 changes: 4 additions & 4 deletions apps/hash-api/src/ai/gpt/shared/webs.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { AccountId } from "@local/hash-graph-types/account";

import type { ImpureGraphContext } from "../../../graph/context-types";
import { getOrgMembershipOrg } from "../../../graph/knowledge/system-types/org-membership";
import type { User } from "../../../graph/knowledge/system-types/user";
import { getUserOrgMemberships } from "../../../graph/knowledge/system-types/user";
import type { ImpureGraphContext } from "../../../graph/context-types.js";
import { getOrgMembershipOrg } from "../../../graph/knowledge/system-types/org-membership.js";
import type { User } from "../../../graph/knowledge/system-types/user.js";
import { getUserOrgMemberships } from "../../../graph/knowledge/system-types/user.js";

export type SimpleWeb = {
uuid: string;
Expand Down
2 changes: 1 addition & 1 deletion apps/hash-api/src/ai/gpt/upsert-gpt-oauth-client.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { isUserHashInstanceAdmin } from "@local/hash-backend-utils/hash-instance";
import type { RequestHandler } from "express";

import { hydraAdmin } from "../../auth/ory-hydra";
import { hydraAdmin } from "../../auth/ory-hydra.js";

type UpsertOAuthClientRequestBody = {
redirectUri: string;
Expand Down
12 changes: 6 additions & 6 deletions apps/hash-api/src/ai/infer-entities-websocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ import type { Client } from "@temporalio/client";
import type { WebSocket } from "ws";
import { WebSocketServer } from "ws";

import { getUserAndSession } from "../auth/create-auth-handlers";
import type { GraphApi, ImpureGraphContext } from "../graph/context-types";
import type { User } from "../graph/knowledge/system-types/user";
import { FlowRunStatus } from "../graphql/api-types.gen";
import { handleCancelInferEntitiesRequest } from "./infer-entities-websocket/handle-cancel-infer-entities-request";
import { handleInferEntitiesRequest } from "./infer-entities-websocket/handle-infer-entities-request";
import { getUserAndSession } from "../auth/create-auth-handlers.js";
import type { GraphApi, ImpureGraphContext } from "../graph/context-types.js";
import type { User } from "../graph/knowledge/system-types/user.js";
import { FlowRunStatus } from "../graphql/api-types.gen.js";
import { handleCancelInferEntitiesRequest } from "./infer-entities-websocket/handle-cancel-infer-entities-request.js";
import { handleInferEntitiesRequest } from "./infer-entities-websocket/handle-infer-entities-request.js";

const inferEntitiesMessageHandler = async ({
socket,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import type { EntityUuid } from "@local/hash-graph-types/entity";
import type { CancelInferEntitiesWebsocketRequestMessage } from "@local/hash-isomorphic-utils/ai-inference-types";
import type { Client } from "@temporalio/client";

import type { GraphApi } from "../../graph/context-types";
import type { User } from "../../graph/knowledge/system-types/user";
import type { GraphApi } from "../../graph/context-types.js";
import type { User } from "../../graph/knowledge/system-types/user.js";

export const handleCancelInferEntitiesRequest = async ({
graphApiClient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import type {
} from "@local/hash-isomorphic-utils/flows/types";
import type { Client } from "@temporalio/client";

import type { User } from "../../graph/knowledge/system-types/user";
import { FlowRunStatus } from "../../graphql/api-types.gen";
import type { User } from "../../graph/knowledge/system-types/user.js";
import { FlowRunStatus } from "../../graphql/api-types.gen.js";

export const handleInferEntitiesRequest = async ({
graphApiClient,
Expand Down
14 changes: 7 additions & 7 deletions apps/hash-api/src/auth/create-auth-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import type { Session } from "@ory/client";
import type { AxiosError } from "axios";
import type { Express, Request, RequestHandler } from "express";

import type { ImpureGraphContext } from "../graph/context-types";
import type { User } from "../graph/knowledge/system-types/user";
import type { ImpureGraphContext } from "../graph/context-types.js";
import type { User } from "../graph/knowledge/system-types/user.js";
import {
createUser,
getUserByKratosIdentityId,
} from "../graph/knowledge/system-types/user";
import { systemAccountId } from "../graph/system-account";
import { hydraAdmin } from "./ory-hydra";
import type { KratosUserIdentity } from "./ory-kratos";
import { kratosFrontendApi } from "./ory-kratos";
} from "../graph/knowledge/system-types/user.js";
import { systemAccountId } from "../graph/system-account.js";
import { hydraAdmin } from "./ory-hydra.js";
import type { KratosUserIdentity } from "./ory-kratos.js";
import { kratosFrontendApi } from "./ory-kratos.js";

const KRATOS_API_KEY = getRequiredEnv("KRATOS_API_KEY");

Expand Down
2 changes: 1 addition & 1 deletion apps/hash-api/src/auth/oauth-consent-handlers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { RequestHandler } from "express";

import { hydraAdmin } from "./ory-hydra";
import { hydraAdmin } from "./ory-hydra.js";

/**
* @see https://github.com/ory/hydra-login-consent-node/tree/master
Expand Down
4 changes: 2 additions & 2 deletions apps/hash-api/src/cache/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { CacheAdapter } from "./adapter";
import type { CacheAdapter } from "./adapter.js";

export type { CacheAdapter };

export { RedisCache } from "./redis";
export { RedisCache } from "./redis.js";
2 changes: 1 addition & 1 deletion apps/hash-api/src/cache/redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { RedisSocketConfig } from "@local/hash-backend-utils/redis";
import { AsyncRedisClient } from "@local/hash-backend-utils/redis";
import { DataSource } from "apollo-datasource";

import type { CacheAdapter } from "./adapter";
import type { CacheAdapter } from "./adapter.js";

export class RedisCache extends DataSource implements CacheAdapter {
private client: AsyncRedisClient;
Expand Down
2 changes: 1 addition & 1 deletion apps/hash-api/src/email/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { URLSearchParams } from "node:url";
import { frontendUrl } from "@local/hash-isomorphic-utils/environment";
import dedent from "dedent";

import type { EmailTransporter } from "./transporters";
import type { EmailTransporter } from "./transporters.js";

export const sendOrgEmailInvitationToEmailAddress =
(emailTransporter: EmailTransporter) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { convert } from "html-to-text";
import nodemailer from "nodemailer";
import type SESTransport from "nodemailer/lib/ses-transport";

import { logger } from "../../logger";
import { logger } from "../../logger.js";
import type {
EmailTransporter,
EmailTransporterSendMailOptions,
} from "./types";
} from "./types.js";

export interface AwsSesEmailTransporterConfig {
from: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import dedent from "dedent";
import { convert } from "html-to-text";
import { dump } from "js-yaml";

import { logger } from "../../logger";
import { logger } from "../../logger.js";
import type {
EmailTransporter,
EmailTransporterSendMailOptions,
} from "./types";
} from "./types.js";

interface PlainEmailDump {
date: string;
Expand Down
6 changes: 3 additions & 3 deletions apps/hash-api/src/email/transporters/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from "./aws-ses-email-transporter";
export * from "./dummy-email-transporter";
export * from "./types";
export * from "./aws-ses-email-transporter.js";
export * from "./dummy-email-transporter.js";
export * from "./types.js";
6 changes: 3 additions & 3 deletions apps/hash-api/src/ensure-system-graph-is-initialized.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { createGraphClient } from "@local/hash-backend-utils/create-graph-client
import { getRequiredEnv } from "@local/hash-backend-utils/environment";
import { createTemporalClient } from "@local/hash-backend-utils/temporal";

import type { ImpureGraphContext } from "./graph/context-types";
import { ensureSystemGraphIsInitialized } from "./graph/ensure-system-graph-is-initialized";
import { logger } from "./logger";
import type { ImpureGraphContext } from "./graph/context-types.js";
import { ensureSystemGraphIsInitialized } from "./graph/ensure-system-graph-is-initialized.js";
import { logger } from "./logger.js";

const context: ImpureGraphContext<false, true> = {
provenance: {
Expand Down
4 changes: 2 additions & 2 deletions apps/hash-api/src/express.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { VaultClient } from "@local/hash-backend-utils/vault";
import type { Session } from "@ory/client";

import type { ImpureGraphContext } from "./graph/context-types";
import type { User } from "./graph/knowledge/system-types/user";
import type { ImpureGraphContext } from "./graph/context-types.js";
import type { User } from "./graph/knowledge/system-types/user.js";

declare global {
namespace Express {
Expand Down
12 changes: 6 additions & 6 deletions apps/hash-api/src/generate-ontology-type-ids.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ import { extractBaseUrl } from "@local/hash-subgraph/type-system-patch";
import type {
ImpureGraphContext,
ImpureGraphFunction,
} from "./graph/context-types";
import type { Org } from "./graph/knowledge/system-types/org";
import { getOrgByShortname } from "./graph/knowledge/system-types/org";
import { getDataTypes } from "./graph/ontology/primitive/data-type";
} from "./graph/context-types.js";
import type { Org } from "./graph/knowledge/system-types/org.js";
import { getOrgByShortname } from "./graph/knowledge/system-types/org.js";
import { getDataTypes } from "./graph/ontology/primitive/data-type.js";
import {
getEntityTypes,
isEntityTypeLinkEntityType,
} from "./graph/ontology/primitive/entity-type";
import { getPropertyTypes } from "./graph/ontology/primitive/property-type";
} from "./graph/ontology/primitive/entity-type.js";
import { getPropertyTypes } from "./graph/ontology/primitive/property-type.js";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
Expand Down
2 changes: 1 addition & 1 deletion apps/hash-api/src/graph/account-permission-management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {
} from "@local/hash-graph-types/account";
import type { OwnedById } from "@local/hash-graph-types/web";

import type { ImpureGraphFunction } from "./context-types";
import type { ImpureGraphFunction } from "./context-types.js";

export const addAccountGroupMember: ImpureGraphFunction<
{ accountId: AccountId; accountGroupId: AccountGroupId },
Expand Down
8 changes: 4 additions & 4 deletions apps/hash-api/src/graph/ensure-system-graph-is-initialized.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Logger } from "@local/hash-backend-utils/logger";

import type { ImpureGraphContext } from "./context-types";
import { migrateOntologyTypes } from "./ensure-system-graph-is-initialized/migrate-ontology-types";
import { ensureSystemEntitiesExist } from "./ensure-system-graph-is-initialized/system-webs-and-entities";
import { ensureHashSystemAccountExists } from "./system-account";
import type { ImpureGraphContext } from "./context-types.js";
import { migrateOntologyTypes } from "./ensure-system-graph-is-initialized/migrate-ontology-types.js";
import { ensureSystemEntitiesExist } from "./ensure-system-graph-is-initialized/system-webs-and-entities.js";
import { ensureHashSystemAccountExists } from "./system-account.js";

export const ensureSystemGraphIsInitialized = async (params: {
logger: Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { fileURLToPath } from "node:url";

import type { Logger } from "@local/hash-backend-utils/logger";

import { isProdEnv } from "../../lib/env-config";
import type { ImpureGraphContext } from "../context-types";
import { systemAccountId } from "../system-account";
import { isProdEnv } from "../../lib/env-config.js";
import type { ImpureGraphContext } from "../context-types.js";
import { systemAccountId } from "../system-account.js";
import type {
MigrationFunction,
MigrationState,
} from "./migrate-ontology-types/types";
} from "./migrate-ontology-types/types.js";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import {
CACHED_DATA_TYPE_SCHEMAS,
CACHED_ENTITY_TYPE_SCHEMAS,
CACHED_PROPERTY_TYPE_SCHEMAS,
} from "../../../../seed-data";
import type { MigrationFunction } from "../types";
} from "../../../../seed-data/index.js";
import type { MigrationFunction } from "../types.js";
import {
loadExternalDataTypeIfNotExists,
loadExternalEntityTypeIfNotExists,
loadExternalPropertyTypeIfNotExists,
} from "../util";
} from "../util.js";

const migrate: MigrationFunction = async ({
context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import {
mimeTypePropertyTypeUrl,
} from "@local/hash-subgraph";

import { systemAccountId } from "../../../system-account";
import type { MigrationFunction } from "../types";
import { systemAccountId } from "../../../system-account.js";
import type { MigrationFunction } from "../types.js";
import {
anyUserInstantiator,
createSystemEntityTypeIfNotExists,
createSystemPropertyTypeIfNotExists,
} from "../util";
} from "../util.js";

const migrate: MigrationFunction = async ({
context,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { MigrationFunction } from "../types";
import { loadExternalEntityTypeIfNotExists } from "../util";
import type { MigrationFunction } from "../types.js";
import { loadExternalEntityTypeIfNotExists } from "../util.js";

const migrate: MigrationFunction = async ({
context,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { linkEntityTypeUrl } from "@local/hash-subgraph";

import { enabledIntegrations } from "../../../../integrations/enabled-integrations";
import type { MigrationFunction } from "../types";
import { enabledIntegrations } from "../../../../integrations/enabled-integrations.js";
import type { MigrationFunction } from "../types.js";
import {
anyUserInstantiator,
createSystemEntityTypeIfNotExists,
createSystemPropertyTypeIfNotExists,
getCurrentHashPropertyTypeId,
} from "../util";
} from "../util.js";

const migrate: MigrationFunction = async ({
context,
Expand Down
Loading
Loading