Skip to main content

@abapify/adt-locks

Single implementation of the SAP ADT lock/unlock protocol. Exposes a service API, a pluggable lock store (file-backed included), and a batch-lock session that acquires/releases N locks atomically (best-effort rollback).

info

All lock/unlock operations in adk, adt-export, and CLI commands delegate here. CSRF tokens come from the security session managed by adt-client.

Install

bun add @abapify/adt-locks

Public API

// Types
export type { LockHandle, LockEntry } from '@abapify/adt-locks';

// Store
export type { LockStore } from '@abapify/adt-locks';
export { FileLockStore } from '@abapify/adt-locks';

// Service
export type {
LockClient,
LockService,
LockOptions,
UnlockOptions,
} from '@abapify/adt-locks';
export { createLockService, parseLockResponse } from '@abapify/adt-locks';

// Batch session
export {
createBatchLockSession,
type BatchLockSession,
} from '@abapify/adt-locks';

Usage

import { createLockService, FileLockStore } from '@abapify/adt-locks';

const locks = createLockService(client, { store: new FileLockStore() });
const handle = await locks.lock('/sap/bc/adt/oo/classes/zcl_test');
try {
// ... mutate the object
} finally {
await locks.unlock('/sap/bc/adt/oo/classes/zcl_test', {
lockHandle: handle.handle,
});
}

Dependencies