scimgateway 5.1.1 → 5.1.2

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.
@@ -11,15 +11,20 @@ on:
11
11
  jobs:
12
12
  build:
13
13
  runs-on: ubuntu-latest
14
-
14
+ env:
15
+ FORCE_COLOR: "1"
16
+ TERM: "xterm-256color"
15
17
  steps:
16
18
  - name: Checkout code
17
19
  uses: actions/checkout@v3
18
20
 
19
- - name: Install Bun
20
- run: |
21
- curl -fsSL https://bun.sh/install | bash
22
- echo "$HOME/.bun/bin" >> $GITHUB_PATH
21
+ # - name: Install Bun
22
+ # run: |
23
+ # curl -fsSL https://bun.sh/install | bash
24
+ # echo "$HOME/.bun/bin" >> $GITHUB_PATH
25
+
26
+ - name: Set up Bun
27
+ uses: oven-sh/setup-bun@v2
23
28
 
24
29
  - name: Install dependencies
25
30
  run: bun install
@@ -8,15 +8,20 @@ on:
8
8
  jobs:
9
9
  release:
10
10
  runs-on: ubuntu-latest
11
-
11
+ env:
12
+ FORCE_COLOR: "1"
13
+ TERM: "xterm-256color"
12
14
  steps:
13
15
  - name: Checkout code
14
16
  uses: actions/checkout@v3
15
17
 
16
- - name: Install Bun
17
- run: |
18
- curl -fsSL https://bun.sh/install | bash
19
- echo "$HOME/.bun/bin" >> $GITHUB_PATH
18
+ # - name: Install Bun
19
+ # run: |
20
+ # curl -fsSL https://bun.sh/install | bash
21
+ # echo "$HOME/.bun/bin" >> $GITHUB_PATH
22
+
23
+ - name: Set up Bun
24
+ uses: oven-sh/setup-bun@v2
20
25
 
21
26
  - name: Install dependencies
22
27
  run: bun install
package/README.md CHANGED
@@ -1182,6 +1182,12 @@ MIT © [Jarle Elshaug](https://www.elshaug.xyz)
1182
1182
 
1183
1183
  ## Change log
1184
1184
 
1185
+ ### v5.1.2
1186
+
1187
+ [Improved]
1188
+
1189
+ - Simplified some initialization logic
1190
+
1185
1191
  ### v5.1.1
1186
1192
 
1187
1193
  [Fixed]
@@ -13,7 +13,7 @@ import { createServer as httpsCreateServer } from 'node:https'
13
13
  import { type IncomingMessage, type ServerResponse } from 'node:http'
14
14
  import { createChecker } from 'is-in-subnet'
15
15
  import { BearerStrategy, type IBearerStrategyOptionWithRequest } from 'passport-azure-ad'
16
- import { fileURLToPath } from 'url'
16
+ import { fileURLToPath } from 'node:url'
17
17
  import { Log } from './logger.ts'
18
18
  import passport from 'passport'
19
19
  import dot from 'dot-object'
@@ -307,43 +307,21 @@ export class ScimGateway {
307
307
  constructor() {
308
308
  const funcHandler: any = {}
309
309
  const startTime = utils.timestamp()
310
-
311
- // need requester/plugin full path for setting pluginName and configDir
312
- const originalStackTrace = new Error().stack
313
- const stackLines = originalStackTrace ? originalStackTrace.split('\n') : ''
314
310
  let requester: string = ''
315
- let callerLine = ''
316
- for (let i = 0; i < stackLines.length; i++) {
317
- if (stackLines[i].includes('new ScimGateway') && i < stackLines.length - 1) {
318
- callerLine = stackLines[i + 1]
319
- break
320
- }
321
- }
322
- /*
323
- const testCases = [ // Bun >= 1.1.43 and node.js
324
- ' at C:\\xxx\\yyy\\scimgateway\\lib\\plugin-loki.ts:41:21',
325
- ' at /xxx/yyy/scimgateway/lib/plugin-loki.ts:41:21',
326
- ' at file:///C:/xxx/yyy/scimgateway/lib/plugin-loki.ts:41:21',
327
- ];
328
-
329
- const testCases = [ // Bun < v1.1.43;
330
- ' at module code (C:\\xxx\\yyy\\scimgateway\\lib\\plugin-loki.ts:41:21)',
331
- ' at module code (/xxx/yyy/scimgateway/lib/plugin-loki.ts:41:21)',
332
- ];
333
- */
334
- if (callerLine) {
335
- let match = callerLine.match(/at\s+(?:file:\/\/\/)?((?:[A-Za-z]:[\\/]|\/)[^:]+)/) // Bun >= v1.1.43 and node.js
336
- if (match && match[1]) {
337
- requester = match[1]
338
- }
339
- if (!requester) {
340
- match = callerLine.match(/\((.+?):\d+:\d+\)/) // Bun < v1.1.43
341
- if (match && match[1]) {
342
- requester = match[1]
343
- }
311
+ {
312
+ let _prepareStackTrace = Error.prepareStackTrace
313
+ Error.prepareStackTrace = (_, stack) => {
314
+ return stack.map((callSite) => {
315
+ return callSite.getFileName()
316
+ })
344
317
  }
318
+ const e = new Error()
319
+ requester = e.stack?.[1] || ''
320
+ try { // node.js using url-path win: file:///path - linux: file://path
321
+ requester = fileURLToPath(requester)
322
+ } catch (err) { void 0 }
323
+ Error.prepareStackTrace = _prepareStackTrace
345
324
  }
346
-
347
325
  let pluginName = path.basename(requester)
348
326
  pluginName = pluginName.substring(0, pluginName.lastIndexOf('.')) || pluginName
349
327
  let pluginDir = path.dirname(requester)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scimgateway",
3
- "version": "5.1.1",
3
+ "version": "5.1.2",
4
4
  "type": "module",
5
5
  "description": "Using SCIM protocol as a gateway for user provisioning to other endpoints",
6
6
  "author": "Jarle Elshaug <jarle.elshaug@gmail.com> (https://elshaug.xyz)",