This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
│ Error: Error creating Trigger: googleapi: Error 400: Invalid value at 'trigger.git_file_source.repo_type' (type.googleapis.com/google.devtools.cloudbuild.v1.GitFileSource.RepoType), "BITBUCKET" | |
│ Details: | |
│ [ | |
│ { | |
│ "@type": "type.googleapis.com/google.rpc.BadRequest", | |
│ "fieldViolations": [ | |
│ { | |
│ "description": "Invalid value at 'trigger.git_file_source.repo_type' (type.googleapis.com/google.devtools.cloudbuild.v1.GitFileSource.RepoType), \"BITBUCKET\"", | |
│ "field": "trigger.git_file_source.repo_type" | |
│ } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as P from 'pino' | |
import {FastifyReply, FastifyRequest} from 'fastify' | |
const enum PINO_LEVELS { | |
trace = 10, | |
debug = 20, | |
info = 30, | |
warn = 40, | |
error = 50, | |
fatal = 60, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as P from 'pino' | |
import {FastifyReply, FastifyRequest} from 'fastify' | |
const enum PINO_LEVELS { | |
trace = 10, | |
debug = 20, | |
info = 30, | |
warn = 40, | |
error = 50, | |
fatal = 60, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public struct ResultCodable<CodableType>: Codable where CodableType: Codable { | |
private enum EncodingError: Swift.Error, CustomStringConvertible { | |
case encodedErrorResult(encodingError: Swift.Error) | |
var description: String { | |
switch self { | |
case .encodedErrorResult(let encodingError): | |
return "Cannot encode `Result.failure` which resulted from decoding error: '\(encodingError)'" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vapor | |
import RedisKit | |
struct MySession { | |
let token: RedisKey | |
let email: String | |
let userId: Int64 | |
let isAdmin: Bool | |
let ipAddress: String? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum Nullable<T>: Codable where T: Codable { | |
case some(_ value: T) | |
case null | |
case undefined | |
init(from decoder: Decoder) throws { | |
let container = try decoder.singleValueContainer() | |
if container.decodeNil() { | |
self = .null | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import class Dispatch.DispatchQueue | |
import NIO | |
public extension DispatchQueue { | |
/// `DispatchQueue.async` but returning a NIO future wrapping the closure return. | |
func async<Value>(on eventLoop: EventLoop, use closure: @escaping () throws -> Value) -> EventLoopFuture<Value> { | |
let promise = eventLoop.makePromise(of: Value.self) | |
async { | |
do { | |
promise.succeed(try closure()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Raw representable `Codable` property wrapper used to instantiate to a `RawRepresentable` type if the `rawValue`decoded is supported | |
/// by the generic `RawRepresentableValue` type. This can be useful when you want to decode a set of constant values | |
/// specified inside `RawRepresentable` enum yet default to the `rawValue` if the decoded `rawValue` is unsupported. | |
/// | |
/// For example, using this property wrapper you could decode an enum specifying a list of error code such as: | |
/// | |
/// enum ErrorCode: String, Codable { | |
/// case notFound, unauthorized, badRequest | |
/// } | |
/// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import NIO | |
import Logging | |
extension EventLoopFuture { | |
func whenFailureLog( | |
level: Logger.Level = .error, | |
_ message: @escaping @autoclosure () -> Logger.Message, | |
using logger: Logger, | |
errorDescriptionMetadataKey: String = "reason", | |
metadata: @escaping @autoclosure () -> Logger.Metadata? = nil, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vapor | |
import StackdriverLogging | |
extension LoggingSystem { | |
/// Prepare the `StackdriverLogHandlerFactory` and bootstrap the `LoggingSystem` to use `StackdriverLogHandler`s. | |
/// | |
/// - Returns: A `StackdriverLoggerLifecycleHandler` that must be passed to the `Vapor.Application` `lifecyle` service | |
/// for proper shutdown of the NIO dependencies used by the logger when the `Application` shuts down. | |
public static func bootstrapStackdriverLogging(for environment: inout Environment, | |
with configuration: StackdriverLoggingConfiguration) throws -> StackdriverLoggerLifecycleHandler { |
NewerOlder