@trigger.dev/core 0.0.0-svelte-test-20231206141434 → 0.0.0-yalt-20231214152805

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.
package/dist/index.mjs CHANGED
@@ -1,195 +1,8 @@
1
- import { env } from 'node:process';
2
- import { Buffer } from 'node:buffer';
3
1
  import { ulid } from 'ulidx';
4
2
  import { z } from 'zod';
5
3
 
6
4
  var __defProp = Object.defineProperty;
7
5
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
- var __accessCheck = (obj, member, msg) => {
9
- if (!member.has(obj))
10
- throw TypeError("Cannot " + msg);
11
- };
12
- var __privateGet = (obj, member, getter) => {
13
- __accessCheck(obj, member, "read from private field");
14
- return getter ? getter.call(obj) : member.get(obj);
15
- };
16
- var __privateAdd = (obj, member, value) => {
17
- if (member.has(obj))
18
- throw TypeError("Cannot add the same private member more than once");
19
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
20
- };
21
- var __privateSet = (obj, member, value, setter) => {
22
- __accessCheck(obj, member, "write to private field");
23
- setter ? setter.call(obj, value) : member.set(obj, value);
24
- return value;
25
- };
26
- var __privateMethod = (obj, member, method) => {
27
- __accessCheck(obj, member, "access private method");
28
- return method;
29
- };
30
- var logLevels = [
31
- "log",
32
- "error",
33
- "warn",
34
- "info",
35
- "debug"
36
- ];
37
- var _name, _level, _filteredKeys, _jsonReplacer, _additionalFields, _structuredLog, structuredLog_fn;
38
- var _Logger = class _Logger {
39
- constructor(name, level = "info", filteredKeys = [], jsonReplacer, additionalFields) {
40
- __privateAdd(this, _structuredLog);
41
- __privateAdd(this, _name, void 0);
42
- __privateAdd(this, _level, void 0);
43
- __privateAdd(this, _filteredKeys, []);
44
- __privateAdd(this, _jsonReplacer, void 0);
45
- __privateAdd(this, _additionalFields, void 0);
46
- __privateSet(this, _name, name);
47
- __privateSet(this, _level, logLevels.indexOf(env.TRIGGER_LOG_LEVEL ?? level));
48
- __privateSet(this, _filteredKeys, filteredKeys);
49
- __privateSet(this, _jsonReplacer, createReplacer(jsonReplacer));
50
- __privateSet(this, _additionalFields, additionalFields ?? (() => ({})));
51
- }
52
- // Return a new Logger instance with the same name and a new log level
53
- // but filter out the keys from the log messages (at any level)
54
- filter(...keys) {
55
- return new _Logger(__privateGet(this, _name), logLevels[__privateGet(this, _level)], keys, __privateGet(this, _jsonReplacer));
56
- }
57
- static satisfiesLogLevel(logLevel, setLevel) {
58
- return logLevels.indexOf(logLevel) <= logLevels.indexOf(setLevel);
59
- }
60
- log(message, ...args) {
61
- if (__privateGet(this, _level) < 0)
62
- return;
63
- __privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.log, message, "log", ...args);
64
- }
65
- error(message, ...args) {
66
- if (__privateGet(this, _level) < 1)
67
- return;
68
- __privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.error, message, "error", ...args);
69
- }
70
- warn(message, ...args) {
71
- if (__privateGet(this, _level) < 2)
72
- return;
73
- __privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.warn, message, "warn", ...args);
74
- }
75
- info(message, ...args) {
76
- if (__privateGet(this, _level) < 3)
77
- return;
78
- __privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.info, message, "info", ...args);
79
- }
80
- debug(message, ...args) {
81
- if (__privateGet(this, _level) < 4)
82
- return;
83
- __privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.debug, message, "debug", ...args);
84
- }
85
- };
86
- _name = new WeakMap();
87
- _level = new WeakMap();
88
- _filteredKeys = new WeakMap();
89
- _jsonReplacer = new WeakMap();
90
- _additionalFields = new WeakMap();
91
- _structuredLog = new WeakSet();
92
- structuredLog_fn = /* @__PURE__ */ __name(function(loggerFunction, message, level, ...args) {
93
- const structuredLog = {
94
- ...structureArgs(safeJsonClone(args), __privateGet(this, _filteredKeys)),
95
- ...__privateGet(this, _additionalFields).call(this),
96
- timestamp: /* @__PURE__ */ new Date(),
97
- name: __privateGet(this, _name),
98
- message,
99
- level
100
- };
101
- loggerFunction(JSON.stringify(structuredLog, __privateGet(this, _jsonReplacer)));
102
- }, "#structuredLog");
103
- __name(_Logger, "Logger");
104
- var Logger = _Logger;
105
- function createReplacer(replacer) {
106
- return (key, value) => {
107
- if (typeof value === "bigint") {
108
- return value.toString();
109
- }
110
- if (replacer) {
111
- return replacer(key, value);
112
- }
113
- return value;
114
- };
115
- }
116
- __name(createReplacer, "createReplacer");
117
- function bigIntReplacer(_key, value) {
118
- if (typeof value === "bigint") {
119
- return value.toString();
120
- }
121
- return value;
122
- }
123
- __name(bigIntReplacer, "bigIntReplacer");
124
- function safeJsonClone(obj) {
125
- try {
126
- return JSON.parse(JSON.stringify(obj, bigIntReplacer));
127
- } catch (e) {
128
- return;
129
- }
130
- }
131
- __name(safeJsonClone, "safeJsonClone");
132
- function structureArgs(args, filteredKeys = []) {
133
- if (!args) {
134
- return;
135
- }
136
- if (args.length === 0) {
137
- return;
138
- }
139
- if (args.length === 1 && typeof args[0] === "object") {
140
- return filterKeys(JSON.parse(JSON.stringify(args[0], bigIntReplacer)), filteredKeys);
141
- }
142
- return args;
143
- }
144
- __name(structureArgs, "structureArgs");
145
- function filterKeys(obj, keys) {
146
- if (typeof obj !== "object" || obj === null) {
147
- return obj;
148
- }
149
- if (Array.isArray(obj)) {
150
- return obj.map((item) => filterKeys(item, keys));
151
- }
152
- const filteredObj = {};
153
- for (const [key, value] of Object.entries(obj)) {
154
- if (keys.includes(key)) {
155
- if (value) {
156
- filteredObj[key] = `[filtered ${prettyPrintBytes(value)}]`;
157
- } else {
158
- filteredObj[key] = value;
159
- }
160
- continue;
161
- }
162
- filteredObj[key] = filterKeys(value, keys);
163
- }
164
- return filteredObj;
165
- }
166
- __name(filterKeys, "filterKeys");
167
- function prettyPrintBytes(value) {
168
- if (env.NODE_ENV === "production") {
169
- return "skipped size";
170
- }
171
- const sizeInBytes = getSizeInBytes(value);
172
- if (sizeInBytes < 1024) {
173
- return `${sizeInBytes} bytes`;
174
- }
175
- if (sizeInBytes < 1024 * 1024) {
176
- return `${(sizeInBytes / 1024).toFixed(2)} KB`;
177
- }
178
- if (sizeInBytes < 1024 * 1024 * 1024) {
179
- return `${(sizeInBytes / (1024 * 1024)).toFixed(2)} MB`;
180
- }
181
- return `${(sizeInBytes / (1024 * 1024 * 1024)).toFixed(2)} GB`;
182
- }
183
- __name(prettyPrintBytes, "prettyPrintBytes");
184
- function getSizeInBytes(value) {
185
- const jsonString = JSON.stringify(value);
186
- if (typeof window === "undefined") {
187
- return Buffer.byteLength(jsonString, "utf8");
188
- } else {
189
- return new TextEncoder().encode(jsonString).length;
190
- }
191
- }
192
- __name(getSizeInBytes, "getSizeInBytes");
193
6
 
