How to use the abap-adt-api.session_types.stateful function in abap-adt-api

To help you get started, we’ve selected a few abap-adt-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sbcgua / sap-nw-abap-vagrant / abapdeploy.js / abapdeploy.js View on Github external
async function installProg(name, source) {
    const client = create();
    const path   = '/sap/bc/adt/programs/programs/' + name;
    const main   = path + '/source/main';

    try {
        await client.createObject({
            description: name,
            name,
            objtype: 'PROG/P',
            parentName: '$TMP',
            parentPath: '/sap/bc/adt/packages/$TMP'
        });

        client.stateful = session_types.stateful;
        const handle = await client.lock(path);
        await client.setObjectSource(main, source, handle.LOCK_HANDLE); // write the program
        console.log(`Program ${name} was successfully created`);
        await client.unLock(path, handle.LOCK_HANDLE);

        // read it for verification
        // const newsource = await c.getObjectSource(main)
        // console.log(newsource);

        const result = await client.activate( name, path );
        console.log(`Program ${name} was activated`);
        console.log(result);
    } finally {
        client.dropSession();
    }
}
github marcellourbani / vscode_abap_remote_fs / client / src / adt / AdtServer.ts View on Github external
public async relogin() {
    this.currentCancel.cancel()
    this.currentCancel = new CancellationTokenSource()
    this.currentCall = Promise.resolve()
    if (this.mainClient.stateful === session_types.stateful) {
      try {
        this.mainClient.stateful = session_types.stateless
        // juts in case I have pending locks...
        await this.mainClient.logout()
      } catch (error) {
        // ignore
      }
      await this.mainClient.login()
    }
  }
github marcellourbani / vscode_abap_remote_fs / client / src / adt / operations / LockManager.ts View on Github external
return this.server.runInSession(async client => {
        if (curLock) return curLock
        client.stateful = session_types.stateful
        const lock = await client.lock(this.main.path)
        return lock
      })
    }
github marcellourbani / vscode_abap_remote_fs / client / src / helpers / mongoClient.ts View on Github external
private toHttpRequest(request: RequestData, source: string): HttpRequest {
    const { body: requestBody, ...rest } = request
    const s = request.headers["X-sap-adt-sessiontype"]
    const stateful = s === session_types.stateful || s === session_types.keep

    return {
      ...rest,
      requestBody,
      source,
      stateful,
      start: new Date().getTime()
    }
  }
  public httpLog(type: LogPhase, data: LogData, source: Sources) {