@trigger.dev/sdk 2.0.0-next.11 → 2.0.0-next.13

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.js CHANGED
@@ -601,14 +601,22 @@ var SourceMetadataSchema = import_zod9.z.object({
601
601
  integration: IntegrationConfigSchema,
602
602
  key: import_zod9.z.string(),
603
603
  params: import_zod9.z.any(),
604
- events: import_zod9.z.array(import_zod9.z.string())
604
+ events: import_zod9.z.array(import_zod9.z.string()),
605
+ registerSourceJob: import_zod9.z.object({
606
+ id: import_zod9.z.string(),
607
+ version: import_zod9.z.string()
608
+ }).optional()
605
609
  });
606
610
  var DynamicTriggerEndpointMetadataSchema = import_zod9.z.object({
607
611
  id: import_zod9.z.string(),
608
612
  jobs: import_zod9.z.array(JobMetadataSchema.pick({
609
613
  id: true,
610
614
  version: true
611
- }))
615
+ })),
616
+ registerSourceJob: import_zod9.z.object({
617
+ id: import_zod9.z.string(),
618
+ version: import_zod9.z.string()
619
+ }).optional()
612
620
  });
613
621
  var IndexEndpointResponseSchema = import_zod9.z.object({
614
622
  jobs: import_zod9.z.array(JobMetadataSchema),
@@ -1925,7 +1933,7 @@ var TriggerClient = class {
1925
1933
  return {
1926
1934
  status: 401,
1927
1935
  body: {
1928
- message: `Forbidden: client apiKey mismatch: Expected ${__privateGet(this, _options3).apiKey}, got ${apiKey}`
1936
+ message: `Forbidden: client apiKey mismatch: Make sure you are using the correct API Key for your environment`
1929
1937
  }
1930
1938
  };
1931
1939
  }
@@ -1997,7 +2005,11 @@ var TriggerClient = class {
1997
2005
  sources: Object.values(__privateGet(this, _registeredSources)),
1998
2006
  dynamicTriggers: Object.values(__privateGet(this, _registeredDynamicTriggers)).map((trigger) => ({
1999
2007
  id: trigger.id,
2000
- jobs: __privateGet(this, _jobMetadataByDynamicTriggers)[trigger.id] ?? []
2008
+ jobs: __privateGet(this, _jobMetadataByDynamicTriggers)[trigger.id] ?? [],
2009
+ registerSourceJob: {
2010
+ id: dynamicTriggerRegisterSourceJobId(trigger.id),
2011
+ version: trigger.source.version
2012
+ }
2001
2013
  })),
2002
2014
  dynamicSchedules: Object.entries(__privateGet(this, _registeredSchedules)).map(([id, jobs]) => ({
2003
2015
  id,
@@ -2143,7 +2155,7 @@ var TriggerClient = class {
2143
2155
  attachDynamicTrigger(trigger) {
2144
2156
  __privateGet(this, _registeredDynamicTriggers)[trigger.id] = trigger;
2145
2157
  new Job(this, {
2146
- id: `register-dynamic-trigger-${trigger.id}`,
2158
+ id: dynamicTriggerRegisterSourceJobId(trigger.id),
2147
2159
  name: `Register dynamic trigger ${trigger.id}`,
2148
2160
  version: trigger.source.version,
2149
2161
  trigger: new EventTrigger({
@@ -2193,6 +2205,10 @@ var TriggerClient = class {
2193
2205
  id: options.source.integration.id,
2194
2206
  metadata: options.source.integration.metadata,
2195
2207
  authSource: options.source.integration.client.usesLocalAuth ? "LOCAL" : "HOSTED"
2208
+ },
2209
+ registerSourceJob: {
2210
+ id: options.key,
2211
+ version: options.source.version
2196
2212
  }
2197
2213
  };
2198
2214
  }
@@ -2479,6 +2495,10 @@ handleHttpSourceRequest_fn = /* @__PURE__ */ __name(async function(source, sourc
2479
2495
  }
2480
2496
  };
2481
2497
  }, "#handleHttpSourceRequest");
2498
+ function dynamicTriggerRegisterSourceJobId(id) {
2499
+ return `register-dynamic-trigger-${id}`;
2500
+ }
2501
+ __name(dynamicTriggerRegisterSourceJobId, "dynamicTriggerRegisterSourceJobId");
2482
2502
 
2483
2503
  // src/integrations.ts
2484
2504
  function authenticatedTask(options) {
@@ -2617,6 +2637,7 @@ var DynamicTrigger = class {
2617
2637
  return __privateGet(this, _options4).event;
2618
2638
  }
2619
2639
  registeredTriggerForParams(params) {
2640
+ const key = slugifyId(this.source.key(params));
2620
2641
  return {
2621
2642
  rule: {
2622
2643
  event: this.event.name,
@@ -2624,7 +2645,7 @@ var DynamicTrigger = class {
2624
2645
  payload: deepMergeFilters(this.source.filter(params), this.event.filter ?? {})
2625
2646
  },
2626
2647
  source: {
2627
- key: slugifyId(this.source.key(params)),
2648
+ key,
2628
2649
  channel: this.source.channel,
2629
2650
  params,
2630
2651
  events: [