194
7
  // src/schemas/addMissingVersionField.ts
195
8
  function addMissingVersionField(val) {
@@ -2023,6 +1836,6 @@ function supportsFeature(featureName, version) {
2023
1836
  }
2024
1837
  __name(supportsFeature, "supportsFeature");
2025
1838
 
2026
- export { API_VERSIONS, ApiEventLogSchema, AutoYieldConfigSchema, AutoYieldMetadataSchema, CachedTaskSchema, CancelRunsForEventSchema, CommonMissingConnectionNotificationPayloadSchema, CommonMissingConnectionNotificationResolvedPayloadSchema, CompleteTaskBodyInputSchema, CompleteTaskBodyV2InputSchema, ConcurrencyLimitOptionsSchema, ConnectionAuthSchema, CreateExternalConnectionBodySchema, CreateRunResponseBodySchema, CronMetadataSchema, CronOptionsSchema, DELIVER_WEBHOOK_REQUEST, DeliverEventResponseSchema, DeserializedJsonSchema, DisplayPropertiesSchema, DisplayPropertySchema, DynamicTriggerEndpointMetadataSchema, DynamicTriggerMetadataSchema, EndpointHeadersSchema, EndpointIndexErrorSchema, EphemeralEventDispatcherRequestBodySchema, EphemeralEventDispatcherResponseBodySchema, ErrorWithStackSchema, EventExampleSchema, EventFilterSchema, EventRuleSchema, EventSpecificationSchema, ExecuteJobHeadersSchema, ExecuteJobRunMetadataSchema, FailTaskBodyInputSchema, FetchOperationSchema, FetchPollOperationSchema, FetchRequestInitSchema, FetchRetryBackoffStrategySchema, FetchRetryHeadersStrategySchema, FetchRetryOptionsSchema, FetchRetryStrategySchema, FetchTimeoutOptionsSchema, GetEndpointIndexResponseSchema, GetEventSchema, GetRunSchema, GetRunStatusesSchema, GetRunsSchema, HTTPMethodUnionSchema, HandleTriggerSourceSchema, HttpEndpointRequestHeadersSchema, HttpSourceRequestHeadersSchema, HttpSourceResponseSchema, IndexEndpointResponseSchema, InitializeCronScheduleBodySchema, InitializeTriggerBodySchema, IntegrationConfigSchema, IntegrationMetadataSchema, IntervalMetadataSchema, IntervalOptionsSchema, InvokeJobRequestBodySchema, InvokeJobResponseSchema, InvokeOptionsSchema, InvokeTriggerMetadataSchema, JobMetadataSchema, JobRunStatusRecordSchema, KeyValueStoreResponseBodySchema, LogMessageSchema, Logger, MISSING_CONNECTION_NOTIFICATION, MISSING_CONNECTION_RESOLVED_NOTIFICATION, MissingConnectionNotificationPayloadSchema, MissingConnectionResolvedNotificationPayloadSchema, MissingDeveloperConnectionNotificationPayloadSchema, MissingDeveloperConnectionResolvedNotificationPayloadSchema, MissingExternalConnectionNotificationPayloadSchema, MissingExternalConnectionResolvedNotificationPayloadSchema, NormalizedRequestSchema, NormalizedResponseSchema, PLATFORM_FEATURES, PongErrorResponseSchema, PongResponseSchema, PongSuccessResponseSchema, PreprocessRunBodySchema, PreprocessRunResponseSchema, QueueOptionsSchema, REGISTER_SOURCE_EVENT_V1, REGISTER_SOURCE_EVENT_V2, REGISTER_WEBHOOK, RawEventSchema, RedactSchema, RedactStringSchema, RegisterDynamicSchedulePayloadSchema, RegisterHTTPTriggerSourceBodySchema, RegisterIntervalScheduleBodySchema, RegisterSMTPTriggerSourceBodySchema, RegisterSQSTriggerSourceBodySchema, RegisterScheduleBodySchema, RegisterScheduleResponseBodySchema, RegisterSourceChannelBodySchema, RegisterSourceEventSchemaV1, RegisterSourceEventSchemaV2, RegisterTriggerBodySchemaV1, RegisterTriggerBodySchemaV2, RegisterTriggerSourceSchema, RegisterWebhookPayloadSchema, RegisterWebhookSourceSchema, RequestFilterSchema, RequestWithRawBodySchema, ResponseFilterSchema, RetryOptionsSchema, RunJobAutoYieldExecutionErrorSchema, RunJobAutoYieldWithCompletedTaskExecutionErrorSchema, RunJobBodySchema, RunJobCanceledWithTaskSchema, RunJobErrorResponseSchema, RunJobErrorSchema, RunJobInvalidPayloadErrorSchema, RunJobResponseSchema, RunJobResumeWithParallelTaskSchema, RunJobResumeWithTaskSchema, RunJobRetryWithTaskSchema, RunJobSuccessSchema, RunJobUnresolvedAuthErrorSchema, RunJobYieldExecutionErrorSchema, RunSourceContextSchema, RunStatusSchema, RunTaskBodyInputSchema, RunTaskBodyOutputSchema, RunTaskOptionsSchema, RunTaskResponseWithCachedTasksBodySchema, RunTaskSchema, RuntimeEnvironmentTypeSchema, SCHEDULED_EVENT, ScheduleMetadataSchema, ScheduledPayloadSchema, ScheduledTriggerMetadataSchema, SchemaErrorSchema, SendBulkEventsBodySchema, SendEventBodySchema, SendEventOptionsSchema, SerializableJsonSchema, ServerTaskSchema, SourceMetadataV2Schema, StaticTriggerMetadataSchema, StatusHistorySchema, StatusUpdateSchema, StatusUpdateStateSchema, StyleSchema, TaskSchema, TaskStatusSchema, TriggerHelpSchema, TriggerMetadataSchema, TriggerSourceSchema, UpdateTriggerSourceBodyV1Schema, UpdateTriggerSourceBodyV2Schema, UpdateWebhookBodySchema, ValidateErrorResponseSchema, ValidateResponseSchema, ValidateSuccessResponseSchema, WebhookContextMetadataSchema, WebhookDeliveryResponseSchema, WebhookMetadataSchema, WebhookSourceRequestHeadersSchema, addMissingVersionField, assertExhaustive, calculateResetAt, calculateRetryAt, currentDate, currentTimestampMilliseconds, currentTimestampSeconds, deepMergeFilters, eventFilterMatches, parseEndpointIndexStats, replacements, requestFilterMatches, responseFilterMatches, stringPatternMatchers, supportsFeature, urlWithSearchParams };
1839
+ export { API_VERSIONS, ApiEventLogSchema, AutoYieldConfigSchema, AutoYieldMetadataSchema, CachedTaskSchema, CancelRunsForEventSchema, CommonMissingConnectionNotificationPayloadSchema, CommonMissingConnectionNotificationResolvedPayloadSchema, CompleteTaskBodyInputSchema, CompleteTaskBodyV2InputSchema, ConcurrencyLimitOptionsSchema, ConnectionAuthSchema, CreateExternalConnectionBodySchema, CreateRunResponseBodySchema, CronMetadataSchema, CronOptionsSchema, DELIVER_WEBHOOK_REQUEST, DeliverEventResponseSchema, DeserializedJsonSchema, DisplayPropertiesSchema, DisplayPropertySchema, DynamicTriggerEndpointMetadataSchema, DynamicTriggerMetadataSchema, EndpointHeadersSchema, EndpointIndexErrorSchema, EphemeralEventDispatcherRequestBodySchema, EphemeralEventDispatcherResponseBodySchema, ErrorWithStackSchema, EventExampleSchema, EventFilterSchema, EventRuleSchema, EventSpecificationSchema, ExecuteJobHeadersSchema, ExecuteJobRunMetadataSchema, FailTaskBodyInputSchema, FetchOperationSchema, FetchPollOperationSchema, FetchRequestInitSchema, FetchRetryBackoffStrategySchema, FetchRetryHeadersStrategySchema, FetchRetryOptionsSchema, FetchRetryStrategySchema, FetchTimeoutOptionsSchema, GetEndpointIndexResponseSchema, GetEventSchema, GetRunSchema, GetRunStatusesSchema, GetRunsSchema, HTTPMethodUnionSchema, HandleTriggerSourceSchema, HttpEndpointRequestHeadersSchema, HttpSourceRequestHeadersSchema, HttpSourceResponseSchema, IndexEndpointResponseSchema, InitializeCronScheduleBodySchema, InitializeTriggerBodySchema, IntegrationConfigSchema, IntegrationMetadataSchema, IntervalMetadataSchema, IntervalOptionsSchema, InvokeJobRequestBodySchema, InvokeJobResponseSchema, InvokeOptionsSchema, InvokeTriggerMetadataSchema, JobMetadataSchema, JobRunStatusRecordSchema, KeyValueStoreResponseBodySchema, LogMessageSchema, MISSING_CONNECTION_NOTIFICATION, MISSING_CONNECTION_RESOLVED_NOTIFICATION, MissingConnectionNotificationPayloadSchema, MissingConnectionResolvedNotificationPayloadSchema, MissingDeveloperConnectionNotificationPayloadSchema, MissingDeveloperConnectionResolvedNotificationPayloadSchema, MissingExternalConnectionNotificationPayloadSchema, MissingExternalConnectionResolvedNotificationPayloadSchema, NormalizedRequestSchema, NormalizedResponseSchema, PLATFORM_FEATURES, PongErrorResponseSchema, PongResponseSchema, PongSuccessResponseSchema, PreprocessRunBodySchema, PreprocessRunResponseSchema, QueueOptionsSchema, REGISTER_SOURCE_EVENT_V1, REGISTER_SOURCE_EVENT_V2, REGISTER_WEBHOOK, RawEventSchema, RedactSchema, RedactStringSchema, RegisterDynamicSchedulePayloadSchema, RegisterHTTPTriggerSourceBodySchema, RegisterIntervalScheduleBodySchema, RegisterSMTPTriggerSourceBodySchema, RegisterSQSTriggerSourceBodySchema, RegisterScheduleBodySchema, RegisterScheduleResponseBodySchema, RegisterSourceChannelBodySchema, RegisterSourceEventSchemaV1, RegisterSourceEventSchemaV2, RegisterTriggerBodySchemaV1, RegisterTriggerBodySchemaV2, RegisterTriggerSourceSchema, RegisterWebhookPayloadSchema, RegisterWebhookSourceSchema, RequestFilterSchema, RequestWithRawBodySchema, ResponseFilterSchema, RetryOptionsSchema, RunJobAutoYieldExecutionErrorSchema, RunJobAutoYieldWithCompletedTaskExecutionErrorSchema, RunJobBodySchema, RunJobCanceledWithTaskSchema, RunJobErrorResponseSchema, RunJobErrorSchema, RunJobInvalidPayloadErrorSchema, RunJobResponseSchema, RunJobResumeWithParallelTaskSchema, RunJobResumeWithTaskSchema, RunJobRetryWithTaskSchema, RunJobSuccessSchema, RunJobUnresolvedAuthErrorSchema, RunJobYieldExecutionErrorSchema, RunSourceContextSchema, RunStatusSchema, RunTaskBodyInputSchema, RunTaskBodyOutputSchema, RunTaskOptionsSchema, RunTaskResponseWithCachedTasksBodySchema, RunTaskSchema, RuntimeEnvironmentTypeSchema, SCHEDULED_EVENT, ScheduleMetadataSchema, ScheduledPayloadSchema, ScheduledTriggerMetadataSchema, SchemaErrorSchema, SendBulkEventsBodySchema, SendEventBodySchema, SendEventOptionsSchema, SerializableJsonSchema, ServerTaskSchema, SourceMetadataV2Schema, StaticTriggerMetadataSchema, StatusHistorySchema, StatusUpdateSchema, StatusUpdateStateSchema, StyleSchema, TaskSchema, TaskStatusSchema, TriggerHelpSchema, TriggerMetadataSchema, TriggerSourceSchema, UpdateTriggerSourceBodyV1Schema, UpdateTriggerSourceBodyV2Schema, UpdateWebhookBodySchema, ValidateErrorResponseSchema, ValidateResponseSchema, ValidateSuccessResponseSchema, WebhookContextMetadataSchema, WebhookDeliveryResponseSchema, WebhookMetadataSchema, WebhookSourceRequestHeadersSchema, addMissingVersionField, assertExhaustive, calculateResetAt, calculateRetryAt, currentDate, currentTimestampMilliseconds, currentTimestampSeconds, deepMergeFilters, eventFilterMatches, parseEndpointIndexStats, replacements, requestFilterMatches, responseFilterMatches, stringPatternMatchers, supportsFeature, urlWithSearchParams };
2027
1840
  //# sourceMappingURL=out.js.map
2028
1841
  //# sourceMappingURL=index.mjs.map