flexso-sfsf-config
TypeScript icon, indicating that this package has built-in type declarations

1.1.3 • Public • Published

NodeJS Library to read the configuration for a Successfactors extension build by SAP.

installation

npm install flexso-sfsf-config

Use the library

  import FlexsoSFSFConfig from "flexso-sfsf-config";
  const sfsfconfig = new FlexsoSfSFConfig ("DESTINATION_NAME", "APP_NAME", async (config) => {
      // deze functie  wordt na elke read van niet gecachte config gedaan.
      // als er iets mis is met het config object raisen we een error.
      // vb PROPERTY1 bestaat niet
      if(!config.values.PROPERTY1) {
  	    throw({
  		    code: "500"
  		    error: "PROPERTY1 is not configured"
  	    })
  	}

  	// de return waarde is terug het config object, dat laat ons toe om ook default waarden te zetten per app
  	// is de return waarde null, dan wordt het config object van de input parameter gerbruikt
  	if( !config.values.PROPERTY2 ) {
  		config.PROPERT2 = "VALUE_PROPERTY_2";
  	}
  	return config;
  });

// Voorbeeld van gebruilk:
app.get("/Matrix", async (req, res) => {
  const tenantName = req.authInfo ? req.authInfo.subdomain : "";
  // read all geeft de huidige configuratievalues terug van alle properties voor de huidige app.
  const config = sfsfconfig.readAll( tenantName );
  /*
  	config = {
  		values: {
  			PROPERTY1: "VALUE_PROPERTY_1",
  			PROPERTY2: "VALUE_PROPERTY_2",

  		},
  		objects: {
  			PROPERTY3: [SFSFConfigurationItemChild, SFSFConfigurationItemChild],
  			PROPERTY4: [SFSFConfigurationItemChild],

  		}
  	}
  */

}) ;
  

Readme

Keywords

Package Sidebar

Install

npm i flexso-sfsf-config

Weekly Downloads

136

Version

1.1.3

License

ISC

Unpacked Size

33.5 kB

Total Files

5

Last publish

Collaborators

  • jowavp
  • gertmertens