@linear/sdk 2.4.0 → 2.6.0

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-cjs.js CHANGED
@@ -7,6 +7,7 @@ var http = require('http');
7
7
  var Url = require('url');
8
8
  var https = require('https');
9
9
  var zlib = require('zlib');
10
+ var crypto = require('crypto');
10
11
 
11
12
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
13
 
@@ -15,6 +16,7 @@ var http__default = /*#__PURE__*/_interopDefaultLegacy(http);
15
16
  var Url__default = /*#__PURE__*/_interopDefaultLegacy(Url);
16
17
  var https__default = /*#__PURE__*/_interopDefaultLegacy(https);
17
18
  var zlib__default = /*#__PURE__*/_interopDefaultLegacy(zlib);
19
+ var crypto__default = /*#__PURE__*/_interopDefaultLegacy(crypto);
18
20
 
19
21
  /******************************************************************************
20
22
  Copyright (c) Microsoft Corporation.
@@ -83966,45 +83968,6 @@ const GithubOAuthTokenPayloadFragmentDoc = {
83966
83968
  ...GithubOrgFragmentDoc.definitions,
83967
83969
  ],
83968
83970
  };
83969
- const OauthClientFragmentDoc = {
83970
- kind: "Document",
83971
- definitions: [
83972
- {
83973
- kind: "FragmentDefinition",
83974
- name: { kind: "Name", value: "OauthClient" },
83975
- typeCondition: { kind: "NamedType", name: { kind: "Name", value: "OauthClient" } },
83976
- selectionSet: {
83977
- kind: "SelectionSet",
83978
- selections: [
83979
- { kind: "Field", name: { kind: "Name", value: "__typename" } },
83980
- { kind: "Field", name: { kind: "Name", value: "imageUrl" } },
83981
- { kind: "Field", name: { kind: "Name", value: "description" } },
83982
- { kind: "Field", name: { kind: "Name", value: "redirectUris" } },
83983
- { kind: "Field", name: { kind: "Name", value: "developer" } },
83984
- { kind: "Field", name: { kind: "Name", value: "clientId" } },
83985
- { kind: "Field", name: { kind: "Name", value: "name" } },
83986
- { kind: "Field", name: { kind: "Name", value: "clientSecret" } },
83987
- { kind: "Field", name: { kind: "Name", value: "updatedAt" } },
83988
- { kind: "Field", name: { kind: "Name", value: "webhookResourceTypes" } },
83989
- { kind: "Field", name: { kind: "Name", value: "archivedAt" } },
83990
- { kind: "Field", name: { kind: "Name", value: "createdAt" } },
83991
- { kind: "Field", name: { kind: "Name", value: "id" } },
83992
- {
83993
- kind: "Field",
83994
- name: { kind: "Name", value: "creator" },
83995
- selectionSet: {
83996
- kind: "SelectionSet",
83997
- selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }],
83998
- },
83999
- },
84000
- { kind: "Field", name: { kind: "Name", value: "developerUrl" } },
84001
- { kind: "Field", name: { kind: "Name", value: "webhookUrl" } },
84002
- { kind: "Field", name: { kind: "Name", value: "publicEnabled" } },
84003
- ],
84004
- },
84005
- },
84006
- ],
84007
- };
84008
83971
  const UserAuthorizedApplicationFragmentDoc = {
84009
83972
  kind: "Document",
84010
83973
  definitions: [
@@ -84447,54 +84410,6 @@ const UserSettingsFragmentDoc = {
84447
84410
  },
84448
84411
  ],
84449
84412
  };
84450
- const AdminJobConfigurationPayloadFragmentDoc = {
84451
- kind: "Document",
84452
- definitions: [
84453
- {
84454
- kind: "FragmentDefinition",
84455
- name: { kind: "Name", value: "AdminJobConfigurationPayload" },
84456
- typeCondition: { kind: "NamedType", name: { kind: "Name", value: "AdminJobConfigurationPayload" } },
84457
- selectionSet: {
84458
- kind: "SelectionSet",
84459
- selections: [
84460
- { kind: "Field", name: { kind: "Name", value: "__typename" } },
84461
- { kind: "Field", name: { kind: "Name", value: "currentJob" } },
84462
- { kind: "Field", name: { kind: "Name", value: "delay" } },
84463
- { kind: "Field", name: { kind: "Name", value: "enabled" } },
84464
- { kind: "Field", name: { kind: "Name", value: "param" } },
84465
- ],
84466
- },
84467
- },
84468
- ],
84469
- };
84470
- const AdminJobStatusPayloadFragmentDoc = {
84471
- kind: "Document",
84472
- definitions: [
84473
- {
84474
- kind: "FragmentDefinition",
84475
- name: { kind: "Name", value: "AdminJobStatusPayload" },
84476
- typeCondition: { kind: "NamedType", name: { kind: "Name", value: "AdminJobStatusPayload" } },
84477
- selectionSet: {
84478
- kind: "SelectionSet",
84479
- selections: [
84480
- { kind: "Field", name: { kind: "Name", value: "__typename" } },
84481
- { kind: "Field", name: { kind: "Name", value: "availableJobs" } },
84482
- {
84483
- kind: "Field",
84484
- name: { kind: "Name", value: "configuration" },
84485
- selectionSet: {
84486
- kind: "SelectionSet",
84487
- selections: [{ kind: "FragmentSpread", name: { kind: "Name", value: "AdminJobConfigurationPayload" } }],
84488
- },
84489
- },
84490
- { kind: "Field", name: { kind: "Name", value: "cursor" } },
84491
- { kind: "Field", name: { kind: "Name", value: "startedAt" } },
84492
- ],
84493
- },
84494
- },
84495
- ...AdminJobConfigurationPayloadFragmentDoc.definitions,
84496
- ],
84497
- };
84498
84413
  const ApiKeyFragmentDoc = {
84499
84414
  kind: "Document",
84500
84415
  definitions: [
@@ -84872,6 +84787,7 @@ const OrganizationFragmentDoc = {
84872
84787
  { kind: "Field", name: { kind: "Name", value: "deletionRequestedAt" } },
84873
84788
  { kind: "Field", name: { kind: "Name", value: "archivedAt" } },
84874
84789
  { kind: "Field", name: { kind: "Name", value: "createdAt" } },
84790
+ { kind: "Field", name: { kind: "Name", value: "trialEndsAt" } },
84875
84791
  { kind: "Field", name: { kind: "Name", value: "id" } },
84876
84792
  { kind: "Field", name: { kind: "Name", value: "samlEnabled" } },
84877
84793
  { kind: "Field", name: { kind: "Name", value: "scimEnabled" } },
@@ -87361,6 +87277,80 @@ const NotificationSubscriptionPayloadFragmentDoc = {
87361
87277
  ...NotificationSubscriptionFragmentDoc.definitions,
87362
87278
  ],
87363
87279
  };
87280
+ const OauthClientFragmentDoc = {
87281
+ kind: "Document",
87282
+ definitions: [
87283
+ {
87284
+ kind: "FragmentDefinition",
87285
+ name: { kind: "Name", value: "OauthClient" },
87286
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "OauthClient" } },
87287
+ selectionSet: {
87288
+ kind: "SelectionSet",
87289
+ selections: [
87290
+ { kind: "Field", name: { kind: "Name", value: "__typename" } },
87291
+ { kind: "Field", name: { kind: "Name", value: "imageUrl" } },
87292
+ { kind: "Field", name: { kind: "Name", value: "description" } },
87293
+ { kind: "Field", name: { kind: "Name", value: "redirectUris" } },
87294
+ { kind: "Field", name: { kind: "Name", value: "developer" } },
87295
+ { kind: "Field", name: { kind: "Name", value: "clientId" } },
87296
+ { kind: "Field", name: { kind: "Name", value: "name" } },
87297
+ { kind: "Field", name: { kind: "Name", value: "clientSecret" } },
87298
+ { kind: "Field", name: { kind: "Name", value: "updatedAt" } },
87299
+ { kind: "Field", name: { kind: "Name", value: "webhookResourceTypes" } },
87300
+ { kind: "Field", name: { kind: "Name", value: "archivedAt" } },
87301
+ { kind: "Field", name: { kind: "Name", value: "createdAt" } },
87302
+ { kind: "Field", name: { kind: "Name", value: "id" } },
87303
+ {
87304
+ kind: "Field",
87305
+ name: { kind: "Name", value: "creator" },
87306
+ selectionSet: {
87307
+ kind: "SelectionSet",
87308
+ selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }],
87309
+ },
87310
+ },
87311
+ { kind: "Field", name: { kind: "Name", value: "developerUrl" } },
87312
+ { kind: "Field", name: { kind: "Name", value: "webhookUrl" } },
87313
+ { kind: "Field", name: { kind: "Name", value: "webhookSecret" } },
87314
+ { kind: "Field", name: { kind: "Name", value: "publicEnabled" } },
87315
+ ],
87316
+ },
87317
+ },
87318
+ ],
87319
+ };
87320
+ const OauthClientConnectionFragmentDoc = {
87321
+ kind: "Document",
87322
+ definitions: [
87323
+ {
87324
+ kind: "FragmentDefinition",
87325
+ name: { kind: "Name", value: "OauthClientConnection" },
87326
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "OauthClientConnection" } },
87327
+ selectionSet: {
87328
+ kind: "SelectionSet",
87329
+ selections: [
87330
+ { kind: "Field", name: { kind: "Name", value: "__typename" } },
87331
+ {
87332
+ kind: "Field",
87333
+ name: { kind: "Name", value: "nodes" },
87334
+ selectionSet: {
87335
+ kind: "SelectionSet",
87336
+ selections: [{ kind: "FragmentSpread", name: { kind: "Name", value: "OauthClient" } }],
87337
+ },
87338
+ },
87339
+ {
87340
+ kind: "Field",
87341
+ name: { kind: "Name", value: "pageInfo" },
87342
+ selectionSet: {
87343
+ kind: "SelectionSet",
87344
+ selections: [{ kind: "FragmentSpread", name: { kind: "Name", value: "PageInfo" } }],
87345
+ },
87346
+ },
87347
+ ],
87348
+ },
87349
+ },
87350
+ ...OauthClientFragmentDoc.definitions,
87351
+ ...PageInfoFragmentDoc.definitions,
87352
+ ],
87353
+ };
87364
87354
  const OrganizationCancelDeletePayloadFragmentDoc = {
87365
87355
  kind: "Document",
87366
87356
  definitions: [
@@ -92021,6 +92011,54 @@ const IntegrationSlackImportEmojisDocument = {
92021
92011
  ...IntegrationPayloadFragmentDoc.definitions,
92022
92012
  ],
92023
92013
  };
92014
+ const IntegrationSlackIntakeDocument = {
92015
+ kind: "Document",
92016
+ definitions: [
92017
+ {
92018
+ kind: "OperationDefinition",
92019
+ operation: "mutation",
92020
+ name: { kind: "Name", value: "integrationSlackIntake" },
92021
+ variableDefinitions: [
92022
+ {
92023
+ kind: "VariableDefinition",
92024
+ variable: { kind: "Variable", name: { kind: "Name", value: "code" } },
92025
+ type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } },
92026
+ },
92027
+ {
92028
+ kind: "VariableDefinition",
92029
+ variable: { kind: "Variable", name: { kind: "Name", value: "redirectUri" } },
92030
+ type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } },
92031
+ },
92032
+ ],
92033
+ selectionSet: {
92034
+ kind: "SelectionSet",
92035
+ selections: [
92036
+ {
92037
+ kind: "Field",
92038
+ name: { kind: "Name", value: "integrationSlackIntake" },
92039
+ arguments: [
92040
+ {
92041
+ kind: "Argument",
92042
+ name: { kind: "Name", value: "code" },
92043
+ value: { kind: "Variable", name: { kind: "Name", value: "code" } },
92044
+ },
92045
+ {
92046
+ kind: "Argument",
92047
+ name: { kind: "Name", value: "redirectUri" },
92048
+ value: { kind: "Variable", name: { kind: "Name", value: "redirectUri" } },
92049
+ },
92050
+ ],
92051
+ selectionSet: {
92052
+ kind: "SelectionSet",
92053
+ selections: [{ kind: "FragmentSpread", name: { kind: "Name", value: "IntegrationPayload" } }],
92054
+ },
92055
+ },
92056
+ ],
92057
+ },
92058
+ },
92059
+ ...IntegrationPayloadFragmentDoc.definitions,
92060
+ ],
92061
+ };
92024
92062
  const IntegrationSlackOrgProjectUpdatesPostDocument = {
92025
92063
  kind: "Document",
92026
92064
  definitions: [
@@ -108668,7 +108706,6 @@ var _generated_documents = /*#__PURE__*/Object.freeze({
108668
108706
  GithubRepoFragmentDoc: GithubRepoFragmentDoc,
108669
108707
  GithubOrgFragmentDoc: GithubOrgFragmentDoc,
108670
108708
  GithubOAuthTokenPayloadFragmentDoc: GithubOAuthTokenPayloadFragmentDoc,
108671
- OauthClientFragmentDoc: OauthClientFragmentDoc,
108672
108709
  UserAuthorizedApplicationFragmentDoc: UserAuthorizedApplicationFragmentDoc,
108673
108710
  ApplicationFragmentDoc: ApplicationFragmentDoc,
108674
108711
  FrontSettingsFragmentDoc: FrontSettingsFragmentDoc,
@@ -108685,8 +108722,6 @@ var _generated_documents = /*#__PURE__*/Object.freeze({
108685
108722
  IntegrationSettingsFragmentDoc: IntegrationSettingsFragmentDoc,
108686
108723
  SamlConfigurationPayloadFragmentDoc: SamlConfigurationPayloadFragmentDoc,
108687
108724
  UserSettingsFragmentDoc: UserSettingsFragmentDoc,
108688
- AdminJobConfigurationPayloadFragmentDoc: AdminJobConfigurationPayloadFragmentDoc,
108689
- AdminJobStatusPayloadFragmentDoc: AdminJobStatusPayloadFragmentDoc,
108690
108725
  ApiKeyFragmentDoc: ApiKeyFragmentDoc,
108691
108726
  PageInfoFragmentDoc: PageInfoFragmentDoc,
108692
108727
  ApiKeyConnectionFragmentDoc: ApiKeyConnectionFragmentDoc,
@@ -108769,6 +108804,8 @@ var _generated_documents = /*#__PURE__*/Object.freeze({
108769
108804
  NotificationSubscriptionFragmentDoc: NotificationSubscriptionFragmentDoc,
108770
108805
  NotificationSubscriptionConnectionFragmentDoc: NotificationSubscriptionConnectionFragmentDoc,
108771
108806
  NotificationSubscriptionPayloadFragmentDoc: NotificationSubscriptionPayloadFragmentDoc,
108807
+ OauthClientFragmentDoc: OauthClientFragmentDoc,
108808
+ OauthClientConnectionFragmentDoc: OauthClientConnectionFragmentDoc,
108772
108809
  OrganizationCancelDeletePayloadFragmentDoc: OrganizationCancelDeletePayloadFragmentDoc,
108773
108810
  OrganizationDeletePayloadFragmentDoc: OrganizationDeletePayloadFragmentDoc,
108774
108811
  OrganizationExistsPayloadFragmentDoc: OrganizationExistsPayloadFragmentDoc,
@@ -108896,6 +108933,7 @@ var _generated_documents = /*#__PURE__*/Object.freeze({
108896
108933
  IntegrationSentryConnectDocument: IntegrationSentryConnectDocument,
108897
108934
  IntegrationSlackDocument: IntegrationSlackDocument,
108898
108935
  IntegrationSlackImportEmojisDocument: IntegrationSlackImportEmojisDocument,
108936
+ IntegrationSlackIntakeDocument: IntegrationSlackIntakeDocument,
108899
108937
  IntegrationSlackOrgProjectUpdatesPostDocument: IntegrationSlackOrgProjectUpdatesPostDocument,
108900
108938
  IntegrationSlackPersonalDocument: IntegrationSlackPersonalDocument,
108901
108939
  IntegrationSlackPostDocument: IntegrationSlackPostDocument,
@@ -109275,38 +109313,6 @@ function parseJson(value) {
109275
109313
  return undefined;
109276
109314
  }
109277
109315
  }
109278
- /**
109279
- * AdminJobConfigurationPayload model
109280
- *
109281
- * @param request - function to call the graphql client
109282
- * @param data - L.AdminJobConfigurationPayloadFragment response data
109283
- */
109284
- class AdminJobConfigurationPayload extends Request {
109285
- constructor(request, data) {
109286
- var _a, _b;
109287
- super(request);
109288
- this.currentJob = (_a = data.currentJob) !== null && _a !== void 0 ? _a : undefined;
109289
- this.delay = data.delay;
109290
- this.enabled = data.enabled;
109291
- this.param = (_b = data.param) !== null && _b !== void 0 ? _b : undefined;
109292
- }
109293
- }
109294
- /**
109295
- * AdminJobStatusPayload model
109296
- *
109297
- * @param request - function to call the graphql client
109298
- * @param data - L.AdminJobStatusPayloadFragment response data
109299
- */
109300
- class AdminJobStatusPayload extends Request {
109301
- constructor(request, data) {
109302
- var _a, _b;
109303
- super(request);
109304
- this.availableJobs = data.availableJobs;
109305
- this.cursor = (_a = data.cursor) !== null && _a !== void 0 ? _a : undefined;
109306
- this.startedAt = (_b = parseDate(data.startedAt)) !== null && _b !== void 0 ? _b : undefined;
109307
- this.configuration = new AdminJobConfigurationPayload(request, data.configuration);
109308
- }
109309
- }
109310
109316
  /**
109311
109317
  * An API key. Grants access to the user's resources.
109312
109318
  *
@@ -111485,7 +111491,7 @@ class NotionSettings extends Request {
111485
111491
  */
111486
111492
  class OauthClient extends Request {
111487
111493
  constructor(request, data) {
111488
- var _a, _b, _c, _d, _e, _f;
111494
+ var _a, _b, _c, _d, _e, _f, _g;
111489
111495
  super(request);
111490
111496
  this.archivedAt = (_a = parseDate(data.archivedAt)) !== null && _a !== void 0 ? _a : undefined;
111491
111497
  this.clientId = data.clientId;
@@ -111501,7 +111507,8 @@ class OauthClient extends Request {
111501
111507
  this.redirectUris = data.redirectUris;
111502
111508
  this.updatedAt = (_e = parseDate(data.updatedAt)) !== null && _e !== void 0 ? _e : new Date();
111503
111509
  this.webhookResourceTypes = data.webhookResourceTypes;
111504
- this.webhookUrl = (_f = data.webhookUrl) !== null && _f !== void 0 ? _f : undefined;
111510
+ this.webhookSecret = (_f = data.webhookSecret) !== null && _f !== void 0 ? _f : undefined;
111511
+ this.webhookUrl = (_g = data.webhookUrl) !== null && _g !== void 0 ? _g : undefined;
111505
111512
  this._creator = data.creator;
111506
111513
  }
111507
111514
  /** The user who created the OAuthClient. */
@@ -111568,6 +111575,18 @@ class OauthClientApprovalNotification extends Request {
111568
111575
  return new UserQuery(this._request).fetch(this._user.id);
111569
111576
  }
111570
111577
  }
111578
+ /**
111579
+ * OauthClientConnection model
111580
+ *
111581
+ * @param request - function to call the graphql client
111582
+ * @param fetch - function to trigger a refetch of this OauthClientConnection model
111583
+ * @param data - OauthClientConnection response data
111584
+ */
111585
+ class OauthClientConnection extends Connection {
111586
+ constructor(request, fetch, data) {
111587
+ super(request, fetch, data.nodes.map(node => new OauthClient(request, node)), new PageInfo(request, data.pageInfo));
111588
+ }
111589
+ }
111571
111590
  /**
111572
111591
  * An organization. Organizations are root-level objects that contain user accounts and teams.
111573
111592
  *
@@ -111576,7 +111595,7 @@ class OauthClientApprovalNotification extends Request {
111576
111595
  */
111577
111596
  class Organization extends Request {
111578
111597
  constructor(request, data) {
111579
- var _a, _b, _c, _d, _e, _f;
111598
+ var _a, _b, _c, _d, _e, _f, _g;
111580
111599
  super(request);
111581
111600
  this.allowedAuthServices = data.allowedAuthServices;
111582
111601
  this.archivedAt = (_a = parseDate(data.archivedAt)) !== null && _a !== void 0 ? _a : undefined;
@@ -111595,7 +111614,8 @@ class Organization extends Request {
111595
111614
  this.roadmapEnabled = data.roadmapEnabled;
111596
111615
  this.samlEnabled = data.samlEnabled;
111597
111616
  this.scimEnabled = data.scimEnabled;
111598
- this.updatedAt = (_f = parseDate(data.updatedAt)) !== null && _f !== void 0 ? _f : new Date();
111617
+ this.trialEndsAt = (_f = parseDate(data.trialEndsAt)) !== null && _f !== void 0 ? _f : undefined;
111618
+ this.updatedAt = (_g = parseDate(data.updatedAt)) !== null && _g !== void 0 ? _g : new Date();
111599
111619
  this.urlKey = data.urlKey;
111600
111620
  this.userCount = data.userCount;
111601
111621
  this.subscription = data.subscription ? new PaidSubscription(request, data.subscription) : undefined;
@@ -115211,6 +115231,33 @@ class IntegrationSlackImportEmojisMutation extends Request {
115211
115231
  });
115212
115232
  }
115213
115233
  }
115234
+ /**
115235
+ * A fetchable IntegrationSlackIntake Mutation
115236
+ *
115237
+ * @param request - function to call the graphql client
115238
+ */
115239
+ class IntegrationSlackIntakeMutation extends Request {
115240
+ constructor(request) {
115241
+ super(request);
115242
+ }
115243
+ /**
115244
+ * Call the IntegrationSlackIntake mutation and return a IntegrationPayload
115245
+ *
115246
+ * @param code - required code to pass to integrationSlackIntake
115247
+ * @param redirectUri - required redirectUri to pass to integrationSlackIntake
115248
+ * @returns parsed response from IntegrationSlackIntakeMutation
115249
+ */
115250
+ fetch(code, redirectUri) {
115251
+ return __awaiter(this, void 0, void 0, function* () {
115252
+ const response = yield this._request(IntegrationSlackIntakeDocument, {
115253
+ code,
115254
+ redirectUri,
115255
+ });
115256
+ const data = response.integrationSlackIntake;
115257
+ return new IntegrationPayload(this._request, data);
115258
+ });
115259
+ }
115260
+ }
115214
115261
  /**
115215
115262
  * A fetchable IntegrationSlackOrgProjectUpdatesPost Mutation
115216
115263
  *
@@ -122177,6 +122224,16 @@ class LinearSdk extends Request {
122177
122224
  integrationSlackImportEmojis(code, redirectUri) {
122178
122225
  return new IntegrationSlackImportEmojisMutation(this._request).fetch(code, redirectUri);
122179
122226
  }
122227
+ /**
122228
+ * Integrates the organization with Slack for issue intake.
122229
+ *
122230
+ * @param code - required code to pass to integrationSlackIntake
122231
+ * @param redirectUri - required redirectUri to pass to integrationSlackIntake
122232
+ * @returns IntegrationPayload
122233
+ */
122234
+ integrationSlackIntake(code, redirectUri) {
122235
+ return new IntegrationSlackIntakeMutation(this._request).fetch(code, redirectUri);
122236
+ }
122180
122237
  /**
122181
122238
  * Slack integration for organization level project update notifications.
122182
122239
  *
@@ -123974,8 +124031,41 @@ class LinearClient extends LinearSdk {
123974
124031
  }
123975
124032
  }
123976
124033
 
123977
- exports.AdminJobConfigurationPayload = AdminJobConfigurationPayload;
123978
- exports.AdminJobStatusPayload = AdminJobStatusPayload;
124034
+ const LINEAR_WEBHOOK_SIGNATURE_HEADER = "linear-signature";
124035
+ const LINEAR_WEBHOOK_TS_FIELD = "webhookTimestamp";
124036
+ /**
124037
+ * Provides helper functions to work with Linear webhooks
124038
+ */
124039
+ class LinearWebhooks {
124040
+ constructor(secret) {
124041
+ this.secret = secret;
124042
+ }
124043
+ /**
124044
+ * Verify the webhook signature
124045
+ * @param rawBody The webhook request raw body.
124046
+ * @param signature The signature to verify.
124047
+ * @param timestamp The `webhookTimestamp` field from the request parsed body.
124048
+ */
124049
+ verify(rawBody, signature, timestamp) {
124050
+ const verificationBuffer = Buffer.from(crypto__default["default"].createHmac("sha256", this.secret).update(rawBody).digest("hex"));
124051
+ const signatureBuffer = Buffer.from(signature);
124052
+ if (verificationBuffer.length !== signatureBuffer.length) {
124053
+ throw new Error("Invalid webhook signature");
124054
+ }
124055
+ if (!crypto__default["default"].timingSafeEqual(verificationBuffer, signatureBuffer)) {
124056
+ throw new Error("Invalid webhook signature");
124057
+ }
124058
+ if (timestamp) {
124059
+ const timeDiff = Math.abs(new Date().getTime() - timestamp);
124060
+ // Throw error if more than one minute delta between provided ts and current time
124061
+ if (timeDiff > 1000 * 60) {
124062
+ throw new Error("Invalid webhook timestamp");
124063
+ }
124064
+ }
124065
+ return true;
124066
+ }
124067
+ }
124068
+
123979
124069
  exports.AdministrableTeamsQuery = AdministrableTeamsQuery;
123980
124070
  exports.AirbyteIntegrationConnectMutation = AirbyteIntegrationConnectMutation;
123981
124071
  exports.ApiKey = ApiKey;
@@ -124174,6 +124264,7 @@ exports.IntegrationRequestPayload = IntegrationRequestPayload;
124174
124264
  exports.IntegrationSentryConnectMutation = IntegrationSentryConnectMutation;
124175
124265
  exports.IntegrationSettings = IntegrationSettings;
124176
124266
  exports.IntegrationSlackImportEmojisMutation = IntegrationSlackImportEmojisMutation;
124267
+ exports.IntegrationSlackIntakeMutation = IntegrationSlackIntakeMutation;
124177
124268
  exports.IntegrationSlackMutation = IntegrationSlackMutation;
124178
124269
  exports.IntegrationSlackOrgProjectUpdatesPostMutation = IntegrationSlackOrgProjectUpdatesPostMutation;
124179
124270
  exports.IntegrationSlackPersonalMutation = IntegrationSlackPersonalMutation;
@@ -124248,6 +124339,8 @@ exports.JiraLinearMapping = JiraLinearMapping;
124248
124339
  exports.JiraProjectData = JiraProjectData;
124249
124340
  exports.JiraSettings = JiraSettings;
124250
124341
  exports.JoinOrganizationFromOnboardingMutation = JoinOrganizationFromOnboardingMutation;
124342
+ exports.LINEAR_WEBHOOK_SIGNATURE_HEADER = LINEAR_WEBHOOK_SIGNATURE_HEADER;
124343
+ exports.LINEAR_WEBHOOK_TS_FIELD = LINEAR_WEBHOOK_TS_FIELD;
124251
124344
  exports.LeaveOrganizationMutation = LeaveOrganizationMutation;
124252
124345
  exports.LinearClient = LinearClient;
124253
124346
  exports.LinearConnection = LinearConnection;
@@ -124256,6 +124349,7 @@ exports.LinearError = LinearError;
124256
124349
  exports.LinearGraphQLClient = LinearGraphQLClient;
124257
124350
  exports.LinearGraphQLError = LinearGraphQLError;
124258
124351
  exports.LinearSdk = LinearSdk;
124352
+ exports.LinearWebhooks = LinearWebhooks;
124259
124353
  exports.LockTimeoutLinearError = LockTimeoutLinearError;
124260
124354
  exports.LogoutMutation = LogoutMutation;
124261
124355
  exports.LogoutResponse = LogoutResponse;
@@ -124275,6 +124369,7 @@ exports.NotionSettings = NotionSettings;
124275
124369
  exports.OauthClient = OauthClient;
124276
124370
  exports.OauthClientApproval = OauthClientApproval;
124277
124371
  exports.OauthClientApprovalNotification = OauthClientApprovalNotification;
124372
+ exports.OauthClientConnection = OauthClientConnection;
124278
124373
  exports.Organization = Organization;
124279
124374
  exports.OrganizationCancelDeletePayload = OrganizationCancelDeletePayload;
124280
124375
  exports.OrganizationDeleteChallengeMutation = OrganizationDeleteChallengeMutation;