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

@aptly-as/app-sdk

Package Overview
Dependencies
Maintainers
2
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aptly-as/app-sdk - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

10

dist/Aptly.d.ts

@@ -0,1 +1,2 @@

import { AptlyClientRedirectOptions, AptlyDashboardRedirectOptions } from '@aptly-as/types';
import { AptlyApi } from './aptly/AptlyApi.js';

@@ -5,5 +6,2 @@ import { AptlyOrganization } from './aptly/AptlyOrganization.js';

export type { AptlyApiOAuth2Response } from './aptly/AptlyApi.js';
export type ErrorOptions = Partial<Record<'error' | 'error_description', string>>;
export type ClientRedirectOptions = Record<'unit', string> & ErrorOptions;
export type DashboardRedirectOptions = Record<'organization' | 'project', string> & ErrorOptions;
export declare class Aptly {

@@ -14,5 +12,5 @@ readonly url: string;

constructor(url: string, client_id: string, client_secret: string);
init(refresh_token: string, organizationID: string): void;
clientRedirectPath(opts: ClientRedirectOptions): string;
dashboardRedirectPath(opts: DashboardRedirectOptions): string;
init(refresh_token: string, organizationID: string): Aptly;
clientRedirect(opts: AptlyClientRedirectOptions): string;
dashboardRedirect(opts: AptlyDashboardRedirectOptions): string;
fetch<T>(path: string, init?: RequestInit): Promise<T>;

@@ -19,0 +17,0 @@ set accessToken(token: string);

@@ -13,7 +13,8 @@ import { AptlyApi } from './aptly/AptlyApi.js';

this.organizationID = organizationID;
return this;
}
clientRedirectPath(opts) {
clientRedirect(opts) {
return `${this.url}/redirect/client?${new URLSearchParams(opts).toString()}`;
}
dashboardRedirectPath(opts) {
dashboardRedirect(opts) {
return `${this.url}/redirect/dashboard?${new URLSearchParams(opts).toString()}`;

@@ -20,0 +21,0 @@ }

80

dist/aptly/AptlyApi.js

@@ -1,2 +0,2 @@

import { AptlyApiError, AptlyErrorCode } from '@aptly-as/types';
import { AptlyError } from '@aptly-as/types';
import jwt from 'jsonwebtoken';

@@ -52,9 +52,8 @@ import { sleep } from '../utils.js';

: this.fetch(path));
if (response.status !== 200) {
throw new AptlyApiError({
status: String(response.status),
response,
if (!response.ok) {
throw new AptlyError({
id: 'none',
status: response.status,
title: response.statusText,
code: AptlyErrorCode.Default,
id: 'none',
detail: await response.text(),
});

@@ -69,6 +68,9 @@ }

if (contentDispositionHeader) {
filename = regExpContentDispositionFilename.exec(contentDispositionHeader)?.groups?.filename || '';
filename =
regExpContentDispositionFilename.exec(contentDispositionHeader)
?.groups?.filename || '';
}
if (contentTypeHeader) {
contentType = regExpContentType.exec(contentTypeHeader)?.groups?.type || '';
contentType =
regExpContentType.exec(contentTypeHeader)?.groups?.type || '';
}

@@ -82,10 +84,15 @@ return {

catch (e) {
if (e instanceof AptlyApiError) {
if (e instanceof AptlyError) {
throw e;
}
throw new AptlyApiError({
status: '500',
else if (e instanceof Error) {
throw new AptlyError({
status: 500,
title: e.name,
detail: e.message,
});
}
throw new AptlyError({
status: 500,
title: 'Failed to parse file buffer',
code: AptlyErrorCode.Default,
id: 'none',
});

@@ -100,11 +107,7 @@ }

catch (error) {
throw new AptlyApiError({
status: String(response?.status || 500),
detail: response.statusText,
code: AptlyErrorCode.Default,
link: '',
title: String(response.status),
id: 'none',
throw new AptlyError({
status: 500,
title: response.statusText,
detail: `Failed to parse json from url: ${response.url}`,
error,
response: response
});

@@ -128,24 +131,7 @@ }

});
if (response.status > 299) {
try {
const error = await response.json();
throw new AptlyApiError(error);
}
catch (error) {
throw new AptlyApiError({
status: String(response.status),
response,
title: response.statusText,
code: AptlyErrorCode.Default,
detail: String(response.status),
id: 'none',
error,
});
}
if (!response.ok) {
throw await AptlyError.fromFetchResponse(response);
}
return response;
}
catch (error) {
throw error;
}
finally {

@@ -157,7 +143,5 @@ this.busy = false;

if (!refresh_token) {
throw new AptlyApiError({
status: '440',
code: AptlyErrorCode.SessionExpired,
throw new AptlyError({
status: 440,
title: 'refresh_token_required',
id: 'none',
});

@@ -179,8 +163,6 @@ }

if (response.status !== 200) {
throw new AptlyApiError({
status: '440',
code: AptlyErrorCode.SessionExpired,
throw new AptlyError({
status: 440,
title: 'refresh_token_invalid',
detail: response.statusText,
id: 'none',
});

@@ -187,0 +169,0 @@ }

@@ -1,2 +0,2 @@

import { AptlyApiError, AptlyErrorCode } from '@aptly-as/types';
import { AptlyError, } from '@aptly-as/types';
import { pathWithParams } from './api.utils.js';

@@ -37,7 +37,5 @@ export class AptlyDocuments {

if (!res.ok) {
throw new AptlyApiError({
id: '',
status: String(res.status),
throw new AptlyError({
status: res.status,
title: res.statusText,
code: AptlyErrorCode.Default,
});

@@ -49,7 +47,5 @@ }

catch (e) {
throw new AptlyApiError({
id: '',
status: '500',
throw new AptlyError({
status: 500,
title: 'Failed to parse json on document upload',
code: AptlyErrorCode.Default,
});

@@ -56,0 +52,0 @@ }

{
"name": "@aptly-as/app-sdk",
"version": "1.1.0",
"version": "1.1.1",
"description": "Aptly app SDK library for app communication and frontend development",
"type": "module",
"main": "dist/index.js",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"module": "./dist/index.js",
"scripts": {

@@ -11,3 +13,4 @@ "dev": "tsc --watch",

"prepublish": "yarn build",
"postversion": "git push && git push --tags"
"postversion": "git push && git push --tags",
"prepare": "husky install"
},

@@ -24,2 +27,5 @@ "files": [

"@types/node": "18",
"husky": "^8.0.3",
"lint-staged": "^15.2.0",
"prettier": "^3.2.4",
"typescript": "^5.2.2"

@@ -26,0 +32,0 @@ },

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