yaschema-api-google-cloud-task-creator
Advanced tools
Comparing version 1.1.2 to 1.2.0
@@ -33,2 +33,3 @@ "use strict"; | ||
const createGoogleCloudTask = (api_1, req_1, ...args_1) => __awaiter(void 0, [api_1, req_1, ...args_1], void 0, function* (api, req, { requestValidationMode = (0, validation_mode_1.getDefaultRequestValidationMode)(), creationOptions, limitMode = DEFAULT_TASK_LIMIT_MODE, limitMSec = DEFAULT_TASK_LIMIT_MSEC, limitType = DEFAULT_TASK_LIMIT_TYPE, limitNameExtension = '' } = {}) { | ||
var _a; | ||
if (api.method === 'LINK' || api.method === 'UNLINK') { | ||
@@ -71,3 +72,8 @@ throw new Error("LINK and UNLINK aren't supported by yaschema-api-google-cloud-task-creator"); | ||
catch (e) { | ||
return { ok: false, error: e instanceof Error ? e.message : undefined }; | ||
const error = e instanceof Error ? e.message : undefined; | ||
// If the task is already enqueued, treat as success | ||
if ((_a = error === null || error === void 0 ? void 0 : error.includes('ALREADY_EXISTS')) !== null && _a !== void 0 ? _a : false) { | ||
return { ok: true }; | ||
} | ||
return { ok: false, error }; | ||
} | ||
@@ -74,0 +80,0 @@ } |
@@ -30,2 +30,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
export const createGoogleCloudTask = (api_1, req_1, ...args_1) => __awaiter(void 0, [api_1, req_1, ...args_1], void 0, function* (api, req, { requestValidationMode = getDefaultRequestValidationMode(), creationOptions, limitMode = DEFAULT_TASK_LIMIT_MODE, limitMSec = DEFAULT_TASK_LIMIT_MSEC, limitType = DEFAULT_TASK_LIMIT_TYPE, limitNameExtension = '' } = {}) { | ||
var _a; | ||
if (api.method === 'LINK' || api.method === 'UNLINK') { | ||
@@ -68,3 +69,8 @@ throw new Error("LINK and UNLINK aren't supported by yaschema-api-google-cloud-task-creator"); | ||
catch (e) { | ||
return { ok: false, error: e instanceof Error ? e.message : undefined }; | ||
const error = e instanceof Error ? e.message : undefined; | ||
// If the task is already enqueued, treat as success | ||
if ((_a = error === null || error === void 0 ? void 0 : error.includes('ALREADY_EXISTS')) !== null && _a !== void 0 ? _a : false) { | ||
return { ok: true }; | ||
} | ||
return { ok: false, error }; | ||
} | ||
@@ -71,0 +77,0 @@ } |
{ | ||
"name": "yaschema-api-google-cloud-task-creator", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Google Cloud createTask support for yaschema-api", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -137,3 +137,10 @@ import type { CallOptions } from 'google-gax'; | ||
} catch (e) { | ||
return { ok: false, error: e instanceof Error ? e.message : undefined }; | ||
const error = e instanceof Error ? e.message : undefined; | ||
// If the task is already enqueued, treat as success | ||
if (error?.includes('ALREADY_EXISTS') ?? false) { | ||
return { ok: true }; | ||
} | ||
return { ok: false, error }; | ||
} | ||
@@ -140,0 +147,0 @@ } catch (e) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
172808
2063