@abapify/adt-locks 0.0.0 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -0
- package/package.json +31 -1
package/README.md
CHANGED
|
@@ -1 +1,73 @@
|
|
|
1
1
|
# @abapify/adt-locks
|
|
2
|
+
|
|
3
|
+
ADT lock/unlock operations and lock-store management. This is the single
|
|
4
|
+
lock implementation used across the `abapify/adt-cli` monorepo: it wraps the
|
|
5
|
+
SAP ADT lock/unlock REST endpoints, parses their XML responses, and persists
|
|
6
|
+
lock handles in a pluggable store so multi-object operations can release
|
|
7
|
+
locks reliably on failure.
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/@abapify/adt-locks)
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm i @abapify/adt-locks
|
|
15
|
+
# or
|
|
16
|
+
bun add @abapify/adt-locks
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
Single lock / unlock via the service, backed by a file-based lock store:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { createLockService, FileLockStore } from '@abapify/adt-locks';
|
|
25
|
+
|
|
26
|
+
const locks = createLockService(client, { store: new FileLockStore() });
|
|
27
|
+
|
|
28
|
+
const handle = await locks.lock('/sap/bc/adt/oo/classes/zcl_test');
|
|
29
|
+
try {
|
|
30
|
+
// ... make changes via the ADT client ...
|
|
31
|
+
} finally {
|
|
32
|
+
await locks.unlock('/sap/bc/adt/oo/classes/zcl_test', {
|
|
33
|
+
lockHandle: handle.handle,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Batch session for N objects with best-effort rollback on failure:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { createBatchLockSession } from '@abapify/adt-locks';
|
|
42
|
+
|
|
43
|
+
const session = createBatchLockSession(locks, {
|
|
44
|
+
targets: [
|
|
45
|
+
{ uri: '/sap/bc/adt/oo/classes/zcl_a' },
|
|
46
|
+
{ uri: '/sap/bc/adt/oo/classes/zcl_b' },
|
|
47
|
+
],
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const acquired = await session.acquireAll();
|
|
51
|
+
// ... do work ...
|
|
52
|
+
await session.releaseAll();
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Role in the monorepo
|
|
56
|
+
|
|
57
|
+
- Single source of truth for ADT locks. `@abapify/adk` (save flow),
|
|
58
|
+
`@abapify/adt-export`, and CLI commands all delegate to `LockService`
|
|
59
|
+
rather than reimplementing lock/unlock.
|
|
60
|
+
- Depends only on `@abapify/adt-client` for transport; it does not know
|
|
61
|
+
about specific object types, which keeps it reusable across plugins.
|
|
62
|
+
- Lock handles are bound to the client's security session; see the
|
|
63
|
+
monorepo `AGENTS.md` for the 3-step CSRF / security-session protocol
|
|
64
|
+
that must be in place before any call here will succeed.
|
|
65
|
+
|
|
66
|
+
## Related
|
|
67
|
+
|
|
68
|
+
- [abapify/adt-cli monorepo](https://github.com/abapify/adt-cli)
|
|
69
|
+
- [Full docs](https://adt-cli.netlify.app)
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1 +1,31 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"name": "@abapify/adt-locks",
|
|
3
|
+
"version": "0.3.6",
|
|
4
|
+
"description": "ADT lock/unlock operations and lock store management",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"types": "./dist/index.d.mts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./dist/index.mjs",
|
|
10
|
+
"./package.json": "./package.json"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@abapify/adt-client": "0.3.6"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/abapify/adt-cli.git",
|
|
25
|
+
"directory": "packages/adt-locks"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/abapify/adt-cli/tree/main/packages/adt-locks#readme",
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/abapify/adt-cli/issues"
|
|
30
|
+
}
|
|
31
|
+
}
|