n8n-nodes-github-copilot 3.31.15 → 3.31.16

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.
@@ -1,6 +1,6 @@
1
1
  import { IExecuteFunctions } from "n8n-workflow";
2
- import { CopilotResponse, downloadFileFromUrl as sharedDownloadFileFromUrl, getFileFromBinary as sharedGetFileFromBinary, estimateTokens as sharedEstimateTokens } from "../../../shared/utils/GitHubCopilotApiUtils";
3
- export declare function makeApiRequest(context: IExecuteFunctions, endpoint: string, body: Record<string, unknown>, hasMedia?: boolean): Promise<CopilotResponse>;
2
+ import { CopilotResponse, RetryConfig, downloadFileFromUrl as sharedDownloadFileFromUrl, getFileFromBinary as sharedGetFileFromBinary, estimateTokens as sharedEstimateTokens } from "../../../shared/utils/GitHubCopilotApiUtils";
3
+ export declare function makeApiRequest(context: IExecuteFunctions, endpoint: string, body: Record<string, unknown>, hasMedia?: boolean, retryConfig?: RetryConfig): Promise<CopilotResponse>;
4
4
  export declare const downloadFileFromUrl: typeof sharedDownloadFileFromUrl;
5
5
  export declare const getFileFromBinary: typeof sharedGetFileFromBinary;
6
6
  export declare const estimateTokens: typeof sharedEstimateTokens;
@@ -6,8 +6,8 @@ exports.getImageMimeType = getImageMimeType;
6
6
  exports.getImageMimeTypeFromFilename = getImageMimeTypeFromFilename;
7
7
  exports.validateFileSize = validateFileSize;
8
8
  const GitHubCopilotApiUtils_1 = require("../../../shared/utils/GitHubCopilotApiUtils");
9
- async function makeApiRequest(context, endpoint, body, hasMedia = false) {
10
- return await (0, GitHubCopilotApiUtils_1.makeGitHubCopilotRequest)(context, endpoint, body, hasMedia);
9
+ async function makeApiRequest(context, endpoint, body, hasMedia = false, retryConfig) {
10
+ return await (0, GitHubCopilotApiUtils_1.makeGitHubCopilotRequest)(context, endpoint, body, hasMedia, retryConfig);
11
11
  }
12
12
  exports.downloadFileFromUrl = GitHubCopilotApiUtils_1.downloadFileFromUrl;
13
13
  exports.getFileFromBinary = GitHubCopilotApiUtils_1.getFileFromBinary;
@@ -1,3 +1,4 @@
1
1
  export * from "./types";
2
2
  export * from "./helpers";
3
+ export type { RetryConfig } from "../../../shared/utils/GitHubCopilotApiUtils";
3
4
  export * from "./imageProcessor";
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-github-copilot",
3
- "version": "3.31.15",
3
+ "version": "3.31.16",
4
4
  "description": "n8n community node for GitHub Copilot with CLI integration, Chat API access, and AI Chat Model for workflows - access GPT-5, Claude, Gemini and more using your Copilot subscription",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/sufficit/n8n-nodes-github-copilot",
@@ -18,7 +18,12 @@ export interface CopilotResponse {
18
18
  total_tokens: number;
19
19
  };
20
20
  }
21
- export declare function makeGitHubCopilotRequest(context: IExecuteFunctions, endpoint: string, body: Record<string, unknown>, hasMedia?: boolean): Promise<CopilotResponse>;
21
+ export interface RetryConfig {
22
+ maxRetries?: number;
23
+ baseDelay?: number;
24
+ retryOn403?: boolean;
25
+ }
26
+ export declare function makeGitHubCopilotRequest(context: IExecuteFunctions, endpoint: string, body: Record<string, unknown>, hasMedia?: boolean, retryConfig?: RetryConfig): Promise<CopilotResponse>;
22
27
  export declare function downloadFileFromUrl(url: string): Promise<Buffer>;
23
28
  export declare function getFileFromBinary(context: IExecuteFunctions, itemIndex: number, propertyName: string): Promise<Buffer>;
24
29
  export declare function getImageMimeType(filename: string): string;
@@ -10,8 +10,11 @@ exports.estimateTokens = estimateTokens;
10
10
  exports.validateTokenLimit = validateTokenLimit;
11
11
  exports.truncateToTokenLimit = truncateToTokenLimit;
12
12
  const GitHubCopilotEndpoints_1 = require("./GitHubCopilotEndpoints");
