Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@platformatic/client

Package Overview
Dependencies
Maintainers
6
Versions
260
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@platformatic/client - npm Package Compare versions

Comparing version 0.35.0 to 0.35.1

60

index.d.ts

@@ -1,7 +0,11 @@

import { type FastifyPluginCallback } from 'fastify'
import { FastifyPluginAsync } from 'fastify'
export type PltClientOptions = {
interface Headers {
[key: string]: string
}
export type PlatformaticClientPluginOptions = {
url: string;
path?: string;
headers?: object;
headers?: Headers;
throwOnError: boolean;

@@ -12,6 +16,50 @@ fullResponse: boolean;

serviceId?: string;
getHeaders?: Function;
getHeaders?: () => Headers;
}
export const pltClient: FastifyPluginCallback<NonNullable<PltClientOptions>>
export default pltClient
interface BuildOpenAPIClientOptions {
url: string;
path: string;
headers?: Headers
}
interface AbstractLogger {
fatal: () => void;
error: () => void;
warn: () => void;
info: () => void;
debug: () => void;
trace: () => void;
}
interface BuildGraphQLClientOptions {
url: string;
headers?: Headers;
}
interface Parameter {
in: string;
name: string;
}
interface MethodMetaInterface {
operationId?: string,
parameters: Parameter[]
}
interface BuildGraphQLClientOutput {
graphql: <T>() => Promise<T>;
}
type OpenTelemetry = {
startSpanClient?: (urlToCall: URL, method: string, telemetryContext: any) => object
endSpanClient?: (span: any, res: any) => void
setErrorInSpanClient?: (span: any, err: unknown) => void
}
export function generateOperationId(path: string, method: string, methodMeta: MethodMetaInterface): string
export function buildOpenAPIClient<T>(options: BuildOpenAPIClientOptions, openTelemetry: OpenTelemetry): Promise<T>
export function buildGraphQLClient(options: BuildGraphQLClientOptions, openTelemetry: OpenTelemetry, logger: AbstractLogger): Promise<BuildGraphQLClientOutput>
export const plugin: FastifyPluginAsync<PlatformaticClientPluginOptions>
export default plugin

@@ -286,4 +286,5 @@ 'use strict'

module.exports = plugin
module.exports.default = plugin
module.exports.buildOpenAPIClient = buildOpenAPIClient
module.exports.buildGraphQLClient = buildGraphQLClient
module.exports.generateOperationId = generateOperationId

24

index.test-d.ts

@@ -1,10 +0,10 @@

import { expectError } from 'tsd'
import { expectError, expectType } from 'tsd'
import fastify from 'fastify'
import pltClient, { type PltClientOptions } from '.'
import pltClient, { type PlatformaticClientPluginOptions, buildOpenAPIClient} from '.'
const server = await fastify()
expectError<PltClientOptions>({})
expectError<PlatformaticClientPluginOptions>({})
expectError<PltClientOptions>({
expectError<PlatformaticClientPluginOptions>({
fullResponse: true,

@@ -15,3 +15,3 @@ throwOnError: true,

expectError<PltClientOptions>({
expectError<PlatformaticClientPluginOptions>({
fullResponse: true,

@@ -35,3 +35,5 @@ throwOnError: true,

url: 'http://127.0.0.1/path/42',
getHeaders: () => console.log('hey!'),
getHeaders: () => {
return { foo: 'bar' }
},
headers: { foo: 'bar' },

@@ -42,1 +44,11 @@ name: 'Frassica',

})
type MyType = {
foo: string
}
const openTelemetryClient = {}
expectType<Promise<MyType>>(buildOpenAPIClient<MyType>({
url: 'http://foo.bar',
path: 'foobar'
}, openTelemetryClient))
{
"name": "@platformatic/client",
"version": "0.35.0",
"version": "0.35.1",
"description": "A client for all platformatic backends",

@@ -26,3 +26,3 @@ "main": "index.js",

"tsd": "^0.28.1",
"@platformatic/telemetry": "0.35.0"
"@platformatic/telemetry": "0.35.1"
},

@@ -29,0 +29,0 @@ "dependencies": {

@@ -554,4 +554,3 @@ 'use strict'

same(resp.statusCode, 470)
console.log(resp)
}
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc