@medusajs/locking 2.22.0-snapshot-20261021091347 → 2.22.1

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/AGENTS.md ADDED
@@ -0,0 +1,72 @@
1
+ # @medusajs/locking
2
+
3
+ Locking Module (`Modules.LOCKING`): infrastructure module that serializes access to keys across concurrent jobs, delegating to a locking provider (in-memory built in; Redis and Postgres providers live in `packages/modules/providers/locking-redis` and `locking-postgres`).
4
+
5
+ ## Using this package
6
+
7
+ - Registered by default as `@medusajs/medusa/locking` with only the in-memory provider (cloud config registers `@medusajs/medusa/locking-redis` as default when `REDIS_URL` is set; see `packages/core/utils/src/common/define-config.ts`).
8
+ - Options (`LockingModuleOptions` in `src/types/index.ts`): `providers[]` of `{ resolve, id, is_default?, options? }`.
9
+
10
+ ```ts
11
+ module.exports = defineConfig({
12
+ modules: [
13
+ {
14
+ resolve: "@medusajs/medusa/locking",
15
+ options: {
16
+ providers: [
17
+ {
18
+ resolve: "@medusajs/medusa/locking-redis",
19
+ id: "locking-redis",
20
+ is_default: true,
21
+ options: { redisUrl: process.env.LOCKING_REDIS_URL },
22
+ },
23
+ ],
24
+ },
25
+ },
26
+ ],
27
+ })
28
+ ```
29
+
30
+ - Resolve: `container.resolve(Modules.LOCKING)` (`ILockingModule`). In workflows prefer `acquireLockStep` / `releaseLockStep` from `@medusajs/medusa/core-flows`.
31
+
32
+ ```ts
33
+ const locking = container.resolve(Modules.LOCKING)
34
+
35
+ await locking.execute("prod_123", async () => {
36
+ // critical section
37
+ }, { timeout: 2 })
38
+ ```
39
+
40
+ - Methods (`src/services/locking-module.ts`), all accept `provider` to override the default:
41
+ - `execute(keys, job, { timeout?, expire?, provider? })`: acquires, runs `job`, always releases.
42
+ - `acquire(keys, { ownerId?, expire?, provider? })`, `release(keys, { ownerId?, provider? })`, `releaseAll({ ownerId?, provider? })`.
43
+ - No data models, no events, no module links.
44
+
45
+ Docs: https://docs.medusajs.com/resources/infrastructure-modules/locking.md, https://docs.medusajs.com/resources/infrastructure-modules/locking/redis.md, https://docs.medusajs.com/resources/infrastructure-modules/locking/postgres.md, https://docs.medusajs.com/learn/fundamentals/workflows/locks.md
46
+
47
+ ## Architecture
48
+
49
+ - `src/loaders/providers.ts`: always registers `InMemoryLockingProvider` (`identifier = "in-memory"`) under `lp_in-memory` and as the default; then registers each configured provider as `lp_<id>` (alias of its provider registration key). The default becomes the provider with `is_default: true`, or the only configured provider when exactly one is configured.
50
+ - `src/services/locking-provider.ts` resolves `lp_<providerId>`; providers must have a static `identifier` and a non-empty `id`, or registration throws.
51
+ - The service's `__hooks.onApplicationShutdown` calls the optional `shutdown()` of every registered provider (used by `locking-redis` to close its client).
52
+ - `src/providers/in-memory.ts`: process-local `Map` of locks with owner, optional expiration, and a promise queue.
53
+
54
+ ## Development
55
+
56
+ ```bash
57
+ cd packages/modules/locking
58
+ yarn build
59
+ yarn test
60
+ yarn test:integration
61
+ ../../../node_modules/.bin/jest integration-tests/__tests__/index.spec.ts -t "should release lock in case of failure"
62
+ ```
63
+
64
+ - Integration tests: `integration-tests/__tests__/index.spec.ts`.
65
+ - The `migration:*` scripts in `package.json` are unused: there is no `mikro-orm.config.dev.ts` and no `src/models`.
66
+
67
+ ## Gotchas
68
+
69
+ - In-memory locks only protect a single process; multi-instance deployments need the Redis or Postgres provider.
70
+ - `timeout` and `expire` are in seconds. In-memory `execute` uses `timeout` default 5 and minimum 1, waits in the key's queue, and throws on timeout; the job is never started then.
71
+ - `acquire` without `ownerId` on an already locked, non-expired key throws `Failed to acquire lock for key "<key>"`. Re-acquiring with the same `ownerId` succeeds and refreshes `expire`.
72
+ - Locks taken by `acquire` without `expire` never expire in memory; release them explicitly.
package/README.md ADDED
@@ -0,0 +1,98 @@
1
+ <p align="center">
2
+ <a href="https://www.medusajs.com">
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/59018053/229103275-b5e482bb-4601-46e6-8142-244f531cebdb.svg">
5
+ <source media="(prefers-color-scheme: light)" srcset="https://user-images.githubusercontent.com/59018053/229103726-e5b529a3-9b3f-4970-8a1f-c6af37f087bf.svg">
6
+ <img alt="Medusa logo" src="https://user-images.githubusercontent.com/59018053/229103726-e5b529a3-9b3f-4970-8a1f-c6af37f087bf.svg">
7
+ </picture>
8
+ </a>
9
+ </p>
10
+ <h1 align="center">
11
+ @medusajs/locking
12
+ </h1>
13
+
14
+ <h4 align="center">
15
+ <a href="https://docs.medusajs.com">Documentation</a> |
16
+ <a href="https://www.medusajs.com">Website</a>
17
+ </h4>
18
+
19
+ <p align="center">
20
+ Building blocks for digital commerce
21
+ </p>
22
+ <p align="center">
23
+ <a href="https://github.com/medusajs/medusa/blob/develop/LICENSE">
24
+ <img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="Medusa is released under the MIT license." />
25
+ </a>
26
+ <a href="https://github.com/medusajs/medusa/blob/develop/CONTRIBUTING.md">
27
+ <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat" alt="PRs welcome!" />
28
+ </a>
29
+ <a href="https://discord.gg/xpCwq3Kfn8">
30
+ <img src="https://img.shields.io/badge/chat-on%20discord-7289DA.svg" alt="Discord Chat" />
31
+ </a>
32
+ <a href="https://twitter.com/intent/follow?screen_name=medusajs">
33
+ <img src="https://img.shields.io/twitter/follow/medusajs.svg?label=Follow%20@medusajs" alt="Follow @medusajs" />
34
+ </a>
35
+ </p>
36
+
37
+ Locking Module for Medusa: acquires and releases locks on shared resources so that only one process runs a critical section at a time, preventing race conditions such as overselling inventory. Locks are handled by Locking Module Providers: an in-memory provider is built in, and Postgres or Redis providers coordinate locks across multiple instances. It ships with `@medusajs/medusa` and is registered by default; use it with the `acquireLockStep` and `releaseLockStep` workflow steps, or resolve it with `container.resolve(Modules.LOCKING)`.
38
+
39
+ ## At a glance
40
+
41
+ | | |
42
+ | --- | --- |
43
+ | Package | `@medusajs/locking` |
44
+ | Type | Infrastructure Module |
45
+ | Module key | `Modules.LOCKING` (`"locking"`) |
46
+ | Registered by default | Yes (in-memory provider; Redis provider on Medusa Cloud when `REDIS_URL` is set) |
47
+
48
+ ## Providers
49
+
50
+ The module accepts multiple providers. The built-in in-memory provider (`in-memory`) is always registered and is the default when you don't register others. Official providers:
51
+
52
+ | Package | Register with |
53
+ | --- | --- |
54
+ | [`@medusajs/locking-postgres`](../providers/locking-postgres) | `@medusajs/medusa/locking-postgres` |
55
+ | [`@medusajs/locking-redis`](../providers/locking-redis) | `@medusajs/medusa/locking-redis` |
56
+
57
+ ## Installation
58
+
59
+ No installation needed. The module ships with `@medusajs/medusa`.
60
+
61
+ ## Usage
62
+
63
+ ```ts
64
+ import { defineConfig } from "@medusajs/framework/utils"
65
+
66
+ module.exports = defineConfig({
67
+ // ...
68
+ modules: [
69
+ {
70
+ resolve: "@medusajs/medusa/locking",
71
+ options: {
72
+ providers: [
73
+ {
74
+ resolve: "@medusajs/medusa/locking-redis",
75
+ id: "locking-redis",
76
+ is_default: true,
77
+ options: {
78
+ redisUrl: process.env.LOCKING_REDIS_URL,
79
+ },
80
+ },
81
+ ],
82
+ },
83
+ },
84
+ ],
85
+ })
86
+ ```
87
+
88
+ ## Configuration
89
+
90
+ | Option | Type | Description | Default |
91
+ | --- | --- | --- | --- |
92
+ | `providers` | `{ resolve: string, id: string, is_default?: boolean, options?: Record<string, unknown> }[]` | Locking providers to register. When only one provider is registered, or one sets `is_default: true`, it becomes the default. | `[]` (in-memory provider is used) |
93
+
94
+ ## Resources
95
+
96
+ - [Locking Module](https://docs.medusajs.com/resources/infrastructure-modules/locking)
97
+ - [Postgres Locking Module Provider](https://docs.medusajs.com/resources/infrastructure-modules/locking/postgres)
98
+ - [Redis Locking Module Provider](https://docs.medusajs.com/resources/infrastructure-modules/locking/redis)
@@ -14,6 +14,9 @@ export default class LockingModuleService implements ILockingModule {
14
14
  protected providerService_: LockingProviderService;
15
15
  protected defaultProviderId: string;
16
16
  constructor(container: InjectedDependencies, moduleDeclaration: InternalModuleDeclaration);
17
+ __hooks: {
18
+ onApplicationShutdown: () => Promise<void>;
19
+ };
17
20
  execute<T>(keys: string | string[], job: (signal?: AbortSignal) => Promise<T>, args?: {
18
21
  timeout?: number;
19
22
  expire?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"locking-module.d.ts","sourceRoot":"","sources":["../../src/services/locking-module.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,cAAc,EACd,yBAAyB,EACzB,MAAM,EACP,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAA;AAC/C,OAAO,sBAAsB,MAAM,oBAAoB,CAAA;AAEvD,KAAK,oBAAoB,GAAG;IAC1B,OAAO,EAAE,aAAa,CAAA;IACtB,sBAAsB,EAAE,sBAAsB,CAAA;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAA;CACjC,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,oBAAqB,YAAW,cAAc;IAO/D,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,yBAAyB;IANjE,SAAS,CAAC,OAAO,EAAE,aAAa,CAAA;IAChC,SAAS,CAAC,gBAAgB,EAAE,sBAAsB,CAAA;IAClD,SAAS,CAAC,iBAAiB,EAAE,MAAM,CAAA;gBAGjC,SAAS,EAAE,oBAAoB,EACZ,iBAAiB,EAAE,yBAAyB;IAO3D,OAAO,CAAC,CAAC,EACb,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,EACzC,IAAI,CAAC,EAAE;QACL,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,QAAQ,CAAC,EAAE,MAAM,CAAA;KAClB,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,EACD,aAAa,GAAE,OAAY,GAC1B,OAAO,CAAC,IAAI,CAAC;CAOjB"}
@@ -4,6 +4,11 @@ const _types_1 = require("../types");
4
4
  class LockingModuleService {
5
5
  constructor(container, moduleDeclaration) {
6
6
  this.moduleDeclaration = moduleDeclaration;
7
+ this.__hooks = {
8
+ onApplicationShutdown: async () => {
9
+ await this.providerService_.shutdown();
10
+ },
11
+ };
7
12
  this.manager = container.manager;
8
13
  this.providerService_ = container.lockingProviderService;
9
14
  this.defaultProviderId = container[_types_1.LockingDefaultProvider];
@@ -1 +1 @@
1
- {"version":3,"file":"locking-module.js","sourceRoot":"","sources":["../../src/services/locking-module.ts"],"names":[],"mappings":";;AAOA,mCAA+C;AAU/C,MAAqB,oBAAoB;IAKvC,YACE,SAA+B,EACZ,iBAA4C;QAA5C,sBAAiB,GAAjB,iBAAiB,CAA2B;QAE/D,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,CAAA;QAChC,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC,sBAAsB,CAAA;QACxD,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC,+BAAsB,CAAC,CAAA;IAC5D,CAAC;IAED,KAAK,CAAC,OAAO,CACX,IAAuB,EACvB,GAAyC,EACzC,IAIC,EACD,gBAAyB,EAAE;QAE3B,MAAM,UAAU,GAAG,IAAI,EAAE,QAAQ,IAAI,IAAI,CAAC,iBAAiB,CAAA;QAC3D,MAAM,QAAQ,GACZ,IAAI,CAAC,gBAAgB,CAAC,4BAA4B,CAAC,UAAU,CAAC,CAAA;QAEhE,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,aAAa,CAAC,CAAA;IACzD,CAAC;IAED,KAAK,CAAC,OAAO,CACX,IAAuB,EACvB,IAIC,EACD,gBAAyB,EAAE;QAE3B,MAAM,UAAU,GAAG,IAAI,EAAE,QAAQ,IAAI,IAAI,CAAC,iBAAiB,CAAA;QAC3D,MAAM,Q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AAM,QAAQ,GACZ,IAAI,CAAC,gBAAgB,CAAC,4BAA4B,CAAC,UAAU,CAAC,CAAA;QAEhE,OAAO,MAAM,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,aAAa,CAAC,CAAA;IACvD,CAAC;CACF;AAjFD,uCAiFC"}
@@ -9,6 +9,7 @@ export default class LockingProviderService {
9
9
  constructor(container: InjectedDependencies);
10
10
  static getRegistrationIdentifier(providerClass: Constructor<ILockingProvider>): string;
11
11
  retrieveProviderRegistration(providerId: string): ILockingProvider;
12
+ shutdown(): Promise<void>;
12
13
  }
13
14
  export {};
14
15
  //# sourceMappingURL=locking-provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"locking-provider.d.ts","sourceRoot":"","sources":["../../src/services/locking-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,MAAM,EACP,MAAM,2BAA2B,CAAA;AAIlC,KAAK,oBAAoB,GAAG;IAC1B,CAAC,GAAG,EAAE,MAAM,MAAM,EAAE,GAAG,gBAAgB,CAAA;IACvC,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,sBAAsB;;IACzC,SAAS,CAAC,aAAa,EAAE,oBAAoB,CAAA;gBAGjC,SAAS,EAAE,oBAAoB;IAO3C,MAAM,CAAC,yBAAyB,CAC9B,aAAa,EAAE,WAAW,CAAC,gBAAgB,CAAC;IAWvC,4BAA4B,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB;CAuB1E"}
1
+ {"version":3,"file":"locking-provider.d.ts","sourceRoot":"","sources":["../../src/services/locking-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,MAAM,EACP,MAAM,2BAA2B,CAAA;AAIlC,KAAK,oBAAoB,GAAG;IAC1B,CAAC,GAAG,EAAE,MAAM,MAAM,EAAE,GAAG,gBAAgB,CAAA;IACvC,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,sBAAsB;;IACzC,SAAS,CAAC,aAAa,EAAE,oBAAoB,CAAA;gBAGjC,SAAS,EAAE,oBAAoB;IAO3C,MAAM,CAAC,yBAAyB,CAC9B,aAAa,EAAE,WAAW,CAAC,gBAAgB,CAAC;IAWvC,4BAA4B,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB;IAwBnE,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAchC"}
@@ -46,6 +46,12 @@ Please make sure that the provider is registered in the container and it is conf
46
46
  throw new Error(errMessage);
47
47
  }
48
48
  }
49
+ async shutdown() {
50
+ const providers = new Set(Object.keys(this.__container__)
51
+ .filter((key) => key.startsWith(types_1.LockingProviderRegistrationPrefix))
52
+ .map((key) => this.__container__[key]));
53
+ await Promise.all([...providers].map((provider) => provider.shutdown?.()));
54
+ }
49
55
  }
50
56
  _LockingProviderService_logger = new WeakMap();
51
57
  exports.default = LockingProviderService;
@@ -1 +1 @@
1
- {"version":3,"file":"locking-provider.js","sourceRoot":"","sources":["../../src/services/locking-provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAKA,qDAAuD;AACvD,oCAA4D;AAO5D,MAAqB,sBAAsB;IAIzC,YAAY,SAA+B;QAF3C,iDAAe;QAGb,IAAI,CAAC,aAAa,GAAG,SAAS,CAAA;QAC9B,uBAAA,IAAI,kCAAW,SAAS,CAAC,QAAQ,CAAC;YAChC,CAAC,CAAC,SAAS,CAAC,MAAM;YAClB,CAAC,CAAE,OAA6B,MAAA,CAAA;IACpC,CAAC;IAED,MAAM,CAAC,yBAAyB,CAC9B,aAA4C;QAE5C,IAAI,CAAE,aAAqB,CAAC,UAAU,EAAE,CAAC;YACvC,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,gBAAgB,EAClC,8DAA8D,CAC/D,CAAA;QACH,CAAC;QACD,OAAO,GAAI,aAAqB,CAAC,UAAU,EAAE,CAAA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;IAC5E,CAAC;CACF;;kBA7DoB,sBAAsB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/locking",
3
- "version": "2.22.0-snapshot-20261021091347",
3
+ "version": "2.22.1",
4
4
  "description": "Locking Module for Medusa",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
@@ -13,10 +13,14 @@
13
13
  },
14
14
  "files": [
15
15
  "dist",
16
+ "AGENTS.md",
16
17
  "!dist/**/__tests__",
17
18
  "!dist/**/__mocks__",
18
19
  "!dist/**/__fixtures__"
19
20
  ],
21
+ "llms": "https://docs.medusajs.com/llms.txt",
22
+ "llmsFull": "https://docs.medusajs.com/llms-full.txt",
23
+ "mcpServer": "https://docs.medusajs.com/mcp",
20
24
  "publishConfig": {
21
25
  "access": "public"
22
26
  },
@@ -35,10 +39,10 @@
35
39
  "orm:cache:clear": "MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true medusa-mikro-orm cache:clear"
36
40
  },
37
41
  "devDependencies": {
38
- "@medusajs/framework": "2.22.0-snapshot-20261021091347",
39
- "@medusajs/test-utils": "2.22.0-snapshot-20261021091347"
42
+ "@medusajs/framework": "2.22.1",
43
+ "@medusajs/test-utils": "2.22.1"
40
44
  },
41
45
  "peerDependencies": {
42
- "@medusajs/framework": "2.22.0-snapshot-20261021091347"
46
+ "@medusajs/framework": "2.22.1"
43
47
  }
44
48
  }