BREAKING CHANGE(switch to esm): update

This commit is contained in:
2023-03-20 12:26:43 +01:00
parent 411516befc
commit 5a3ccf6f4f
17 changed files with 4398 additions and 11253 deletions

8
ts/00_commitinfo_data.ts Normal file
View File

@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
*/
export const commitinfo = {
name: '@apiglobal/sdk',
version: '2.0.0',
description: 'an sdk package for api.global'
}

View File

@ -1,5 +1,5 @@
export * from './sdk.classes.agenvironment';
export * from './sdk.classes.aghandler';
export * from './sdk.classes.authinfo';
export * from './sdk.classes.agenvironment.js';
export * from './sdk.classes.aghandler.js';
export * from './sdk.classes.authinfo.js';
export * from './interfaces';
export * from './interfaces/index.js';

View File

@ -1 +1 @@
export * from './projectsettings';
export * from './projectsettings.js';

View File

@ -1,8 +1,8 @@
import * as plugins from './sdk.plugins';
import * as plugins from './sdk.plugins.js';
/**
* AgEnvironment handles the provision of environment variables to handlers
*/
export abstract class AgEnvironment {
public abstract async getEnvVar(envVarName: string): Promise<string>;
public abstract getEnvVar(envVarName: string): Promise<string>;
}

View File

@ -1,6 +1,6 @@
import * as plugins from './sdk.plugins';
import { AuthInfo } from './sdk.classes.authinfo';
import { AgEnvironment } from './sdk.classes.agenvironment';
import * as plugins from './sdk.plugins.js';
import { AuthInfo } from './sdk.classes.authinfo.js';
import { AgEnvironment } from './sdk.classes.agenvironment.js';
export interface IRequirementResult {
allOk: boolean;
@ -18,8 +18,10 @@ export abstract class AAgHandler<TClaim> {
public abstract checkRequirements(): Promise<IRequirementResult>;
public async checkQenvFile(pathToQenvFileArg: string) {
if(!(await plugins.smartfile.fs.fileExists(pathToQenvFileArg))) {
throw new Error(`AgHandler with slug '${this.slug}': qenv file does not exists at ${pathToQenvFileArg}`);
if (!(await plugins.smartfile.fs.fileExists(pathToQenvFileArg))) {
throw new Error(
`AgHandler with slug '${this.slug}': qenv file does not exists at ${pathToQenvFileArg}`
);
}
const qenvFile = plugins.smartfile.fs.toObjectSync(pathToQenvFileArg);
const missingEnvironmentVariables: string[] = [];
@ -30,7 +32,9 @@ export abstract class AAgHandler<TClaim> {
}
}
if (missingEnvironmentVariables.length > 0) {
console.log(`AgHandler with slug '${this.slug}': There are ${missingEnvironmentVariables.length} missing environment variables`);
console.log(
`AgHandler with slug '${this.slug}': There are ${missingEnvironmentVariables.length} missing environment variables`
);
const errorMessage = `AgHandler with slug '${this.slug}': The missing env Varibles are ${missingEnvironmentVariables}`;
console.log(errorMessage);
throw new Error(errorMessage);

View File

@ -1,4 +1,4 @@
import * as plugins from './sdk.plugins';
import * as plugins from './sdk.plugins.js';
/**
* AuthInfo is created for every single incoming request

View File

@ -9,9 +9,7 @@ export { typedrequest };
// pushrocks scope
import * as smartfile from '@pushrocks/smartfile';
export {
smartfile
};
export { smartfile };
// @tsclass scope
import * as tsclass from '@tsclass/tsclass';