Moved Logger to core-backend, no longer importing node:buffer in core/react (#778)
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
---
|
||||
"@trigger.dev/core-backend": patch
|
||||
"@trigger.dev/sdk": patch
|
||||
"@trigger.dev/core": patch
|
||||
---
|
||||
|
||||
Moved Logger to core-backend, no longer importing node:buffer in core/react
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Logger } from "@trigger.dev/core-backend";
|
||||
import type { PoolClient } from "pg";
|
||||
import { z } from "zod";
|
||||
import { Logger } from "@trigger.dev/core";
|
||||
import { logger } from "~/services/logger.server";
|
||||
import { NotificationCatalog, NotificationChannel, notificationCatalog } from "./types";
|
||||
import { safeJsonParse } from "~/utils/json";
|
||||
import { NotificationCatalog, NotificationChannel, notificationCatalog } from "./types";
|
||||
|
||||
export class PgListenService {
|
||||
#poolClient: PoolClient;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { LogLevel } from "@trigger.dev/core";
|
||||
import { Logger } from "@trigger.dev/core";
|
||||
import type { LogLevel } from "@trigger.dev/core-backend";
|
||||
import { Logger } from "@trigger.dev/core-backend";
|
||||
import { sensitiveDataReplacer } from "./sensitiveDataReplacer";
|
||||
import { AsyncLocalStorage } from "async_hooks";
|
||||
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
export * from "./bloom";
|
||||
export * from "./logger";
|
||||
|
||||
@@ -196,11 +196,5 @@ function prettyPrintBytes(value: unknown): string {
|
||||
function getSizeInBytes(value: unknown) {
|
||||
const jsonString = JSON.stringify(value);
|
||||
|
||||
if (typeof window === "undefined") {
|
||||
// Node.js environment
|
||||
return Buffer.byteLength(jsonString, "utf8");
|
||||
} else {
|
||||
// Browser environment
|
||||
return new TextEncoder().encode(jsonString).length;
|
||||
}
|
||||
return Buffer.byteLength(jsonString, "utf8");
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
export * from "./logger";
|
||||
export * from "./schemas";
|
||||
export * from "./types";
|
||||
export * from "./utils";
|
||||
|
||||
@@ -20,8 +20,6 @@ import {
|
||||
JobRunStatusRecordSchema,
|
||||
KeyValueStoreResponseBody,
|
||||
KeyValueStoreResponseBodySchema,
|
||||
LogLevel,
|
||||
Logger,
|
||||
RegisterScheduleResponseBodySchema,
|
||||
RegisterSourceEventSchemaV2,
|
||||
RegisterSourceEventV2,
|
||||
@@ -40,6 +38,7 @@ import {
|
||||
assertExhaustive,
|
||||
urlWithSearchParams,
|
||||
} from "@trigger.dev/core";
|
||||
import { LogLevel, Logger } from "@trigger.dev/core-backend";
|
||||
import { env } from "node:process";
|
||||
|
||||
import { z } from "zod";
|
||||
|
||||
@@ -11,8 +11,6 @@ import {
|
||||
FetchTimeoutOptions,
|
||||
InitialStatusUpdate,
|
||||
IntervalOptions,
|
||||
LogLevel,
|
||||
Logger,
|
||||
RunTaskOptions,
|
||||
SendEvent,
|
||||
SendEventOptions,
|
||||
@@ -21,6 +19,7 @@ import {
|
||||
UpdateWebhookBody,
|
||||
supportsFeature,
|
||||
} from "@trigger.dev/core";
|
||||
import { LogLevel, Logger } from "@trigger.dev/core-backend";
|
||||
import { BloomFilter } from "@trigger.dev/core-backend";
|
||||
import { AsyncLocalStorage } from "node:async_hooks";
|
||||
import { webcrypto } from "node:crypto";
|
||||
|
||||
@@ -3,11 +3,11 @@ import {
|
||||
IntegrationConfig,
|
||||
InvokeOptions,
|
||||
JobMetadata,
|
||||
LogLevel,
|
||||
Prettify,
|
||||
RunNotification,
|
||||
SuccessfulRunNotification,
|
||||
} from "@trigger.dev/core";
|
||||
import { LogLevel } from "@trigger.dev/core-backend";
|
||||
import { ConcurrencyLimit } from "./concurrencyLimit";
|
||||
import { IOWithIntegrations, TriggerIntegration } from "./integrations";
|
||||
import { runLocalStorage } from "./runLocalStorage";
|
||||
|
||||
@@ -17,8 +17,6 @@ import {
|
||||
IntegrationConfig,
|
||||
InvokeOptions,
|
||||
JobMetadata,
|
||||
LogLevel,
|
||||
Logger,
|
||||
NormalizedResponse,
|
||||
PreprocessRunBody,
|
||||
PreprocessRunBodySchema,
|
||||
@@ -46,8 +44,12 @@ import {
|
||||
WebhookMetadata,
|
||||
WebhookSourceRequestHeadersSchema,
|
||||
} from "@trigger.dev/core";
|
||||
import { LogLevel, Logger } from "@trigger.dev/core-backend";
|
||||
import EventEmitter from "node:events";
|
||||
import { env } from "node:process";
|
||||
import * as packageJson from "../package.json";
|
||||
import { ApiClient } from "./apiClient";
|
||||
import { ConcurrencyLimit, ConcurrencyLimitOptions } from "./concurrencyLimit";
|
||||
import {
|
||||
AutoYieldExecutionError,
|
||||
AutoYieldWithCompletedTaskExecutionError,
|
||||
@@ -65,18 +67,21 @@ import { IO, IOStats } from "./io";
|
||||
import { createIOWithIntegrations } from "./ioWithIntegrations";
|
||||
import { Job, JobOptions } from "./job";
|
||||
import { runLocalStorage } from "./runLocalStorage";
|
||||
import { KeyValueStore } from "./store/keyValueStore";
|
||||
import { DynamicTrigger, DynamicTriggerOptions } from "./triggers/dynamic";
|
||||
import { EventTrigger } from "./triggers/eventTrigger";
|
||||
import { ExternalSource } from "./triggers/externalSource";
|
||||
import { DynamicIntervalOptions, DynamicSchedule } from "./triggers/scheduled";
|
||||
import type {
|
||||
EventSpecification,
|
||||
NotificationsEventEmitter,
|
||||
Trigger,
|
||||
TriggerContext,
|
||||
TriggerPreprocessContext,
|
||||
VerifyResult,
|
||||
import { WebhookDeliveryContext, WebhookSource } from "./triggers/webhook";
|
||||
import {
|
||||
type EventSpecification,
|
||||
type NotificationsEventEmitter,
|
||||
type Trigger,
|
||||
type TriggerContext,
|
||||
type TriggerPreprocessContext,
|
||||
type VerifyResult,
|
||||
} from "./types";
|
||||
import { formatSchemaErrors } from "./utils/formatSchemaErrors";
|
||||
|
||||
const parseRequestPayload = (rawPayload: any) => {
|
||||
const result = RequestWithRawBodySchema.safeParse(rawPayload);
|
||||
@@ -92,14 +97,6 @@ const parseRequestPayload = (rawPayload: any) => {
|
||||
});
|
||||
};
|
||||
|
||||
const deliverWebhookEvent = (key: string): EventSpecification<Request> => ({
|
||||
name: `${DELIVER_WEBHOOK_REQUEST}.${key}`,
|
||||
title: "Deliver Webhook",
|
||||
source: "internal",
|
||||
icon: "mail-fast",
|
||||
parsePayload: parseRequestPayload,
|
||||
});
|
||||
|
||||
const registerWebhookEvent = (key: string): EventSpecification<RegisterWebhookPayload> => ({
|
||||
name: `${REGISTER_WEBHOOK}.${key}`,
|
||||
title: "Register Webhook",
|
||||
@@ -116,13 +113,6 @@ const registerSourceEvent: EventSpecification<RegisterSourceEventV2> = {
|
||||
parsePayload: RegisterSourceEventSchemaV2.parse,
|
||||
};
|
||||
|
||||
import EventEmitter from "node:events";
|
||||
import * as packageJson from "../package.json";
|
||||
import { ConcurrencyLimit, ConcurrencyLimitOptions } from "./concurrencyLimit";
|
||||
import { KeyValueStore } from "./store/keyValueStore";
|
||||
import { WebhookDeliveryContext, WebhookSource } from "./triggers/webhook";
|
||||
import { formatSchemaErrors } from "./utils/formatSchemaErrors";
|
||||
|
||||
export type TriggerClientOptions = {
|
||||
/** The `id` property is used to uniquely identify the client.
|
||||
*/
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
import {
|
||||
ConnectionAuth,
|
||||
DisplayProperty,
|
||||
EventFilter,
|
||||
HandleTriggerSource,
|
||||
HttpSourceResponseMetadata,
|
||||
Logger,
|
||||
NormalizedResponse,
|
||||
Prettify,
|
||||
RegisterTriggerSource,
|
||||
SendEvent,
|
||||
SerializableJson,
|
||||
TriggerMetadata,
|
||||
deepMergeFilters,
|
||||
} from "@trigger.dev/core";
|
||||
import { Logger } from "@trigger.dev/core-backend";
|
||||
import type { Buffer } from "buffer";
|
||||
import { IOWithIntegrations, TriggerIntegration } from "../integrations";
|
||||
import { IO } from "../io";
|
||||
import { Job } from "../job";
|
||||
import { TriggerClient } from "../triggerClient";
|
||||
import type { EventSpecification, SchemaParser, Trigger, TriggerContext } from "../types";
|
||||
import { slugifyId } from "../utils";
|
||||
import { SerializableJson } from "@trigger.dev/core";
|
||||
import { ConnectionAuth } from "@trigger.dev/core";
|
||||
import { Prettify } from "@trigger.dev/core";
|
||||
import type { Buffer } from "buffer";
|
||||
|
||||
export type HttpSourceEvent = {
|
||||
url: string;
|
||||
|
||||
@@ -2,24 +2,21 @@ import type {
|
||||
DisplayProperty,
|
||||
EventFilter,
|
||||
FailedRunNotification,
|
||||
Logger,
|
||||
OverridableRunTaskOptions,
|
||||
Prettify,
|
||||
RedactString,
|
||||
RegisteredOptionsDiff,
|
||||
RunNotificationJobMetadata,
|
||||
RunNotificationRunMetadata,
|
||||
RunTaskOptions,
|
||||
RuntimeEnvironmentType,
|
||||
ServerTask,
|
||||
SourceEventOption,
|
||||
SuccessfulRunNotification,
|
||||
TriggerMetadata,
|
||||
} from "@trigger.dev/core";
|
||||
import { Logger } from "@trigger.dev/core-backend";
|
||||
import type TypedEmitter from "typed-emitter";
|
||||
import { z } from "zod";
|
||||
import { Job } from "./job";
|
||||
import { TriggerClient } from "./triggerClient";
|
||||
import { z } from "zod";
|
||||
import type TypedEmitter from "typed-emitter";
|
||||
|
||||
export type {
|
||||
DisplayProperty,
|
||||
@@ -124,8 +121,8 @@ export type TypedEventSpecificationExample<TEvent> = {
|
||||
id: string;
|
||||
name: string;
|
||||
icon?: string;
|
||||
payload: TEvent
|
||||
}
|
||||
payload: TEvent;
|
||||
};
|
||||
|
||||
export interface EventSpecification<TEvent extends any, TInvoke extends any = TEvent> {
|
||||
name: string | string[];
|
||||
|
||||
Reference in New Issue
Block a user