@trigger.dev/sdk 0.0.0-cross-runtime-20231201153629 → 0.0.0-cross-runtime-20231201164903
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.d.mts +16 -16
- package/dist/index.d.ts +16 -16
- package/dist/index.js +11 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -6
package/dist/index.d.mts
CHANGED
|
@@ -1426,6 +1426,22 @@ declare class ConcurrencyLimit {
|
|
|
1426
1426
|
get limit(): number;
|
|
1427
1427
|
}
|
|
1428
1428
|
|
|
1429
|
+
declare class KeyValueStore {
|
|
1430
|
+
#private;
|
|
1431
|
+
private apiClient;
|
|
1432
|
+
private type;
|
|
1433
|
+
private namespace;
|
|
1434
|
+
constructor(apiClient: ApiClient, type?: string | null, namespace?: string);
|
|
1435
|
+
delete(cacheKey: string | any[], key: string): Promise<boolean>;
|
|
1436
|
+
delete(key: string): Promise<boolean>;
|
|
1437
|
+
get<T extends Json<T> = any>(cacheKey: string | any[], key: string): Promise<T>;
|
|
1438
|
+
get<T extends Json<T> = any>(key: string): Promise<T>;
|
|
1439
|
+
has(cacheKey: string | any[], key: string): Promise<boolean>;
|
|
1440
|
+
has(key: string): Promise<boolean>;
|
|
1441
|
+
set<T extends Json<T>>(cacheKey: string | any[], key: string, value: T): Promise<T>;
|
|
1442
|
+
set<T extends Json<T>>(key: string, value: T): Promise<T>;
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1429
1445
|
type WebhookCRUDContext<TParams extends any, TConfig extends Record<string, string[]>> = {
|
|
1430
1446
|
active: boolean;
|
|
1431
1447
|
params: TParams;
|
|
@@ -1561,22 +1577,6 @@ declare class WebhookTrigger<TEventSpecification extends EventSpecification<any>
|
|
|
1561
1577
|
}>;
|
|
1562
1578
|
}
|
|
1563
1579
|
|
|
1564
|
-
declare class KeyValueStore {
|
|
1565
|
-
#private;
|
|
1566
|
-
private apiClient;
|
|
1567
|
-
private type;
|
|
1568
|
-
private namespace;
|
|
1569
|
-
constructor(apiClient: ApiClient, type?: string | null, namespace?: string);
|
|
1570
|
-
delete(cacheKey: string | any[], key: string): Promise<boolean>;
|
|
1571
|
-
delete(key: string): Promise<boolean>;
|
|
1572
|
-
get<T extends Json<T> = any>(cacheKey: string | any[], key: string): Promise<T>;
|
|
1573
|
-
get<T extends Json<T> = any>(key: string): Promise<T>;
|
|
1574
|
-
has(cacheKey: string | any[], key: string): Promise<boolean>;
|
|
1575
|
-
has(key: string): Promise<boolean>;
|
|
1576
|
-
set<T extends Json<T>>(cacheKey: string | any[], key: string, value: T): Promise<T>;
|
|
1577
|
-
set<T extends Json<T>>(key: string, value: T): Promise<T>;
|
|
1578
|
-
}
|
|
1579
|
-
|
|
1580
1580
|
type TriggerClientOptions = {
|
|
1581
1581
|
/** The `id` property is used to uniquely identify the client.
|
|
1582
1582
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1426,6 +1426,22 @@ declare class ConcurrencyLimit {
|
|
|
1426
1426
|
get limit(): number;
|
|
1427
1427
|
}
|
|
1428
1428
|
|
|
1429
|
+
declare class KeyValueStore {
|
|
1430
|
+
#private;
|
|
1431
|
+
private apiClient;
|
|
1432
|
+
private type;
|
|
1433
|
+
private namespace;
|
|
1434
|
+
constructor(apiClient: ApiClient, type?: string | null, namespace?: string);
|
|
1435
|
+
delete(cacheKey: string | any[], key: string): Promise<boolean>;
|
|
1436
|
+
delete(key: string): Promise<boolean>;
|
|
1437
|
+
get<T extends Json<T> = any>(cacheKey: string | any[], key: string): Promise<T>;
|
|
1438
|
+
get<T extends Json<T> = any>(key: string): Promise<T>;
|
|
1439
|
+
has(cacheKey: string | any[], key: string): Promise<boolean>;
|
|
1440
|
+
has(key: string): Promise<boolean>;
|
|
1441
|
+
set<T extends Json<T>>(cacheKey: string | any[], key: string, value: T): Promise<T>;
|
|
1442
|
+
set<T extends Json<T>>(key: string, value: T): Promise<T>;
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1429
1445
|
type WebhookCRUDContext<TParams extends any, TConfig extends Record<string, string[]>> = {
|
|
1430
1446
|
active: boolean;
|
|
1431
1447
|
params: TParams;
|
|
@@ -1561,22 +1577,6 @@ declare class WebhookTrigger<TEventSpecification extends EventSpecification<any>
|
|
|
1561
1577
|
}>;
|
|
1562
1578
|
}
|
|
1563
1579
|
|
|
1564
|
-
declare class KeyValueStore {
|
|
1565
|
-
#private;
|
|
1566
|
-
private apiClient;
|
|
1567
|
-
private type;
|
|
1568
|
-
private namespace;
|
|
1569
|
-
constructor(apiClient: ApiClient, type?: string | null, namespace?: string);
|
|
1570
|
-
delete(cacheKey: string | any[], key: string): Promise<boolean>;
|
|
1571
|
-
delete(key: string): Promise<boolean>;
|
|
1572
|
-
get<T extends Json<T> = any>(cacheKey: string | any[], key: string): Promise<T>;
|
|
1573
|
-
get<T extends Json<T> = any>(key: string): Promise<T>;
|
|
1574
|
-
has(cacheKey: string | any[], key: string): Promise<boolean>;
|
|
1575
|
-
has(key: string): Promise<boolean>;
|
|
1576
|
-
set<T extends Json<T>>(cacheKey: string | any[], key: string, value: T): Promise<T>;
|
|
1577
|
-
set<T extends Json<T>>(key: string, value: T): Promise<T>;
|
|
1578
|
-
}
|
|
1579
|
-
|
|
1580
1580
|
type TriggerClientOptions = {
|
|
1581
1581
|
/** The `id` property is used to uniquely identify the client.
|
|
1582
1582
|
*/
|
package/dist/index.js
CHANGED
|
@@ -304,10 +304,11 @@ var Job = _Job;
|
|
|
304
304
|
|
|
305
305
|
// src/triggerClient.ts
|
|
306
306
|
var import_core8 = require("@trigger.dev/core");
|
|
307
|
-
var
|
|
307
|
+
var import_node_process2 = require("node:process");
|
|
308
308
|
|
|
309
309
|
// src/apiClient.ts
|
|
310
310
|
var import_core3 = require("@trigger.dev/core");
|
|
311
|
+
var import_node_process = require("node:process");
|
|
311
312
|
var import_zod3 = require("zod");
|
|
312
313
|
|
|
313
314
|
// src/io.ts
|
|
@@ -1901,7 +1902,7 @@ var _ApiClient = class _ApiClient {
|
|
|
1901
1902
|
__privateAdd(this, _logger, void 0);
|
|
1902
1903
|
__privateAdd(this, _storeClient, void 0);
|
|
1903
1904
|
__privateSet(this, _options, options);
|
|
1904
|
-
__privateSet(this, _apiUrl, __privateGet(this, _options).apiUrl ??
|
|
1905
|
+
__privateSet(this, _apiUrl, __privateGet(this, _options).apiUrl ?? import_node_process.env.TRIGGER_API_URL ?? "https://api.trigger.dev");
|
|
1905
1906
|
__privateSet(this, _logger, new import_core3.Logger("trigger.dev", __privateGet(this, _options).logLevel));
|
|
1906
1907
|
__privateSet(this, _storeClient, new KeyValueStoreClient(__privateMethod(this, _queryKeyValueStore, queryKeyValueStore_fn).bind(this)));
|
|
1907
1908
|
}
|
|
@@ -2339,7 +2340,7 @@ apiKey_fn = /* @__PURE__ */ __name(async function() {
|
|
|
2339
2340
|
__name(_ApiClient, "ApiClient");
|
|
2340
2341
|
var ApiClient = _ApiClient;
|
|
2341
2342
|
function getApiKey(key) {
|
|
2342
|
-
const apiKey = key ??
|
|
2343
|
+
const apiKey = key ?? import_node_process.env.TRIGGER_API_KEY;
|
|
2343
2344
|
if (!apiKey) {
|
|
2344
2345
|
return {
|
|
2345
2346
|
status: "missing"
|
|
@@ -3004,7 +3005,7 @@ var DynamicSchedule = _DynamicSchedule;
|
|
|
3004
3005
|
var import_node_events = __toESM(require("node:events"));
|
|
3005
3006
|
|
|
3006
3007
|
// package.json
|
|
3007
|
-
var version = "0.0.0-cross-runtime-
|
|
3008
|
+
var version = "0.0.0-cross-runtime-20231201164903";
|
|
3008
3009
|
|
|
3009
3010
|
// src/concurrencyLimit.ts
|
|
3010
3011
|
var _ConcurrencyLimit = class _ConcurrencyLimit {
|
|
@@ -3465,7 +3466,7 @@ var _TriggerClient = class _TriggerClient {
|
|
|
3465
3466
|
defineJob(options) {
|
|
3466
3467
|
const existingRegisteredJob = __privateGet(this, _registeredJobs)[options.id];
|
|
3467
3468
|
if (existingRegisteredJob) {
|
|
3468
|
-
console.warn(
|
|
3469
|
+
console.warn(`[@trigger.dev/sdk] Warning: The Job "${existingRegisteredJob.id}" you're attempting to define has already been defined. Please assign a different ID to the job.`);
|
|
3469
3470
|
}
|
|
3470
3471
|
return new Job(this, options);
|
|
3471
3472
|
}
|
|
@@ -3488,7 +3489,7 @@ var _TriggerClient = class _TriggerClient {
|
|
|
3488
3489
|
defineHttpEndpoint(options, suppressWarnings = false) {
|
|
3489
3490
|
const existingHttpEndpoint = __privateGet(this, _registeredHttpEndpoints)[options.id];
|
|
3490
3491
|
if (!suppressWarnings && existingHttpEndpoint) {
|
|
3491
|
-
console.warn(
|
|
3492
|
+
console.warn(`[@trigger.dev/sdk] Warning: The HttpEndpoint "${existingHttpEndpoint.id}" you're attempting to define has already been defined. Please assign a different ID to the HttpEndpoint.`);
|
|
3492
3493
|
}
|
|
3493
3494
|
const endpoint = httpEndpoint(options);
|
|
3494
3495
|
__privateGet(this, _registeredHttpEndpoints)[endpoint.id] = endpoint;
|
|
@@ -3767,14 +3768,14 @@ var _TriggerClient = class _TriggerClient {
|
|
|
3767
3768
|
if (typeof apiKey !== "string") {
|
|
3768
3769
|
return "missing-header";
|
|
3769
3770
|
}
|
|
3770
|
-
const localApiKey = __privateGet(this, _options4).apiKey ??
|
|
3771
|
+
const localApiKey = __privateGet(this, _options4).apiKey ?? import_node_process2.env.TRIGGER_API_KEY;
|
|
3771
3772
|
if (!localApiKey) {
|
|
3772
3773
|
return "missing-client";
|
|
3773
3774
|
}
|
|
3774
3775
|
return apiKey === localApiKey ? "authorized" : "unauthorized";
|
|
3775
3776
|
}
|
|
3776
3777
|
apiKey() {
|
|
3777
|
-
return __privateGet(this, _options4).apiKey ??
|
|
3778
|
+
return __privateGet(this, _options4).apiKey ?? import_node_process2.env.TRIGGER_API_KEY;
|
|
3778
3779
|
}
|
|
3779
3780
|
};
|
|
3780
3781
|
_options4 = new WeakMap();
|
|
@@ -4856,7 +4857,7 @@ __name(_WebhookTrigger, "WebhookTrigger");
|
|
|
4856
4857
|
var WebhookTrigger = _WebhookTrigger;
|
|
4857
4858
|
|
|
4858
4859
|
// src/security.ts
|
|
4859
|
-
var
|
|
4860
|
+
var import_node_crypto3 = __toESM(require("node:crypto"));
|
|
4860
4861
|
async function verifyRequestSignature({ request, headerName, headerEncoding = "hex", secret, algorithm }) {
|
|
4861
4862
|
if (!secret) {
|
|
4862
4863
|
return {
|
|
@@ -4890,7 +4891,7 @@ async function verifyRequestSignature({ request, headerName, headerEncoding = "h
|
|
|
4890
4891
|
}
|
|
4891
4892
|
__name(verifyRequestSignature, "verifyRequestSignature");
|
|
4892
4893
|
function verifyHmacSha256(headerValue, headerEncoding, secret, body) {
|
|
4893
|
-
const bodyDigest =
|
|
4894
|
+
const bodyDigest = import_node_crypto3.default.createHmac("sha256", secret).update(body).digest(headerEncoding);
|
|
4894
4895
|
const signature = headerValue?.replace("hmac-sha256=", "").replace("sha256=", "") ?? "";
|
|
4895
4896
|
return signature === bodyDigest;
|
|
4896
4897
|
}
|