13
- async function makeGitHubCopilotRequest(context, endpoint, body, hasMedia = false) {
14
- var _a;
13
+ async function makeGitHubCopilotRequest(context, endpoint, body, hasMedia = false, retryConfig) {
14
+ var _a, _b, _c, _d;
15
+ const MAX_RETRIES = (_a = retryConfig === null || retryConfig === void 0 ? void 0 : retryConfig.maxRetries) !== null && _a !== void 0 ? _a : 3;
16
+ const BASE_DELAY = (_b = retryConfig === null || retryConfig === void 0 ? void 0 : retryConfig.baseDelay) !== null && _b !== void 0 ? _b : 500;
17
+ const RETRY_ON_403 = (_c = retryConfig === null || retryConfig === void 0 ? void 0 : retryConfig.retryOn403) !== null && _c !== void 0 ? _c : true;
15
18
  let credentialType = "githubCopilotApi";
16
19
  try {
17
20
  credentialType = context.getNodeParameter("credentialType", 0, "githubCopilotApi");
@@ -23,7 +26,7 @@ async function makeGitHubCopilotRequest(context, endpoint, body, hasMedia = fals
23
26
  console.log(`🔍 ${credentialType} Credentials Debug:`, Object.keys(credentials));
24
27
  const token = (credentials.accessToken ||
25
28
  credentials.access_token ||
26
- ((_a = credentials.oauthTokenData) === null || _a === void 0 ? void 0 : _a.access_token) ||
29
+ ((_d = credentials.oauthTokenData) === null || _d === void 0 ? void 0 : _d.access_token) ||
27
30
  credentials.token);
28
31
  if (!token) {
29
32
  console.error(`❌ Available ${credentialType} credential properties:`, Object.keys(credentials));
@@ -49,14 +52,13 @@ async function makeGitHubCopilotRequest(context, endpoint, body, hasMedia = fals
49
52
  body: JSON.stringify(body),
50
53
  };
51
54
  const fullUrl = `${GitHubCopilotEndpoints_1.GITHUB_COPILOT_API.BASE_URL}${endpoint}`;
52
- const MAX_RETRIES = 3;
53
55
  let lastError = null;
54
56
  for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
55
57
  try {
56
58
  const response = await fetch(fullUrl, options);
57
- if (response.status === 403 && attempt < MAX_RETRIES) {
58
- console.warn(`⚠️ GitHub Copilot API 403 error on attempt ${attempt}/${MAX_RETRIES}. Retrying...`);
59
- await new Promise(resolve => setTimeout(resolve, 500 * Math.pow(2, attempt - 1)));
59
+ if (response.status === 403 && RETRY_ON_403 && attempt < MAX_RETRIES) {
60
+ console.warn(`⚠️ GitHub Copilot API 403 error on attempt ${attempt}/${MAX_RETRIES}. Retrying in ${BASE_DELAY * Math.pow(2, attempt - 1)}ms...`);
61
+ await new Promise(resolve => setTimeout(resolve, BASE_DELAY * Math.pow(2, attempt - 1)));
60
62
  continue;
61
63
  }
62
64
  if (!response.ok) {
@@ -80,8 +82,8 @@ async function makeGitHubCopilotRequest(context, endpoint, body, hasMedia = fals
80
82
  catch (error) {
81
83
  lastError = error instanceof Error ? error : new Error(String(error));
82
84
  if (attempt < MAX_RETRIES) {
83
- console.warn(`⚠️ GitHub Copilot API error on attempt ${attempt}/${MAX_RETRIES}: ${lastError.message}. Retrying...`);
84
- await new Promise(resolve => setTimeout(resolve, 500 * Math.pow(2, attempt - 1)));
85
+ console.warn(`⚠️ GitHub Copilot API error on attempt ${attempt}/${MAX_RETRIES}: ${lastError.message}. Retrying in ${BASE_DELAY * Math.pow(2, attempt - 1)}ms...`);
86
+ await new Promise(resolve => setTimeout(resolve, BASE_DELAY * Math.pow(2, attempt - 1)));
85
87
  continue;
86
88
  }
87
89
  throw lastError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-github-copilot",
3
- "version": "3.31.15",
3
+ "version": "3.31.16",
4
4
  "description": "n8n community node for GitHub Copilot with CLI integration, Chat API access, and AI Chat Model for workflows - access GPT-5, Claude, Gemini and more using your Copilot subscription",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/sufficit/n8n-nodes-github-copilot",