@onereach/billing-shared 30.8.1-beta.12369.0 → 30.8.1-beta.12385.0

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.
@@ -16,5 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./common"), exports);
18
18
  __exportStar(require("./billing-domain"), exports);
19
- __exportStar(require("./customer-account-actions"), exports);
20
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,mDAAiC;AACjC,6DAA2C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,mDAAiC"}
@@ -1,4 +1,3 @@
1
1
  export * from './common';
2
2
  export * from './billing-domain';
3
- export * from './customer-account-actions';
4
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC"}
@@ -1,4 +1,3 @@
1
1
  export * from './common';
2
2
  export * from './billing-domain';
3
- export * from './customer-account-actions';
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/billing-shared",
3
- "version": "30.8.1-beta.12369.0",
3
+ "version": "30.8.1-beta.12385.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -9,14 +9,7 @@ const __dirname = dirname(__filename);
9
9
  const lockDir = '/tmp/shared-esm-build.lock';
10
10
  const pidFile = resolve(lockDir, 'pid');
11
11
  let ownsLock = false;
12
- let emptyLockObservedAt;
13
- let stopRequested = false;
14
-
15
- const requestStop = () => {
16
- stopRequested = true;
17
- };
18
- process.on('SIGINT', requestStop);
19
- process.on('SIGTERM', requestStop);
12
+ const startupDeadline = Date.now() + 1000;
20
13
 
21
14
  const isAlive = (pid) => { try { process.kill(pid, 0);return true; } catch { return false; } };
22
15
  const reclaimLock = () => {
@@ -33,8 +26,6 @@ const reclaimLock = () => {
33
26
  });
34
27
  };
35
28
  while (!ownsLock) {
36
- if (stopRequested) process.exit(0);
37
-
38
29
  try {
39
30
  mkdirSync(lockDir);
40
31
  ownsLock = true;
@@ -45,29 +36,22 @@ while (!ownsLock) {
45
36
  // eslint-disable-next-line no-empty
46
37
  try { oldPid = Number(readFileSync(pidFile, 'utf8').trim()); } catch {}
47
38
  if (!Number.isNaN(oldPid) && isAlive(oldPid)) {
48
- emptyLockObservedAt = undefined;
49
39
  // eslint-disable-next-line no-console
50
- console.log(`shared already running (pid=${oldPid}); waiting to take over`);
51
- while (isAlive(oldPid) && !stopRequested) {
52
- await new Promise(resolve => { setTimeout(resolve, 250); });
53
- }
54
- continue;
40
+ console.log(`shared already running (pid=${oldPid})`);
41
+ process.exit(0);
55
42
  }
56
43
 
57
44
  if (Number.isNaN(oldPid)) {
58
- emptyLockObservedAt ??= Date.now();
59
- if (Date.now() - emptyLockObservedAt < 1000) {
45
+ if (Date.now() < startupDeadline) {
60
46
  await new Promise(resolve => { setTimeout(resolve, 25); });
61
47
  continue;
62
48
  }
63
49
 
64
50
  reclaimLock();
65
- emptyLockObservedAt = undefined;
66
51
  continue;
67
52
  }
68
53
 
69
54
  reclaimLock();
70
- emptyLockObservedAt = undefined;
71
55
  }
72
56
  }
73
57
 
@@ -93,8 +77,6 @@ const shutdown = (signal) => {
93
77
  shuttingDown = true;
94
78
  child.kill(signal);
95
79
  };
96
- process.removeListener('SIGINT', requestStop);
97
- process.removeListener('SIGTERM', requestStop);
98
80
  process.on('SIGINT', () => shutdown('SIGINT'));
99
81
  process.on('SIGTERM', () => shutdown('SIGTERM'));
100
82
 
@@ -1,3 +1,2 @@
1
1
  export * from './common';
2
2
  export * from './billing-domain';
3
- export * from './customer-account-actions';
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=customer-account-actions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customer-account-actions.js","sourceRoot":"","sources":["../../../src/types/customer-account-actions.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=customer-account-actions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customer-account-actions.js","sourceRoot":"","sources":["../../../src/types/customer-account-actions.ts"],"names":[],"mappings":""}
@@ -1,8 +0,0 @@
1
- import type { CustomerAccountAction } from '../enums/customer-account-action';
2
- export interface CustomerAccountActionQueuePayload {
3
- accountId: string;
4
- action: CustomerAccountAction;
5
- environmentId: string;
6
- jobId: string;
7
- }
8
- //# sourceMappingURL=customer-account-actions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customer-account-actions.d.ts","sourceRoot":"","sources":["../../../src/types/customer-account-actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAE9E,MAAM,WAAW,iCAAiC;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,qBAAqB,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -1,8 +0,0 @@
1
- import type { CustomerAccountAction } from '../enums/customer-account-action';
2
-
3
- export interface CustomerAccountActionQueuePayload {
4
- accountId: string;
5
- action: CustomerAccountAction;
6
- environmentId: string;
7
- jobId: string;
8
- }