scimgateway 5.0.12 → 5.0.14

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 CHANGED
@@ -16,6 +16,7 @@ Validated through IdP's:
16
16
 
17
17
  Latest news:
18
18
 
19
+ - Email, onError and sendMail() supports modern REST OAuth for Microsoft Exchange Online (ExO) and Google Workspace Gmail, alongside traditional SMTP Auth for all mail systems. HelperRest supports a wide range of common authentication methods, including basicAuth, bearerAuth, tokenAuth, oauth, oauthSamlAssertion, oauthJwtAssertion and Auth PassTrough
19
20
  - Major version **v5.0.0** marks a shift to native TypeScript support and prioritizes [Bun](https://bun.sh/) over Node.js. This upgrade requires some modifications to existing plugins.
20
21
  - **BREAKING**: [SCIM Stream](https://elshaug.xyz/docs/scim-stream) is the modern way of user provisioning letting clients subscribe to messages instead of traditional IGA top-down provisioning. SCIM Gateway now offers enhanced functionality with support for message subscription and automated provisioning using SCIM Stream
21
22
  - Authentication PassThrough letting plugin pass authentication directly to endpoint for avoid maintaining secrets at the gateway. E.g., using Entra ID application OAuth
@@ -436,18 +437,18 @@ Definitions in `endpoint` object are customized according to our plugin code. Pl
436
437
  "2603:1056:2000::/48",
437
438
  "2603:1057:2::/48"
438
439
  ]
439
- - **email** - Contains configuration for sending email from plugin or automated error notifications emailOnError. Note, for emailOnError only the first error will be sent until sendInterval have passed
440
- - **email.host** - Mailserver e.g. "smtp.gmail.com" - mandatory when not using tenantIdGUID (Microsoft)
441
- - **email.port** - Port used by mailserver e.g. 587, 25 or 465 - mandatory when not using tenantIdGUID (Microsoft)
440
+ - **email** - Contains configuration for sending email from plugin or automated error notifications emailOnError. Note, for emailOnError only the first error will be sent until sendInterval have passed. Supporting both SMTP Auth and modern REST OAuth. For OAuth, currently Microsoft Exchange Online (ExO) and Google Workspace Gmail are supported
442
441
  - **email.auth** - Authentication configuration
443
- - **email.auth.type** - `basic` or `oauth`
444
- - **email.auth.options** - Authentication configuration options - note, different options for type basic and oauth
445
- - **email.auth.options.username (basic)** - Mail account for authentication normally same as sender of the email, e.g. "user@gmail.com"
446
- - **email.auth.options.password (basic)** - Mail account password
447
- - **email.auth.options.tenantIdGUID (oauth)** - Entra ID tenant id, mandatory/recommended when using Microsoft Exchange Online
448
- - **email.auth.options.tokenUrl (oauth)** - Token endpoint, mandatory when not using tenantIdGUID (Microsoft Exchange Online)
449
- - **email.auth.options.clientId (oauth)** - Client ID
450
- - **email.auth.options.clientSecret (oauth)** - Client Secret
442
+ - **email.auth.type** - `oauth` or `smtp`
443
+ - **email.auth.options** - Authentication options - note, different options for type oauth and smtp
444
+ - **email.auth.options.tenantIdGUID (oauth/ExO)** - Entra ID tenant id, mandatory/recommended when using Microsoft Exchange Online
445
+ - **email.auth.options.clientId (oauth/ExO)** - Client ID
446
+ - **email.auth.options.clientSecret (oauth/ExO)** - Client Secret
447
+ - **email.auth.options.serviceAccountKeyFile (oauth/Gmail)** - Google Service Account key json-file name located in the `package-root>\config\certs` directory unless absolute path being defined
448
+ - **email.auth.options.host (smtp)** - Mailserver e.g. "smtp.gmail.com" - mandatory for smtp
449
+ - **email.auth.options.port (smtp)** - Port used by mailserver e.g. 587, 25 or 465 - mandatory for smtp
450
+ - **email.auth.options.username (smtp)** - Mail account for authentication normally same as sender of the email, e.g. "user@gmail.com"
451
+ - **email.auth.options.password (smtp)** - Mail account password
451
452
  - **email.proxy** - Proxy configuration if using mailproxy
452
453
  - **email.proxy.host** - Proxy host e.g. `http://proxy-host:1234`
453
454
  - **email.proxy.username** - username if authentication is required
@@ -455,12 +456,12 @@ Definitions in `endpoint` object are customized according to our plugin code. Pl
455
456
  - **email.emailOnError** - Contains configuration for sending error notifications by email. Note, only the first error will be sent until sendInterval have passed
456
457
  - **email.emailOnError.enabled** - true or false, value set to true will enable email notifications
457
458
  - **email.emailOnError.sendInterval** - Default 15. Mail notifications on error are deferred until sendInterval **minutes** have passed since the last notification.
458
- - **email.emailOnError.from** - Sender email addresses e.g: "noreply@example.com", note must correspond with email.auth.options being used and mailserver configuration
459
+ - **email.emailOnError.from** - Sender email addresses e.g: "noreply@example.com". **Mandatory for oauth**. For smtp email.auth.options.username will be used
459
460
  - **email.emailOnError.to** - Comma separated list of recipients email addresses e.g: "someone@example.com"
460
461
  - **email.emailOnError.cc** - Optional comma separated list of cc mail addresses
461
462
  - **email.emailOnError.subject** - Optional mail subject, default `SCIM Gateway error message`
462
463
 
463
- Configuration notes when using default configuration oauth and tenantIdGUID - Microsoft Exchange Online (ExO):
464
+ **Configuration notes for Microsoft Exchange Online (ExO):**
464
465
 
465
466
  - Entra ID application must have application permissions `Mail.Send`
466
467
  - To prevent the sending of emails from any defined mailboxes, an ExO `ApplicationAccessPolicy` must be defined through PowerShell.
@@ -475,9 +476,33 @@ Definitions in `endpoint` object are customized according to our plugin code. Pl
475
476
  ##Create ApplicationAccessPolicy
476
477
  New-ApplicationAccessPolicy -AppId <AppClientID> -PolicyScopeGroupId <MailEnabledSecurityGrpId> -AccessRight RestrictAccess -Description "Restrict app to specific mailboxes"
477
478
 
479
+ **Configuration notes for Google Workspace Gmail:**
480
+
481
+ - https://console.cloud.google.com
482
+ - IAM & Admin > Service Accounts > Create Service Account
483
+ - Name=email-sender
484
+ - Create and Continue
485
+ - Grant this service account access to project - not needed
486
+ - Grant users access to this service - not needed
487
+ - IAM & Admin > Service Accounts > "email-sender" account > Keys
488
+ - Add Key > Create new key > JSON
489
+ - download json `serviceAccountKeyFile` file, refere to configuration `email.auth.options.serviceAccountKeyFile`
490
+
491
+ - https://admin.google.com
492
+ - Security > Access and data control > API controls
493
+ - Manage Domain Wide Delegation > Add new
494
+ - Client ID = id of service account created
495
+ - OAuth scope = https://www.googleapis.com/auth/gmail.send
496
+
497
+ - https://admin.google.com
498
+ - Billing > Subscriptions - verify Google Workspace license
499
+ - Directory > Users > "user"
500
+ - Licenses > Edit > enable Google Workspace license
501
+ `email.onerror.from` mail address must have Google Workspace Business license
502
+
478
503
  - **stream** - See [SCIM Stream](https://elshaug.xyz/docs/scim-stream) for configuration details
479
504
 
480
- - **endpoint** - Contains endpoint specific configuration according to our **plugin code**.
505
+ - **endpoint** - Contains endpoint specific configuration according to customized **plugin code**.
481
506
 
482
507
  #### Configuration notes
483
508
 
@@ -1111,6 +1136,22 @@ MIT © [Jarle Elshaug](https://www.elshaug.xyz)
1111
1136
 
1112
1137
  ## Change log
1113
1138
 
1139
+ ### v5.0.14
1140
+
1141
+ [Improved]
1142
+
1143
+ - email now supports Google Workspace Gmail using REST OAuth
1144
+ - email workaround for ExO national characters introduced in v5.0.7 not needed anymore - ExO/GraphApi seems to have been fixed
1145
+ - some minor cosmetics on email message layout formatting when using plain text message
1146
+ - HelperRest now includes authentication type `oauthJwtAssertion`
1147
+
1148
+ ### v5.0.13
1149
+
1150
+ [Improved]
1151
+
1152
+ - scim-stream, using the new reorganized nats.js v3 client library
1153
+ - cosmetics, `use strict` not needed and removed because ES modules are always strict mode
1154
+
1114
1155
  ### v5.0.12
1115
1156
 
1116
1157
  [Fixed]
package/bun.lockb CHANGED
Binary file
@@ -2,6 +2,7 @@ import { HttpsProxyAgent } from 'https-proxy-agent'
2
2
  import { URL } from 'url'
3
3
  import { Buffer } from 'node:buffer'
4
4
  import { samlAssertion } from './samlAssertion.ts' // prereq: saml
5
+ import { sign as jwtSign } from 'jsonwebtoken'
5
6
  import fs from 'node:fs'
6
7
  import querystring from 'querystring'
7
8
  import * as utils from './utils.ts'
@@ -16,6 +17,7 @@ export class HelperRest {
16
17
  private scimgateway: any
17
18
  private idleTimeout: number
18
19
  private graphUrl = 'https://graph.microsoft.com/beta' // beta instead of 'v1.0' gives all user attributes when no $select
20
+ private googleUrl = 'https://www.googleapis.com'
19
21
 
20
22
  constructor(scimgateway: any, optionalEntities?: Record<string, any>) {
21
23
  if (!scimgateway || !scimgateway.gwName) throw new Error('HelperRest initialization error: argument scimgateway is not of type ScimGateway')
@@ -33,6 +35,11 @@ export class HelperRest {
33
35
  if (this.config_entity[baseEntity]?.connection?.auth?.type === 'oauth') {
34
36
  this.config_entity[baseEntity].connection.baseUrls = [this.graphUrl]
35
37
  }
38
+ } else if (this.config_entity[baseEntity]?.connection?.auth?.options?.serviceAccountKeyFile) { // Google, setting baseUrls to googleapis
39
+ const type = this.config_entity[baseEntity]?.connection?.auth?.type
40
+ if (type === 'oauthJwtAssertion' || type === 'oauth') { // includes oauth because of email.auth.type
41
+ this.config_entity[baseEntity].connection.baseUrls = [this.googleUrl]
42
+ }
36
43
  }
37
44
  connectionFound = true
38
45
  }
@@ -107,13 +114,57 @@ export class HelperRest {
107
114
  const audience = `scimgateway/${this.scimgateway.pluginName}`
108
115
  const delay = 1
109
116
 
110
- const assertion = await samlAssertion.run(context, cert, key, issuer, lifetime, clientId, nameId, userIdentifierFormat, tokenEndpoint, audience, delay)
111
117
  form = {
112
118
  token_url: tokenUrl,
113
119
  grant_type: 'urn:ietf:params:oauth:grant-type:saml2-bearer',
114
120
  client_id: clientId,
115
121
  company_id: this.config_entity[baseEntity].connection.auth.options.companyId,
116
- assertion: assertion,
122
+ assertion: await samlAssertion.run(context, cert, key, issuer, lifetime, clientId, nameId, userIdentifierFormat, tokenEndpoint, audience, delay),
123
+ }
124
+ break
125
+
126
+ case 'oauthJwtAssertion':
127
+ let privateKey = ''
128
+ let jwtAttr: Record<string, any> = {}
129
+ const serviceAccountKeyFile = this.config_entity[baseEntity]?.connection?.auth?.options?.serviceAccountKeyFile
130
+
131
+ if (serviceAccountKeyFile) { // Google Service Account key json-file
132
+ const gkey: Record<string, any> = await (async () => {
133
+ try {
134
+ const jsonObject = await import(serviceAccountKeyFile, { assert: { type: 'json' } })
135
+ return jsonObject.default // access the object via the `default` property
136
+ } catch (err: any) {
137
+ throw new Error(`auth type '${this.config_entity[baseEntity]?.connection?.auth?.type}' - serviceAccountKeyFile error: ${err.message}`)
138
+ }
139
+ })()
140
+
141
+ tokenUrl = gkey.token_uri // https://oauth2.googleapis.com/token
142
+ privateKey = gkey.private_key
143
+ jwtAttr = {
144
+ scope: this.config_entity[baseEntity]?.connection?.auth?.options?.scope, // https://www.googleapis.com/auth/gmail.send
145
+ sub: this.config_entity[baseEntity]?.connection?.auth?.options?.subject, // firstname.lastname@mycompany.com
146
+ iss: gkey.client_email, // service account email/user
147
+ aud: gkey.token_uri,
148
+ iat: Math.floor(Date.now() / 1000), // issued at
149
+ exp: Math.floor(Date.now() / 1000) + (60 * 60), // expiration time
150
+ }
151
+ } else { // standard JWT requires all configuation set
152
+ tokenUrl = this.config_entity[baseEntity]?.connection?.auth?.options?.tokenUrl
153
+ const privateKeyFile = this.config_entity[baseEntity]?.connection?.auth?.options?.certificate?.key
154
+ if (privateKeyFile) privateKey = fs.readFileSync(privateKeyFile).toString()
155
+ jwtAttr = {
156
+ scope: this.config_entity[baseEntity]?.connection?.auth?.options?.scope,
157
+ sub: this.config_entity[baseEntity]?.connection?.auth?.options?.subject,
158
+ iss: this.config_entity[baseEntity]?.connection?.auth?.options?.issuer,
159
+ aud: this.config_entity[baseEntity]?.connection?.auth?.options?.audience,
160
+ iat: Math.floor(Date.now() / 1000),
161
+ exp: Math.floor(Date.now() / 1000) + (60 * 60),
162
+ }
163
+ }
164
+
165
+ form = {
166
+ grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer',
167
+ assertion: jwtSign(jwtAttr, privateKey, { algorithm: 'RS256' }),
117
168
  }
118
169
  break
119
170
 
@@ -232,19 +283,28 @@ export class HelperRest {
232
283
  },
233
284
  }
234
285
 
235
- // Supporting no auth, header based auth (e.g., config {"options":{"headers":{"APIkey":"123"}}}),
236
- // basicAuth, bearerAuth, oauth, tokenAuth, oauthSamlAssertion and auth PassTrough using request header authorization
286
+ // Support no auth, header based auth (e.g., config {"options":{"headers":{"APIkey":"123"}}}),
287
+ // basicAuth, bearerAuth, oauth, tokenAuth, oauthSamlAssertion, oauthJwtAssertion and auth PassTrough using request header authorization
288
+
289
+ let orgConnection: any
290
+ if (opt?.connection) { // allow overriding/extending configuration connection by caller argument opt.connection
291
+ let org = this.config_entity[baseEntity]?.connection
292
+ orgConnection = utils.copyObj(org)
293
+ if (!org) org = {}
294
+ org = utils.extendObj(org, opt.connection)
295
+ }
296
+
237
297
  switch (this.config_entity[baseEntity]?.connection?.auth?.type) {
238
298
  case 'basic':
239
299
  if (!this.config_entity[baseEntity]?.connection?.auth?.options?.username || !this.config_entity[baseEntity]?.connection?.auth?.options?.password) {
240
- const err = new Error(`auth type 'basic' - missing configuration entity.${baseEntity}.connection.auth.options.username/password`)
300
+ const err = new Error(`auth.type 'basic' - missing configuration entity.${baseEntity}.connection.auth.options.username/password`)
241
301
  throw err
242
302
  }
243
303
  param.options.headers['Authorization'] = 'Basic ' + Buffer.from(`${this.config_entity[baseEntity].connection.auth.options.username}:${this.config_entity[baseEntity].connection.auth.options.password}`).toString('base64')
244
304
  break
245
305
  case 'oauth':
246
306
  if (!this.config_entity[baseEntity]?.connection?.auth?.options?.clientId || !this.config_entity[baseEntity]?.connection?.auth?.options?.clientSecret) {
247
- const err = new Error(`auth type 'oauth' - missing configuration entity.${baseEntity}.connection.auth.options.clientId/clientSecret`)
307
+ const err = new Error(`auth.type 'oauth' - missing configuration entity.${baseEntity}.connection.auth.options.clientId/clientSecret`)
248
308
  throw err
249
309
  }
250
310
  param.accessToken = await this.getAccessToken(baseEntity, ctx)
@@ -268,16 +328,42 @@ export class HelperRest {
268
328
  case 'oauthSamlAssertion':
269
329
  if (!this.config_entity[baseEntity]?.connection?.auth?.options?.clientId || !this.config_entity[baseEntity]?.connection?.auth?.options?.companyId
270
330
  || !this.config_entity[baseEntity]?.connection?.auth?.options?.certificate?.key) {
271
- const err = new Error(`auth type 'oauthSamlAssertion' - missing configuration entity.${baseEntity}.connection.auth.options...`)
331
+ const err = new Error(`auth.type 'oauthSamlAssertion' - missing configuration entity.${baseEntity}.connection.auth.options...`)
332
+ throw err
333
+ }
334
+ param.accessToken = await this.getAccessToken(baseEntity, ctx)
335
+ param.options.headers['Authorization'] = `Bearer ${param.accessToken.access_token}`
336
+ break
337
+ case 'oauthJwtAssertion':
338
+ if (this.config_entity[baseEntity]?.connection?.auth?.options?.serviceAccountKeyFile) { // Google Service Account
339
+ if (!this.config_entity[baseEntity]?.connection?.auth?.options?.scope || !this.config_entity[baseEntity]?.connection?.auth?.options?.subject) {
340
+ const err = new Error(`auth.type 'oauthJwtAssertion' - using auth.options 'serviceAccountKeyFile' also requires mandatory configuration entity.${baseEntity}.connection.auth.options.scope/subject`)
341
+ throw err
342
+ }
343
+ } else if (!this.config_entity[baseEntity]?.connection?.auth?.options?.tokenUrl
344
+ || !this.config_entity[baseEntity]?.connection?.auth?.options?.scope
345
+ || !this.config_entity[baseEntity]?.connection?.auth?.options?.subject
346
+ || !this.config_entity[baseEntity]?.connection?.auth?.options?.issuer
347
+ || !this.config_entity[baseEntity]?.connection?.auth?.options?.audience
348
+ || !this.config_entity[baseEntity]?.connection?.auth?.options?.certificate?.key
349
+ ) {
350
+ const err = new Error(`auth.type 'oauthJwtAssertion' - when not using auth.options 'serviceAccountKeyFile' which is related to Google, following auth.options is mandatory: tokenUrl, scope, subject, issuer, audience, certificate.key`)
272
351
  throw err
273
352
  }
353
+
274
354
  param.accessToken = await this.getAccessToken(baseEntity, ctx)
275
355
  param.options.headers['Authorization'] = `Bearer ${param.accessToken.access_token}`
276
356
  break
357
+
277
358
  default:
278
359
  // no auth or PassTrough
279
360
  }
280
361
 
362
+ if (orgConnection) {
363
+ this.config_entity[baseEntity].connection = orgConnection // reset back to original
364
+ if (opt?.connection) delete opt.connection
365
+ }
366
+
281
367
  // proxy
282
368
  if (this.config_entity[baseEntity]?.connection?.proxy?.host) {
283
369
  const agent = new HttpsProxyAgent(this.config_entity[baseEntity].connection.proxy.host)
@@ -334,7 +420,10 @@ export class HelperRest {
334
420
  // adding none static
335
421
  cli.options.method = method
336
422
  cli.options.path = `${urlObj.pathname}${urlObj.search}`
337
- if (opt) cli.options = utils.extendObj(cli.options, opt) // merge with argument options
423
+ if (opt) {
424
+ if (opt?.connection) delete opt.connection // only used for internal connection options
425
+ cli.options = utils.extendObj(cli.options, opt) // merge with argument options
426
+ }
338
427
 
339
428
  return cli // final client
340
429
  }
@@ -582,9 +671,9 @@ export class HelperRest {
582
671
  * ```
583
672
  * {
584
673
  * "options": {
585
- * "tenantIdGUID": "<Entra ID tenantIdGUID", // simplified configuration for using Microsoft Graph API
586
- * "tokenUrl": "<tokenUrl>", // not used when tenantIdGUID defined
587
- * "clientId": "<clientId",
674
+ * "tenantIdGUID": "<Entra ID tenantIdGUID", // Microsoft Graph API - baseUrls automatically set to [https://graph.microsoft.com/beta]
675
+ * "tokenUrl": "<tokenUrl>", // not used when tenantIdGUID defined - baseUrls required
676
+ * "clientId": "<clientId>",
588
677
  * "clientSecret": "<clientSecret>"
589
678
  * }
590
679
  * }
@@ -626,6 +715,32 @@ export class HelperRest {
626
715
  * }
627
716
  * ```
628
717
  *
718
+ * type=**"oauthJwtAssertion"** having auth.options:
719
+ * ```
720
+ * // Google API - baseUrls automatically set to [https://www.googleapis.com]
721
+ * {
722
+ * "options": {
723
+ * "serviceAccountKeyFile": "<Google Service Account key file name>", // located in ./config/certs
724
+ * "scope": "<jwt-scope>"
725
+ * "subject": "<jwt-subject>
726
+ * }
727
+ * }
728
+ *
729
+ * // General JWT API - baseUrls required
730
+ * {
731
+ * "options": {
732
+ * "tokenUrl": "<tokenUrl",
733
+ * "scope": "<jwt-scope>",
734
+ * "subject": "<jwt-subject>",
735
+ * "issuer": "<jwt-issuer>",
736
+ * "audience": "<jwt-audience>",
737
+ * "certificate": {
738
+ * "key": "<signing-key-file-name>"
739
+ * }
740
+ * }
741
+ * }
742
+ * ```
743
+ *
629
744
  * **connection.options** can be set according to web-standard fetch client options
630
745
  * examples:
631
746
  * ```
package/lib/plugin-api.ts CHANGED
@@ -24,8 +24,6 @@
24
24
  //
25
25
  // =================================================================================
26
26
 
27
- 'use strict'
28
-
29
27
  // for supporting nodejs running scimgateway package directly, using dynamic import instead of: import { ScimGateway } from 'scimgateway'
30
28
  // scimgateway also inclues HelperRest: import { ScimGateway, HelperRest } from 'scimgateway'
31
29
 
@@ -57,8 +57,6 @@
57
57
  // Members members members
58
58
  // =====================================================================================================================
59
59
 
60
- 'use strict'
61
-
62
60
  import querystring from 'querystring'
63
61
  // for supporting nodejs running scimgateway package directly, using dynamic import instead of: import { ScimGateway } from 'scimgateway'
64
62
  // scimgateway also inclues HelperRest: import { ScimGateway, HelperRest } from 'scimgateway'
@@ -79,8 +79,6 @@
79
79
  //
80
80
  // =================================================================================
81
81
 
82
- 'use strict'
83
-
84
82
  import ldap from 'ldapjs'
85
83
  // @ts-expect-error missing type definitions
86
84
  import { BerReader } from '@ldapjs/asn1'
@@ -24,8 +24,6 @@
24
24
  //
25
25
  // =================================================================================
26
26
 
27
- 'use strict'
28
-
29
27
  import Loki from 'lokijs'
30
28
  import path from 'node:path'
31
29
  // for supporting nodejs running scimgateway package directly, using dynamic import instead of: import { ScimGateway } from 'scimgateway'
@@ -22,8 +22,6 @@
22
22
  //
23
23
  // =================================================================================
24
24
 
25
- 'use strict'
26
-
27
25
  import { MongoClient } from 'mongodb'
28
26
  // for supporting nodejs running scimgateway package directly, using dynamic import instead of: import { ScimGateway } from 'scimgateway'
29
27
  // scimgateway also inclues HelperRest: import { ScimGateway, HelperRest } from 'scimgateway'
@@ -56,8 +56,6 @@
56
56
  //
57
57
  // =================================================================================
58
58
 
59
- 'use strict'
60
-
61
59
  import { Connection, Request } from 'tedious'
62
60
  // for supporting nodejs running scimgateway package directly, using dynamic import instead of: import { ScimGateway } from 'scimgateway'
63
61
  // scimgateway also inclues HelperRest: import { ScimGateway, HelperRest } from 'scimgateway'
@@ -17,8 +17,6 @@
17
17
  // Currently no other attributes needed for maintaining saml users
18
18
  // =================================================================================
19
19
 
20
- 'use strict'
21
-
22
20
  import hdb from 'hdb' // prereq: bun install hdb
23
21
  // for supporting nodejs running scimgateway package directly, using dynamic import instead of: import { ScimGateway } from 'scimgateway'
24
22
  // scimgateway also inclues HelperRest: import { ScimGateway, HelperRest } from 'scimgateway'
@@ -24,8 +24,6 @@
24
24
  //
25
25
  // =================================================================================
26
26
 
27
- 'use strict'
28
-
29
27
  // for supporting nodejs running scimgateway package directly, using dynamic import instead of: import { ScimGateway } from 'scimgateway'
30
28
  // scimgateway also inclues HelperRest: import { ScimGateway, HelperRest } from 'scimgateway'
31
29
 
@@ -27,8 +27,6 @@
27
27
  //
28
28
  // =================================================================================
29
29
 
30
- 'use strict'
31
-
32
30
  import soap from 'soap' // prereq: bun install soap
33
31
  import path from 'node:path'
34
32
  // for supporting nodejs running scimgateway package directly, using dynamic import instead of: import { ScimGateway } from 'scimgateway'
@@ -11,4 +11,4 @@
11
11
  // for details see: https://elshaug.xyz/docs/scim-stream
12
12
  //
13
13
  // ================================================================
14
- 'use strict';(function(_0xfaabdb,_0x4af979){const _0xb3b178=a0_0xe6f9,_0x4a84c5=_0xfaabdb();while(!![]){try{const _0x45bc59=parseInt(_0xb3b178(0x179))/0x1*(-parseInt(_0xb3b178(0xd7))/0x2)+-parseInt(_0xb3b178(0x189))/0x3+parseInt(_0xb3b178(0x1a3))/0x4*(parseInt(_0xb3b178(0x133))/0x5)+parseInt(_0xb3b178(0x1bd))/0x6*(parseInt(_0xb3b178(0x104))/0x7)+parseInt(_0xb3b178(0x19c))/0x8*(-parseInt(_0xb3b178(0x177))/0x9)+parseInt(_0xb3b178(0xd5))/0xa*(-parseInt(_0xb3b178(0x154))/0xb)+parseInt(_0xb3b178(0x17c))/0xc;if(_0x45bc59===_0x4af979)break;else _0x4a84c5['push'](_0x4a84c5['shift']());}catch(_0x87397d){_0x4a84c5['push'](_0x4a84c5['shift']());}}}(a0_0x3711,0x583e9));function a0_0x3711(){const _0x167e38=['ConsumerNotFound','Application','ConsumerEvents','length','foldReplacing','publisher\x20not\x20initialized/connected','value','deliver_policy','consumers','pluginName','onCreate','330PbBUWv','\x20Create\x20userName=','certificate',',\x20attributes=','parse','transports','config','configDir','false','allSettled','baseUrls','firstn','status','server_name','getGroups','gwName','apply','internal\x20stream\x20policy\x20have\x20been\x20changed\x20-\x20central\x20SCIM\x20Stream\x20must\x20be\x20stopped\x20and\x20corresponding\x20./jetstream\x20folder\x20deleted\x20before\x20startup\x20allowing\x20new\x20policy','attribute','\x20-\x20will\x20do\x20auto\x20reconnect\x20when\x20connection\x20becomes\x20available',']\x20client\x20is\x20attempting\x20to\x20reconnect\x20','\x20message:\x20user\x20not\x20created\x20because\x20of\x20active=false','\x20group\x20removal\x20error:\x20','from','\x20message\x20response:\x20','rejected','\x20done','Resources','All','toUpperCase','jwt','append','createGroup','nats','name','221652yHVewl','\x20-\x20','1XXWFpM','ENOTFOUND','passThrough','3332592kBhGso','operation','getMemberOf','modifyUser','prototype','approles','\x20role\x20removal\x20error:\x20','stringify','delete','headers','data','call','randomUUID','954585yjlphY','waitOnFirstConnect','forEach','/certs/','createWriteStream','path','\x20createUser()\x20obj=','fsExistsSync','getuniquevalue',',\x20id=','DeliverPolicy','startsWith','tls','utf8','uppercase','getUsers',']\x20initialization\x20error:\x20missing\x20configuration\x20nats.subject','info','copyObj','16HXgGpd','\x27\x20not\x20supported','servers','_info','charAt','DebugEvents','obj','2842124YeoZpL','push','replaceAll','handle','Operations','jetstreamManager','\x20not\x20equal\x20subscriber\x20configured\x20baseEntity=',',false',']\x20client\x20error\x20','update','modifyOnly','tenant','usePutSoftSync','subscriber\x20message\x20error:\x20message\x20baseEntity=','Reconnect','modifyGroup','Events','file-not-configured','utf-8','debug','type','connect',']\x20client\x20disconnected\x20',']\x20connected\x20','StaleConnection',']\x20error:\x20missing\x20entity\x20configuration\x20for\x20baseEntity=','6SaSiOJ','query','generateUserPassword','Msg-Id','SCIM\x20Stream',']\x20subscriber[',',true','GW.','readFileSync','\x20message:\x20user\x20not\x20created\x20because\x20of\x20configuration\x20modifyOnly=true','activityOperation','jetstream','\x20calling\x20\x22','mkdirSync','isArray','filter_subject','map','encode','deleteUserOnLastGroupRoleRemoval','\x22\x20with\x20chunks\x20and\x20awaiting\x20result','UnableConnectingHost','splice','{\x22error\x22:\x22','caller','publisher\x20response\x20error:\x20','\x20or\x20',']\x20publisher[','\x20Replace\x20User\x20id=','ack',']\x20initialization\x20error:\x20missing\x20configuration\x20nats.tenant','\x20message\x20handled:\x20','\x22,\x22errName\x22:\x22','SIGTERM','split','hasOwnProperty','\x20Delete\x20User\x20id=','181360wKQdkg','pingInterval','489434YJPhrF','putApi','level','subscriber\x20message\x20error:\x20message\x20missing\x20method',']\x20error:\x20client\x20have\x20not\x20been\x20initialized','baseEntity','\x20(count=','errName','active','\x20error:\x20','file','sub','undefined','message','\x20missing\x20mandatory\x20user.userName\x20in\x20message:\x20','subject','\x20Delete\x20User\x20userName=','lowercase','closed','\x20processing\x20incoming\x20message','postApi','secret','roles','createUser','toString','then','join','userName','\x20message:\x20user\x20does\x20not\x20exist',']\x20connect\x20error:\x20','patchApi','replaceUsrGrp','indexOf','\x20with\x20chunks\x20returned\x20errors:\x20','maxReconnectAttempts','Explicit','includes','503','jwtAuthenticator','createRandomPassword','func','getAppRoles','attributes','close','getApi','3706150SFJVzz',']\x20initialization\x20error:\x20nats.subject\x20root\x20topic\x20must\x20be\x20\x27GW\x27,\x20nats.subject\x20example:\x20GW.APP1','getServer','Reconnecting','\x20getUserId()\x20error:\x20','replace','\x20handling\x20message:\x20','\x20roles\x20converted\x20to\x20groups:\x20','increment','respond','rawFilter','drain','getUsers()\x20getObj=','Disconnect','replaceDomains','/approles','trim','publisher\x20error:\x20none\x20JSON\x20formatted\x20response:\x20','toLowerCase','maxPingOut','HR.','approles_','ctxPassThrough','SIGINT','getProcessed','all','reason','deleteUser','User','StringCodec',']\x20closed\x20with\x20error:\x20','timeout',']\x20initialization\x20error:\x20missing\x20configuration\x20stream.baseUrls','logger',']\x20initialization\x20error:\x20missing\x20certificate\x20configuration','\x22\x20and\x20awaiting\x20result','string','groups','reconnectTimeWait','publisher[','error',']\x20client\x20reconnected\x20','isClosed','AckPolicy','\x20-\x20will\x20do\x20auto\x20connect\x20when\x20available\x20-\x20however,\x20please\x20verify\x20stream\x20configuration','existsSync','typeId','5DSYPBs','endsWith',']\x20error:\x20message\x20must\x20be\x20JSON\x20formatted','filter','deleteApi','convertedScim20',',\x20obj=','\x20missing\x20user\x20object\x20in\x20message:\x20','reconnect','subscribe',']\x20initialization\x20error:\x20missing\x20configuration\x20nats','add','remove','##doIncrement',']\x20error:\x20no\x20subscribers/responders\x20to\x20subject\x20','operator','get','true','decode','Users','substring','\x20=>\x20subscriber\x20not\x20activated'];a0_0x3711=function(){return _0x167e38;};return a0_0x3711();}import a0_0x1f12d0 from'nats';import a0_0x7d5195 from'fold-to-ascii';import a0_0x804e61 from'node:fs';function a0_0xe6f9(_0x1afc6f,_0x43fb34){const _0x371179=a0_0x3711();return a0_0xe6f9=function(_0xe6f917,_0x4ac354){_0xe6f917=_0xe6f917-0xd3;let _0x546687=_0x371179[_0xe6f917];return _0x546687;},a0_0xe6f9(_0x1afc6f,_0x43fb34);}import a0_0x24d390 from'node:path';import a0_0xd1e96 from'crypto';import*as a0_0x3bafd7 from'./utils.ts';import*as a0_0x690914 from'./utils-scim.ts';export class Subscriber{constructor(_0x680bee){const _0x438835=a0_0xe6f9,_0x5cd7a3=_0x680bee,_0x870e65={};let _0x332977='';for(let _0x19afcd=0x0;_0x19afcd<_0x5cd7a3['logger']['transports'][_0x438835(0x14c)];_0x19afcd++){if(_0x5cd7a3[_0x438835(0x125)][_0x438835(0x159)][_0x19afcd][_0x438835(0x176)]===_0x438835(0xe1)){_0x332977=_0x5cd7a3[_0x438835(0x125)]['transports'][_0x19afcd][_0x438835(0xd9)];break;}}const _0x5bffdc=''+(_0x332977===_0x438835(0x1b6)?'\x0a':''),_0xbf2e38=async(_0x4b491c,_0x15c95e)=>{const _0x440c35=_0x438835,_0x16613d=_0x870e65[_0x4b491c][_0x440c35(0x15a)]?.[_0x440c35(0x175)]?.[_0x440c35(0xe6)];let _0x567ff;try{_0x567ff=await a0_0x1f12d0['connect'](_0x15c95e);if(_0x567ff['info'][_0x440c35(0x161)]!==_0x440c35(0x1c1)){_0x567ff[_0x440c35(0x102)]();return;}_0x870e65[_0x4b491c]['nc']=_0x567ff,_0x2667e9(_0x4b491c,_0x567ff),_0x5508c0(_0x4b491c,_0x567ff);}catch(_0x13e52b){_0x5cd7a3[_0x440c35(0x125)][_0x440c35(0x12c)](_0x5cd7a3[_0x440c35(0x163)]+'['+_0x5cd7a3[_0x440c35(0x152)]+']\x20subscriber['+_0x4b491c+']['+_0x16613d+_0x440c35(0xf4)+_0x13e52b['message']+_0x440c35(0x130)),_0x15c95e['waitOnFirstConnect']=!![];try{_0x567ff=await a0_0x1f12d0[_0x440c35(0x1b8)](_0x15c95e);if(_0x567ff[_0x440c35(0x19a)][_0x440c35(0x161)]!==_0x440c35(0x1c1)){_0x567ff[_0x440c35(0x102)]();return;}_0x870e65[_0x4b491c]['nc']=_0x567ff,_0x2667e9(_0x4b491c,_0x567ff),_0x5508c0(_0x4b491c,_0x567ff);}catch(_0xbc5adc){_0x5cd7a3[_0x440c35(0x125)][_0x440c35(0x12c)](_0x5cd7a3[_0x440c35(0x163)]+'['+_0x5cd7a3['pluginName']+_0x440c35(0x1c2)+_0x4b491c+']['+_0x16613d+']\x20connect\x20error:\x20'+_0xbc5adc['message']);return;}}_0x5cd7a3['logger'][_0x440c35(0x1b6)](_0x5cd7a3[_0x440c35(0x163)]+'['+_0x5cd7a3[_0x440c35(0x152)]+_0x440c35(0x1c2)+_0x4b491c+']['+_0x16613d+_0x440c35(0x1ba)+(_0x15c95e['tls']['ca']?'tls':'')+'\x20'+_0x567ff[_0x440c35(0x106)]()),_0x567ff['closed']()[_0x440c35(0xf0)](_0x5d6677=>{const _0x30733c=_0x440c35;_0x5d6677&&_0x5cd7a3[_0x30733c(0x125)][_0x30733c(0x12c)](_0x5cd7a3[_0x30733c(0x163)]+'['+_0x5cd7a3[_0x30733c(0x152)]+']\x20subscriber['+_0x4b491c+']['+_0x16613d+_0x30733c(0x122)+_0x5d6677[_0x30733c(0xe4)]);});};this[_0x438835(0x13e)]=async(_0x4a9018,_0x1d620e)=>{const _0x1e041e=_0x438835;if(!_0x1d620e?.[_0x1e041e(0x175)]){_0x5cd7a3['logger'][_0x1e041e(0x12c)](_0x5cd7a3[_0x1e041e(0x163)]+'['+_0x5cd7a3['pluginName']+']\x20subscriber['+_0x4a9018+_0x1e041e(0x13d));return;}if(!_0x1d620e?.[_0x1e041e(0x175)]?.[_0x1e041e(0x1ae)]){_0x5cd7a3['logger']['error'](_0x5cd7a3[_0x1e041e(0x163)]+'['+_0x5cd7a3[_0x1e041e(0x152)]+_0x1e041e(0x1c2)+_0x4a9018+']\x20initialization\x20error:\x20missing\x20configuration\x20nats.tenant');return;}if(!_0x1d620e?.[_0x1e041e(0x175)]?.[_0x1e041e(0xe6)]){_0x5cd7a3[_0x1e041e(0x125)][_0x1e041e(0x12c)](_0x5cd7a3['gwName']+'['+_0x5cd7a3['pluginName']+_0x1e041e(0x1c2)+_0x4a9018+_0x1e041e(0x199));return;}if(!_0x1d620e?.[_0x1e041e(0x156)]?.['ca']){_0x5cd7a3[_0x1e041e(0x125)][_0x1e041e(0x12c)](_0x5cd7a3[_0x1e041e(0x163)]+'['+_0x5cd7a3[_0x1e041e(0x152)]+_0x1e041e(0x1c2)+_0x4a9018+_0x1e041e(0x126));return;}if(!_0x1d620e[_0x1e041e(0x15e)]||!Array[_0x1e041e(0x1cb)](_0x1d620e[_0x1e041e(0x15e)])||_0x1d620e[_0x1e041e(0x15e)][_0x1e041e(0x14c)]<0x1){_0x5cd7a3[_0x1e041e(0x125)][_0x1e041e(0x12c)](_0x5cd7a3['gwName']+'['+_0x5cd7a3['pluginName']+_0x1e041e(0x1c2)+_0x4a9018+_0x1e041e(0x124));return;}if(!_0x1d620e[_0x1e041e(0x1af)]){const _0x4e513a=_0x1d620e?.[_0x1e041e(0x175)]?.[_0x1e041e(0xe6)][_0x1e041e(0x171)]();if(_0x4e513a[_0x1e041e(0x194)](_0x1e041e(0x118)))_0x1d620e[_0x1e041e(0x1af)]=!![];}const _0x362c80={};try{let _0x19ec3b=a0_0x24d390[_0x1e041e(0xf1)](_0x5cd7a3[_0x1e041e(0x15b)],_0x1e041e(0x18c),_0x1d620e?.[_0x1e041e(0x156)]?.['ca']||'file-not-configured');(_0x1d620e?.['certificate']?.['ca']?.[_0x1e041e(0x194)]('/')||_0x1d620e?.[_0x1e041e(0x156)]?.['ca']?.['includes']('\x5c'))&&(_0x19ec3b=_0x1d620e['certificate']['ca']),_0x362c80['ca']=[a0_0x804e61[_0x1e041e(0x1c5)](_0x19ec3b)],_0x362c80['rejectUnauthorized']=!![];}catch(_0x4daf5b){_0x5cd7a3[_0x1e041e(0x125)]['error'](_0x5cd7a3['gwName']+'['+_0x5cd7a3[_0x1e041e(0x152)]+_0x1e041e(0x1c2)+_0x4a9018+']\x20initialization\x20certificate\x20error:\x20'+_0x4daf5b[_0x1e041e(0xe4)]);return;}const _0x1061bd={},_0x315a37=new TextEncoder()[_0x1e041e(0x1ce)](_0x1d620e?.[_0x1e041e(0x175)]?.[_0x1e041e(0xec)]),_0x43bcc3=_0x1d620e?.['nats']?.[_0x1e041e(0x172)];_0x1061bd['authenticator']=a0_0x1f12d0[_0x1e041e(0xfd)](_0x43bcc3,_0x315a37),_0x1061bd[_0x1e041e(0x19e)]=_0x1d620e[_0x1e041e(0x15e)],_0x1061bd[_0x1e041e(0x195)]=_0x362c80,_0x1061bd[_0x1e041e(0x18a)]=![],_0x1061bd[_0x1e041e(0x13b)]=!![],_0x1061bd[_0x1e041e(0x12a)]=0x3e8*0xa,_0x1061bd[_0x1e041e(0xf9)]=-0x1,_0x1061bd[_0x1e041e(0xd6)]=0x2*0x3c*0x3e8,_0x1061bd[_0x1e041e(0x117)]=0x5,_0x1061bd[_0x1e041e(0x1b6)]=![],_0x870e65[_0x4a9018]={},_0x870e65[_0x4a9018][_0x1e041e(0x15a)]=_0x1d620e,_0x870e65[_0x4a9018]['nc']=undefined,_0x870e65[_0x4a9018][_0x1e041e(0xe2)]=undefined,_0xbf2e38(_0x4a9018,_0x1061bd);};const _0x5508c0=async(_0x46ea9e,_0x1c6193)=>{const _0x281443=_0x438835,_0x30ffff=_0x870e65[_0x46ea9e][_0x281443(0x15a)],_0x1d6ade=_0x30ffff?.[_0x281443(0x175)]?.[_0x281443(0xe6)];if(!_0x1c6193){_0x5cd7a3[_0x281443(0x125)][_0x281443(0x12c)](_0x5cd7a3[_0x281443(0x163)]+'['+_0x5cd7a3[_0x281443(0x152)]+_0x281443(0x1c2)+_0x46ea9e+']['+_0x1d6ade+_0x281443(0xdb));return;}const _0x2ea960=async(_0x5a81c0,_0x133c8e)=>{const _0x7ae8bc=_0x281443;try{_0x5cd7a3['logger'][_0x7ae8bc(0x19a)](_0x5a81c0+_0x7ae8bc(0x10a)+_0x133c8e);let _0x494456;try{if(_0x30ffff[_0x7ae8bc(0x112)]&&Array['isArray'](_0x30ffff['replaceDomains']))for(let _0x23a177=0x0;_0x23a177<_0x30ffff[_0x7ae8bc(0x112)][_0x7ae8bc(0x14c)];_0x23a177++){const _0x1ae729=_0x30ffff[_0x7ae8bc(0x112)][_0x23a177];if(!_0x1ae729[_0x7ae8bc(0x16b)]||!_0x1ae729['from'][_0x7ae8bc(0xfb)]('.')||!_0x1ae729['to']||!_0x1ae729['to']['includes']('.'))continue;const _0x2c1c44=new RegExp('@'+_0x1ae729[_0x7ae8bc(0x16b)]+'\x22','gi');_0x133c8e=_0x133c8e[_0x7ae8bc(0x109)](_0x2c1c44,'@'+_0x1ae729['to']+'\x22');}_0x494456=JSON[_0x7ae8bc(0x158)](_0x133c8e);}catch(_0x31790e){_0x5cd7a3[_0x7ae8bc(0x125)][_0x7ae8bc(0x12c)](_0x5a81c0+'\x20message\x20json\x20parsing\x20error:\x20'+_0x31790e[_0x7ae8bc(0xe4)]+'\x20message:\x20'+_0x133c8e),_0x5cd7a3['logger'][_0x7ae8bc(0x1b6)](_0x5a81c0+_0x7ae8bc(0x16e)+_0x5bffdc);return;}const _0x1608db=_0x494456['user'];if(!_0x1608db){_0x5cd7a3['logger'][_0x7ae8bc(0x12c)](_0x5a81c0+_0x7ae8bc(0x13a)+JSON['stringify'](_0x494456)),_0x5cd7a3[_0x7ae8bc(0x125)]['debug'](_0x5a81c0+_0x7ae8bc(0x16e)+_0x5bffdc);return;}if(!_0x1608db[_0x7ae8bc(0xf2)]){_0x5cd7a3['logger']['error'](_0x5a81c0+_0x7ae8bc(0xe5)+JSON[_0x7ae8bc(0x183)](_0x494456)),_0x5cd7a3[_0x7ae8bc(0x125)][_0x7ae8bc(0x1b6)](_0x5a81c0+_0x7ae8bc(0x16e)+_0x5bffdc);return;}delete _0x1608db['schemas'];let _0x5975f8;_0x1608db['id']&&(_0x5975f8=_0x1608db['id'],delete _0x1608db['id']);let _0x17139f;_0x1608db[_0x7ae8bc(0x153)]&&(_0x17139f=a0_0x3bafd7[_0x7ae8bc(0x19b)](_0x1608db[_0x7ae8bc(0x153)]),delete _0x1608db[_0x7ae8bc(0x153)]);await _0x2c406b(_0x46ea9e,_0x1608db);const _0x50d822=_0x1608db[_0x7ae8bc(0xf2)];let _0x34ff08,_0x12d0a2;try{_0x34ff08=await _0x13ec27(_0x46ea9e,'userName',_0x50d822);}catch(_0x9a94c5){_0x5cd7a3[_0x7ae8bc(0x125)][_0x7ae8bc(0x12c)](_0x5a81c0+_0x7ae8bc(0x108)+_0x9a94c5[_0x7ae8bc(0xe4)]),_0x5cd7a3[_0x7ae8bc(0x125)]['debug'](_0x5a81c0+_0x7ae8bc(0x16e)+_0x5bffdc);const _0x4005f7=[_0x7ae8bc(0x1d1),'UnableConnectingService','ECONNREFUSED',_0x7ae8bc(0x17a),'ETIMEDOUT',_0x7ae8bc(0x123)];for(const _0x49857 in _0x4005f7){if(_0x9a94c5[_0x7ae8bc(0xe4)][_0x7ae8bc(0xfb)](_0x49857))return!![];}return;}if(!_0x30ffff['skipConvertRolesToGroups']){let _0x7d2977=![];if(_0x494456[_0x7ae8bc(0x1a7)]&&Array[_0x7ae8bc(0x1cb)](_0x494456[_0x7ae8bc(0x1a7)]))for(let _0x456983=0x0;_0x456983<_0x494456[_0x7ae8bc(0x1a7)][_0x7ae8bc(0x14c)];_0x456983++){const _0x35aa23=_0x494456['Operations'][_0x456983];_0x35aa23[_0x7ae8bc(0x18e)][_0x7ae8bc(0x194)](_0x7ae8bc(0xed))&&(_0x35aa23['path']=_0x7ae8bc(0x129),Array[_0x7ae8bc(0x1cb)](_0x35aa23['value'])?(_0x35aa23[_0x7ae8bc(0x14f)][0x0]['id']=_0x35aa23['value'][0x0]['value'],_0x35aa23['value'][0x0]['display']=_0x35aa23['value'][0x0][_0x7ae8bc(0x1b7)]+_0x7ae8bc(0x178)+_0x35aa23[_0x7ae8bc(0x14f)][0x0][_0x7ae8bc(0x14f)],delete _0x35aa23[_0x7ae8bc(0x14f)][0x0][_0x7ae8bc(0x14f)],delete _0x35aa23[_0x7ae8bc(0x14f)][0x0]['type']):_0x35aa23[_0x7ae8bc(0x14f)]=[{'id':_0x35aa23[_0x7ae8bc(0x14f)],'display':_0x35aa23[_0x7ae8bc(0x14f)]}],delete _0x35aa23[_0x7ae8bc(0x132)],_0x7d2977=!![]);}if(_0x1608db[_0x7ae8bc(0xed)]&&Array[_0x7ae8bc(0x1cb)](_0x1608db[_0x7ae8bc(0xed)])&&_0x1608db[_0x7ae8bc(0xed)]['length']>0x0){if(!_0x1608db['groups'])_0x1608db[_0x7ae8bc(0x129)]=[];if(!Array['isArray'](_0x1608db['groups']))_0x1608db['groups']=[];for(let _0x5b8ae8=0x0;_0x5b8ae8<_0x1608db[_0x7ae8bc(0xed)][_0x7ae8bc(0x14c)];_0x5b8ae8++){const _0x447283={},_0x2916bd=_0x1608db['roles'][_0x5b8ae8];_0x447283[_0x7ae8bc(0x14f)]=_0x2916bd[_0x7ae8bc(0x14f)],_0x447283['display']=_0x2916bd['type']+_0x7ae8bc(0x178)+_0x2916bd['display'],_0x1608db['groups'][_0x7ae8bc(0x1a4)](_0x447283);}delete _0x1608db[_0x7ae8bc(0xed)],_0x7d2977=!![];}if(_0x7d2977)_0x5cd7a3[_0x7ae8bc(0x125)][_0x7ae8bc(0x1b6)](_0x5a81c0+_0x7ae8bc(0x10b)+JSON['stringify'](_0x494456));}if(!_0x34ff08){if(_0x494456['activityOperation']===_0x7ae8bc(0x11f)){_0x5cd7a3[_0x7ae8bc(0x125)][_0x7ae8bc(0x1b6)](_0x5a81c0+_0x7ae8bc(0xe7)+_0x50d822+_0x7ae8bc(0xf3)),_0x5cd7a3[_0x7ae8bc(0x125)][_0x7ae8bc(0x1b6)](_0x5a81c0+'\x20done'+_0x5bffdc);return;}if(_0x30ffff[_0x7ae8bc(0x1ad)]&&_0x30ffff[_0x7ae8bc(0x1ad)]===!![]){_0x5cd7a3['logger']['debug'](_0x5a81c0+_0x7ae8bc(0x155)+_0x50d822+_0x7ae8bc(0x1c6)),_0x5cd7a3['logger']['debug'](_0x5a81c0+_0x7ae8bc(0x16e)+_0x5bffdc);return;}if(Object[_0x7ae8bc(0x180)][_0x7ae8bc(0xd3)][_0x7ae8bc(0x187)](_0x1608db,_0x7ae8bc(0xdf))){if(typeof _0x1608db[_0x7ae8bc(0xdf)]===_0x7ae8bc(0x128)){const _0x23f48a=_0x1608db['active'][_0x7ae8bc(0x116)]();if(_0x23f48a===_0x7ae8bc(0x144))_0x1608db[_0x7ae8bc(0xdf)]=!![];else{if(_0x23f48a===_0x7ae8bc(0x15c))_0x1608db[_0x7ae8bc(0xdf)]=![];}}if(_0x1608db[_0x7ae8bc(0xdf)]===![]){_0x5cd7a3['logger'][_0x7ae8bc(0x1b6)](_0x5a81c0+_0x7ae8bc(0x155)+_0x50d822+_0x7ae8bc(0x169)),_0x5cd7a3[_0x7ae8bc(0x125)][_0x7ae8bc(0x1b6)](_0x5a81c0+'\x20done'+_0x5bffdc);return;}}_0x5cd7a3[_0x7ae8bc(0x125)][_0x7ae8bc(0x1b6)](_0x5a81c0+'\x20Create\x20User\x20userName='+_0x50d822);const _0x40d2a3=a0_0x3bafd7['copyObj'](_0x1608db);try{delete _0x40d2a3['groups'];!_0x40d2a3['password']&&_0x30ffff[_0x7ae8bc(0x1bf)]&&_0x30ffff['generateUserPassword']===!![]&&(_0x40d2a3['password']=a0_0x3bafd7[_0x7ae8bc(0xfe)](0xf));if(_0x17139f||_0x5975f8){if(_0x17139f)for(const _0x3baf5d in _0x17139f){_0x40d2a3[_0x3baf5d]=_0x17139f[_0x3baf5d];}if(_0x5975f8)_0x40d2a3['id']=_0x5975f8;await _0x2c406b(_0x46ea9e,_0x40d2a3);}await _0x5cd7a3[_0x7ae8bc(0xee)](_0x46ea9e,_0x40d2a3),_0x1608db[_0x7ae8bc(0x129)]&&Array[_0x7ae8bc(0x1cb)](_0x1608db[_0x7ae8bc(0x129)])&&_0x1608db[_0x7ae8bc(0x129)][_0x7ae8bc(0x14c)]>0x0&&(_0x12d0a2=await _0x13ec27(_0x46ea9e,_0x7ae8bc(0xf2),_0x50d822));}catch(_0x4fda0f){_0x5cd7a3[_0x7ae8bc(0x125)][_0x7ae8bc(0x12c)](_0x5a81c0+_0x7ae8bc(0x18f)+JSON[_0x7ae8bc(0x183)](_0x40d2a3)+_0x7ae8bc(0xe0)+_0x4fda0f[_0x7ae8bc(0xe4)]+'}'),_0x5cd7a3[_0x7ae8bc(0x125)]['debug'](_0x5a81c0+_0x7ae8bc(0x16e)+_0x5bffdc);return;}}if(_0x34ff08||_0x12d0a2){if(_0x494456[_0x7ae8bc(0x1c7)]===_0x7ae8bc(0x11f)){if(_0x30ffff['modifyOnly']&&_0x30ffff[_0x7ae8bc(0x1ad)]===!![]){_0x5cd7a3[_0x7ae8bc(0x125)][_0x7ae8bc(0x1b6)](_0x5a81c0+'\x20Delete\x20User\x20id='+_0x34ff08+'\x20message:\x20user\x20not\x20deleted\x20because\x20of\x20configuration\x20modifyOnly=true'),_0x5cd7a3[_0x7ae8bc(0x125)]['debug'](_0x5a81c0+'\x20done'+_0x5bffdc);return;}_0x5cd7a3[_0x7ae8bc(0x125)]['debug'](_0x5a81c0+'\x20Delete\x20User\x20id='+_0x34ff08);try{await _0x5cd7a3['deleteUser'](_0x46ea9e,_0x34ff08);}catch(_0x9de8c5){_0x5cd7a3[_0x7ae8bc(0x125)][_0x7ae8bc(0x12c)](_0x5a81c0+_0x7ae8bc(0xd4)+_0x34ff08+_0x7ae8bc(0xe0)+_0x9de8c5[_0x7ae8bc(0xe4)]+'}'),_0x5cd7a3[_0x7ae8bc(0x125)][_0x7ae8bc(0x1b6)](_0x5a81c0+_0x7ae8bc(0x16e)+_0x5bffdc);return;}}else{if(_0x12d0a2)_0x34ff08=_0x12d0a2;_0x5cd7a3[_0x7ae8bc(0x125)]['debug'](_0x5a81c0+'\x20Replace\x20User\x20id='+_0x34ff08);try{await _0x5cd7a3['replaceUsrGrp'](_0x7ae8bc(0x146),_0x46ea9e,_0x34ff08,_0x1608db,_0x30ffff[_0x7ae8bc(0x1af)]);}catch(_0x399c3d){_0x5cd7a3[_0x7ae8bc(0x125)][_0x7ae8bc(0x12c)](_0x5a81c0+_0x7ae8bc(0x1d8)+_0x34ff08+_0x7ae8bc(0xe0)+_0x399c3d[_0x7ae8bc(0xe4)]),_0x5cd7a3[_0x7ae8bc(0x125)][_0x7ae8bc(0x1b6)](_0x5a81c0+_0x7ae8bc(0x16e)+_0x5bffdc);return;}if(_0x30ffff[_0x7ae8bc(0x1af)]){const [_0x5e9643,_0x5ec60a]=a0_0x690914[_0x7ae8bc(0x138)]({'Operations':_0x494456['Operations']});if(_0x5ec60a){_0x5cd7a3['logger']['error'](_0x5a81c0+_0x7ae8bc(0x1d8)+_0x34ff08+'\x20convertedScim20\x20error:\x20'+_0x5ec60a[_0x7ae8bc(0xe4)]),_0x5cd7a3['logger'][_0x7ae8bc(0x1b6)](_0x5a81c0+_0x7ae8bc(0x16e)+_0x5bffdc);return;}const _0x7525c8=[];if(_0x5e9643[_0x7ae8bc(0xed)]&&Array[_0x7ae8bc(0x1cb)](_0x5e9643[_0x7ae8bc(0xed)]))for(let _0x51cf05=0x0;_0x51cf05<_0x5e9643[_0x7ae8bc(0xed)][_0x7ae8bc(0x14c)];_0x51cf05++){_0x5e9643[_0x7ae8bc(0xed)][_0x51cf05][_0x7ae8bc(0x17d)]&&_0x5e9643[_0x7ae8bc(0xed)][_0x51cf05][_0x7ae8bc(0x17d)]===_0x7ae8bc(0x184)&&_0x7525c8['push'](_0x5e9643[_0x7ae8bc(0xed)][_0x51cf05]);}if(_0x7525c8[_0x7ae8bc(0x14c)]>0x0)try{await _0x5cd7a3[_0x7ae8bc(0x17f)](_0x46ea9e,_0x34ff08,{'roles':_0x7525c8});}catch(_0x4133d8){_0x5cd7a3[_0x7ae8bc(0x125)][_0x7ae8bc(0x12c)](_0x5a81c0+_0x7ae8bc(0x1d8)+_0x34ff08+_0x7ae8bc(0x182)+_0x4133d8[_0x7ae8bc(0xe4)]);}const _0x37a828=[];if(_0x5e9643[_0x7ae8bc(0x129)]&&Array['isArray'](_0x5e9643[_0x7ae8bc(0x129)]))for(let _0x5ad472=0x0;_0x5ad472<_0x5e9643[_0x7ae8bc(0x129)]['length'];_0x5ad472++){_0x5e9643['groups'][_0x5ad472][_0x7ae8bc(0x17d)]&&_0x5e9643[_0x7ae8bc(0x129)][_0x5ad472][_0x7ae8bc(0x17d)]==='delete'&&_0x37a828[_0x7ae8bc(0x1a4)](_0x5e9643[_0x7ae8bc(0x129)][_0x5ad472]);}if(_0x37a828[_0x7ae8bc(0x14c)]>0x0)for(let _0x28c50e=0x0;_0x28c50e<_0x37a828[_0x7ae8bc(0x14c)];_0x28c50e++){try{await _0x5cd7a3['modifyGroup'](_0x46ea9e,_0x37a828[_0x28c50e]['id'],{'members':[{'operation':_0x7ae8bc(0x184),'value':_0x34ff08}]});}catch(_0x51516a){_0x5cd7a3[_0x7ae8bc(0x125)][_0x7ae8bc(0x12c)](_0x5a81c0+'\x20Replace\x20User\x20id='+_0x34ff08+_0x7ae8bc(0x16a)+_0x51516a[_0x7ae8bc(0xe4)]);}}}if(_0x30ffff[_0x7ae8bc(0x1cf)]&&_0x494456[_0x7ae8bc(0x1c7)]===_0x7ae8bc(0x17f)){if(_0x1608db[_0x7ae8bc(0x129)]&&Array['isArray'](_0x1608db[_0x7ae8bc(0x129)])&&_0x1608db[_0x7ae8bc(0x129)][_0x7ae8bc(0x14c)]===0x0){if(_0x1608db[_0x7ae8bc(0xed)]&&Array[_0x7ae8bc(0x1cb)](_0x1608db[_0x7ae8bc(0xed)])&&_0x1608db[_0x7ae8bc(0xed)][_0x7ae8bc(0x14c)]===0x0){if(_0x494456[_0x7ae8bc(0x1a7)]&&Array[_0x7ae8bc(0x1cb)](_0x494456[_0x7ae8bc(0x1a7)])&&_0x494456[_0x7ae8bc(0x1a7)][_0x7ae8bc(0x14c)]>0x0){let _0x14a593=![];for(let _0x5d58ae=0x0;_0x5d58ae<_0x494456[_0x7ae8bc(0x1a7)][_0x7ae8bc(0x14c)];_0x5d58ae++){const _0x459b9e=_0x494456['Operations'][_0x5d58ae];if(_0x459b9e['op']===_0x7ae8bc(0x13f)){if(_0x459b9e[_0x7ae8bc(0x18e)]){if(_0x459b9e['path'][_0x7ae8bc(0x194)](_0x7ae8bc(0xed))&&_0x459b9e[_0x7ae8bc(0x132)]){_0x14a593=!![];break;}else{if(_0x459b9e[_0x7ae8bc(0x18e)]===_0x7ae8bc(0x129)){_0x14a593=!![];break;}}}}}if(_0x14a593){_0x5cd7a3[_0x7ae8bc(0x125)]['debug'](_0x5a81c0+_0x7ae8bc(0xd4)+_0x34ff08);try{await _0x5cd7a3[_0x7ae8bc(0x11f)](_0x46ea9e,_0x34ff08);}catch(_0x24793b){_0x5cd7a3[_0x7ae8bc(0x125)][_0x7ae8bc(0x12c)](_0x5a81c0+_0x7ae8bc(0xd4)+_0x34ff08+_0x7ae8bc(0xe0)+_0x24793b[_0x7ae8bc(0xe4)]+'}'),_0x5cd7a3['logger'][_0x7ae8bc(0x1b6)](_0x5a81c0+_0x7ae8bc(0x16e)+_0x5bffdc);return;}}}}}}}}_0x5cd7a3[_0x7ae8bc(0x125)][_0x7ae8bc(0x1b6)](_0x5a81c0+_0x7ae8bc(0x16e)+_0x5bffdc);}catch(_0x32755f){_0x5cd7a3[_0x7ae8bc(0x125)][_0x7ae8bc(0x12c)](_0x5cd7a3[_0x7ae8bc(0x163)]+'['+_0x5cd7a3[_0x7ae8bc(0x152)]+_0x7ae8bc(0x1c2)+_0x46ea9e+']['+_0x1d6ade+']\x20error:\x20'+_0x32755f['message']+_0x7ae8bc(0x148)+_0x5bffdc);}},_0xe435c5=a0_0x1f12d0[_0x281443(0x121)](),_0x20c053=_0x1c6193[_0x281443(0x1c8)](),_0x68a56=('durable_'+_0x5cd7a3[_0x281443(0x152)]+'_'+_0x46ea9e)['replaceAll']('*','#')[_0x281443(0x1a5)]('>','##')[_0x281443(0x1a5)]('.','_'),_0x42ba30=_0x1d6ade[_0x281443(0x1de)]('.')[0x0]['toUpperCase']()==='GW',_0x1978fd=async()=>{const _0x442152=_0x281443;try{let _0x2a11a5;const _0x4779d8=''+_0x30ffff?.['nats']?.[_0x442152(0x1ae)],_0x237419=await _0x1c6193[_0x442152(0x1a8)](),_0x579503=async()=>{const _0x256cdf=_0x442152;let _0x31390a;try{_0x31390a=await _0x20c053[_0x256cdf(0x151)]['get'](_0x4779d8,_0x68a56);}catch(_0x55dd78){const _0x2d2f4e={'durable_name':_0x68a56,'deliver_policy':a0_0x1f12d0[_0x256cdf(0x193)][_0x256cdf(0x170)],'ack_policy':a0_0x1f12d0[_0x256cdf(0x12f)][_0x256cdf(0xfa)],'filter_subject':_0x1d6ade};await _0x237419[_0x256cdf(0x151)]['add'](_0x4779d8,_0x2d2f4e),_0x31390a=await _0x20c053['consumers'][_0x256cdf(0x143)](_0x4779d8,_0x68a56);}if(_0x31390a?.['_info']?.[_0x256cdf(0x15a)]?.[_0x256cdf(0x150)]!==_0x256cdf(0x11d))throw new Error(_0x256cdf(0x165));_0x31390a?.[_0x256cdf(0x19f)]?.['config']?.[_0x256cdf(0x1cc)]!==_0x1d6ade&&(await _0x237419[_0x256cdf(0x151)][_0x256cdf(0x1ac)](_0x4779d8,_0x68a56,{'filter_subject':_0x1d6ade}),_0x31390a=await _0x20c053[_0x256cdf(0x151)][_0x256cdf(0x143)](_0x4779d8,_0x68a56)),_0x2a11a5=await _0x31390a['consume']({'max_messages':0x64}),_0x24e427(_0x2a11a5);},_0x24e427=async _0x3d6bd6=>{const _0x525616=_0x442152;for await(const _0x3f3abd of await _0x3d6bd6[_0x525616(0x160)]()){switch(_0x3f3abd[_0x525616(0x1b7)]){case a0_0x1f12d0[_0x525616(0x14b)][_0x525616(0x149)]:_0x5cd7a3[_0x525616(0x125)][_0x525616(0x19a)](_0x5cd7a3[_0x525616(0x163)]+'['+_0x5cd7a3[_0x525616(0x152)]+_0x525616(0x1c2)+_0x46ea9e+']['+_0x1d6ade+']\x20client\x20consumer\x20reinitiated\x20because\x20of\x20'+_0x3f3abd['type']),_0x579503();return;}}};await _0x579503();let _0x2428b0=-0x1;do{for await(const _0x1077d8 of _0x2a11a5){if(!_0x1077d8['headers']||!_0x1077d8[_0x442152(0x185)][_0x442152(0x143)](_0x442152(0x1c0))){_0x1077d8[_0x442152(0x1d9)]();continue;}_0x2428b0=_0x2a11a5[_0x442152(0x11c)]();const _0x393e04=_0x5cd7a3[_0x442152(0x163)]+'['+_0x5cd7a3[_0x442152(0x152)]+']\x20subscriber['+_0x46ea9e+']['+_0x1077d8[_0x442152(0xe6)]+']['+_0x2428b0+']['+(_0x1077d8['headers']?_0x1077d8[_0x442152(0x185)][_0x442152(0x143)](_0x442152(0x1c0)):'')+']',_0x8f4677=_0xe435c5[_0x442152(0x145)](_0x1077d8[_0x442152(0x186)]),_0xb709d1=await _0x2ea960(_0x393e04,_0x8f4677);if(!_0xb709d1||_0xb709d1!==!![])_0x1077d8[_0x442152(0x1d9)]();else _0x5cd7a3[_0x442152(0x125)][_0x442152(0x12c)](_0x393e04+'\x20subscriber\x20error:\x20scimgateway\x20endpoint\x20connect\x20problem\x20-\x20will\x20do\x20auto\x20retry\x20until\x20connected');if(_0x2428b0<0x1)break;}}while(_0x2428b0===0x0);}catch(_0x22cac3){_0x5cd7a3[_0x442152(0x125)][_0x442152(0x12c)](_0x5cd7a3[_0x442152(0x163)]+'['+_0x5cd7a3[_0x442152(0x152)]+_0x442152(0x1c2)+_0x46ea9e+']['+_0x1d6ade+']\x20subscriber\x20stopped\x20error:\x20'+_0x22cac3[_0x442152(0xe4)]);}},_0x8966a2=async()=>{const _0x5f692=_0x281443,_0x1bc183=_0x1c6193[_0x5f692(0x13c)](_0x1d6ade,{'max':0x64});for await(const _0x56df08 of _0x1bc183){if(!_0x56df08[_0x5f692(0x185)]||!_0x56df08[_0x5f692(0x185)]['get'](_0x5f692(0x1c0)))continue;let _0x45967d,_0x263daa;try{try{_0x45967d=JSON[_0x5f692(0x158)](_0x56df08['string']());}catch(_0x996ff6){const _0x48c8a5='subscriber\x20message\x20error:\x20message\x20not\x20JSON\x20formatted';_0x5cd7a3[_0x5f692(0x125)][_0x5f692(0x12c)](_0x5cd7a3[_0x5f692(0x163)]+'['+_0x5cd7a3['pluginName']+_0x5f692(0x1c2)+_0x46ea9e+']['+_0x1d6ade+']\x20'+_0x48c8a5+':\x20'+_0x56df08[_0x5f692(0x128)]());throw new Error(_0x48c8a5);}if(!_0x45967d||!_0x45967d[_0x5f692(0xff)]){const _0x428e35=_0x5f692(0xda);this[_0x5f692(0x1d4)][_0x5f692(0x125)][_0x5f692(0x12c)](this['caller']['gwName']+'['+this[_0x5f692(0x1d4)][_0x5f692(0x152)]+']\x20subscriber['+_0x46ea9e+']['+_0x1d6ade+']\x20'+_0x428e35+':\x20'+_0x45967d);throw new Error(_0x428e35);}!Object[_0x5f692(0x180)]['hasOwnProperty'][_0x5f692(0x187)](_0x45967d,'baseEntity')&&(_0x45967d[_0x5f692(0xdc)]=_0x5f692(0xe3));if(_0x45967d['baseEntity']!==_0x46ea9e){const _0x4fb864=_0x5f692(0x1b0)+_0x45967d[_0x5f692(0xdc)]+_0x5f692(0x1a9)+_0x46ea9e;_0x5cd7a3['logger'][_0x5f692(0x12c)](_0x5cd7a3[_0x5f692(0x163)]+'['+_0x5cd7a3[_0x5f692(0x152)]+']\x20subscriber['+_0x46ea9e+']['+_0x1d6ade+']\x20'+_0x4fb864);throw new Error(_0x4fb864);}_0x263daa=_0x5cd7a3[_0x5f692(0x163)]+'['+_0x5cd7a3[_0x5f692(0x152)]+_0x5f692(0x1c2)+_0x46ea9e+']['+_0x56df08[_0x5f692(0xe6)]+']['+(_0x56df08[_0x5f692(0x185)]?_0x56df08[_0x5f692(0x185)][_0x5f692(0x143)](_0x5f692(0x1c0)):'')+']',_0x5cd7a3[_0x5f692(0x125)][_0x5f692(0x1b6)](_0x263daa+_0x5f692(0xea));const _0x4431c2={};let _0x1d8065,_0x486472;switch(_0x45967d[_0x5f692(0xff)]){case'getUsers':if(!_0x45967d[_0x5f692(0x1a2)][_0x5f692(0x142)]&&_0x45967d[_0x5f692(0x1a2)][_0x5f692(0x10e)]&&_0x45967d[_0x5f692(0x1a2)][_0x5f692(0x10e)][_0x5f692(0xfb)](_0x5f692(0x1d6))){const _0x3a7741=_0x45967d[_0x5f692(0x1a2)][_0x5f692(0x10e)][_0x5f692(0x1de)](_0x5f692(0x1d6));let _0x5adcc6=[];for(let _0x309aed=0x0;_0x309aed<_0x3a7741['length'];_0x309aed++){_0x3a7741[_0x309aed]=_0x3a7741[_0x309aed][_0x5f692(0x109)](/\(/g,'')[_0x5f692(0x109)](/\)/g,'')[_0x5f692(0x114)]();const _0x2f8ae6=_0x3a7741[_0x309aed]['split']('\x20');if(_0x2f8ae6['length']===0x3||_0x2f8ae6[_0x5f692(0x14c)]>0x2&&_0x2f8ae6[0x2][_0x5f692(0x194)]('\x22')&&_0x2f8ae6[_0x2f8ae6['length']-0x1][_0x5f692(0x134)]('\x22')){const _0x3c7cf1={};_0x3c7cf1[_0x5f692(0x166)]=_0x2f8ae6[0x0],_0x3c7cf1[_0x5f692(0x142)]=_0x2f8ae6[0x1][_0x5f692(0x116)](),_0x3c7cf1[_0x5f692(0x14f)]=decodeURIComponent(_0x2f8ae6['slice'](0x2)[_0x5f692(0xf1)]('\x20')[_0x5f692(0x109)](/"/g,'')),_0x5adcc6[_0x5f692(0x1a4)](_0x3c7cf1);}else{_0x5adcc6=[];break;}}if(_0x5adcc6[_0x5f692(0x14c)]>0x0){const _0x2e0405=async _0x59ca19=>{const _0x3d51ab=_0x5f692;return await _0x5cd7a3[_0x45967d[_0x3d51ab(0xff)]](_0x46ea9e,_0x59ca19,_0x45967d[_0x3d51ab(0x101)],_0x45967d[_0x3d51ab(0x17b)]);},_0x49f95e=0x5,_0xbf33e7=[];_0x5cd7a3['logger'][_0x5f692(0x1b6)](_0x263daa+'\x20calling\x20\x22'+_0x45967d[_0x5f692(0xff)]+_0x5f692(0x1d0));do{const _0x26deee=_0x5adcc6[_0x5f692(0x1d2)](0x0,_0x49f95e),_0x248983=await Promise[_0x5f692(0x15d)](_0x26deee[_0x5f692(0x1cd)](_0x129877=>_0x2e0405(_0x129877))),_0x3833e8=_0x248983[_0x5f692(0x136)](_0xe1ab4e=>_0xe1ab4e[_0x5f692(0x160)]===_0x5f692(0x16d))[_0x5f692(0x1cd)](_0x1e1be7=>_0x1e1be7[_0x5f692(0x11e)][_0x5f692(0xe4)]);if(_0x3833e8[_0x5f692(0x14c)]>0x0){const _0x37e60c=_0x45967d[_0x5f692(0xff)]+_0x5f692(0xf8)+_0x3833e8[_0x5f692(0xf1)](',\x20');throw new Error(_0x37e60c);}const _0x4ebbe7=_0x248983[_0x5f692(0x1cd)](_0x5b3828=>_0x5b3828?.[_0x5f692(0x14f)]?.[_0x5f692(0x16f)]);for(let _0x1f0483=0x0;_0x1f0483<_0x4ebbe7['length'];_0x1f0483++){Array[_0x5f692(0x180)][_0x5f692(0x1a4)][_0x5f692(0x164)](_0xbf33e7,_0x4ebbe7[_0x1f0483]);}}while(_0x5adcc6[_0x5f692(0x14c)]>0x0);_0x1d8065={'Resources':_0xbf33e7};}}!_0x1d8065&&(_0x5cd7a3[_0x5f692(0x125)][_0x5f692(0x1b6)](_0x263daa+_0x5f692(0x1c9)+_0x45967d[_0x5f692(0xff)]+'\x22\x20and\x20awaiting\x20result'),_0x1d8065=await _0x5cd7a3[_0x45967d[_0x5f692(0xff)]](_0x46ea9e,_0x45967d[_0x5f692(0x1a2)],_0x45967d[_0x5f692(0x101)],_0x45967d[_0x5f692(0x11a)]));if(Array[_0x5f692(0x1cb)](_0x1d8065?.[_0x5f692(0x16f)])){if(_0x45967d?.[_0x5f692(0x101)]?.[_0x5f692(0x14c)]===0x0||_0x45967d?.[_0x5f692(0x101)]?.['includes']('groups'))for(let _0x4ff87c=0x0;_0x4ff87c<_0x1d8065[_0x5f692(0x16f)]['length'];_0x4ff87c++){const _0x378e98=_0x1d8065[_0x5f692(0x16f)][_0x4ff87c];if(!_0x378e98['id'])break;if(_0x378e98[_0x5f692(0x129)])break;_0x378e98[_0x5f692(0x129)]=await _0x5cd7a3[_0x5f692(0x17e)](_0x46ea9e,_0x378e98['id'],'getGroups',_0x45967d['ctxPassThrough']);}}break;case _0x5f692(0x162):_0x5cd7a3['logger'][_0x5f692(0x1b6)](_0x263daa+_0x5f692(0x1c9)+_0x45967d[_0x5f692(0xff)]+'\x22\x20and\x20awaiting\x20result'),_0x1d8065=await _0x5cd7a3[_0x45967d[_0x5f692(0xff)]](_0x46ea9e,_0x45967d[_0x5f692(0x1a2)],_0x45967d['attributes'],_0x45967d[_0x5f692(0x11a)]);break;case'createUser':_0x5cd7a3['logger'][_0x5f692(0x1b6)](_0x263daa+_0x5f692(0x1c9)+_0x45967d[_0x5f692(0xff)]+'\x22\x20and\x20awaiting\x20result'),_0x1d8065=await _0x5cd7a3[_0x45967d['func']](_0x46ea9e,_0x45967d[_0x5f692(0x1a2)],_0x45967d[_0x5f692(0x11a)]);break;case _0x5f692(0x174):_0x5cd7a3[_0x5f692(0x125)][_0x5f692(0x1b6)](_0x263daa+_0x5f692(0x1c9)+_0x45967d[_0x5f692(0xff)]+_0x5f692(0x127)),_0x1d8065=await _0x5cd7a3[_0x45967d[_0x5f692(0xff)]](_0x46ea9e,_0x45967d['obj'],_0x45967d[_0x5f692(0x11a)]);break;case _0x5f692(0x11f):_0x5cd7a3[_0x5f692(0x125)][_0x5f692(0x1b6)](_0x263daa+_0x5f692(0x1c9)+_0x45967d[_0x5f692(0xff)]+_0x5f692(0x127)),_0x1d8065=await _0x5cd7a3[_0x45967d[_0x5f692(0xff)]](_0x46ea9e,_0x45967d['id'],_0x45967d[_0x5f692(0x11a)]);break;case'deleteGroup':_0x5cd7a3[_0x5f692(0x125)]['debug'](_0x263daa+_0x5f692(0x1c9)+_0x45967d['func']+'\x22\x20and\x20awaiting\x20result'),_0x1d8065=await _0x5cd7a3[_0x45967d[_0x5f692(0xff)]](_0x46ea9e,_0x45967d['id'],_0x45967d[_0x5f692(0x11a)]);break;case'modifyUser':_0x5cd7a3['logger'][_0x5f692(0x1b6)](_0x263daa+_0x5f692(0x1c9)+_0x45967d['func']+_0x5f692(0x127)),_0x1d8065=await _0x5cd7a3[_0x45967d[_0x5f692(0xff)]](_0x46ea9e,_0x45967d['id'],_0x45967d[_0x5f692(0x1a2)],_0x45967d[_0x5f692(0x11a)]);break;case _0x5f692(0x1b2):_0x5cd7a3[_0x5f692(0x125)]['debug'](_0x263daa+_0x5f692(0x1c9)+_0x45967d[_0x5f692(0xff)]+_0x5f692(0x127)),_0x1d8065=await _0x5cd7a3[_0x45967d[_0x5f692(0xff)]](_0x46ea9e,_0x45967d['id'],_0x45967d['obj'],_0x45967d[_0x5f692(0x11a)]);break;case _0x5f692(0xf6):_0x5cd7a3[_0x5f692(0x125)][_0x5f692(0x1b6)](_0x263daa+'\x20calling\x20\x22'+_0x45967d[_0x5f692(0xff)]+_0x5f692(0x127)),_0x1d8065=await _0x5cd7a3[_0x45967d[_0x5f692(0xff)]](_0x45967d[_0x5f692(0x1a6)],_0x46ea9e,_0x45967d['id'],_0x45967d['obj'],_0x30ffff[_0x5f692(0x1af)],_0x45967d[_0x5f692(0x11a)]);break;case _0x5f692(0xeb):_0x5cd7a3[_0x5f692(0x125)]['debug'](_0x263daa+_0x5f692(0x1c9)+_0x45967d['func']+_0x5f692(0x127)),_0x1d8065=await _0x5cd7a3[_0x45967d[_0x5f692(0xff)]](_0x46ea9e,_0x45967d[_0x5f692(0x1a2)],_0x45967d['ctxPassThrough']);break;case _0x5f692(0xd8):_0x5cd7a3[_0x5f692(0x125)][_0x5f692(0x1b6)](_0x263daa+'\x20calling\x20\x22'+_0x45967d[_0x5f692(0xff)]+_0x5f692(0x127)),_0x1d8065=await _0x5cd7a3[_0x45967d['func']](_0x46ea9e,_0x45967d['id'],_0x45967d[_0x5f692(0x1a2)],_0x45967d[_0x5f692(0x11a)]);break;case _0x5f692(0xf5):_0x5cd7a3[_0x5f692(0x125)][_0x5f692(0x1b6)](_0x263daa+_0x5f692(0x1c9)+_0x45967d['func']+_0x5f692(0x127)),_0x1d8065=await _0x5cd7a3[_0x45967d[_0x5f692(0xff)]](_0x46ea9e,_0x45967d['id'],_0x45967d['obj'],_0x45967d['ctxPassThrough']);break;case _0x5f692(0x103):_0x5cd7a3[_0x5f692(0x125)][_0x5f692(0x1b6)](_0x263daa+_0x5f692(0x1c9)+_0x45967d['func']+_0x5f692(0x127)),_0x1d8065=await _0x5cd7a3[_0x45967d[_0x5f692(0xff)]](_0x46ea9e,_0x45967d['id'],_0x45967d[_0x5f692(0x1be)],_0x45967d[_0x5f692(0x1a2)],_0x45967d[_0x5f692(0x11a)]);break;case _0x5f692(0x137):_0x5cd7a3[_0x5f692(0x125)]['debug'](_0x263daa+_0x5f692(0x1c9)+_0x45967d[_0x5f692(0xff)]+'\x22\x20and\x20awaiting\x20result'),_0x1d8065=await _0x5cd7a3[_0x45967d[_0x5f692(0xff)]](_0x46ea9e,_0x45967d['id'],_0x45967d[_0x5f692(0x11a)]);break;default:_0x486472='subscriber\x20message\x20error:\x20handle\x20\x27'+_0x45967d['func']+_0x5f692(0x19d),_0x5cd7a3[_0x5f692(0x125)][_0x5f692(0x12c)](_0x263daa+'\x20'+_0x486472);throw new Error(_0x486472);}if(!_0x1d8065)_0x1d8065=null;const _0xe2f6dc=JSON[_0x5f692(0x183)](_0x1d8065);_0x56df08[_0x5f692(0x10d)](_0xe2f6dc),_0x5cd7a3['logger'][_0x5f692(0x19a)](_0x263daa+_0x5f692(0x1db)+_0x45967d[_0x5f692(0xff)]+_0x5f692(0x139)+(_0x45967d['obj']?JSON[_0x5f692(0x183)](_0x45967d[_0x5f692(0x1a2)]):'')+_0x5f692(0x192)+(_0x45967d['id']?_0x45967d['id']:'')+_0x5f692(0x157)+(_0x45967d[_0x5f692(0x101)]?_0x45967d[_0x5f692(0x101)]:'')+_0x5f692(0x16c)+_0xe2f6dc+_0x5bffdc);}catch(_0x4d2b58){const _0x16d730=_0x5f692(0x1d3)+_0x4d2b58['message']+_0x5f692(0x1dc)+_0x4d2b58['name']+'\x22}';_0x56df08[_0x5f692(0x10d)](_0x16d730),_0x5cd7a3['logger'][_0x5f692(0x19a)]((_0x263daa||'')+'\x20message\x20handled:\x20'+_0x45967d[_0x5f692(0xff)]+_0x5f692(0x139)+(_0x45967d[_0x5f692(0x1a2)]?JSON[_0x5f692(0x183)](_0x45967d['obj']):'')+_0x5f692(0x192)+(_0x45967d['id']?_0x45967d['id']:'')+_0x5f692(0x157)+(_0x45967d[_0x5f692(0x101)]?_0x45967d['attributes']:'')+'\x20message\x20error\x20response:\x20'+_0x16d730+_0x5bffdc);}}};if(_0x42ba30)_0x8966a2();else _0x1978fd();},_0x2667e9=async(_0x51f58b,_0x5393a0)=>{const _0x2668a6=_0x438835,_0x4e3595=_0x870e65[_0x51f58b][_0x2668a6(0x15a)]?.['nats']?.['subject'];let _0x4457d1=0x0;for await(const _0x274361 of _0x5393a0[_0x2668a6(0x160)]()){switch(_0x274361['type']){case a0_0x1f12d0['Events']['Disconnect']:_0x5cd7a3[_0x2668a6(0x125)][_0x2668a6(0x12c)](_0x5cd7a3[_0x2668a6(0x163)]+'['+_0x5cd7a3[_0x2668a6(0x152)]+_0x2668a6(0x1c2)+_0x51f58b+']['+_0x4e3595+_0x2668a6(0x1b9)+_0x274361[_0x2668a6(0x186)]+_0x2668a6(0x167)),_0x4457d1=0x0;break;case a0_0x1f12d0[_0x2668a6(0x1b3)][_0x2668a6(0x1b1)]:_0x5cd7a3[_0x2668a6(0x125)][_0x2668a6(0x19a)](_0x5cd7a3['gwName']+'['+_0x5cd7a3['pluginName']+_0x2668a6(0x1c2)+_0x51f58b+']['+_0x4e3595+_0x2668a6(0x12d)+_0x274361[_0x2668a6(0x186)]);break;case a0_0x1f12d0[_0x2668a6(0x1b3)]['Error']:_0x5cd7a3[_0x2668a6(0x125)]['error'](_0x5cd7a3['gwName']+'['+_0x5cd7a3[_0x2668a6(0x152)]+']\x20subscriber['+_0x51f58b+']['+_0x4e3595+_0x2668a6(0x1ab)+_0x274361[_0x2668a6(0x186)]);break;case a0_0x1f12d0['DebugEvents']['Reconnecting']:_0x4457d1+=0x1;_0x4457d1%0x1e===0x0&&_0x5cd7a3['logger'][_0x2668a6(0x1b6)](_0x5cd7a3[_0x2668a6(0x163)]+'['+_0x5cd7a3['pluginName']+_0x2668a6(0x1c2)+_0x51f58b+']['+_0x4e3595+_0x2668a6(0x168)+_0x274361[_0x2668a6(0x186)]+'\x20(count='+_0x4457d1+')');break;case a0_0x1f12d0[_0x2668a6(0x1a1)][_0x2668a6(0x1bb)]:_0x5cd7a3['logger']['debug'](_0x5cd7a3[_0x2668a6(0x163)]+'['+_0x5cd7a3[_0x2668a6(0x152)]+_0x2668a6(0x1c2)+_0x51f58b+']['+_0x4e3595+']\x20client\x20has\x20a\x20stale\x20connection\x20'+_0x274361[_0x2668a6(0x186)]);break;}}};process['on'](_0x438835(0x1dd),async()=>{const _0x41deb1=_0x438835;for(const _0x5a1399 in _0x870e65){_0x870e65[_0x5a1399]['nc']&&!_0x870e65[_0x5a1399]['nc'][_0x41deb1(0x12e)]()&&await _0x870e65[_0x5a1399]['nc']['drain']();}}),process['on'](_0x438835(0x11b),async()=>{const _0x30c25e=_0x438835;for(const _0x43f45f in _0x870e65){_0x870e65[_0x43f45f]['nc']&&!_0x870e65[_0x43f45f]['nc'][_0x30c25e(0x12e)]()&&await _0x870e65[_0x43f45f]['nc'][_0x30c25e(0x10f)]();}});const _0x13ec27=async(_0xe1e17b,_0x50684c,_0x2cbb3a)=>{const _0x2cbe0c=_0x438835,_0x361048={'attribute':_0x50684c,'operator':'eq','value':_0x2cbb3a,'rawFilter':undefined,'startIndex':undefined,'count':undefined},_0x5956e9=[_0x50684c];if(_0x50684c!=='id')_0x5956e9[_0x2cbe0c(0x1a4)]('id');try{const _0x3c7d05=await _0x5cd7a3[_0x2cbe0c(0x198)](_0xe1e17b,_0x361048,_0x5956e9);if(!_0x3c7d05||!_0x3c7d05[_0x2cbe0c(0x16f)]||!Array[_0x2cbe0c(0x1cb)](_0x3c7d05[_0x2cbe0c(0x16f)]))throw new Error(_0x2cbe0c(0x110)+JSON['stringify'](_0x361048)+'\x20error:\x20missing\x20result');if(_0x3c7d05['Resources']['length']===0x0)return null;else{if(_0x3c7d05[_0x2cbe0c(0x16f)][_0x2cbe0c(0x14c)]>0x2)throw new Error(_0x2cbe0c(0x110)+JSON[_0x2cbe0c(0x183)](_0x361048)+'\x20error:\x20more\x20than\x20one\x20user\x20were\x20found}');else{const _0x18e8be=_0x3c7d05[_0x2cbe0c(0x16f)][0x0];if(!_0x18e8be['id'])throw new Error(_0x2cbe0c(0x110)+JSON[_0x2cbe0c(0x183)](_0x361048)+'\x20result='+JSON[_0x2cbe0c(0x183)](_0x18e8be)+'\x20error:\x20missing\x20id}');return decodeURIComponent(_0x18e8be['id']);}}}catch(_0x17d49f){throw new Error('getUsers()\x20getObj='+JSON[_0x2cbe0c(0x183)](_0x361048)+_0x2cbe0c(0xe0)+_0x17d49f[_0x2cbe0c(0xe4)]+'}');}},_0x2729f5=_0x5539dd=>{const _0x2b3e67=_0x438835;if(!_0x5539dd||typeof _0x5539dd!==_0x2b3e67(0x128))return[null,null];_0x5539dd=_0x5539dd[_0x2b3e67(0x114)]();const _0x596d13=_0x5539dd[_0x2b3e67(0xf7)]('(');if(_0x596d13<0x1)return[null,null];if(_0x5539dd[_0x2b3e67(0x147)](_0x5539dd[_0x2b3e67(0x14c)]-0x1)!==')')return[null,null];if(_0x4604e4(_0x5539dd,'(')!==_0x4604e4(_0x5539dd,')'))return[null,null];const _0x4e2890=_0x5539dd[_0x2b3e67(0x147)](0x0,_0x596d13),_0x52a25b=_0x5539dd['substring'](_0x596d13+0x1,_0x5539dd['length']-0x1);let _0x5c71c0=[];const _0x24d2a7=_0x52a25b[_0x2b3e67(0x1de)](',');let _0x43398c='';for(let _0x1d941d=0x0;_0x1d941d<_0x24d2a7[_0x2b3e67(0x14c)];_0x1d941d++){const _0x5c9b8e=_0x43398c?_0x43398c+','+_0x24d2a7[_0x1d941d]:_0x24d2a7[_0x1d941d],_0x502653=_0x4604e4(_0x5c9b8e,'('),_0x6c29b3=_0x4604e4(_0x5c9b8e,')');if(_0x502653===_0x6c29b3)_0x5c71c0['push'](_0x505015(_0x5c9b8e,'\x22')),_0x43398c='';else{if(_0x43398c)_0x43398c+=','+_0x24d2a7[_0x1d941d];else _0x43398c+=_0x24d2a7[_0x1d941d];}}if(_0x5c71c0['length']===0x0)_0x5c71c0=null;return[_0x4e2890,_0x5c71c0];};function _0x4604e4(_0x5a062a,_0x8cf49c){const _0x3bad2d=_0x438835;let _0x2588e8=0x0;for(let _0x424b48=0x0;_0x424b48<_0x5a062a[_0x3bad2d(0x14c)];_0x424b48++){_0x5a062a[_0x3bad2d(0x1a0)](_0x424b48)===_0x8cf49c&&(_0x2588e8+=0x1);}return _0x2588e8;}const _0x505015=(_0x280310,_0x1bf89a)=>{const _0x86080a=_0x438835;if(typeof _0x280310!==_0x86080a(0x128)||typeof _0x1bf89a!=='string')return _0x280310;if(_0x280310[_0x86080a(0x14c)]===0x1)return _0x280310;if(_0x1bf89a[_0x86080a(0x14c)]!==0x1)return _0x280310;return _0x280310=_0x280310[_0x86080a(0x114)](),_0x280310[_0x86080a(0x147)](0x0,0x1)===_0x1bf89a&&(_0x280310=_0x280310[_0x86080a(0x147)](0x1)),_0x280310['substring'](_0x280310[_0x86080a(0x14c)]-0x1)===_0x1bf89a&&(_0x280310=_0x280310[_0x86080a(0x147)](0x0,_0x280310['length']-0x1)),_0x280310;},_0x19b82c=async(_0x483b6f,_0x4690ea,_0x52169f,_0x4549c7)=>{const _0x1cd93a=_0x438835;if(!_0x4690ea||!_0x52169f||!_0x4549c7)return null;const [_0x1d1468,_0xb02044]=_0x2729f5(_0x4549c7);if(!_0x1d1468||!_0xb02044){const _0x238733=_0x4549c7[_0x1cd93a(0x1de)]('(');if(_0x238733[_0x1cd93a(0x14c)]>0x1){const _0x518440=[_0x1cd93a(0xe8),_0x1cd93a(0x197),_0x1cd93a(0x15f),'elementnumber',_0x1cd93a(0xf1),_0x1cd93a(0x109),'normalize',_0x1cd93a(0x10c),_0x1cd93a(0x191)],_0x45f8d4=_0x238733[0x0][_0x1cd93a(0x116)]();if(_0x518440[_0x1cd93a(0xfb)](_0x45f8d4))return null;}return _0x4549c7;}for(let _0x44a9ea=0x0;_0x44a9ea<_0xb02044[_0x1cd93a(0x14c)];_0x44a9ea++){if(_0xb02044[_0x44a9ea]['substring'](0x0,0x1)==='['){const _0x5386ed=_0xb02044[_0x44a9ea][_0x1cd93a(0xf7)](']');if(_0x5386ed<0x0)return null;const _0x61c227=_0xb02044[_0x44a9ea]['substring'](0x1,_0x5386ed),_0xbe774f=_0x61c227['split']('.');let _0x131c1c;for(let _0x44f5ff=0x0;_0x44f5ff<_0xbe774f['length'];_0x44f5ff++){if(_0x44f5ff===0x0)_0x131c1c=_0x4690ea[_0xbe774f[_0x44f5ff]];else{if(!_0x131c1c)return null;_0x131c1c=_0x131c1c[_0xbe774f[_0x44f5ff]];}}if(!_0x131c1c)return null;_0xb02044[_0x44a9ea]=_0x131c1c;}}for(let _0x985d5a=0x0;_0x985d5a<_0xb02044[_0x1cd93a(0x14c)];_0x985d5a++){const [_0x3d6d55]=_0x2729f5(_0xb02044[_0x985d5a]);_0x3d6d55&&(_0xb02044[_0x985d5a]=await _0x19b82c(_0x483b6f,_0x4690ea,_0x52169f,_0xb02044[_0x985d5a]));}if(_0xb02044[0x0]===null)return null;switch(_0x1d1468[_0x1cd93a(0x116)]()){case'lowercase':{if(_0xb02044[_0x1cd93a(0x14c)]!==0x1)return null;const [_0x437fad]=_0x2729f5(_0xb02044[0x0]);if(_0x437fad)_0xb02044[0x0]=await _0x19b82c(_0x483b6f,_0x4690ea,_0x52169f,_0x437fad);if(_0xb02044[0x0]===null)return null;return _0xb02044[0x0][_0x1cd93a(0x116)]();}case _0x1cd93a(0x197):{if(_0xb02044[_0x1cd93a(0x14c)]!==0x1)return null;const [_0x504648]=_0x2729f5(_0xb02044[0x0]);if(_0x504648)_0xb02044[0x0]=await _0x19b82c(_0x483b6f,_0x4690ea,_0x52169f,_0x504648);if(_0xb02044[0x0]===null)return null;return _0xb02044[0x0][_0x1cd93a(0x171)]();}case'firstn':{if(_0xb02044[_0x1cd93a(0x14c)]!==0x2)return null;const [_0x2dd456]=_0x2729f5(_0xb02044[0x0]);if(_0x2dd456)_0xb02044[0x0]=await _0x19b82c(_0x483b6f,_0x4690ea,_0x52169f,_0x2dd456);if(_0xb02044[0x0]===null)return null;if(isNaN(_0xb02044[0x1]))return null;return _0xb02044[0x0][_0x1cd93a(0x147)](0x0,_0xb02044[0x1]);}case'elementnumber':{const [_0x1aede6]=_0x2729f5(_0xb02044[0x0]);if(_0xb02044[_0x1cd93a(0x14c)]<0x2)return null;if(_0x1aede6)_0xb02044[0x0]=await _0x19b82c(_0x483b6f,_0x4690ea,_0x52169f,_0x1aede6);if(_0xb02044[0x0]===null)return null;const _0x18712b=_0xb02044[0x1];if(isNaN(_0x18712b))return null;let _0xe9411;if(_0xb02044[_0x1cd93a(0x14c)]===0x3)_0xe9411=_0xb02044[0x0][_0x1cd93a(0x1de)](_0xb02044[0x2]);else _0xe9411=_0xe9411=_0xb02044[0x0][_0x1cd93a(0x1de)]('\x20');if(_0x18712b<=_0xe9411[_0x1cd93a(0x14c)])return _0xe9411[_0x18712b-0x1];else return'';}case _0x1cd93a(0x109):{const [_0x51eca4]=_0x2729f5(_0xb02044[0x0]);if(_0x51eca4)_0xb02044[0x0]=await _0x19b82c(_0x483b6f,_0x4690ea,_0x52169f,_0x51eca4);if(_0xb02044[0x0]===null)return null;if(_0xb02044[_0x1cd93a(0x14c)]!==0x3)return null;return _0xb02044[0x0][_0x1cd93a(0x1a5)](_0xb02044[0x1],_0xb02044[0x2]);}case'normalize':{if(_0xb02044[_0x1cd93a(0x14c)]!==0x1)return null;const [_0x1dbda9]=_0x2729f5(_0xb02044[0x0]);if(_0x1dbda9)_0xb02044[0x0]=await _0x19b82c(_0x483b6f,_0x4690ea,_0x52169f,_0x1dbda9);if(_0xb02044[0x0]===null)return null;return a0_0x7d5195[_0x1cd93a(0x14d)](_0xb02044[0x0]);}case _0x1cd93a(0xf1):{let _0x18f092='';for(let _0x5cd186=0x0;_0x5cd186<_0xb02044[_0x1cd93a(0x14c)];_0x5cd186++){const [_0x504064]=_0x2729f5(_0xb02044[_0x5cd186]);if(_0x504064)_0xb02044[_0x5cd186]=await _0x19b82c(_0x483b6f,_0x4690ea,_0x52169f,_0x504064);if(_0xb02044[_0x5cd186]===null)return null;_0x18f092+=_0xb02044[_0x5cd186];}return _0x18f092;}case _0x1cd93a(0x10c):{if(_0xb02044[_0x1cd93a(0x14c)]>0x2)return null;const [_0x36c3da]=_0x2729f5(_0xb02044[0x0]);if(_0x36c3da)_0xb02044[0x0]=await _0x19b82c(_0x483b6f,_0x4690ea,_0x52169f,_0x36c3da);if(_0xb02044[0x0]===null)return null;const _0x26073a=parseInt(_0xb02044[0x0]);if(isNaN(_0x26073a))return null;let _0x37338b=_0x1cd93a(0x140);_0x37338b+=','+_0xb02044[0x0];if(_0xb02044['length']===0x2&&_0xb02044[0x1]['toLowerCase']()===_0x1cd93a(0x144))_0x37338b+=_0x1cd93a(0x1c3);else _0x37338b+=_0x1cd93a(0x1aa);return _0x37338b+='##',_0x37338b;}case _0x1cd93a(0x191):{if(_0xb02044[_0x1cd93a(0x14c)]!==0x1)return null;const [_0x5957df]=_0x2729f5(_0xb02044[0x0]);if(_0x5957df)_0xb02044[0x0]=await _0x19b82c(_0x483b6f,_0x4690ea,_0x52169f,_0x5957df);if(_0xb02044[0x0]===null)return null;let _0x5e7549,_0x2a6489=![],_0x4aa231='';const _0x3ab69e=_0xb02044[0x0][_0x1cd93a(0x1de)]('##');if(_0x3ab69e[_0x1cd93a(0x14c)]>0x2)for(let _0x4bdfc9=0x0;_0x4bdfc9<_0x3ab69e[_0x1cd93a(0x14c)];_0x4bdfc9++){if(_0x3ab69e[_0x4bdfc9][_0x1cd93a(0x194)]('doIncrement')){const _0x4ddc21=_0x3ab69e[_0x4bdfc9][_0x1cd93a(0x1de)](',');if(_0x4ddc21[_0x1cd93a(0x14c)]<0x2)return null;const _0x551eb0=parseInt(_0x4ddc21[0x1]);if(isNaN(_0x551eb0))return null;_0x4aa231='##'+_0x3ab69e[_0x4bdfc9]+'##',_0x5e7549=_0x4ddc21[0x1],_0x4ddc21[_0x1cd93a(0x14c)]>0x2&&(_0x2a6489=_0x4ddc21[0x2][_0x1cd93a(0x116)]()==='true');}}let _0x5cb1ad,_0x2c8ae7=0x0,_0x2148db=0x0;if(_0x5e7549){_0x2148db=_0x5e7549[_0x1cd93a(0x14c)],_0x2c8ae7=0xa;for(let _0xa99ee8=0x1;_0xa99ee8<_0x2148db;_0xa99ee8++){_0x2c8ae7*=0xa;}_0x2c8ae7-=0x1,_0x5cb1ad=parseInt(_0x5e7549);if(isNaN(_0x5cb1ad))return null;_0x5cb1ad-=0x1;}else _0x5cb1ad=0x0;do{_0x5cb1ad+=0x1;let _0x1e809c=_0xb02044[0x0];if(_0x5e7549!==undefined&&_0x4aa231){let _0x123009=_0x5cb1ad[_0x1cd93a(0xef)]();while(_0x123009[_0x1cd93a(0x14c)]<_0x2148db){_0x123009='0'+_0x123009;}_0x2a6489?_0x1e809c=_0x1e809c[_0x1cd93a(0x109)](_0x4aa231,_0x123009):(_0x1e809c=_0x1e809c[_0x1cd93a(0x109)](_0x4aa231,''),_0x2a6489=!![],_0x5cb1ad-=0x1);}try{const _0x14d95a=await _0x13ec27(_0x483b6f,_0x52169f,_0x1e809c);if(!_0x14d95a)return _0x1e809c;}catch(_0x58651f){return _0x5cd7a3['logger'][_0x1cd93a(0x12c)](_0x5cd7a3[_0x1cd93a(0x163)]+'['+_0x5cd7a3[_0x1cd93a(0x152)]+']\x20'+_0x1d1468+_0x1cd93a(0x108)+_0x58651f[_0x1cd93a(0xe4)]),null;}}while(_0x5cb1ad<_0x2c8ae7);return null;}default:}return null;},_0x2c406b=async(_0x44a163,_0x4632af)=>{const _0x9485c7=_0x438835;for(const _0xc6da70 in _0x4632af){const _0x11594e=_0x4632af[_0xc6da70],[_0x4651d9,_0x158e8c]=_0x2729f5(_0x11594e);if(_0x4651d9){const _0xaf184a=''+_0xc6da70,_0x5802d3=_0x4651d9+'('+_0x158e8c[_0x9485c7(0xf1)](',')+')',_0x376b64=await _0x19b82c(_0x44a163,_0x4632af,_0xaf184a,_0x5802d3);if(_0x376b64===null)delete _0x4632af[_0xc6da70];else _0x4632af[_0xc6da70]=_0x376b64;}for(const _0x488214 in _0x11594e){const _0x86d8ce=_0x11594e[_0x488214],[_0x2f627d,_0x5333a1]=_0x2729f5(_0x86d8ce);if(_0x2f627d){const _0x52fb3e=_0xc6da70+'.'+_0x488214,_0x1ac217=_0x2f627d+'('+_0x5333a1[_0x9485c7(0xf1)](',')+')',_0x228217=await _0x19b82c(_0x44a163,_0x4632af,_0x52fb3e,_0x1ac217);if(_0x228217===null)delete _0x11594e[_0x488214];else _0x11594e[_0x488214]=_0x228217;}}}return _0x4632af;};}}export class Publisher{constructor(_0x510f44){const _0x3c1a84=a0_0xe6f9,_0x5ad16e=_0x510f44,_0xbe3537={},_0x292b60=async(_0x42e0c0,_0x4dcdc2)=>{const _0x5ed36c=a0_0xe6f9,_0x37a861=_0xbe3537[_0x42e0c0]['config']?.[_0x5ed36c(0x175)]?.[_0x5ed36c(0xe6)];let _0x140973=0x0;for await(const _0x3d5d6c of _0x4dcdc2[_0x5ed36c(0x160)]()){switch(_0x3d5d6c[_0x5ed36c(0x1b7)]){case a0_0x1f12d0[_0x5ed36c(0x1b3)][_0x5ed36c(0x111)]:_0x5ad16e[_0x5ed36c(0x125)][_0x5ed36c(0x12c)](_0x5ad16e[_0x5ed36c(0x163)]+'['+_0x5ad16e[_0x5ed36c(0x152)]+']\x20publisher['+_0x42e0c0+']['+_0x37a861+_0x5ed36c(0x1b9)+_0x3d5d6c[_0x5ed36c(0x186)]+_0x5ed36c(0x167)),_0x140973=0x0;break;case a0_0x1f12d0[_0x5ed36c(0x1b3)][_0x5ed36c(0x1b1)]:_0x5ad16e[_0x5ed36c(0x125)][_0x5ed36c(0x19a)](_0x5ad16e[_0x5ed36c(0x163)]+'['+_0x5ad16e['pluginName']+']\x20publisher['+_0x42e0c0+']['+_0x37a861+_0x5ed36c(0x12d)+_0x3d5d6c[_0x5ed36c(0x186)]);break;case a0_0x1f12d0[_0x5ed36c(0x1b3)]['Error']:_0x5ad16e[_0x5ed36c(0x125)][_0x5ed36c(0x12c)](_0x5ad16e[_0x5ed36c(0x163)]+'['+_0x5ad16e[_0x5ed36c(0x152)]+_0x5ed36c(0x1d7)+_0x42e0c0+']['+_0x37a861+']\x20client\x20error\x20'+_0x3d5d6c[_0x5ed36c(0x186)]);break;case a0_0x1f12d0[_0x5ed36c(0x1a1)][_0x5ed36c(0x107)]:_0x140973+=0x1;_0x140973%0x1e===0x0&&_0x5ad16e['logger'][_0x5ed36c(0x1b6)](_0x5ad16e[_0x5ed36c(0x163)]+'['+_0x5ad16e[_0x5ed36c(0x152)]+_0x5ed36c(0x1d7)+_0x42e0c0+']['+_0x37a861+']\x20client\x20is\x20attempting\x20to\x20reconnect\x20'+_0x3d5d6c[_0x5ed36c(0x186)]+_0x5ed36c(0xdd)+_0x140973+')');break;case a0_0x1f12d0[_0x5ed36c(0x1a1)]['StaleConnection']:_0x5ad16e[_0x5ed36c(0x125)][_0x5ed36c(0x1b6)](_0x5ad16e['gwName']+'['+_0x5ad16e['pluginName']+']\x20publisher['+_0x42e0c0+']['+_0x37a861+']\x20client\x20has\x20a\x20stale\x20connection\x20'+_0x3d5d6c['data']);break;}}},_0x5bc997=async(_0x3cfc8b,_0xc10f7d)=>{const _0x5a23ea=a0_0xe6f9,_0x40f9c2=_0xbe3537[_0x3cfc8b][_0x5a23ea(0x15a)]?.[_0x5a23ea(0x175)]?.[_0x5a23ea(0xe6)];let _0x465b89;try{_0x465b89=await a0_0x1f12d0[_0x5a23ea(0x1b8)](_0xc10f7d);if(_0x465b89[_0x5a23ea(0x19a)][_0x5a23ea(0x161)]!==_0x5a23ea(0x1c1)){_0x465b89['close']();return;}_0xbe3537[_0x3cfc8b]['nc']=_0x465b89,_0x292b60(_0x3cfc8b,_0x465b89);}catch(_0x5e85db){_0x5ad16e[_0x5a23ea(0x125)][_0x5a23ea(0x12c)](_0x5ad16e[_0x5a23ea(0x163)]+'['+_0x5ad16e['pluginName']+_0x5a23ea(0x1d7)+_0x3cfc8b+']['+_0x40f9c2+_0x5a23ea(0xf4)+_0x5e85db[_0x5a23ea(0xe4)]+'\x20-\x20will\x20do\x20auto\x20connect\x20when\x20available\x20-\x20however,\x20please\x20verify\x20stream\x20configuration'),_0xc10f7d[_0x5a23ea(0x18a)]=!![];try{_0x465b89=await a0_0x1f12d0[_0x5a23ea(0x1b8)](_0xc10f7d);if(_0x465b89[_0x5a23ea(0x19a)][_0x5a23ea(0x161)]!==_0x5a23ea(0x1c1)){_0x465b89[_0x5a23ea(0x102)]();return;}_0xbe3537[_0x3cfc8b]['nc']=_0x465b89,_0x292b60(_0x3cfc8b,_0x465b89);}catch(_0x45c46d){_0x5ad16e[_0x5a23ea(0x125)]['error'](_0x5ad16e[_0x5a23ea(0x163)]+'['+_0x5ad16e[_0x5a23ea(0x152)]+_0x5a23ea(0x1d7)+_0x3cfc8b+']['+_0x40f9c2+_0x5a23ea(0xf4)+_0x45c46d['message']);return;}}_0x5ad16e[_0x5a23ea(0x125)]['debug'](_0x5ad16e[_0x5a23ea(0x163)]+'['+_0x5ad16e['pluginName']+']\x20publisher['+_0x3cfc8b+']['+_0x40f9c2+_0x5a23ea(0x1ba)+(_0xc10f7d['tls']['ca']?_0x5a23ea(0x195):'')+'\x20'+_0x465b89['getServer']()),_0x465b89[_0x5a23ea(0xe9)]()[_0x5a23ea(0xf0)](_0xd0d807=>{const _0x539f87=_0x5a23ea;_0xd0d807&&_0x5ad16e[_0x539f87(0x125)][_0x539f87(0x12c)](_0x5ad16e[_0x539f87(0x163)]+'['+_0x5ad16e['pluginName']+_0x539f87(0x1d7)+_0x3cfc8b+']['+_0x40f9c2+_0x539f87(0x122)+_0xd0d807[_0x539f87(0xe4)]);});};this['add']=async(_0x491304,_0x48a7bb)=>{const _0x5477c2=a0_0xe6f9;if(!_0x48a7bb?.[_0x5477c2(0x175)]){_0x5ad16e[_0x5477c2(0x125)][_0x5477c2(0x12c)](_0x5ad16e[_0x5477c2(0x163)]+'['+_0x5ad16e[_0x5477c2(0x152)]+_0x5477c2(0x1d7)+_0x491304+_0x5477c2(0x13d));return;}if(!_0x48a7bb?.[_0x5477c2(0x175)]?.['tenant']){_0x5ad16e[_0x5477c2(0x125)]['error'](_0x5ad16e['gwName']+'['+_0x5ad16e[_0x5477c2(0x152)]+']\x20publisher['+_0x491304+_0x5477c2(0x1da));return;}if(!_0x48a7bb?.[_0x5477c2(0x175)]?.[_0x5477c2(0xe6)]){_0x5ad16e[_0x5477c2(0x125)][_0x5477c2(0x12c)](_0x5ad16e[_0x5477c2(0x163)]+'['+_0x5ad16e[_0x5477c2(0x152)]+_0x5477c2(0x1d7)+_0x491304+_0x5477c2(0x199));return;}if(!_0x48a7bb?.[_0x5477c2(0x175)]?.[_0x5477c2(0xe6)][_0x5477c2(0x194)](_0x5477c2(0x1c4))){_0x5ad16e[_0x5477c2(0x125)][_0x5477c2(0x12c)](_0x5ad16e[_0x5477c2(0x163)]+'['+_0x5ad16e[_0x5477c2(0x152)]+_0x5477c2(0x1d7)+_0x491304+_0x5477c2(0x105));return;}if(!_0x48a7bb['baseUrls']||!Array[_0x5477c2(0x1cb)](_0x48a7bb['baseUrls'])||_0x48a7bb[_0x5477c2(0x15e)][_0x5477c2(0x14c)]<0x1){_0x5ad16e[_0x5477c2(0x125)][_0x5477c2(0x12c)](_0x5ad16e['gwName']+'['+_0x5ad16e[_0x5477c2(0x152)]+_0x5477c2(0x1d7)+_0x491304+_0x5477c2(0x124));return;}if(!_0x48a7bb?.[_0x5477c2(0x156)]?.['ca']){_0x5ad16e['logger']['error'](_0x5ad16e['gwName']+'['+_0x5ad16e[_0x5477c2(0x152)]+_0x5477c2(0x1d7)+_0x491304+']\x20initialization\x20error:\x20missing\x20certificate\x20configuration');return;}const _0x4b5a83={};try{let _0x5e85d5=a0_0x24d390[_0x5477c2(0xf1)](_0x5ad16e[_0x5477c2(0x15b)],_0x5477c2(0x18c),_0x48a7bb?.[_0x5477c2(0x156)]?.['ca']||_0x5477c2(0x1b4));(_0x48a7bb?.[_0x5477c2(0x156)]?.['ca']?.['startsWith']('/')||_0x48a7bb?.[_0x5477c2(0x156)]?.['ca']?.['includes']('\x5c'))&&(_0x5e85d5=_0x48a7bb['certificate']['ca']),_0x4b5a83['ca']=[a0_0x804e61[_0x5477c2(0x1c5)](_0x5e85d5)],_0x4b5a83['rejectUnauthorized']=!![];}catch(_0x3d855a){_0x5ad16e[_0x5477c2(0x125)][_0x5477c2(0x12c)](_0x5ad16e[_0x5477c2(0x163)]+'['+_0x5ad16e[_0x5477c2(0x152)]+_0x5477c2(0x1d7)+_0x491304+']\x20initialization\x20certificate\x20error:\x20'+_0x3d855a[_0x5477c2(0xe4)]);return;}const _0x30aeba={},_0x11bbbc=new TextEncoder()[_0x5477c2(0x1ce)](_0x48a7bb?.[_0x5477c2(0x175)]?.[_0x5477c2(0xec)]),_0x3dccc7=_0x48a7bb?.[_0x5477c2(0x175)]?.['jwt'];_0x30aeba['authenticator']=a0_0x1f12d0['jwtAuthenticator'](_0x3dccc7,_0x11bbbc),_0x30aeba['servers']=_0x48a7bb[_0x5477c2(0x15e)],_0x30aeba[_0x5477c2(0x195)]=_0x4b5a83,_0x30aeba['waitOnFirstConnect']=![],_0x30aeba['reconnect']=!![],_0x30aeba['reconnectTimeWait']=0x3e8*0xa,_0x30aeba[_0x5477c2(0xf9)]=-0x1,_0x30aeba[_0x5477c2(0xd6)]=0x2*0x3c*0x3e8,_0x30aeba['maxPingOut']=0x5,_0x30aeba[_0x5477c2(0x1b6)]=![],_0xbe3537[_0x491304]={},_0xbe3537[_0x491304][_0x5477c2(0x15a)]=_0x48a7bb,_0xbe3537[_0x491304]['nc']=undefined,_0x5bc997(_0x491304,_0x30aeba);};const _0x9778b2=a0_0x1f12d0['StringCodec']();this['publish']=async _0xfa4001=>{const _0x30d186=a0_0xe6f9;let _0x1b2739;try{if(_0xfa4001['constructor']===Object){_0x1b2739=_0xfa4001[_0x30d186(0xdc)];if(!_0x1b2739)_0xfa4001[_0x30d186(0xdc)]=_0x30d186(0xe3);_0xfa4001=JSON['stringify'](_0xfa4001);}else{const _0x16f574=JSON[_0x30d186(0x158)](_0xfa4001);_0x1b2739=_0x16f574['baseEntity'];}}catch(_0x42ec3b){throw new Error(_0x30d186(0x12b)+_0x1b2739+_0x30d186(0x135));}if(!_0xbe3537[_0x1b2739])throw new Error(_0x30d186(0x12b)+_0x1b2739+_0x30d186(0x1bc)+_0x1b2739);const _0x4b8cc1=a0_0x1f12d0[_0x30d186(0x185)]();_0x4b8cc1[_0x30d186(0x173)](_0x30d186(0x1c0),a0_0xd1e96[_0x30d186(0x188)]());let _0x15f045;try{if(!_0xbe3537[_0x1b2739]['nc'])throw new Error(_0x30d186(0x14e));_0x15f045=await _0xbe3537[_0x1b2739]['nc']['request'](_0xbe3537[_0x1b2739][_0x30d186(0x15a)]?.[_0x30d186(0x175)]?.['subject'],_0x9778b2['encode'](_0xfa4001),{'headers':_0x4b8cc1});}catch(_0xbface6){if(_0xbface6[_0x30d186(0xe4)]===_0x30d186(0xfc))throw new Error('publisher['+_0x1b2739+_0x30d186(0x141)+_0xbe3537[_0x1b2739][_0x30d186(0x15a)]?.['nats']?.[_0x30d186(0xe6)]);else throw new Error(_0x30d186(0x12b)+_0x1b2739+']\x20error:\x20'+_0xbface6['message']);}let _0xc2e300;try{_0xc2e300=JSON['parse'](_0x15f045[_0x30d186(0x128)]());}catch(_0x17d46d){throw new Error(_0x30d186(0x115)+_0x15f045['string']());}if(_0xc2e300?.[_0x30d186(0x12c)]){const _0x1634ad=new Error(_0x30d186(0x1d5)+_0xc2e300[_0x30d186(0x12c)]);_0x1634ad[_0x30d186(0x176)]=_0xc2e300[_0x30d186(0xde)];throw _0x1634ad;}return _0xc2e300;},process['on'](_0x3c1a84(0x1dd),async()=>{const _0x1ad7a5=_0x3c1a84;for(const _0x10514c in _0xbe3537){_0xbe3537[_0x10514c]['nc']&&!_0xbe3537[_0x10514c]['nc'][_0x1ad7a5(0x12e)]()&&await _0xbe3537[_0x10514c]['nc']['drain']();}}),process['on'](_0x3c1a84(0x11b),async()=>{const _0x8bdd93=_0x3c1a84;for(const _0xa7eed2 in _0xbe3537){_0xbe3537[_0xa7eed2]['nc']&&!_0xbe3537[_0xa7eed2]['nc'][_0x8bdd93(0x12e)]()&&await _0xbe3537[_0xa7eed2]['nc'][_0x8bdd93(0x10f)]();}});}}export const getAppRoles=async(_0x2af6a2,_0x118933)=>{const _0xaf47d5=a0_0xe6f9,_0x1cbcee=_0xaf47d5(0x100),_0x470236=_0x2af6a2;_0x470236[_0xaf47d5(0x125)][_0xaf47d5(0x1b6)](_0x470236[_0xaf47d5(0x163)]+'['+_0x470236[_0xaf47d5(0x152)]+']\x20handling\x20\x22'+_0x1cbcee+'\x22');try{if(!a0_0x804e61[_0xaf47d5(0x131)](_0x470236[_0xaf47d5(0x15b)]+'/approles'))a0_0x804e61[_0xaf47d5(0x1ca)](_0x470236[_0xaf47d5(0x15b)]+_0xaf47d5(0x113));}catch(_0x259e0a){void 0x0;}const _0x1bfbdf=a0_0x24d390['join'](''+_0x470236[_0xaf47d5(0x15b)],_0xaf47d5(0x181),_0xaf47d5(0x119)+_0x470236[_0xaf47d5(0x152)]+'_autogenerated.cfg'),_0xe0b9d5={};a0_0x3bafd7[_0xaf47d5(0x190)](_0x1bfbdf)&&a0_0x804e61[_0xaf47d5(0x1c5)](_0x1bfbdf,_0xaf47d5(0x1b5))[_0xaf47d5(0x1de)](/\r?\n/)[_0xaf47d5(0x18b)](_0x57f1d6=>{const _0xdfb2d0=_0xaf47d5,_0xafc7e7=_0x57f1d6[_0xdfb2d0(0x1de)]('\x20');_0xafc7e7[_0xdfb2d0(0x14c)]===0x2&&(_0xe0b9d5[_0xafc7e7[0x0]]=_0xafc7e7[0x1]);});const _0x9f44c3=a0_0x804e61[_0xaf47d5(0x18d)](_0x1bfbdf,{'flags':'w','encoding':_0xaf47d5(0x196),'mode':0x1b6,'autoClose':!![]}),_0x29c2cf=[],_0x105693=await _0x470236[_0xaf47d5(0x162)](_0x118933,{'attribute':undefined,'operator':undefined,'value':undefined},['id','displayName']);return _0x105693['Resources']['forEach'](_0x1b40fb=>{const _0x207852=_0xaf47d5;if(_0x1b40fb['id']){let _0x5b80da=a0_0xd1e96[_0x207852(0x188)]();if(_0xe0b9d5[_0x1b40fb['id']])_0x5b80da=_0xe0b9d5[_0x1b40fb['id']];const _0x17e71d={'allowedMemberTypes':[_0x207852(0x120)],'description':'SCIM\x20Stream\x20-\x20Autogenerated','displayName':_0x1b40fb['displayName']||_0x1b40fb['id'],'id':_0x5b80da,'isEnabled':!![],'lang':null,'origin':_0x207852(0x14a),'value':decodeURIComponent(_0x1b40fb['id'])};_0x29c2cf[_0x207852(0x1a4)](_0x17e71d),_0x9f44c3['write'](_0x1b40fb['id']+'\x20'+_0x5b80da+'\x0a');}}),_0x9f44c3[_0xaf47d5(0x102)](),_0x470236[_0xaf47d5(0x125)][_0xaf47d5(0x1b6)](_0x470236[_0xaf47d5(0x163)]+'['+_0x470236[_0xaf47d5(0x152)]+']\x20approle\x20uuid\x20file\x20created:\x20'+_0x1bfbdf),{'Resources':[{'appRoles':_0x29c2cf}]};};
14
+ 'use strict';(function(_0x9489f9,_0xa108ad){const _0x3d4f8b=a0_0xb16d,_0x364ee3=_0x9489f9();while(!![]){try{const _0x4537eb=-parseInt(_0x3d4f8b(0x15f))/0x1*(parseInt(_0x3d4f8b(0x123))/0x2)+-parseInt(_0x3d4f8b(0x181))/0x3+parseInt(_0x3d4f8b(0x1cc))/0x4+parseInt(_0x3d4f8b(0x188))/0x5+parseInt(_0x3d4f8b(0x1df))/0x6*(parseInt(_0x3d4f8b(0xe4))/0x7)+parseInt(_0x3d4f8b(0x13d))/0x8*(parseInt(_0x3d4f8b(0x1ab))/0x9)+-parseInt(_0x3d4f8b(0x150))/0xa*(parseInt(_0x3d4f8b(0x117))/0xb);if(_0x4537eb===_0xa108ad)break;else _0x364ee3['push'](_0x364ee3['shift']());}catch(_0x41e5c4){_0x364ee3['push'](_0x364ee3['shift']());}}}(a0_0x4ebe,0x6e113));import{jwtAuthenticator,headers}from'@nats-io/nats-core';import{jetstream,jetstreamManager,DeliverPolicy,AckPolicy}from'@nats-io/jetstream';import{connect as a0_0x1eb4cc}from'@nats-io/transport-node';function a0_0x4ebe(){const _0x918521=['typeId','utf8','\x22\x20with\x20chunks\x20and\x20awaiting\x20result','indexOf','4rgyKDU','ENOTFOUND','\x20missing\x20mandatory\x20user.userName\x20in\x20message:\x20','elementnumber','Resources','baseUrls','debug',']\x20error:\x20missing\x20entity\x20configuration\x20for\x20baseEntity=',']\x20error:\x20','\x20message:\x20user\x20not\x20created\x20because\x20of\x20configuration\x20modifyOnly=true','subject','approles','\x20getUserId()\x20error:\x20','\x20error:\x20','groups','reason','password','drain','normalize','forEach','write',']\x20error:\x20no\x20subscribers/responders\x20to\x20subject\x20','all','\x20message:\x20user\x20not\x20created\x20because\x20of\x20active=false','filter','status','8yiwNOh','Operations','\x22\x20and\x20awaiting\x20result','{\x22error\x22:\x22','prototype','randomUUID','getGroups','lowercase','filter_subject','SIGINT','constructor','modifyOnly','obj',']\x20handling\x20\x22',']\x20client\x20disconnected\x20','true','GW.',']\x20initialization\x20error:\x20nats.subject\x20root\x20topic\x20must\x20be\x20\x27GW\x27,\x20nats.subject\x20example:\x20GW.APP1','schemas','2673590zcWHHt','staleConnection','\x20or\x20','\x20missing\x20user\x20object\x20in\x20message:\x20',',\x20id=','modifyGroup','activityOperation','\x20createUser()\x20obj=','\x20subscriber\x20error:\x20scimgateway\x20endpoint\x20connect\x20problem\x20-\x20will\x20do\x20auto\x20retry\x20until\x20connected','Msg-Id','isClosed','createUser','publisher\x20not\x20initialized/connected','subscriber\x20message\x20error:\x20message\x20not\x20JSON\x20formatted','query','10321vRbKAY','handle','replaceDomains','getProcessed','active','deleteGroup','attributes','userName','attribute','copyObj','getApi',']\x20subscriber[','nats','endsWith','logger','allSettled','skipConvertRolesToGroups',']\x20closed\x20with\x20error:\x20','encode','createRandomPassword','certificate','baseEntity',']\x20initialization\x20error:\x20missing\x20configuration\x20nats.subject','pingInterval','convertedScim20','delete','maxPingOut','\x20handling\x20message:\x20','isArray','increment','info','message',',\x20obj=','startsWith','813705OBJWxl','replaceAll','deleteUser',']\x20client\x20reconnected\x20','request','\x20(count=','operator','2780350YTjVbI','\x20message:\x20user\x20not\x20deleted\x20because\x20of\x20configuration\x20modifyOnly=true','type','/approles','503','getMemberOf','get','slice','\x20-\x20',']\x20error:\x20client\x20have\x20not\x20been\x20initialized','ctxPassThrough','pluginName','gwName',']\x20initialization\x20error:\x20missing\x20configuration\x20nats',']\x20initialization\x20certificate\x20error:\x20','stringify','from','splice','\x20result=','SCIM\x20Stream\x20-\x20Autogenerated','rejected','level','configDir','\x20role\x20removal\x20error:\x20','deleteApi','rawFilter','name','_info',',true','\x27\x20not\x20supported','operation','closed','durable_','add',']\x20initialization\x20error:\x20missing\x20configuration\x20nats.tenant','845694wSPWrJ','getAppRoles','display','ack','passThrough','\x20message:\x20user\x20does\x20not\x20exist','caller','roles','maxReconnectAttempts','publish','string','ECONNREFUSED','disconnect','HR.','displayName','SCIM\x20Stream','append',']\x20client\x20is\x20attempting\x20to\x20reconnect\x20','\x20error:\x20more\x20than\x20one\x20user\x20were\x20found}','reconnect','consumers',']\x20client\x20error\x20','data','func','split','sub','server_name','path','Users','error','servers','rejectUnauthorized','config','769264vuvHlv','modifyUser','\x20error:\x20missing\x20result',']\x20initialization\x20error:\x20missing\x20certificate\x20configuration',']\x20publisher[','getUsers()\x20getObj=','\x20message\x20handled:\x20','close','\x20Delete\x20User\x20id=','push','waitOnFirstConnect','\x20message\x20json\x20parsing\x20error:\x20','\x20Create\x20User\x20userName=','secret','toUpperCase','call','\x20-\x20will\x20do\x20auto\x20connect\x20when\x20available\x20-\x20however,\x20please\x20verify\x20stream\x20configuration','internal\x20stream\x20policy\x20have\x20been\x20changed\x20-\x20central\x20SCIM\x20Stream\x20must\x20be\x20stopped\x20and\x20corresponding\x20./jetstream\x20folder\x20deleted\x20before\x20startup\x20allowing\x20new\x20policy','\x20-\x20will\x20do\x20auto\x20reconnect\x20when\x20connection\x20becomes\x20available','2202buZmkM','tls','/certs/','map',']\x20initialization\x20error:\x20missing\x20configuration\x20stream.baseUrls','getuniquevalue','reconnectTimeWait','\x20Create\x20userName=','apply','toLowerCase','\x20calling\x20\x22','replaceUsrGrp',']\x20connect\x20error:\x20','\x20Delete\x20User\x20userName=','3199vvveZk','file-not-configured','\x20message\x20error\x20response:\x20','\x20group\x20removal\x20error:\x20','UnableConnectingHost',']\x20client\x20has\x20a\x20stale\x20connection\x20','transports','publisher[','publisher\x20error:\x20none\x20JSON\x20formatted\x20response:\x20','headers','utf-8','\x20error:\x20missing\x20id}','substring','includes','\x20convertedScim20\x20error:\x20','ETIMEDOUT','deliver_policy','onCreate','foldReplacing','\x20message:\x20','\x20with\x20chunks\x20returned\x20errors:\x20',',\x20attributes=','charAt','hasOwnProperty','undefined','createWriteStream','createGroup','User','_autogenerated.cfg','All','respond','reconnecting','mkdirSync','SIGTERM','length','file','parse','tenant','readFileSync','trim','getUsers','Explicit',']\x20error:\x20message\x20must\x20be\x20JSON\x20formatted','publisher\x20response\x20error:\x20','then','consumer_not_found',']\x20subscriber\x20stopped\x20error:\x20','subscribe','jwt','\x20processing\x20incoming\x20message',',false','11HWeXwY','value','\x20Replace\x20User\x20id=','join','consume','replace','\x20done','usePutSoftSync'];a0_0x4ebe=function(){return _0x918521;};return a0_0x4ebe();}import a0_0x15849a from'fold-to-ascii';import a0_0x5517ab from'node:fs';import a0_0x31a0e9 from'node:path';import a0_0xf9b720 from'node:crypto';import*as a0_0x2da0c2 from'./utils.ts';import*as a0_0x370d20 from'./utils-scim.ts';export class Subscriber{constructor(_0x231acd){const _0x576821=a0_0xb16d,_0x6c3bac=_0x231acd,_0x2106a9={};let _0x3fcecc='';for(let _0x544b46=0x0;_0x544b46<_0x6c3bac['logger']['transports'][_0x576821(0x106)];_0x544b46++){if(_0x6c3bac[_0x576821(0x16d)][_0x576821(0xea)][_0x544b46][_0x576821(0x1a2)]===_0x576821(0x107)){_0x3fcecc=_0x6c3bac[_0x576821(0x16d)][_0x576821(0xea)][_0x544b46][_0x576821(0x19d)];break;}}const _0x146a38=''+(_0x3fcecc==='debug'?'\x0a':''),_0x4a81e6=async(_0x1cab3b,_0x2e5da1)=>{const _0x2f3463=_0x576821,_0x3d4a61=_0x2106a9[_0x1cab3b][_0x2f3463(0x1cb)]?.['nats']?.['subject'];let _0x2c390c;try{_0x2c390c=await a0_0x1eb4cc(_0x2e5da1);if(_0x2c390c[_0x2f3463(0x17d)][_0x2f3463(0x1c5)]!==_0x2f3463(0x1ba)){_0x2c390c[_0x2f3463(0x1d3)]();return;}_0x2106a9[_0x1cab3b]['nc']=_0x2c390c,_0x5232e7(_0x1cab3b,_0x2c390c),_0x499d06(_0x1cab3b,_0x2c390c);}catch(_0x3ed5f6){_0x6c3bac[_0x2f3463(0x16d)][_0x2f3463(0x1c8)](_0x6c3bac[_0x2f3463(0x194)]+'['+_0x6c3bac['pluginName']+_0x2f3463(0x16a)+_0x1cab3b+']['+_0x3d4a61+_0x2f3463(0xe2)+_0x3ed5f6[_0x2f3463(0x17e)]+'\x20-\x20will\x20do\x20auto\x20connect\x20when\x20available\x20-\x20however,\x20please\x20verify\x20stream\x20configuration'),_0x2e5da1[_0x2f3463(0x1d6)]=!![];try{_0x2c390c=await a0_0x1eb4cc(_0x2e5da1);if(_0x2c390c[_0x2f3463(0x17d)]['server_name']!=='SCIM\x20Stream'){_0x2c390c['close']();return;}_0x2106a9[_0x1cab3b]['nc']=_0x2c390c,_0x5232e7(_0x1cab3b,_0x2c390c),_0x499d06(_0x1cab3b,_0x2c390c);}catch(_0x3451a1){_0x6c3bac[_0x2f3463(0x16d)][_0x2f3463(0x1c8)](_0x6c3bac[_0x2f3463(0x194)]+'['+_0x6c3bac[_0x2f3463(0x193)]+_0x2f3463(0x16a)+_0x1cab3b+']['+_0x3d4a61+_0x2f3463(0xe2)+_0x3451a1[_0x2f3463(0x17e)]);return;}}_0x6c3bac['logger'][_0x2f3463(0x129)](_0x6c3bac['gwName']+'['+_0x6c3bac[_0x2f3463(0x193)]+']\x20subscriber['+_0x1cab3b+']['+_0x3d4a61+']\x20connected\x20'+(_0x2e5da1[_0x2f3463(0x1e0)]['ca']?_0x2f3463(0x1e0):'')+'\x20'+_0x2c390c['getServer']()),_0x2c390c['closed']()[_0x2f3463(0x110)](_0x2bc89f=>{const _0x4d451b=_0x2f3463;_0x2bc89f&&_0x6c3bac[_0x4d451b(0x16d)][_0x4d451b(0x1c8)](_0x6c3bac['gwName']+'['+_0x6c3bac[_0x4d451b(0x193)]+_0x4d451b(0x16a)+_0x1cab3b+']['+_0x3d4a61+_0x4d451b(0x170)+_0x2bc89f['message']);});};this[_0x576821(0x1a9)]=async(_0x33e51c,_0x16bb18)=>{const _0x129325=_0x576821;if(!_0x16bb18?.[_0x129325(0x16b)]){_0x6c3bac[_0x129325(0x16d)][_0x129325(0x1c8)](_0x6c3bac[_0x129325(0x194)]+'['+_0x6c3bac['pluginName']+']\x20subscriber['+_0x33e51c+_0x129325(0x195));return;}if(!_0x16bb18?.['nats']?.[_0x129325(0x109)]){_0x6c3bac['logger'][_0x129325(0x1c8)](_0x6c3bac[_0x129325(0x194)]+'['+_0x6c3bac[_0x129325(0x193)]+']\x20subscriber['+_0x33e51c+_0x129325(0x1aa));return;}if(!_0x16bb18?.[_0x129325(0x16b)]?.[_0x129325(0x12d)]){_0x6c3bac['logger'][_0x129325(0x1c8)](_0x6c3bac[_0x129325(0x194)]+'['+_0x6c3bac['pluginName']+_0x129325(0x16a)+_0x33e51c+_0x129325(0x175));return;}if(!_0x16bb18?.['certificate']?.['ca']){_0x6c3bac[_0x129325(0x16d)][_0x129325(0x1c8)](_0x6c3bac[_0x129325(0x194)]+'['+_0x6c3bac[_0x129325(0x193)]+_0x129325(0x16a)+_0x33e51c+']\x20initialization\x20error:\x20missing\x20certificate\x20configuration');return;}if(!_0x16bb18[_0x129325(0x128)]||!Array['isArray'](_0x16bb18[_0x129325(0x128)])||_0x16bb18['baseUrls'][_0x129325(0x106)]<0x1){_0x6c3bac[_0x129325(0x16d)][_0x129325(0x1c8)](_0x6c3bac[_0x129325(0x194)]+'['+_0x6c3bac[_0x129325(0x193)]+_0x129325(0x16a)+_0x33e51c+_0x129325(0x1e3));return;}if(!_0x16bb18[_0x129325(0x11e)]){const _0x4f1cc4=_0x16bb18?.[_0x129325(0x16b)]?.[_0x129325(0x12d)][_0x129325(0x1da)]();if(_0x4f1cc4[_0x129325(0x180)](_0x129325(0x1b8)))_0x16bb18[_0x129325(0x11e)]=!![];}const _0x2794d6={};try{let _0x3038fa=a0_0x31a0e9[_0x129325(0x11a)](_0x6c3bac[_0x129325(0x19e)],_0x129325(0x1e1),_0x16bb18?.['certificate']?.['ca']||_0x129325(0xe5));(_0x16bb18?.[_0x129325(0x173)]?.['ca']?.['startsWith']('/')||_0x16bb18?.[_0x129325(0x173)]?.['ca']?.[_0x129325(0xf1)]('\x5c'))&&(_0x3038fa=_0x16bb18[_0x129325(0x173)]['ca']),_0x2794d6['ca']=[a0_0x5517ab[_0x129325(0x10a)](_0x3038fa)],_0x2794d6[_0x129325(0x1ca)]=!![];}catch(_0x1ba58a){_0x6c3bac[_0x129325(0x16d)][_0x129325(0x1c8)](_0x6c3bac['gwName']+'['+_0x6c3bac['pluginName']+_0x129325(0x16a)+_0x33e51c+_0x129325(0x196)+_0x1ba58a['message']);return;}const _0x5ecf52={},_0xd0664=new TextEncoder()[_0x129325(0x171)](_0x16bb18?.[_0x129325(0x16b)]?.[_0x129325(0x1d9)]),_0x40ca4c=_0x16bb18?.[_0x129325(0x16b)]?.['jwt'];_0x5ecf52['authenticator']=jwtAuthenticator(_0x40ca4c,_0xd0664),_0x5ecf52[_0x129325(0x1c9)]=_0x16bb18[_0x129325(0x128)],_0x5ecf52[_0x129325(0x1e0)]=_0x2794d6,_0x5ecf52[_0x129325(0x1d6)]=![],_0x5ecf52[_0x129325(0x1be)]=!![],_0x5ecf52[_0x129325(0x1e5)]=0x3e8*0xa,_0x5ecf52['maxReconnectAttempts']=-0x1,_0x5ecf52[_0x129325(0x176)]=0x2*0x3c*0x3e8,_0x5ecf52[_0x129325(0x179)]=0x5,_0x5ecf52['debug']=![],_0x2106a9[_0x33e51c]={},_0x2106a9[_0x33e51c][_0x129325(0x1cb)]=_0x16bb18,_0x2106a9[_0x33e51c]['nc']=undefined,_0x2106a9[_0x33e51c][_0x129325(0x1c4)]=undefined,_0x4a81e6(_0x33e51c,_0x5ecf52);};const _0x499d06=async(_0x5f05b4,_0x2fe531)=>{const _0x73c459=_0x576821,_0x55455f=_0x2106a9[_0x5f05b4][_0x73c459(0x1cb)],_0x3c536d=_0x55455f?.[_0x73c459(0x16b)]?.[_0x73c459(0x12d)];if(!_0x2fe531){_0x6c3bac['logger'][_0x73c459(0x1c8)](_0x6c3bac['gwName']+'['+_0x6c3bac[_0x73c459(0x193)]+_0x73c459(0x16a)+_0x5f05b4+']['+_0x3c536d+_0x73c459(0x191));return;}const _0x58d20e=async(_0x4b165b,_0x5ab24c)=>{const _0x29b91c=_0x73c459;try{_0x6c3bac[_0x29b91c(0x16d)]['info'](_0x4b165b+_0x29b91c(0x17a)+_0x5ab24c);let _0xdb60de;try{if(_0x55455f[_0x29b91c(0x161)]&&Array[_0x29b91c(0x17b)](_0x55455f[_0x29b91c(0x161)]))for(let _0x1d3b3b=0x0;_0x1d3b3b<_0x55455f[_0x29b91c(0x161)]['length'];_0x1d3b3b++){const _0x4683a8=_0x55455f[_0x29b91c(0x161)][_0x1d3b3b];if(!_0x4683a8[_0x29b91c(0x198)]||!_0x4683a8['from'][_0x29b91c(0xf1)]('.')||!_0x4683a8['to']||!_0x4683a8['to']['includes']('.'))continue;const _0x1d95ee=new RegExp('@'+_0x4683a8[_0x29b91c(0x198)]+'\x22','gi');_0x5ab24c=_0x5ab24c[_0x29b91c(0x11c)](_0x1d95ee,'@'+_0x4683a8['to']+'\x22');}_0xdb60de=JSON[_0x29b91c(0x108)](_0x5ab24c);}catch(_0x20ffee){_0x6c3bac[_0x29b91c(0x16d)]['error'](_0x4b165b+_0x29b91c(0x1d7)+_0x20ffee[_0x29b91c(0x17e)]+_0x29b91c(0xf7)+_0x5ab24c),_0x6c3bac['logger'][_0x29b91c(0x129)](_0x4b165b+_0x29b91c(0x11d)+_0x146a38);return;}const _0x14bf89=_0xdb60de['user'];if(!_0x14bf89){_0x6c3bac[_0x29b91c(0x16d)][_0x29b91c(0x1c8)](_0x4b165b+_0x29b91c(0x153)+JSON['stringify'](_0xdb60de)),_0x6c3bac[_0x29b91c(0x16d)][_0x29b91c(0x129)](_0x4b165b+'\x20done'+_0x146a38);return;}if(!_0x14bf89[_0x29b91c(0x166)]){_0x6c3bac[_0x29b91c(0x16d)][_0x29b91c(0x1c8)](_0x4b165b+_0x29b91c(0x125)+JSON[_0x29b91c(0x197)](_0xdb60de)),_0x6c3bac[_0x29b91c(0x16d)]['debug'](_0x4b165b+_0x29b91c(0x11d)+_0x146a38);return;}delete _0x14bf89[_0x29b91c(0x14f)];let _0x5c7ee4;_0x14bf89['id']&&(_0x5c7ee4=_0x14bf89['id'],delete _0x14bf89['id']);let _0x127398;_0x14bf89[_0x29b91c(0xf5)]&&(_0x127398=a0_0x2da0c2['copyObj'](_0x14bf89['onCreate']),delete _0x14bf89['onCreate']);await _0x11ce40(_0x5f05b4,_0x14bf89);const _0xf9ab78=_0x14bf89[_0x29b91c(0x166)];let _0x2d3a22,_0x311b53;try{_0x2d3a22=await _0x53ada3(_0x5f05b4,_0x29b91c(0x166),_0xf9ab78);}catch(_0x2f916f){_0x6c3bac['logger'][_0x29b91c(0x1c8)](_0x4b165b+_0x29b91c(0x12f)+_0x2f916f[_0x29b91c(0x17e)]),_0x6c3bac[_0x29b91c(0x16d)]['debug'](_0x4b165b+'\x20done'+_0x146a38);const _0x47c51c=[_0x29b91c(0xe8),'UnableConnectingService',_0x29b91c(0x1b6),_0x29b91c(0x124),_0x29b91c(0xf3),'timeout'];for(const _0x6f66bb in _0x47c51c){if(_0x2f916f[_0x29b91c(0x17e)][_0x29b91c(0xf1)](_0x6f66bb))return!![];}return;}if(!_0x55455f[_0x29b91c(0x16f)]){let _0x5ae404=![];if(_0xdb60de[_0x29b91c(0x13e)]&&Array[_0x29b91c(0x17b)](_0xdb60de[_0x29b91c(0x13e)]))for(let _0x3d883b=0x0;_0x3d883b<_0xdb60de[_0x29b91c(0x13e)]['length'];_0x3d883b++){const _0x11449a=_0xdb60de[_0x29b91c(0x13e)][_0x3d883b];_0x11449a[_0x29b91c(0x1c6)][_0x29b91c(0x180)](_0x29b91c(0x1b2))&&(_0x11449a[_0x29b91c(0x1c6)]=_0x29b91c(0x131),Array[_0x29b91c(0x17b)](_0x11449a[_0x29b91c(0x118)])?(_0x11449a[_0x29b91c(0x118)][0x0]['id']=_0x11449a[_0x29b91c(0x118)][0x0]['value'],_0x11449a['value'][0x0][_0x29b91c(0x1ad)]=_0x11449a[_0x29b91c(0x118)][0x0][_0x29b91c(0x18a)]+_0x29b91c(0x190)+_0x11449a['value'][0x0][_0x29b91c(0x118)],delete _0x11449a[_0x29b91c(0x118)][0x0][_0x29b91c(0x118)],delete _0x11449a['value'][0x0][_0x29b91c(0x18a)]):_0x11449a['value']=[{'id':_0x11449a[_0x29b91c(0x118)],'display':_0x11449a['value']}],delete _0x11449a['typeId'],_0x5ae404=!![]);}if(_0x14bf89[_0x29b91c(0x1b2)]&&Array[_0x29b91c(0x17b)](_0x14bf89['roles'])&&_0x14bf89[_0x29b91c(0x1b2)]['length']>0x0){if(!_0x14bf89[_0x29b91c(0x131)])_0x14bf89[_0x29b91c(0x131)]=[];if(!Array[_0x29b91c(0x17b)](_0x14bf89[_0x29b91c(0x131)]))_0x14bf89[_0x29b91c(0x131)]=[];for(let _0x36fb19=0x0;_0x36fb19<_0x14bf89['roles'][_0x29b91c(0x106)];_0x36fb19++){const _0x26b22d={},_0x3d906d=_0x14bf89['roles'][_0x36fb19];_0x26b22d['value']=_0x3d906d[_0x29b91c(0x118)],_0x26b22d[_0x29b91c(0x1ad)]=_0x3d906d[_0x29b91c(0x18a)]+'\x20-\x20'+_0x3d906d['display'],_0x14bf89[_0x29b91c(0x131)][_0x29b91c(0x1d5)](_0x26b22d);}delete _0x14bf89[_0x29b91c(0x1b2)],_0x5ae404=!![];}if(_0x5ae404)_0x6c3bac[_0x29b91c(0x16d)]['debug'](_0x4b165b+'\x20roles\x20converted\x20to\x20groups:\x20'+JSON['stringify'](_0xdb60de));}if(!_0x2d3a22){if(_0xdb60de[_0x29b91c(0x156)]===_0x29b91c(0x183)){_0x6c3bac[_0x29b91c(0x16d)]['debug'](_0x4b165b+_0x29b91c(0xe3)+_0xf9ab78+_0x29b91c(0x1b0)),_0x6c3bac[_0x29b91c(0x16d)][_0x29b91c(0x129)](_0x4b165b+_0x29b91c(0x11d)+_0x146a38);return;}if(_0x55455f['modifyOnly']&&_0x55455f[_0x29b91c(0x148)]===!![]){_0x6c3bac[_0x29b91c(0x16d)][_0x29b91c(0x129)](_0x4b165b+_0x29b91c(0x1e6)+_0xf9ab78+_0x29b91c(0x12c)),_0x6c3bac[_0x29b91c(0x16d)]['debug'](_0x4b165b+_0x29b91c(0x11d)+_0x146a38);return;}if(Object[_0x29b91c(0x141)][_0x29b91c(0xfb)]['call'](_0x14bf89,_0x29b91c(0x163))){if(typeof _0x14bf89[_0x29b91c(0x163)]===_0x29b91c(0x1b5)){const _0x564718=_0x14bf89[_0x29b91c(0x163)][_0x29b91c(0x1e8)]();if(_0x564718==='true')_0x14bf89[_0x29b91c(0x163)]=!![];else{if(_0x564718==='false')_0x14bf89['active']=![];}}if(_0x14bf89[_0x29b91c(0x163)]===![]){_0x6c3bac[_0x29b91c(0x16d)][_0x29b91c(0x129)](_0x4b165b+_0x29b91c(0x1e6)+_0xf9ab78+_0x29b91c(0x13a)),_0x6c3bac[_0x29b91c(0x16d)][_0x29b91c(0x129)](_0x4b165b+_0x29b91c(0x11d)+_0x146a38);return;}}_0x6c3bac[_0x29b91c(0x16d)][_0x29b91c(0x129)](_0x4b165b+_0x29b91c(0x1d8)+_0xf9ab78);const _0x4f6e28=a0_0x2da0c2[_0x29b91c(0x168)](_0x14bf89);try{delete _0x4f6e28[_0x29b91c(0x131)];!_0x4f6e28[_0x29b91c(0x133)]&&_0x55455f['generateUserPassword']&&_0x55455f['generateUserPassword']===!![]&&(_0x4f6e28[_0x29b91c(0x133)]=a0_0x2da0c2[_0x29b91c(0x172)](0xf));if(_0x127398||_0x5c7ee4){if(_0x127398)for(const _0x203075 in _0x127398){_0x4f6e28[_0x203075]=_0x127398[_0x203075];}if(_0x5c7ee4)_0x4f6e28['id']=_0x5c7ee4;await _0x11ce40(_0x5f05b4,_0x4f6e28);}await _0x6c3bac[_0x29b91c(0x15b)](_0x5f05b4,_0x4f6e28),_0x14bf89[_0x29b91c(0x131)]&&Array[_0x29b91c(0x17b)](_0x14bf89[_0x29b91c(0x131)])&&_0x14bf89[_0x29b91c(0x131)][_0x29b91c(0x106)]>0x0&&(_0x311b53=await _0x53ada3(_0x5f05b4,_0x29b91c(0x166),_0xf9ab78));}catch(_0x24e317){_0x6c3bac[_0x29b91c(0x16d)][_0x29b91c(0x1c8)](_0x4b165b+_0x29b91c(0x157)+JSON['stringify'](_0x4f6e28)+'\x20error:\x20'+_0x24e317[_0x29b91c(0x17e)]+'}'),_0x6c3bac[_0x29b91c(0x16d)][_0x29b91c(0x129)](_0x4b165b+'\x20done'+_0x146a38);return;}}if(_0x2d3a22||_0x311b53){if(_0xdb60de['activityOperation']===_0x29b91c(0x183)){if(_0x55455f[_0x29b91c(0x148)]&&_0x55455f['modifyOnly']===!![]){_0x6c3bac[_0x29b91c(0x16d)][_0x29b91c(0x129)](_0x4b165b+'\x20Delete\x20User\x20id='+_0x2d3a22+_0x29b91c(0x189)),_0x6c3bac[_0x29b91c(0x16d)][_0x29b91c(0x129)](_0x4b165b+_0x29b91c(0x11d)+_0x146a38);return;}_0x6c3bac[_0x29b91c(0x16d)][_0x29b91c(0x129)](_0x4b165b+_0x29b91c(0x1d4)+_0x2d3a22);try{await _0x6c3bac[_0x29b91c(0x183)](_0x5f05b4,_0x2d3a22);}catch(_0x28a64d){_0x6c3bac[_0x29b91c(0x16d)][_0x29b91c(0x1c8)](_0x4b165b+_0x29b91c(0x1d4)+_0x2d3a22+_0x29b91c(0x130)+_0x28a64d[_0x29b91c(0x17e)]+'}'),_0x6c3bac[_0x29b91c(0x16d)][_0x29b91c(0x129)](_0x4b165b+_0x29b91c(0x11d)+_0x146a38);return;}}else{if(_0x311b53)_0x2d3a22=_0x311b53;_0x6c3bac['logger'][_0x29b91c(0x129)](_0x4b165b+_0x29b91c(0x119)+_0x2d3a22);try{await _0x6c3bac[_0x29b91c(0x1ea)](_0x29b91c(0x1c7),_0x5f05b4,_0x2d3a22,_0x14bf89,_0x55455f['usePutSoftSync']);}catch(_0x8caade){_0x6c3bac[_0x29b91c(0x16d)][_0x29b91c(0x1c8)](_0x4b165b+_0x29b91c(0x119)+_0x2d3a22+'\x20error:\x20'+_0x8caade[_0x29b91c(0x17e)]),_0x6c3bac[_0x29b91c(0x16d)][_0x29b91c(0x129)](_0x4b165b+'\x20done'+_0x146a38);return;}if(_0x55455f[_0x29b91c(0x11e)]){const [_0x35d644,_0x506944]=a0_0x370d20[_0x29b91c(0x177)]({'Operations':_0xdb60de['Operations']});if(_0x506944){_0x6c3bac['logger'][_0x29b91c(0x1c8)](_0x4b165b+_0x29b91c(0x119)+_0x2d3a22+_0x29b91c(0xf2)+_0x506944[_0x29b91c(0x17e)]),_0x6c3bac[_0x29b91c(0x16d)]['debug'](_0x4b165b+_0x29b91c(0x11d)+_0x146a38);return;}const _0x31c0a9=[];if(_0x35d644[_0x29b91c(0x1b2)]&&Array[_0x29b91c(0x17b)](_0x35d644['roles']))for(let _0x1b5da8=0x0;_0x1b5da8<_0x35d644[_0x29b91c(0x1b2)][_0x29b91c(0x106)];_0x1b5da8++){_0x35d644[_0x29b91c(0x1b2)][_0x1b5da8][_0x29b91c(0x1a6)]&&_0x35d644[_0x29b91c(0x1b2)][_0x1b5da8][_0x29b91c(0x1a6)]===_0x29b91c(0x178)&&_0x31c0a9[_0x29b91c(0x1d5)](_0x35d644['roles'][_0x1b5da8]);}if(_0x31c0a9['length']>0x0)try{await _0x6c3bac[_0x29b91c(0x1cd)](_0x5f05b4,_0x2d3a22,{'roles':_0x31c0a9});}catch(_0x5a9285){_0x6c3bac['logger'][_0x29b91c(0x1c8)](_0x4b165b+_0x29b91c(0x119)+_0x2d3a22+_0x29b91c(0x19f)+_0x5a9285['message']);}const _0xac8fc6=[];if(_0x35d644[_0x29b91c(0x131)]&&Array[_0x29b91c(0x17b)](_0x35d644[_0x29b91c(0x131)]))for(let _0x1b72af=0x0;_0x1b72af<_0x35d644[_0x29b91c(0x131)]['length'];_0x1b72af++){_0x35d644[_0x29b91c(0x131)][_0x1b72af][_0x29b91c(0x1a6)]&&_0x35d644[_0x29b91c(0x131)][_0x1b72af][_0x29b91c(0x1a6)]==='delete'&&_0xac8fc6['push'](_0x35d644[_0x29b91c(0x131)][_0x1b72af]);}if(_0xac8fc6[_0x29b91c(0x106)]>0x0)for(let _0xae40ca=0x0;_0xae40ca<_0xac8fc6[_0x29b91c(0x106)];_0xae40ca++){try{await _0x6c3bac[_0x29b91c(0x155)](_0x5f05b4,_0xac8fc6[_0xae40ca]['id'],{'members':[{'operation':'delete','value':_0x2d3a22}]});}catch(_0x2d9e6a){_0x6c3bac[_0x29b91c(0x16d)][_0x29b91c(0x1c8)](_0x4b165b+'\x20Replace\x20User\x20id='+_0x2d3a22+_0x29b91c(0xe7)+_0x2d9e6a['message']);}}}if(_0x55455f['deleteUserOnLastGroupRoleRemoval']&&_0xdb60de[_0x29b91c(0x156)]===_0x29b91c(0x1cd)){if(_0x14bf89[_0x29b91c(0x131)]&&Array['isArray'](_0x14bf89['groups'])&&_0x14bf89[_0x29b91c(0x131)][_0x29b91c(0x106)]===0x0){if(_0x14bf89['roles']&&Array[_0x29b91c(0x17b)](_0x14bf89[_0x29b91c(0x1b2)])&&_0x14bf89[_0x29b91c(0x1b2)][_0x29b91c(0x106)]===0x0){if(_0xdb60de[_0x29b91c(0x13e)]&&Array[_0x29b91c(0x17b)](_0xdb60de[_0x29b91c(0x13e)])&&_0xdb60de[_0x29b91c(0x13e)][_0x29b91c(0x106)]>0x0){let _0x3afc39=![];for(let _0x4d5bfb=0x0;_0x4d5bfb<_0xdb60de[_0x29b91c(0x13e)]['length'];_0x4d5bfb++){const _0x34134a=_0xdb60de[_0x29b91c(0x13e)][_0x4d5bfb];if(_0x34134a['op']==='remove'){if(_0x34134a['path']){if(_0x34134a[_0x29b91c(0x1c6)][_0x29b91c(0x180)]('roles')&&_0x34134a[_0x29b91c(0x11f)]){_0x3afc39=!![];break;}else{if(_0x34134a['path']==='groups'){_0x3afc39=!![];break;}}}}}if(_0x3afc39){_0x6c3bac[_0x29b91c(0x16d)][_0x29b91c(0x129)](_0x4b165b+_0x29b91c(0x1d4)+_0x2d3a22);try{await _0x6c3bac[_0x29b91c(0x183)](_0x5f05b4,_0x2d3a22);}catch(_0x1872a3){_0x6c3bac[_0x29b91c(0x16d)][_0x29b91c(0x1c8)](_0x4b165b+'\x20Delete\x20User\x20id='+_0x2d3a22+_0x29b91c(0x130)+_0x1872a3[_0x29b91c(0x17e)]+'}'),_0x6c3bac[_0x29b91c(0x16d)][_0x29b91c(0x129)](_0x4b165b+'\x20done'+_0x146a38);return;}}}}}}}}_0x6c3bac[_0x29b91c(0x16d)][_0x29b91c(0x129)](_0x4b165b+_0x29b91c(0x11d)+_0x146a38);}catch(_0x54c35d){_0x6c3bac[_0x29b91c(0x16d)][_0x29b91c(0x1c8)](_0x6c3bac[_0x29b91c(0x194)]+'['+_0x6c3bac['pluginName']+_0x29b91c(0x16a)+_0x5f05b4+']['+_0x3c536d+_0x29b91c(0x12b)+_0x54c35d[_0x29b91c(0x17e)]+'\x20=>\x20subscriber\x20not\x20activated'+_0x146a38);}},_0x381681=jetstream(_0x2fe531),_0x312a19=(_0x73c459(0x1a8)+_0x6c3bac[_0x73c459(0x193)]+'_'+_0x5f05b4)[_0x73c459(0x182)]('*','#')[_0x73c459(0x182)]('>','##')[_0x73c459(0x182)]('.','_'),_0x42cd1c=_0x3c536d[_0x73c459(0x1c3)]('.')[0x0][_0x73c459(0x1da)]()==='GW',_0xdfe09a=async()=>{const _0x3b5637=_0x73c459;try{let _0x3fcf66;const _0x10bea2=''+_0x55455f?.[_0x3b5637(0x16b)]?.['tenant'],_0x1d79dd=await jetstreamManager(_0x2fe531),_0x10140c=async()=>{const _0x5e5ad1=_0x3b5637;let _0x38f7cc;try{_0x38f7cc=await _0x381681[_0x5e5ad1(0x1bf)][_0x5e5ad1(0x18e)](_0x10bea2,_0x312a19);}catch(_0x3c3663){const _0xd49452={'durable_name':_0x312a19,'deliver_policy':DeliverPolicy[_0x5e5ad1(0x101)],'ack_policy':AckPolicy[_0x5e5ad1(0x10d)],'filter_subject':_0x3c536d};await _0x1d79dd['consumers']['add'](_0x10bea2,_0xd49452),_0x38f7cc=await _0x381681[_0x5e5ad1(0x1bf)][_0x5e5ad1(0x18e)](_0x10bea2,_0x312a19);}if(_0x38f7cc?.[_0x5e5ad1(0x1a3)]?.[_0x5e5ad1(0x1cb)]?.[_0x5e5ad1(0xf4)]!==_0x5e5ad1(0x139))throw new Error(_0x5e5ad1(0x1dd));_0x38f7cc?.[_0x5e5ad1(0x1a3)]?.['config']?.[_0x5e5ad1(0x145)]!==_0x3c536d&&(await _0x1d79dd[_0x5e5ad1(0x1bf)]['update'](_0x10bea2,_0x312a19,{'filter_subject':_0x3c536d}),_0x38f7cc=await _0x381681[_0x5e5ad1(0x1bf)][_0x5e5ad1(0x18e)](_0x10bea2,_0x312a19)),_0x3fcf66=await _0x38f7cc[_0x5e5ad1(0x11b)]({'max_messages':0x64}),_0x1d1616(_0x3fcf66);},_0x1d1616=async _0x2086ce=>{const _0x2df83e=_0x3b5637;for await(const _0x440d13 of await _0x2086ce[_0x2df83e(0x13c)]()){switch(_0x440d13[_0x2df83e(0x18a)]){case _0x2df83e(0x111):_0x6c3bac[_0x2df83e(0x16d)][_0x2df83e(0x17d)](_0x6c3bac[_0x2df83e(0x194)]+'['+_0x6c3bac['pluginName']+_0x2df83e(0x16a)+_0x5f05b4+']['+_0x3c536d+']\x20client\x20consumer\x20reinitiated\x20because\x20of\x20'+_0x440d13[_0x2df83e(0x18a)]),_0x10140c();return;}}};await _0x10140c();let _0x560173=-0x1;do{for await(const _0x477f02 of _0x3fcf66){if(!_0x477f02[_0x3b5637(0xed)]||!_0x477f02[_0x3b5637(0xed)][_0x3b5637(0x18e)](_0x3b5637(0x159))){_0x477f02[_0x3b5637(0x1ae)]();continue;}_0x560173=_0x3fcf66[_0x3b5637(0x162)]();const _0x4b6e1f=_0x6c3bac['gwName']+'['+_0x6c3bac[_0x3b5637(0x193)]+_0x3b5637(0x16a)+_0x5f05b4+']['+_0x477f02['subject']+']['+_0x560173+']['+(_0x477f02['headers']?_0x477f02[_0x3b5637(0xed)][_0x3b5637(0x18e)](_0x3b5637(0x159)):'')+']',_0x560198=_0x477f02['string'](),_0x46ddd9=await _0x58d20e(_0x4b6e1f,_0x560198);if(!_0x46ddd9||_0x46ddd9!==!![])_0x477f02['ack']();else _0x6c3bac[_0x3b5637(0x16d)][_0x3b5637(0x1c8)](_0x4b6e1f+_0x3b5637(0x158));if(_0x560173<0x1)break;}}while(_0x560173===0x0);}catch(_0x3ae582){_0x6c3bac[_0x3b5637(0x16d)]['error'](_0x6c3bac['gwName']+'['+_0x6c3bac['pluginName']+']\x20subscriber['+_0x5f05b4+']['+_0x3c536d+_0x3b5637(0x112)+_0x3ae582['message']);}},_0x5dd8c3=async()=>{const _0x20d9c3=_0x73c459,_0xaf7598=_0x2fe531[_0x20d9c3(0x113)](_0x3c536d,{'max':0x64});for await(const _0xf36dbf of _0xaf7598){if(!_0xf36dbf[_0x20d9c3(0xed)]||!_0xf36dbf['headers']['get']('Msg-Id'))continue;let _0x5351c,_0x1967da;try{try{_0x5351c=JSON[_0x20d9c3(0x108)](_0xf36dbf[_0x20d9c3(0x1b5)]());}catch(_0x24ca89){const _0x466523=_0x20d9c3(0x15d);_0x6c3bac[_0x20d9c3(0x16d)][_0x20d9c3(0x1c8)](_0x6c3bac[_0x20d9c3(0x194)]+'['+_0x6c3bac[_0x20d9c3(0x193)]+_0x20d9c3(0x16a)+_0x5f05b4+']['+_0x3c536d+']\x20'+_0x466523+':\x20'+_0xf36dbf[_0x20d9c3(0x1b5)]());throw new Error(_0x466523);}if(!_0x5351c||!_0x5351c['func']){const _0x23d771='subscriber\x20message\x20error:\x20message\x20missing\x20method';this[_0x20d9c3(0x1b1)]['logger'][_0x20d9c3(0x1c8)](this[_0x20d9c3(0x1b1)]['gwName']+'['+this[_0x20d9c3(0x1b1)][_0x20d9c3(0x193)]+']\x20subscriber['+_0x5f05b4+']['+_0x3c536d+']\x20'+_0x23d771+':\x20'+_0x5351c);throw new Error(_0x23d771);}!Object[_0x20d9c3(0x141)]['hasOwnProperty'][_0x20d9c3(0x1db)](_0x5351c,_0x20d9c3(0x174))&&(_0x5351c[_0x20d9c3(0x174)]=_0x20d9c3(0xfc));if(_0x5351c[_0x20d9c3(0x174)]!==_0x5f05b4){const _0x29c9b5='subscriber\x20message\x20error:\x20message\x20baseEntity='+_0x5351c[_0x20d9c3(0x174)]+'\x20not\x20equal\x20subscriber\x20configured\x20baseEntity='+_0x5f05b4;_0x6c3bac[_0x20d9c3(0x16d)]['error'](_0x6c3bac[_0x20d9c3(0x194)]+'['+_0x6c3bac[_0x20d9c3(0x193)]+_0x20d9c3(0x16a)+_0x5f05b4+']['+_0x3c536d+']\x20'+_0x29c9b5);throw new Error(_0x29c9b5);}_0x1967da=_0x6c3bac[_0x20d9c3(0x194)]+'['+_0x6c3bac[_0x20d9c3(0x193)]+_0x20d9c3(0x16a)+_0x5f05b4+']['+_0xf36dbf['subject']+']['+(_0xf36dbf[_0x20d9c3(0xed)]?_0xf36dbf[_0x20d9c3(0xed)][_0x20d9c3(0x18e)]('Msg-Id'):'')+']',_0x6c3bac[_0x20d9c3(0x16d)]['debug'](_0x1967da+_0x20d9c3(0x115));let _0x2eac7b,_0x2eddee;switch(_0x5351c[_0x20d9c3(0x1c2)]){case _0x20d9c3(0x10c):if(!_0x5351c[_0x20d9c3(0x149)][_0x20d9c3(0x187)]&&_0x5351c[_0x20d9c3(0x149)][_0x20d9c3(0x1a1)]&&_0x5351c[_0x20d9c3(0x149)]['rawFilter'][_0x20d9c3(0xf1)](_0x20d9c3(0x152))){const _0x14d8c0=_0x5351c[_0x20d9c3(0x149)][_0x20d9c3(0x1a1)][_0x20d9c3(0x1c3)](_0x20d9c3(0x152));let _0xcc0a4d=[];for(let _0x168cf5=0x0;_0x168cf5<_0x14d8c0[_0x20d9c3(0x106)];_0x168cf5++){_0x14d8c0[_0x168cf5]=_0x14d8c0[_0x168cf5][_0x20d9c3(0x11c)](/\(/g,'')[_0x20d9c3(0x11c)](/\)/g,'')[_0x20d9c3(0x10b)]();const _0x53653b=_0x14d8c0[_0x168cf5]['split']('\x20');if(_0x53653b[_0x20d9c3(0x106)]===0x3||_0x53653b['length']>0x2&&_0x53653b[0x2][_0x20d9c3(0x180)]('\x22')&&_0x53653b[_0x53653b['length']-0x1][_0x20d9c3(0x16c)]('\x22')){const _0x20ed2e={};_0x20ed2e[_0x20d9c3(0x167)]=_0x53653b[0x0],_0x20ed2e[_0x20d9c3(0x187)]=_0x53653b[0x1][_0x20d9c3(0x1e8)](),_0x20ed2e[_0x20d9c3(0x118)]=decodeURIComponent(_0x53653b[_0x20d9c3(0x18f)](0x2)[_0x20d9c3(0x11a)]('\x20')[_0x20d9c3(0x11c)](/"/g,'')),_0xcc0a4d[_0x20d9c3(0x1d5)](_0x20ed2e);}else{_0xcc0a4d=[];break;}}if(_0xcc0a4d[_0x20d9c3(0x106)]>0x0){const _0x1bb7f2=async _0x1b01fd=>{const _0x137908=_0x20d9c3;return await _0x6c3bac[_0x5351c['func']](_0x5f05b4,_0x1b01fd,_0x5351c[_0x137908(0x165)],_0x5351c[_0x137908(0x1af)]);},_0x3aad60=0x5,_0x173d22=[];_0x6c3bac[_0x20d9c3(0x16d)][_0x20d9c3(0x129)](_0x1967da+'\x20calling\x20\x22'+_0x5351c[_0x20d9c3(0x1c2)]+_0x20d9c3(0x121));do{const _0x3fa170=_0xcc0a4d[_0x20d9c3(0x199)](0x0,_0x3aad60),_0x2bc681=await Promise[_0x20d9c3(0x16e)](_0x3fa170['map'](_0x1759bc=>_0x1bb7f2(_0x1759bc))),_0x30b986=_0x2bc681[_0x20d9c3(0x13b)](_0x8881d0=>_0x8881d0[_0x20d9c3(0x13c)]===_0x20d9c3(0x19c))[_0x20d9c3(0x1e2)](_0x96d875=>_0x96d875[_0x20d9c3(0x132)][_0x20d9c3(0x17e)]);if(_0x30b986['length']>0x0){const _0x34811d=_0x5351c[_0x20d9c3(0x1c2)]+_0x20d9c3(0xf8)+_0x30b986[_0x20d9c3(0x11a)](',\x20');throw new Error(_0x34811d);}const _0x56bc7e=_0x2bc681[_0x20d9c3(0x1e2)](_0x2c7f8b=>_0x2c7f8b?.['value']?.[_0x20d9c3(0x127)]);for(let _0x5d9193=0x0;_0x5d9193<_0x56bc7e[_0x20d9c3(0x106)];_0x5d9193++){Array[_0x20d9c3(0x141)][_0x20d9c3(0x1d5)][_0x20d9c3(0x1e7)](_0x173d22,_0x56bc7e[_0x5d9193]);}}while(_0xcc0a4d[_0x20d9c3(0x106)]>0x0);_0x2eac7b={'Resources':_0x173d22};}}!_0x2eac7b&&(_0x6c3bac['logger'][_0x20d9c3(0x129)](_0x1967da+_0x20d9c3(0x1e9)+_0x5351c[_0x20d9c3(0x1c2)]+_0x20d9c3(0x13f)),_0x2eac7b=await _0x6c3bac[_0x5351c[_0x20d9c3(0x1c2)]](_0x5f05b4,_0x5351c[_0x20d9c3(0x149)],_0x5351c[_0x20d9c3(0x165)],_0x5351c['ctxPassThrough']));if(Array[_0x20d9c3(0x17b)](_0x2eac7b?.[_0x20d9c3(0x127)])){if(_0x5351c?.[_0x20d9c3(0x165)]?.[_0x20d9c3(0x106)]===0x0||_0x5351c?.[_0x20d9c3(0x165)]?.[_0x20d9c3(0xf1)](_0x20d9c3(0x131)))for(let _0x1c816b=0x0;_0x1c816b<_0x2eac7b[_0x20d9c3(0x127)][_0x20d9c3(0x106)];_0x1c816b++){const _0x95ff8b=_0x2eac7b[_0x20d9c3(0x127)][_0x1c816b];if(!_0x95ff8b['id'])break;if(_0x95ff8b['groups'])break;_0x95ff8b[_0x20d9c3(0x131)]=await _0x6c3bac[_0x20d9c3(0x18d)](_0x5f05b4,_0x95ff8b['id'],_0x20d9c3(0x143),_0x5351c['ctxPassThrough']);}}break;case _0x20d9c3(0x143):_0x6c3bac[_0x20d9c3(0x16d)][_0x20d9c3(0x129)](_0x1967da+_0x20d9c3(0x1e9)+_0x5351c[_0x20d9c3(0x1c2)]+_0x20d9c3(0x13f)),_0x2eac7b=await _0x6c3bac[_0x5351c[_0x20d9c3(0x1c2)]](_0x5f05b4,_0x5351c['obj'],_0x5351c[_0x20d9c3(0x165)],_0x5351c[_0x20d9c3(0x192)]);break;case _0x20d9c3(0x15b):_0x6c3bac['logger'][_0x20d9c3(0x129)](_0x1967da+'\x20calling\x20\x22'+_0x5351c[_0x20d9c3(0x1c2)]+_0x20d9c3(0x13f)),_0x2eac7b=await _0x6c3bac[_0x5351c[_0x20d9c3(0x1c2)]](_0x5f05b4,_0x5351c[_0x20d9c3(0x149)],_0x5351c[_0x20d9c3(0x192)]);break;case _0x20d9c3(0xfe):_0x6c3bac[_0x20d9c3(0x16d)][_0x20d9c3(0x129)](_0x1967da+_0x20d9c3(0x1e9)+_0x5351c['func']+_0x20d9c3(0x13f)),_0x2eac7b=await _0x6c3bac[_0x5351c['func']](_0x5f05b4,_0x5351c[_0x20d9c3(0x149)],_0x5351c[_0x20d9c3(0x192)]);break;case _0x20d9c3(0x183):_0x6c3bac[_0x20d9c3(0x16d)][_0x20d9c3(0x129)](_0x1967da+_0x20d9c3(0x1e9)+_0x5351c[_0x20d9c3(0x1c2)]+_0x20d9c3(0x13f)),_0x2eac7b=await _0x6c3bac[_0x5351c[_0x20d9c3(0x1c2)]](_0x5f05b4,_0x5351c['id'],_0x5351c[_0x20d9c3(0x192)]);break;case _0x20d9c3(0x164):_0x6c3bac[_0x20d9c3(0x16d)][_0x20d9c3(0x129)](_0x1967da+_0x20d9c3(0x1e9)+_0x5351c['func']+'\x22\x20and\x20awaiting\x20result'),_0x2eac7b=await _0x6c3bac[_0x5351c[_0x20d9c3(0x1c2)]](_0x5f05b4,_0x5351c['id'],_0x5351c[_0x20d9c3(0x192)]);break;case'modifyUser':_0x6c3bac[_0x20d9c3(0x16d)][_0x20d9c3(0x129)](_0x1967da+'\x20calling\x20\x22'+_0x5351c[_0x20d9c3(0x1c2)]+_0x20d9c3(0x13f)),_0x2eac7b=await _0x6c3bac[_0x5351c[_0x20d9c3(0x1c2)]](_0x5f05b4,_0x5351c['id'],_0x5351c[_0x20d9c3(0x149)],_0x5351c[_0x20d9c3(0x192)]);break;case _0x20d9c3(0x155):_0x6c3bac['logger']['debug'](_0x1967da+_0x20d9c3(0x1e9)+_0x5351c[_0x20d9c3(0x1c2)]+_0x20d9c3(0x13f)),_0x2eac7b=await _0x6c3bac[_0x5351c[_0x20d9c3(0x1c2)]](_0x5f05b4,_0x5351c['id'],_0x5351c[_0x20d9c3(0x149)],_0x5351c[_0x20d9c3(0x192)]);break;case'replaceUsrGrp':_0x6c3bac[_0x20d9c3(0x16d)][_0x20d9c3(0x129)](_0x1967da+'\x20calling\x20\x22'+_0x5351c[_0x20d9c3(0x1c2)]+'\x22\x20and\x20awaiting\x20result'),_0x2eac7b=await _0x6c3bac[_0x5351c[_0x20d9c3(0x1c2)]](_0x5351c[_0x20d9c3(0x160)],_0x5f05b4,_0x5351c['id'],_0x5351c['obj'],_0x55455f[_0x20d9c3(0x11e)],_0x5351c[_0x20d9c3(0x192)]);break;case'postApi':_0x6c3bac['logger'][_0x20d9c3(0x129)](_0x1967da+_0x20d9c3(0x1e9)+_0x5351c[_0x20d9c3(0x1c2)]+_0x20d9c3(0x13f)),_0x2eac7b=await _0x6c3bac[_0x5351c['func']](_0x5f05b4,_0x5351c[_0x20d9c3(0x149)],_0x5351c['ctxPassThrough']);break;case'putApi':_0x6c3bac[_0x20d9c3(0x16d)]['debug'](_0x1967da+_0x20d9c3(0x1e9)+_0x5351c[_0x20d9c3(0x1c2)]+'\x22\x20and\x20awaiting\x20result'),_0x2eac7b=await _0x6c3bac[_0x5351c[_0x20d9c3(0x1c2)]](_0x5f05b4,_0x5351c['id'],_0x5351c[_0x20d9c3(0x149)],_0x5351c[_0x20d9c3(0x192)]);break;case'patchApi':_0x6c3bac[_0x20d9c3(0x16d)][_0x20d9c3(0x129)](_0x1967da+_0x20d9c3(0x1e9)+_0x5351c['func']+'\x22\x20and\x20awaiting\x20result'),_0x2eac7b=await _0x6c3bac[_0x5351c[_0x20d9c3(0x1c2)]](_0x5f05b4,_0x5351c['id'],_0x5351c['obj'],_0x5351c[_0x20d9c3(0x192)]);break;case _0x20d9c3(0x169):_0x6c3bac[_0x20d9c3(0x16d)][_0x20d9c3(0x129)](_0x1967da+'\x20calling\x20\x22'+_0x5351c[_0x20d9c3(0x1c2)]+'\x22\x20and\x20awaiting\x20result'),_0x2eac7b=await _0x6c3bac[_0x5351c['func']](_0x5f05b4,_0x5351c['id'],_0x5351c[_0x20d9c3(0x15e)],_0x5351c[_0x20d9c3(0x149)],_0x5351c['ctxPassThrough']);break;case _0x20d9c3(0x1a0):_0x6c3bac[_0x20d9c3(0x16d)]['debug'](_0x1967da+_0x20d9c3(0x1e9)+_0x5351c[_0x20d9c3(0x1c2)]+_0x20d9c3(0x13f)),_0x2eac7b=await _0x6c3bac[_0x5351c['func']](_0x5f05b4,_0x5351c['id'],_0x5351c[_0x20d9c3(0x192)]);break;default:_0x2eddee='subscriber\x20message\x20error:\x20handle\x20\x27'+_0x5351c['func']+_0x20d9c3(0x1a5),_0x6c3bac[_0x20d9c3(0x16d)]['error'](_0x1967da+'\x20'+_0x2eddee);throw new Error(_0x2eddee);}if(!_0x2eac7b)_0x2eac7b=null;const _0x32abd1=JSON['stringify'](_0x2eac7b);_0xf36dbf[_0x20d9c3(0x102)](_0x32abd1),_0x6c3bac['logger'][_0x20d9c3(0x17d)](_0x1967da+_0x20d9c3(0x1d2)+_0x5351c[_0x20d9c3(0x1c2)]+_0x20d9c3(0x17f)+(_0x5351c[_0x20d9c3(0x149)]?JSON['stringify'](_0x5351c[_0x20d9c3(0x149)]):'')+_0x20d9c3(0x154)+(_0x5351c['id']?_0x5351c['id']:'')+_0x20d9c3(0xf9)+(_0x5351c[_0x20d9c3(0x165)]?_0x5351c[_0x20d9c3(0x165)]:'')+'\x20message\x20response:\x20'+_0x32abd1+_0x146a38);}catch(_0x1c8c48){const _0x175a1f=_0x20d9c3(0x140)+_0x1c8c48[_0x20d9c3(0x17e)]+'\x22,\x22errName\x22:\x22'+_0x1c8c48['name']+'\x22}';_0xf36dbf[_0x20d9c3(0x102)](_0x175a1f),_0x6c3bac['logger'][_0x20d9c3(0x17d)]((_0x1967da||'')+'\x20message\x20handled:\x20'+_0x5351c[_0x20d9c3(0x1c2)]+_0x20d9c3(0x17f)+(_0x5351c['obj']?JSON[_0x20d9c3(0x197)](_0x5351c[_0x20d9c3(0x149)]):'')+_0x20d9c3(0x154)+(_0x5351c['id']?_0x5351c['id']:'')+_0x20d9c3(0xf9)+(_0x5351c[_0x20d9c3(0x165)]?_0x5351c[_0x20d9c3(0x165)]:'')+_0x20d9c3(0xe6)+_0x175a1f+_0x146a38);}}};if(_0x42cd1c)_0x5dd8c3();else _0xdfe09a();},_0x5232e7=async(_0x4ca753,_0x206473)=>{const _0x17b5d6=_0x576821,_0x4641ed=_0x2106a9[_0x4ca753][_0x17b5d6(0x1cb)]?.[_0x17b5d6(0x16b)]?.[_0x17b5d6(0x12d)];let _0x3cc8cc=0x0;for await(const _0x470d49 of _0x206473['status']()){switch(_0x470d49[_0x17b5d6(0x18a)]){case _0x17b5d6(0x1b7):_0x6c3bac['logger']['error'](_0x6c3bac[_0x17b5d6(0x194)]+'['+_0x6c3bac[_0x17b5d6(0x193)]+']\x20subscriber['+_0x4ca753+']['+_0x4641ed+_0x17b5d6(0x14b)+_0x470d49[_0x17b5d6(0x1c1)]+_0x17b5d6(0x1de)),_0x3cc8cc=0x0;break;case _0x17b5d6(0x1be):_0x6c3bac['logger']['info'](_0x6c3bac['gwName']+'['+_0x6c3bac[_0x17b5d6(0x193)]+_0x17b5d6(0x16a)+_0x4ca753+']['+_0x4641ed+_0x17b5d6(0x184)+_0x470d49[_0x17b5d6(0x1c1)]);break;case _0x17b5d6(0x1c8):_0x6c3bac[_0x17b5d6(0x16d)]['error'](_0x6c3bac[_0x17b5d6(0x194)]+'['+_0x6c3bac['pluginName']+_0x17b5d6(0x16a)+_0x4ca753+']['+_0x4641ed+_0x17b5d6(0x1c0)+_0x470d49[_0x17b5d6(0x1c1)]);break;case _0x17b5d6(0x103):_0x3cc8cc+=0x1;_0x3cc8cc%0x1e===0x0&&_0x6c3bac['logger'][_0x17b5d6(0x129)](_0x6c3bac[_0x17b5d6(0x194)]+'['+_0x6c3bac[_0x17b5d6(0x193)]+_0x17b5d6(0x16a)+_0x4ca753+']['+_0x4641ed+']\x20client\x20is\x20attempting\x20to\x20reconnect\x20'+_0x470d49['data']+'\x20(count='+_0x3cc8cc+')');break;case _0x17b5d6(0x151):_0x6c3bac['logger']['debug'](_0x6c3bac[_0x17b5d6(0x194)]+'['+_0x6c3bac[_0x17b5d6(0x193)]+_0x17b5d6(0x16a)+_0x4ca753+']['+_0x4641ed+_0x17b5d6(0xe9)+_0x470d49[_0x17b5d6(0x1c1)]);break;}}};process['on'](_0x576821(0x105),async()=>{const _0x1bc137=_0x576821;for(const _0x8aca66 in _0x2106a9){_0x2106a9[_0x8aca66]['nc']&&!_0x2106a9[_0x8aca66]['nc'][_0x1bc137(0x15a)]()&&await _0x2106a9[_0x8aca66]['nc']['drain']();}}),process['on'](_0x576821(0x146),async()=>{for(const _0xec8e97 in _0x2106a9){_0x2106a9[_0xec8e97]['nc']&&!_0x2106a9[_0xec8e97]['nc']['isClosed']()&&await _0x2106a9[_0xec8e97]['nc']['drain']();}});const _0x53ada3=async(_0x5f5b0e,_0x580281,_0xed166b)=>{const _0x31ca58=_0x576821,_0x5e5b48={'attribute':_0x580281,'operator':'eq','value':_0xed166b,'rawFilter':undefined,'startIndex':undefined,'count':undefined},_0x4f6a70=[_0x580281];if(_0x580281!=='id')_0x4f6a70['push']('id');try{const _0x53cc77=await _0x6c3bac[_0x31ca58(0x10c)](_0x5f5b0e,_0x5e5b48,_0x4f6a70);if(!_0x53cc77||!_0x53cc77['Resources']||!Array['isArray'](_0x53cc77[_0x31ca58(0x127)]))throw new Error('getUsers()\x20getObj='+JSON[_0x31ca58(0x197)](_0x5e5b48)+_0x31ca58(0x1ce));if(_0x53cc77['Resources'][_0x31ca58(0x106)]===0x0)return null;else{if(_0x53cc77[_0x31ca58(0x127)][_0x31ca58(0x106)]>0x2)throw new Error('getUsers()\x20getObj='+JSON['stringify'](_0x5e5b48)+_0x31ca58(0x1bd));else{const _0x3e2914=_0x53cc77[_0x31ca58(0x127)][0x0];if(!_0x3e2914['id'])throw new Error(_0x31ca58(0x1d1)+JSON[_0x31ca58(0x197)](_0x5e5b48)+_0x31ca58(0x19a)+JSON[_0x31ca58(0x197)](_0x3e2914)+_0x31ca58(0xef));return decodeURIComponent(_0x3e2914['id']);}}}catch(_0x3b910f){throw new Error(_0x31ca58(0x1d1)+JSON[_0x31ca58(0x197)](_0x5e5b48)+_0x31ca58(0x130)+_0x3b910f['message']+'}');}},_0x1688ba=_0x15e411=>{const _0x421f81=_0x576821;if(!_0x15e411||typeof _0x15e411!==_0x421f81(0x1b5))return[null,null];_0x15e411=_0x15e411[_0x421f81(0x10b)]();const _0x109335=_0x15e411[_0x421f81(0x122)]('(');if(_0x109335<0x1)return[null,null];if(_0x15e411[_0x421f81(0xf0)](_0x15e411[_0x421f81(0x106)]-0x1)!==')')return[null,null];if(_0x120dce(_0x15e411,'(')!==_0x120dce(_0x15e411,')'))return[null,null];const _0x2a7dd4=_0x15e411[_0x421f81(0xf0)](0x0,_0x109335),_0x5151b9=_0x15e411[_0x421f81(0xf0)](_0x109335+0x1,_0x15e411['length']-0x1);let _0x976cdf=[];const _0x561a0d=_0x5151b9[_0x421f81(0x1c3)](',');let _0x523dac='';for(let _0x2f8eda=0x0;_0x2f8eda<_0x561a0d[_0x421f81(0x106)];_0x2f8eda++){const _0x15f99a=_0x523dac?_0x523dac+','+_0x561a0d[_0x2f8eda]:_0x561a0d[_0x2f8eda],_0x2025de=_0x120dce(_0x15f99a,'('),_0x189285=_0x120dce(_0x15f99a,')');if(_0x2025de===_0x189285)_0x976cdf[_0x421f81(0x1d5)](_0x3ff864(_0x15f99a,'\x22')),_0x523dac='';else{if(_0x523dac)_0x523dac+=','+_0x561a0d[_0x2f8eda];else _0x523dac+=_0x561a0d[_0x2f8eda];}}if(_0x976cdf[_0x421f81(0x106)]===0x0)_0x976cdf=null;return[_0x2a7dd4,_0x976cdf];};function _0x120dce(_0x41fcb1,_0x5cafde){const _0x319cc1=_0x576821;let _0x5662c0=0x0;for(let _0x3a3436=0x0;_0x3a3436<_0x41fcb1[_0x319cc1(0x106)];_0x3a3436++){_0x41fcb1[_0x319cc1(0xfa)](_0x3a3436)===_0x5cafde&&(_0x5662c0+=0x1);}return _0x5662c0;}const _0x3ff864=(_0x1865e4,_0x4975c3)=>{const _0x5edcc7=_0x576821;if(typeof _0x1865e4!==_0x5edcc7(0x1b5)||typeof _0x4975c3!==_0x5edcc7(0x1b5))return _0x1865e4;if(_0x1865e4[_0x5edcc7(0x106)]===0x1)return _0x1865e4;if(_0x4975c3[_0x5edcc7(0x106)]!==0x1)return _0x1865e4;return _0x1865e4=_0x1865e4['trim'](),_0x1865e4['substring'](0x0,0x1)===_0x4975c3&&(_0x1865e4=_0x1865e4[_0x5edcc7(0xf0)](0x1)),_0x1865e4['substring'](_0x1865e4[_0x5edcc7(0x106)]-0x1)===_0x4975c3&&(_0x1865e4=_0x1865e4['substring'](0x0,_0x1865e4[_0x5edcc7(0x106)]-0x1)),_0x1865e4;},_0x2865b8=async(_0x11138d,_0x385a69,_0x2e4f82,_0x2ed6b7)=>{const _0x152a2e=_0x576821;if(!_0x385a69||!_0x2e4f82||!_0x2ed6b7)return null;const [_0x1f905d,_0xd0e325]=_0x1688ba(_0x2ed6b7);if(!_0x1f905d||!_0xd0e325){const _0x2b2585=_0x2ed6b7[_0x152a2e(0x1c3)]('(');if(_0x2b2585[_0x152a2e(0x106)]>0x1){const _0x176e91=[_0x152a2e(0x144),'uppercase','firstn',_0x152a2e(0x126),_0x152a2e(0x11a),_0x152a2e(0x11c),_0x152a2e(0x135),_0x152a2e(0x17c),_0x152a2e(0x1e4)],_0x1192c4=_0x2b2585[0x0][_0x152a2e(0x1e8)]();if(_0x176e91[_0x152a2e(0xf1)](_0x1192c4))return null;}return _0x2ed6b7;}for(let _0x27b3cc=0x0;_0x27b3cc<_0xd0e325[_0x152a2e(0x106)];_0x27b3cc++){if(_0xd0e325[_0x27b3cc][_0x152a2e(0xf0)](0x0,0x1)==='['){const _0x169c07=_0xd0e325[_0x27b3cc][_0x152a2e(0x122)](']');if(_0x169c07<0x0)return null;const _0x5a6ea5=_0xd0e325[_0x27b3cc]['substring'](0x1,_0x169c07),_0x11f5cd=_0x5a6ea5['split']('.');let _0x88f068;for(let _0x19d23d=0x0;_0x19d23d<_0x11f5cd['length'];_0x19d23d++){if(_0x19d23d===0x0)_0x88f068=_0x385a69[_0x11f5cd[_0x19d23d]];else{if(!_0x88f068)return null;_0x88f068=_0x88f068[_0x11f5cd[_0x19d23d]];}}if(!_0x88f068)return null;_0xd0e325[_0x27b3cc]=_0x88f068;}}for(let _0x4b64c2=0x0;_0x4b64c2<_0xd0e325['length'];_0x4b64c2++){const [_0x2ce42b]=_0x1688ba(_0xd0e325[_0x4b64c2]);_0x2ce42b&&(_0xd0e325[_0x4b64c2]=await _0x2865b8(_0x11138d,_0x385a69,_0x2e4f82,_0xd0e325[_0x4b64c2]));}if(_0xd0e325[0x0]===null)return null;switch(_0x1f905d[_0x152a2e(0x1e8)]()){case _0x152a2e(0x144):{if(_0xd0e325[_0x152a2e(0x106)]!==0x1)return null;const [_0x5d5af8]=_0x1688ba(_0xd0e325[0x0]);if(_0x5d5af8)_0xd0e325[0x0]=await _0x2865b8(_0x11138d,_0x385a69,_0x2e4f82,_0x5d5af8);if(_0xd0e325[0x0]===null)return null;return _0xd0e325[0x0]['toLowerCase']();}case'uppercase':{if(_0xd0e325[_0x152a2e(0x106)]!==0x1)return null;const [_0x380077]=_0x1688ba(_0xd0e325[0x0]);if(_0x380077)_0xd0e325[0x0]=await _0x2865b8(_0x11138d,_0x385a69,_0x2e4f82,_0x380077);if(_0xd0e325[0x0]===null)return null;return _0xd0e325[0x0][_0x152a2e(0x1da)]();}case'firstn':{if(_0xd0e325[_0x152a2e(0x106)]!==0x2)return null;const [_0x1a7fb8]=_0x1688ba(_0xd0e325[0x0]);if(_0x1a7fb8)_0xd0e325[0x0]=await _0x2865b8(_0x11138d,_0x385a69,_0x2e4f82,_0x1a7fb8);if(_0xd0e325[0x0]===null)return null;if(isNaN(_0xd0e325[0x1]))return null;return _0xd0e325[0x0][_0x152a2e(0xf0)](0x0,_0xd0e325[0x1]);}case _0x152a2e(0x126):{const [_0x3ae8ec]=_0x1688ba(_0xd0e325[0x0]);if(_0xd0e325['length']<0x2)return null;if(_0x3ae8ec)_0xd0e325[0x0]=await _0x2865b8(_0x11138d,_0x385a69,_0x2e4f82,_0x3ae8ec);if(_0xd0e325[0x0]===null)return null;const _0x4a552a=_0xd0e325[0x1];if(isNaN(_0x4a552a))return null;let _0x46f541;if(_0xd0e325[_0x152a2e(0x106)]===0x3)_0x46f541=_0xd0e325[0x0]['split'](_0xd0e325[0x2]);else _0x46f541=_0x46f541=_0xd0e325[0x0][_0x152a2e(0x1c3)]('\x20');if(_0x4a552a<=_0x46f541[_0x152a2e(0x106)])return _0x46f541[_0x4a552a-0x1];else return'';}case _0x152a2e(0x11c):{const [_0x61582e]=_0x1688ba(_0xd0e325[0x0]);if(_0x61582e)_0xd0e325[0x0]=await _0x2865b8(_0x11138d,_0x385a69,_0x2e4f82,_0x61582e);if(_0xd0e325[0x0]===null)return null;if(_0xd0e325[_0x152a2e(0x106)]!==0x3)return null;return _0xd0e325[0x0][_0x152a2e(0x182)](_0xd0e325[0x1],_0xd0e325[0x2]);}case _0x152a2e(0x135):{if(_0xd0e325[_0x152a2e(0x106)]!==0x1)return null;const [_0x2f909e]=_0x1688ba(_0xd0e325[0x0]);if(_0x2f909e)_0xd0e325[0x0]=await _0x2865b8(_0x11138d,_0x385a69,_0x2e4f82,_0x2f909e);if(_0xd0e325[0x0]===null)return null;return a0_0x15849a[_0x152a2e(0xf6)](_0xd0e325[0x0]);}case _0x152a2e(0x11a):{let _0x322a8a='';for(let _0x376337=0x0;_0x376337<_0xd0e325[_0x152a2e(0x106)];_0x376337++){const [_0x5292ce]=_0x1688ba(_0xd0e325[_0x376337]);if(_0x5292ce)_0xd0e325[_0x376337]=await _0x2865b8(_0x11138d,_0x385a69,_0x2e4f82,_0x5292ce);if(_0xd0e325[_0x376337]===null)return null;_0x322a8a+=_0xd0e325[_0x376337];}return _0x322a8a;}case _0x152a2e(0x17c):{if(_0xd0e325['length']>0x2)return null;const [_0x394058]=_0x1688ba(_0xd0e325[0x0]);if(_0x394058)_0xd0e325[0x0]=await _0x2865b8(_0x11138d,_0x385a69,_0x2e4f82,_0x394058);if(_0xd0e325[0x0]===null)return null;const _0x3a8f3b=parseInt(_0xd0e325[0x0]);if(isNaN(_0x3a8f3b))return null;let _0x4b829d='##doIncrement';_0x4b829d+=','+_0xd0e325[0x0];if(_0xd0e325['length']===0x2&&_0xd0e325[0x1][_0x152a2e(0x1e8)]()===_0x152a2e(0x14c))_0x4b829d+=_0x152a2e(0x1a4);else _0x4b829d+=_0x152a2e(0x116);return _0x4b829d+='##',_0x4b829d;}case _0x152a2e(0x1e4):{if(_0xd0e325[_0x152a2e(0x106)]!==0x1)return null;const [_0x24c038]=_0x1688ba(_0xd0e325[0x0]);if(_0x24c038)_0xd0e325[0x0]=await _0x2865b8(_0x11138d,_0x385a69,_0x2e4f82,_0x24c038);if(_0xd0e325[0x0]===null)return null;let _0x29c337,_0x44c28d=![],_0x4cbf9a='';const _0x315897=_0xd0e325[0x0]['split']('##');if(_0x315897[_0x152a2e(0x106)]>0x2)for(let _0x5bf13c=0x0;_0x5bf13c<_0x315897['length'];_0x5bf13c++){if(_0x315897[_0x5bf13c][_0x152a2e(0x180)]('doIncrement')){const _0x5b921e=_0x315897[_0x5bf13c][_0x152a2e(0x1c3)](',');if(_0x5b921e[_0x152a2e(0x106)]<0x2)return null;const _0x13ec64=parseInt(_0x5b921e[0x1]);if(isNaN(_0x13ec64))return null;_0x4cbf9a='##'+_0x315897[_0x5bf13c]+'##',_0x29c337=_0x5b921e[0x1],_0x5b921e[_0x152a2e(0x106)]>0x2&&(_0x44c28d=_0x5b921e[0x2][_0x152a2e(0x1e8)]()===_0x152a2e(0x14c));}}let _0x4f37e0,_0x58d535=0x0,_0x2347c3=0x0;if(_0x29c337){_0x2347c3=_0x29c337[_0x152a2e(0x106)],_0x58d535=0xa;for(let _0x2fbf64=0x1;_0x2fbf64<_0x2347c3;_0x2fbf64++){_0x58d535*=0xa;}_0x58d535-=0x1,_0x4f37e0=parseInt(_0x29c337);if(isNaN(_0x4f37e0))return null;_0x4f37e0-=0x1;}else _0x4f37e0=0x0;do{_0x4f37e0+=0x1;let _0x1512d8=_0xd0e325[0x0];if(_0x29c337!==undefined&&_0x4cbf9a){let _0x4cfc5e=_0x4f37e0['toString']();while(_0x4cfc5e[_0x152a2e(0x106)]<_0x2347c3){_0x4cfc5e='0'+_0x4cfc5e;}_0x44c28d?_0x1512d8=_0x1512d8[_0x152a2e(0x11c)](_0x4cbf9a,_0x4cfc5e):(_0x1512d8=_0x1512d8[_0x152a2e(0x11c)](_0x4cbf9a,''),_0x44c28d=!![],_0x4f37e0-=0x1);}try{const _0x17a3d8=await _0x53ada3(_0x11138d,_0x2e4f82,_0x1512d8);if(!_0x17a3d8)return _0x1512d8;}catch(_0x293a6e){return _0x6c3bac[_0x152a2e(0x16d)][_0x152a2e(0x1c8)](_0x6c3bac[_0x152a2e(0x194)]+'['+_0x6c3bac[_0x152a2e(0x193)]+']\x20'+_0x1f905d+_0x152a2e(0x12f)+_0x293a6e[_0x152a2e(0x17e)]),null;}}while(_0x4f37e0<_0x58d535);return null;}default:}return null;},_0x11ce40=async(_0x524b83,_0x46bfe3)=>{const _0x3ae344=_0x576821;for(const _0x22d61c in _0x46bfe3){const _0x27a394=_0x46bfe3[_0x22d61c],[_0x2e80eb,_0x362945]=_0x1688ba(_0x27a394);if(_0x2e80eb){const _0x372e83=''+_0x22d61c,_0x2d5339=_0x2e80eb+'('+_0x362945[_0x3ae344(0x11a)](',')+')',_0x4d6396=await _0x2865b8(_0x524b83,_0x46bfe3,_0x372e83,_0x2d5339);if(_0x4d6396===null)delete _0x46bfe3[_0x22d61c];else _0x46bfe3[_0x22d61c]=_0x4d6396;}for(const _0xec2e5 in _0x27a394){const _0x13d2f0=_0x27a394[_0xec2e5],[_0x1d2305,_0x5eb2ef]=_0x1688ba(_0x13d2f0);if(_0x1d2305){const _0x10e852=_0x22d61c+'.'+_0xec2e5,_0x21c32f=_0x1d2305+'('+_0x5eb2ef[_0x3ae344(0x11a)](',')+')',_0x29749b=await _0x2865b8(_0x524b83,_0x46bfe3,_0x10e852,_0x21c32f);if(_0x29749b===null)delete _0x27a394[_0xec2e5];else _0x27a394[_0xec2e5]=_0x29749b;}}}return _0x46bfe3;};}}function a0_0xb16d(_0x207a7c,_0x13d1c0){const _0x4ebe68=a0_0x4ebe();return a0_0xb16d=function(_0xb16d14,_0x56d99e){_0xb16d14=_0xb16d14-0xe2;let _0x2555ee=_0x4ebe68[_0xb16d14];return _0x2555ee;},a0_0xb16d(_0x207a7c,_0x13d1c0);}export class Publisher{constructor(_0x37c773){const _0x2b202e=a0_0xb16d,_0x2a6e0f=_0x37c773,_0x3e6888={},_0x305537=async(_0x357da7,_0x2043ca)=>{const _0x4e7c19=a0_0xb16d,_0x5074ad=_0x3e6888[_0x357da7][_0x4e7c19(0x1cb)]?.[_0x4e7c19(0x16b)]?.[_0x4e7c19(0x12d)];let _0x137331=0x0;for await(const _0x2340c8 of _0x2043ca[_0x4e7c19(0x13c)]()){switch(_0x2340c8['type']){case _0x4e7c19(0x1b7):_0x2a6e0f[_0x4e7c19(0x16d)][_0x4e7c19(0x1c8)](_0x2a6e0f[_0x4e7c19(0x194)]+'['+_0x2a6e0f['pluginName']+_0x4e7c19(0x1d0)+_0x357da7+']['+_0x5074ad+']\x20client\x20disconnected\x20'+_0x2340c8[_0x4e7c19(0x1c1)]+_0x4e7c19(0x1de)),_0x137331=0x0;break;case _0x4e7c19(0x1be):_0x2a6e0f[_0x4e7c19(0x16d)][_0x4e7c19(0x17d)](_0x2a6e0f[_0x4e7c19(0x194)]+'['+_0x2a6e0f[_0x4e7c19(0x193)]+']\x20publisher['+_0x357da7+']['+_0x5074ad+_0x4e7c19(0x184)+_0x2340c8[_0x4e7c19(0x1c1)]);break;case _0x4e7c19(0x1c8):_0x2a6e0f[_0x4e7c19(0x16d)]['error'](_0x2a6e0f[_0x4e7c19(0x194)]+'['+_0x2a6e0f[_0x4e7c19(0x193)]+']\x20publisher['+_0x357da7+']['+_0x5074ad+_0x4e7c19(0x1c0)+_0x2340c8[_0x4e7c19(0x1c1)]);break;case _0x4e7c19(0x103):_0x137331+=0x1;_0x137331%0x1e===0x0&&_0x2a6e0f[_0x4e7c19(0x16d)][_0x4e7c19(0x129)](_0x2a6e0f['gwName']+'['+_0x2a6e0f[_0x4e7c19(0x193)]+_0x4e7c19(0x1d0)+_0x357da7+']['+_0x5074ad+_0x4e7c19(0x1bc)+_0x2340c8['data']+_0x4e7c19(0x186)+_0x137331+')');break;case'staleConnection':_0x2a6e0f[_0x4e7c19(0x16d)]['debug'](_0x2a6e0f[_0x4e7c19(0x194)]+'['+_0x2a6e0f[_0x4e7c19(0x193)]+_0x4e7c19(0x1d0)+_0x357da7+']['+_0x5074ad+_0x4e7c19(0xe9)+_0x2340c8[_0x4e7c19(0x1c1)]);break;}}},_0x330396=async(_0x34a171,_0x134916)=>{const _0xfd622d=a0_0xb16d,_0x1e247a=_0x3e6888[_0x34a171][_0xfd622d(0x1cb)]?.[_0xfd622d(0x16b)]?.[_0xfd622d(0x12d)];let _0x2d02ee;try{_0x2d02ee=await a0_0x1eb4cc(_0x134916);if(_0x2d02ee[_0xfd622d(0x17d)][_0xfd622d(0x1c5)]!==_0xfd622d(0x1ba)){_0x2d02ee[_0xfd622d(0x1d3)]();return;}_0x3e6888[_0x34a171]['nc']=_0x2d02ee,_0x305537(_0x34a171,_0x2d02ee);}catch(_0x177d35){_0x2a6e0f[_0xfd622d(0x16d)][_0xfd622d(0x1c8)](_0x2a6e0f['gwName']+'['+_0x2a6e0f[_0xfd622d(0x193)]+_0xfd622d(0x1d0)+_0x34a171+']['+_0x1e247a+_0xfd622d(0xe2)+_0x177d35[_0xfd622d(0x17e)]+_0xfd622d(0x1dc)),_0x134916[_0xfd622d(0x1d6)]=!![];try{_0x2d02ee=await a0_0x1eb4cc(_0x134916);if(_0x2d02ee[_0xfd622d(0x17d)]['server_name']!==_0xfd622d(0x1ba)){_0x2d02ee[_0xfd622d(0x1d3)]();return;}_0x3e6888[_0x34a171]['nc']=_0x2d02ee,_0x305537(_0x34a171,_0x2d02ee);}catch(_0x3206c5){_0x2a6e0f[_0xfd622d(0x16d)]['error'](_0x2a6e0f[_0xfd622d(0x194)]+'['+_0x2a6e0f[_0xfd622d(0x193)]+_0xfd622d(0x1d0)+_0x34a171+']['+_0x1e247a+_0xfd622d(0xe2)+_0x3206c5['message']);return;}}_0x2a6e0f['logger'][_0xfd622d(0x129)](_0x2a6e0f[_0xfd622d(0x194)]+'['+_0x2a6e0f[_0xfd622d(0x193)]+']\x20publisher['+_0x34a171+']['+_0x1e247a+']\x20connected\x20'+(_0x134916[_0xfd622d(0x1e0)]['ca']?'tls':'')+'\x20'+_0x2d02ee['getServer']()),_0x2d02ee[_0xfd622d(0x1a7)]()[_0xfd622d(0x110)](_0x13a29d=>{const _0x35c46a=_0xfd622d;_0x13a29d&&_0x2a6e0f[_0x35c46a(0x16d)]['error'](_0x2a6e0f[_0x35c46a(0x194)]+'['+_0x2a6e0f[_0x35c46a(0x193)]+_0x35c46a(0x1d0)+_0x34a171+']['+_0x1e247a+_0x35c46a(0x170)+_0x13a29d[_0x35c46a(0x17e)]);});};this[_0x2b202e(0x1a9)]=async(_0x6d4e4b,_0x5620cc)=>{const _0x36eb5b=_0x2b202e;if(!_0x5620cc?.[_0x36eb5b(0x16b)]){_0x2a6e0f['logger'][_0x36eb5b(0x1c8)](_0x2a6e0f['gwName']+'['+_0x2a6e0f[_0x36eb5b(0x193)]+']\x20publisher['+_0x6d4e4b+_0x36eb5b(0x195));return;}if(!_0x5620cc?.[_0x36eb5b(0x16b)]?.[_0x36eb5b(0x109)]){_0x2a6e0f[_0x36eb5b(0x16d)][_0x36eb5b(0x1c8)](_0x2a6e0f['gwName']+'['+_0x2a6e0f[_0x36eb5b(0x193)]+_0x36eb5b(0x1d0)+_0x6d4e4b+_0x36eb5b(0x1aa));return;}if(!_0x5620cc?.[_0x36eb5b(0x16b)]?.[_0x36eb5b(0x12d)]){_0x2a6e0f['logger'][_0x36eb5b(0x1c8)](_0x2a6e0f[_0x36eb5b(0x194)]+'['+_0x2a6e0f[_0x36eb5b(0x193)]+_0x36eb5b(0x1d0)+_0x6d4e4b+']\x20initialization\x20error:\x20missing\x20configuration\x20nats.subject');return;}if(!_0x5620cc?.[_0x36eb5b(0x16b)]?.[_0x36eb5b(0x12d)][_0x36eb5b(0x180)](_0x36eb5b(0x14d))){_0x2a6e0f[_0x36eb5b(0x16d)][_0x36eb5b(0x1c8)](_0x2a6e0f['gwName']+'['+_0x2a6e0f[_0x36eb5b(0x193)]+_0x36eb5b(0x1d0)+_0x6d4e4b+_0x36eb5b(0x14e));return;}if(!_0x5620cc[_0x36eb5b(0x128)]||!Array['isArray'](_0x5620cc[_0x36eb5b(0x128)])||_0x5620cc[_0x36eb5b(0x128)]['length']<0x1){_0x2a6e0f[_0x36eb5b(0x16d)][_0x36eb5b(0x1c8)](_0x2a6e0f[_0x36eb5b(0x194)]+'['+_0x2a6e0f['pluginName']+_0x36eb5b(0x1d0)+_0x6d4e4b+_0x36eb5b(0x1e3));return;}if(!_0x5620cc?.['certificate']?.['ca']){_0x2a6e0f[_0x36eb5b(0x16d)][_0x36eb5b(0x1c8)](_0x2a6e0f['gwName']+'['+_0x2a6e0f[_0x36eb5b(0x193)]+_0x36eb5b(0x1d0)+_0x6d4e4b+_0x36eb5b(0x1cf));return;}const _0x2a4cf7={};try{let _0x154206=a0_0x31a0e9['join'](_0x2a6e0f['configDir'],_0x36eb5b(0x1e1),_0x5620cc?.['certificate']?.['ca']||_0x36eb5b(0xe5));(_0x5620cc?.[_0x36eb5b(0x173)]?.['ca']?.['startsWith']('/')||_0x5620cc?.['certificate']?.['ca']?.[_0x36eb5b(0xf1)]('\x5c'))&&(_0x154206=_0x5620cc[_0x36eb5b(0x173)]['ca']),_0x2a4cf7['ca']=[a0_0x5517ab[_0x36eb5b(0x10a)](_0x154206)],_0x2a4cf7[_0x36eb5b(0x1ca)]=!![];}catch(_0x307d4e){_0x2a6e0f['logger'][_0x36eb5b(0x1c8)](_0x2a6e0f[_0x36eb5b(0x194)]+'['+_0x2a6e0f[_0x36eb5b(0x193)]+_0x36eb5b(0x1d0)+_0x6d4e4b+_0x36eb5b(0x196)+_0x307d4e[_0x36eb5b(0x17e)]);return;}const _0xae1db2={},_0x509c6d=new TextEncoder()[_0x36eb5b(0x171)](_0x5620cc?.[_0x36eb5b(0x16b)]?.[_0x36eb5b(0x1d9)]),_0x5b7d3d=_0x5620cc?.[_0x36eb5b(0x16b)]?.[_0x36eb5b(0x114)];_0xae1db2['authenticator']=jwtAuthenticator(_0x5b7d3d,_0x509c6d),_0xae1db2['servers']=_0x5620cc[_0x36eb5b(0x128)],_0xae1db2[_0x36eb5b(0x1e0)]=_0x2a4cf7,_0xae1db2[_0x36eb5b(0x1d6)]=![],_0xae1db2[_0x36eb5b(0x1be)]=!![],_0xae1db2[_0x36eb5b(0x1e5)]=0x3e8*0xa,_0xae1db2[_0x36eb5b(0x1b3)]=-0x1,_0xae1db2[_0x36eb5b(0x176)]=0x2*0x3c*0x3e8,_0xae1db2[_0x36eb5b(0x179)]=0x5,_0xae1db2[_0x36eb5b(0x129)]=![],_0x3e6888[_0x6d4e4b]={},_0x3e6888[_0x6d4e4b]['config']=_0x5620cc,_0x3e6888[_0x6d4e4b]['nc']=undefined,_0x330396(_0x6d4e4b,_0xae1db2);},this[_0x2b202e(0x1b4)]=async _0x2ab967=>{const _0x487da8=_0x2b202e;let _0x494527;try{if(_0x2ab967[_0x487da8(0x147)]===Object){_0x494527=_0x2ab967[_0x487da8(0x174)];if(!_0x494527)_0x2ab967[_0x487da8(0x174)]=_0x487da8(0xfc);_0x2ab967=JSON['stringify'](_0x2ab967);}else{const _0x4a646f=JSON[_0x487da8(0x108)](_0x2ab967);_0x494527=_0x4a646f[_0x487da8(0x174)];}}catch(_0x37b689){throw new Error(_0x487da8(0xeb)+_0x494527+_0x487da8(0x10e));}if(!_0x3e6888[_0x494527])throw new Error(_0x487da8(0xeb)+_0x494527+_0x487da8(0x12a)+_0x494527);const _0x83ed7a=headers();_0x83ed7a[_0x487da8(0x1bb)](_0x487da8(0x159),a0_0xf9b720['randomUUID']());let _0x3ef29a;try{if(!_0x3e6888[_0x494527]['nc'])throw new Error(_0x487da8(0x15c));_0x3ef29a=await _0x3e6888[_0x494527]['nc'][_0x487da8(0x185)](_0x3e6888[_0x494527][_0x487da8(0x1cb)]?.[_0x487da8(0x16b)]?.['subject'],_0x2ab967,{'headers':_0x83ed7a});}catch(_0x5aeece){if(_0x5aeece['message']===_0x487da8(0x18c))throw new Error(_0x487da8(0xeb)+_0x494527+_0x487da8(0x138)+_0x3e6888[_0x494527][_0x487da8(0x1cb)]?.[_0x487da8(0x16b)]?.[_0x487da8(0x12d)]);else throw new Error(_0x487da8(0xeb)+_0x494527+_0x487da8(0x12b)+_0x5aeece['message']);}let _0x36f94b;try{_0x36f94b=JSON['parse'](_0x3ef29a[_0x487da8(0x1b5)]());}catch(_0x1de63d){throw new Error(_0x487da8(0xec)+_0x3ef29a[_0x487da8(0x1b5)]());}if(_0x36f94b?.[_0x487da8(0x1c8)]){const _0xbc1f36=new Error(_0x487da8(0x10f)+_0x36f94b[_0x487da8(0x1c8)]);_0xbc1f36[_0x487da8(0x1a2)]=_0x36f94b['errName'];throw _0xbc1f36;}return _0x36f94b;},process['on'](_0x2b202e(0x105),async()=>{const _0x4a813d=_0x2b202e;for(const _0x5dfdf7 in _0x3e6888){_0x3e6888[_0x5dfdf7]['nc']&&!_0x3e6888[_0x5dfdf7]['nc']['isClosed']()&&await _0x3e6888[_0x5dfdf7]['nc'][_0x4a813d(0x134)]();}}),process['on'](_0x2b202e(0x146),async()=>{const _0x19bd8f=_0x2b202e;for(const _0x35271a in _0x3e6888){_0x3e6888[_0x35271a]['nc']&&!_0x3e6888[_0x35271a]['nc'][_0x19bd8f(0x15a)]()&&await _0x3e6888[_0x35271a]['nc']['drain']();}});}}export const getAppRoles=async(_0xf04722,_0x561713)=>{const _0x5b993d=a0_0xb16d,_0x192e78=_0x5b993d(0x1ac),_0x20e2aa=_0xf04722;_0x20e2aa[_0x5b993d(0x16d)][_0x5b993d(0x129)](_0x20e2aa[_0x5b993d(0x194)]+'['+_0x20e2aa[_0x5b993d(0x193)]+_0x5b993d(0x14a)+_0x192e78+'\x22');try{if(!a0_0x5517ab['existsSync'](_0x20e2aa[_0x5b993d(0x19e)]+'/approles'))a0_0x5517ab[_0x5b993d(0x104)](_0x20e2aa[_0x5b993d(0x19e)]+_0x5b993d(0x18b));}catch(_0x3b8198){void 0x0;}const _0x1cb423=a0_0x31a0e9[_0x5b993d(0x11a)](''+_0x20e2aa['configDir'],_0x5b993d(0x12e),'approles_'+_0x20e2aa[_0x5b993d(0x193)]+_0x5b993d(0x100)),_0x101a6c={};a0_0x2da0c2['fsExistsSync'](_0x1cb423)&&a0_0x5517ab[_0x5b993d(0x10a)](_0x1cb423,_0x5b993d(0xee))[_0x5b993d(0x1c3)](/\r?\n/)[_0x5b993d(0x136)](_0x5327ce=>{const _0x16423a=_0x5b993d,_0x72ef1d=_0x5327ce[_0x16423a(0x1c3)]('\x20');_0x72ef1d['length']===0x2&&(_0x101a6c[_0x72ef1d[0x0]]=_0x72ef1d[0x1]);});const _0x4e5606=a0_0x5517ab[_0x5b993d(0xfd)](_0x1cb423,{'flags':'w','encoding':_0x5b993d(0x120),'mode':0x1b6,'autoClose':!![]}),_0x537233=[],_0x3ccbb9=await _0x20e2aa[_0x5b993d(0x143)](_0x561713,{'attribute':undefined,'operator':undefined,'value':undefined},['id',_0x5b993d(0x1b9)]);return _0x3ccbb9[_0x5b993d(0x127)][_0x5b993d(0x136)](_0x31e6c1=>{const _0xa0cd82=_0x5b993d;if(_0x31e6c1['id']){let _0x574da8=a0_0xf9b720[_0xa0cd82(0x142)]();if(_0x101a6c[_0x31e6c1['id']])_0x574da8=_0x101a6c[_0x31e6c1['id']];const _0x1f73fd={'allowedMemberTypes':[_0xa0cd82(0xff)],'description':_0xa0cd82(0x19b),'displayName':_0x31e6c1[_0xa0cd82(0x1b9)]||_0x31e6c1['id'],'id':_0x574da8,'isEnabled':!![],'lang':null,'origin':'Application','value':decodeURIComponent(_0x31e6c1['id'])};_0x537233[_0xa0cd82(0x1d5)](_0x1f73fd),_0x4e5606[_0xa0cd82(0x137)](_0x31e6c1['id']+'\x20'+_0x574da8+'\x0a');}}),_0x4e5606['close'](),_0x20e2aa[_0x5b993d(0x16d)][_0x5b993d(0x129)](_0x20e2aa[_0x5b993d(0x194)]+'['+_0x20e2aa[_0x5b993d(0x193)]+']\x20approle\x20uuid\x20file\x20created:\x20'+_0x1cb423),{'Resources':[{'appRoles':_0x537233}]};};
@@ -8,8 +8,6 @@
8
8
  // Optional SCIM Stream subscriber/publisher
9
9
  // =================================================================================
10
10
 
11
- 'use strict'
12
-
13
11
  import { createServer as httpCreateServer } from 'node:http'
14
12
  import { createServer as httpsCreateServer } from 'node:https'
15
13
  import { type IncomingMessage, type ServerResponse } from 'node:http'
@@ -410,41 +408,43 @@ export class ScimGateway {
410
408
  if (!this.config.scimgateway.email.auth) this.config.scimgateway.email.auth = {}
411
409
  if (!this.config.scimgateway.email.auth.options) this.config.scimgateway.email.auth.options = {}
412
410
  if (!this.config.scimgateway.email.emailOnError) this.config.scimgateway.email.emailOnError = {}
411
+ if (!this.config.scimgateway.email.emailOnError) this.config.scimgateway.email.proxy = {}
413
412
 
414
413
  if (!this.config.scimgateway.stream) this.config.scimgateway.stream = {}
415
414
  if (!this.config.scimgateway.stream.subscriber) this.config.scimgateway.stream.subscriber = {}
416
415
  if (!this.config.scimgateway.stream.publisher) this.config.scimgateway.stream.publisher = {}
417
416
 
418
417
  // start - legacy support
419
- if (!this.config.scimgateway.emailOnError) this.config.scimgateway.emailOnError = {}
420
- if (!this.config.scimgateway.emailOnError.smtp) this.config.scimgateway.emailOnError.smtp = {}
421
- if (this.config.scimgateway.emailOnError.smtp.host) {
422
- this.config.scimgateway.email.host = this.config.scimgateway.emailOnError.smtp.host
418
+ if (this.config.scimgateway?.emailOnError?.smtp?.host) {
419
+ this.config.scimgateway.email.auth.options.host = this.config.scimgateway.emailOnError.smtp.host
423
420
  }
424
- if (this.config.scimgateway.emailOnError.smtp.port) {
425
- this.config.scimgateway.email.port = this.config.scimgateway.emailOnError.smtp.port
421
+ if (this.config.scimgateway?.emailOnError?.smtp?.port) {
422
+ this.config.scimgateway.email.auth.options.port = this.config.scimgateway.emailOnError.smtp.port
426
423
  }
427
- if (this.config.scimgateway.emailOnError.smtp.proxy) {
424
+ if (this.config.scimgateway?.emailOnError?.smtp?.proxy) {
428
425
  this.config.scimgateway.email.proxy = this.config.scimgateway.emailOnError.smtp.proxy
429
426
  }
430
- if (this.config.scimgateway.emailOnError.smtp.username) {
427
+ if (this.config.scimgateway?.emailOnError?.smtp?.username) {
431
428
  this.config.scimgateway.email.emailOnError.from = this.config.scimgateway.emailOnError.smtp.username
432
429
  this.config.scimgateway.email.auth.options.username = this.config.scimgateway.emailOnError.smtp.username
433
430
  }
434
- if (this.config.scimgateway.emailOnError.smtp.password) {
431
+ if (this.config.scimgateway?.emailOnError?.smtp?.password) {
435
432
  this.config.scimgateway.email.auth.options.password = this.config.scimgateway.emailOnError.smtp.password
436
- this.config.scimgateway.email.auth.type = 'basic'
433
+ this.config.scimgateway.email.auth.type = 'smtp'
437
434
  }
438
- if (this.config.scimgateway.emailOnError.smtp.enabled) {
435
+ if (this.config.scimgateway?.emailOnError?.smtp?.enabled) {
439
436
  this.config.scimgateway.email.emailOnError.enabled = this.config.scimgateway.emailOnError.smtp.enabled
440
437
  }
441
- if (this.config.scimgateway.emailOnError.smtp.sendInterval) {
438
+ if (this.config.scimgateway?.emailOnError?.smtp?.sendInterval) {
442
439
  this.config.scimgateway.email.emailOnError.sendInterval = this.config.scimgateway.emailOnError.smtp.sendInterval
443
440
  }
444
- if (this.config.scimgateway.emailOnError.smtp.to) {
441
+ if (this.config.scimgateway?.emailOnError?.smtp?.subject) {
442
+ this.config.scimgateway.email.emailOnError.subject = this.config.scimgateway.emailOnError.smtp.subject
443
+ }
444
+ if (this.config.scimgateway?.emailOnError?.smtp?.to) {
445
445
  this.config.scimgateway.email.emailOnError.to = this.config.scimgateway.emailOnError.smtp.to
446
446
  }
447
- if (this.config.scimgateway.emailOnError.smtp.cc) {
447
+ if (this.config.scimgateway?.emailOnError?.smtp?.cc) {
448
448
  this.config.scimgateway.email.emailOnError.cc = this.config.scimgateway.emailOnError.smtp.cc
449
449
  }
450
450
  // end - legacy support
@@ -2659,12 +2659,8 @@ export class ScimGateway {
2659
2659
  setTimeout(function () { // release lock after "sendInterval" minutes
2660
2660
  isMailLock = false
2661
2661
  }, (this.config.scimgateway.email.emailOnError.sendInterval || 15) * 1000 * 60)
2662
- const msgHtml = `<html><body>
2663
- <p>${msg}</p>
2664
- <br>
2665
- <p><strong>This is an automatically generated email - please do NOT reply to this email or forward to others</strong></p>
2666
- </body></html>`
2667
2662
 
2663
+ const msgHtml = `<html><body><pre style="font-family: monospace; white-space: pre-wrap;">${msg}</pre><br/><p><strong>This is an automatically generated email - please do NOT reply to this email or forward to others</strong></p></body></html>`
2668
2664
  const msgObj = {
2669
2665
  from: this.config.scimgateway.email.emailOnError.from,
2670
2666
  to: this.config.scimgateway.email.emailOnError.to,
@@ -2949,33 +2945,24 @@ export class ScimGateway {
2949
2945
  logger.error(`${gwName}[${pluginName}] sendMail failed: missing or invalid msgObj argument`)
2950
2946
  return
2951
2947
  }
2948
+ if (!isHtml) {
2949
+ isHtml = true
2950
+ msgObj.content = `<html><body><pre style="font-family: monospace; white-space: pre-wrap;">${msgObj.content}</pre></body></html>`
2951
+ }
2952
2952
 
2953
2953
  if (authType === 'oauth') {
2954
2954
  if (!this.helperRest) this.helperRest = new HelperRest(this, { entity: { undefined: { connection: this.config.scimgateway.email } } })
2955
2955
  if (this.config.scimgateway.email.auth?.options?.tenantIdGUID) {
2956
- // Graph API
2957
- let content: string
2958
- if (isHtml) { // ExO workaround for national special caracters in html content - require singleValueExtendedProperties being used
2959
- var enc = new TextEncoder() // utf-8
2960
- const buf = enc.encode(msgObj.content)
2961
- content = new TextDecoder('windows-1252').decode(buf)
2962
- } else content = msgObj.content
2963
-
2956
+ // Microsoft Exchange Online (ExO) - using Graph API
2964
2957
  const emailMessage: Record<string, any> = {
2965
2958
  message: {
2966
2959
  subject: msgObj.subject ? msgObj.subject : 'SCIM Gateway message',
2967
2960
  body: {
2968
- content,
2961
+ content: msgObj.content,
2969
2962
  contentType: isHtml ? 'HTML' : 'Text',
2970
2963
  },
2971
2964
  toRecipients: [],
2972
2965
  ccRecipients: [],
2973
- singleValueExtendedProperties: [ // force using ExO header: Content-Type: text/plain; charset="utf-8"
2974
- {
2975
- id: 'Integer 0x3fde', // Content-Type header - can be verifed by checking raw mail
2976
- value: '65001', // text/plain; charset="utf-8"
2977
- },
2978
- ],
2979
2966
  },
2980
2967
  saveToSentItems: 'false',
2981
2968
  }
@@ -2985,7 +2972,7 @@ export class ScimGateway {
2985
2972
  for (let i = 0; i < arr.length; i++) {
2986
2973
  emailMessage.message.toRecipients.push({
2987
2974
  emailAddress: {
2988
- address: arr[i],
2975
+ address: arr[i].trim(),
2989
2976
  },
2990
2977
  })
2991
2978
  }
@@ -2995,7 +2982,7 @@ export class ScimGateway {
2995
2982
  for (let i = 0; i < arr.length; i++) {
2996
2983
  emailMessage.message.ccRecipients.push({
2997
2984
  emailAddress: {
2998
- address: arr[i],
2985
+ address: arr[i].trim(),
2999
2986
  },
3000
2987
  })
3001
2988
  }
@@ -3011,29 +2998,57 @@ export class ScimGateway {
3011
2998
  logger.error(`${gwName}[${pluginName}] sendMail subject '${emailMessage.message.subject}' sending failed: ${err.message}`)
3012
2999
  }
3013
3000
  return
3001
+ } else if (this.config.scimgateway.email.auth?.options?.serviceAccountKeyFile) {
3002
+ // Google Workspace Gmail
3003
+ if (!msgObj.to) msgObj.to = ''
3004
+ if (!msgObj.cc) msgObj.cc = ''
3005
+
3006
+ let mimeMessage = `From: ${msgObj.from}
3007
+ To: ${msgObj.to}
3008
+ Cc: ${msgObj.cc}
3009
+ Subject: ${msgObj.subject}
3010
+ MIME-Version: 1.0
3011
+ Content-Type: text/html; charset="UTF-8"
3012
+ Content-Transfer-Encoding: quoted-printable
3013
+
3014
+ `
3015
+ mimeMessage += msgObj.content
3016
+ const encodedMessage = btoa(mimeMessage)
3017
+ const emailMessage = { raw: encodedMessage }
3018
+ const path = `/gmail/v1/users/${msgObj.from}/messages/send`
3019
+ try { // using opt connection argument type=oauthJwtAssertion and options scope/subject because we want to keep simplified email.auth.type=oauth and options serviceAccountKeyFile
3020
+ await this.helperRest.doRequest('undefined', 'POST', path, emailMessage, null, { connection: { auth: { type: 'oauthJwtAssertion', options: { scope: 'https://www.googleapis.com/auth/gmail.send', subject: msgObj.from } } } })
3021
+ logger.debug(`${gwName}[${pluginName}] sendMail subject '${emailMessage}' sent to: ${msgObj.to}${(msgObj.cc) ? ',' + msgObj.cc : ''}`)
3022
+ } catch (err: any) {
3023
+ logger.error(`${gwName}[${pluginName}] sendMail subject '${emailMessage}' sending failed: ${err.message}`)
3024
+ }
3025
+ return
3014
3026
  }
3027
+ logger.error(`${gwName}[${pluginName}] sendMail error: type oauth supports only ExO (scimgateway.email.auth.options.tenantIdGUID) or Google Workspace Gmail (scimgateway.email.auth.options.serviceAccountKeyFile)`)
3028
+ return
3015
3029
  }
3016
3030
 
3017
- // nodemailer
3018
- if (!this.config.scimgateway?.email?.host) {
3019
- logger.error(`${gwName}[${pluginName}] sendMail subject '${msgObj.subject}' sending failed: some missing scimgateway.email configuration`)
3031
+ if (authType !== 'smtp') {
3032
+ logger.error(`${gwName}[${pluginName}] sendMail error: configuration scimgateway.email.auth.type must be set to oauth or smtp`)
3020
3033
  return
3021
3034
  }
3035
+
3036
+ // nodemailer - SMTP Auth
3022
3037
  const smtpConfig: { [key: string]: any } = {
3023
- host: this.config.scimgateway.email.host, // e.g. smtp.office365.com
3024
- port: this.config.scimgateway.email.port || 587,
3025
- proxy: this.config.scimgateway.email.proxy || null,
3026
- secure: (this.config.scimgateway.email.port === 465), // false on 25/587
3038
+ host: this.config.scimgateway?.email?.auth?.options?.host, // e.g. smtp.office365.com
3039
+ port: this.config.scimgateway?.email?.auth?.options?.port || 587,
3040
+ secure: (this.config.scimgateway?.email?.auth?.options?.port === 465), // false on 25/587
3027
3041
  tls: { ciphers: 'TLSv1.2' },
3042
+ proxy: this.config.scimgateway?.email?.proxy,
3028
3043
  }
3029
- if (authType) {
3030
- smtpConfig.auth = {}
3031
- if (authType === 'basic') {
3032
- smtpConfig.auth.user = this.config.scimgateway.email.auth.options.username
3033
- smtpConfig.auth.pass = this.config.scimgateway.email.auth.options.password
3034
- } else if (authType === 'oauth') {
3035
- smtpConfig.auth.type = 'OAuth2'
3036
- }
3044
+
3045
+ smtpConfig.auth = {}
3046
+ smtpConfig.auth.user = this.config.scimgateway?.email?.auth?.options?.username
3047
+ smtpConfig.auth.pass = this.config.scimgateway?.email?.auth?.options?.password
3048
+
3049
+ if (!this.config.scimgateway?.email?.auth?.options?.host || !this.config.scimgateway?.email?.auth?.options?.username) {
3050
+ logger.error(`${gwName}[${pluginName}] sendMail subject '${msgObj.subject}' sending error: missing scimgateway.email.options configuration for auth type smtp`)
3051
+ return
3037
3052
  }
3038
3053
 
3039
3054
  const transporter = nodemailer.createTransport(smtpConfig)
@@ -3045,20 +3060,6 @@ export class ScimGateway {
3045
3060
  subject: msgObj.subject ? msgObj.subject : 'SCIM Gateway message',
3046
3061
  }
3047
3062
 
3048
- if (authType === 'oauth') {
3049
- mailOptions.auth = {}
3050
- mailOptions.auth.user = msgObj.from
3051
- transporter.set('oauth2_provision_cb', async (user, renew, callback) => {
3052
- const aObj = await this.helperRest.getAccessToken('undefined')
3053
- const accessToken = aObj ? aObj?.access_token : null
3054
- if (!accessToken) {
3055
- return callback(new Error('missing access token'))
3056
- } else {
3057
- return callback(null, accessToken)
3058
- }
3059
- })
3060
- }
3061
-
3062
3063
  if (isHtml) mailOptions.html = msgObj.content
3063
3064
  else mailOptions.text = msgObj.content
3064
3065
 
@@ -3118,6 +3119,12 @@ export class ScimGateway {
3118
3119
  dotConfig[key] = keyFile
3119
3120
  const addKey = key.replace(`.${lastKey}`, '.publicKeyContent')
3120
3121
  dotConfig[addKey] = fs.readFileSync(keyFile)
3122
+ } else if (key.endsWith('.serviceAccountKeyFile')) { // Google Service Account Key json-file
3123
+ let keyFile = path.join(this.configDir, '/certs/', dotConfig[key])
3124
+ if (dotConfig[key].startsWith('/') || dotConfig[key].includes('\\')) {
3125
+ keyFile = dotConfig[key]
3126
+ }
3127
+ dotConfig[key] = keyFile
3121
3128
  }
3122
3129
 
3123
3130
  // process env, file and text
package/lib/utils-scim.ts CHANGED
@@ -1,5 +1,3 @@
1
- 'use strict'
2
-
3
1
  import { fileURLToPath } from 'url'
4
2
  import dot from 'dot-object'
5
3
  import fs from 'node:fs'
package/lib/utils.ts CHANGED
@@ -3,11 +3,8 @@
3
3
  //
4
4
  // Author: Jarle Elshaug
5
5
  //
6
- // Note, don't use arrow functions
7
6
  // ==================================
8
7
 
9
- 'use strict'
10
-
11
8
  import * as crypto from 'node:crypto'
12
9
  import id from 'node-machine-id'
13
10
  import fs from 'node:fs'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scimgateway",
3
- "version": "5.0.12",
3
+ "version": "5.0.14",
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)",
@@ -36,6 +36,9 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@ldapjs/asn1": "^2.0.0",
39
+ "@nats-io/jetstream": "^3.0.0-35",
40
+ "@nats-io/nats-core": "^3.0.0-48",
41
+ "@nats-io/transport-node": "^3.0.0-33",
39
42
  "@types/ldapjs": "^3.0.6",
40
43
  "@types/lokijs": "^1.5.14",
41
44
  "@types/tedious": "^4.0.14",
@@ -47,7 +50,6 @@
47
50
  "ldapjs": "^3.0.7",
48
51
  "lokijs": "^1.5.12",
49
52
  "mongodb": "^6.12.0",
50
- "nats": "^2.28.2",
51
53
  "node-machine-id": "1.1.12",
52
54
  "nodemailer": "^6.9.16",
53
55
  "passport": "^0.7.0",