piper-utils 1.1.66 → 1.1.68

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/bin/main.js CHANGED
@@ -95,6 +95,267 @@ async function assertCanWriteBookBusiness(access,businessId,{getPartnerById}={})
95
95
  */
96
96
  async function assertCanWriteOwnBusiness(access,businessId,{getPartnerById}={}){if(!access)throw _errorCodes.errorList.unauthorized;if("global"===access.level)return;if("partner"===access.level){if(await(0,_accessContext.ensurePartnerScope)(access,{getPartnerById}),!access.partnerBusinessId)throw{..._errorCodes.errorList.partnerNotConfigured};if(businessId!==access.partnerBusinessId)throw _errorCodes.errorList.unauthorized;return}throw _errorCodes.errorList.unauthorized},exports.stampOwnBusinessId=async function stampOwnBusinessId(access,body,{getPartnerById}={}){if(!access||"partner"!==access.level)return;if(body.businessId)return;await(0,_accessContext.ensurePartnerScope)(access,{getPartnerById}),body.businessId=access.partnerBusinessId}
97
97
  /***/;var _lodash=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(__webpack_require__(825)),_accessContext=__webpack_require__(62),_errorCodes=__webpack_require__(953)},
98
+ /***/179(__unused_webpack_module,exports,__webpack_require__){Object.defineProperty(exports,"__esModule",{value:!0}),exports.attachAudit=attachAudit,exports.auditMe=auditMe,exports.auditModels=void 0,exports.bindAuditRequest=
99
+ /**
100
+ * Bind per-request audit context for one or more models. Call this **once at
101
+ * the top of each route handler** that mutates an audited model.
102
+ *
103
+ * Resolves the acting user from the JWT claims on the event
104
+ * (via {@link getCurrentUser}) and reads the company `auditEnabled` flag from
105
+ * the `custom:SET` claim (via {@link getCompanySettings}). If the company has
106
+ * `auditEnabled: false` then no rows will be written for the bound models on
107
+ * this request.
108
+ *
109
+ * Audit is **off by default** for any model that has not been bound this
110
+ * request — a route that omits this call writes no audit rows.
111
+ *
112
+ * @example
113
+ * // src/customer/customerRoutes.js
114
+ * export async function updateCustomer(event) {
115
+ * checkModule('customer', event);
116
+ * const businessId = checkWriteAccess(event);
117
+ * bindAuditRequest(event, businessId, [Customer]);
118
+ * // ...mutate Customer here; rows are written automatically by hooks
119
+ * }
120
+ *
121
+ * @example
122
+ * // Bind several models in one call when a handler touches more than one
123
+ * bindAuditRequest(event, businessId, [Order, Payment, Receivable]);
124
+ *
125
+ * @param {import('aws-lambda').APIGatewayProxyEvent} event API Gateway event
126
+ * with `requestContext.authorizer.claims` (must include `email` and
127
+ * optionally `custom:UID`, `custom:SET`)
128
+ * @param {string|number} businessId business id this request acts on; stamped
129
+ * onto every audit row written for the bound models
130
+ * @param {Array<import('sequelize').ModelStatic<any>>} models Sequelize models
131
+ * to enable audit on for the duration of this request
132
+ * @returns {void}
133
+ * @see {@link bindAuditRequestForUser} - the equivalent for non-JWT contexts
134
+ * (webhooks, integration crons, Cognito triggers)
135
+ * @see {@link attachAudit} - one-time setup that creates the audit table
136
+ */
137
+ function bindAuditRequest(event,businessId,models){const user=(0,_requestResponse.getCurrentUser)(event),auditEnabled=!!((0,_accessRightsUtils.getCompanySettings)(event)||{}).auditEnabled;_lodash.default.forEach(models,model=>{
138
+ // Lazily ensure the audit table model + hooks are wired in this Lambda
139
+ // process. `attachAudit` is idempotent — first call registers, subsequent
140
+ // calls are no-ops. The returned sync() promise is intentionally not
141
+ // awaited; the table is expected to already exist from the migration
142
+ // Lambda, and the synchronous registration is what the request needs.
143
+ const attachPromise=attachAudit(model);attachPromise&&"function"==typeof attachPromise.catch&&attachPromise.catch(err=>console.error("attachAudit sync failed for",model.name,err)),modelOptions[model.name]={user,businessId,auditEnabled}})}
144
+ /**
145
+ * Bind per-request audit context for **system-driven flows** that do not carry
146
+ * an API Gateway JWT — for example, payment-gateway webhooks, integration
147
+ * crons (QuickBooks/Inbox/etc.), Cognito triggers, or batch jobs.
148
+ *
149
+ * Use {@link bindAuditRequest} instead whenever you have a JWT-authenticated
150
+ * API event; that path automatically resolves the user and the company's
151
+ * `auditEnabled` flag from claims.
152
+ *
153
+ * @example
154
+ * // payment webhook from the gateway — no JWT, but we still want audit
155
+ * import { systemUser } from '../user/user.js';
156
+ *
157
+ * export async function webhook(event) {
158
+ * const businessId = event.queryStringParameters.businessId;
159
+ * bindAuditRequestForUser(systemUser, businessId, [Order, Payment]);
160
+ * // ...mutate Order/Payment; audit rows are written by hooks
161
+ * }
162
+ *
163
+ * @example
164
+ * // turn audit OFF explicitly for a system flow that should not be audited
165
+ * bindAuditRequestForUser(systemUser, businessId, [Order], { auditEnabled: false });
166
+ *
167
+ * @param {{ username: string, id?: number }} user identity stamped onto each
168
+ * audit row's `changedByUser` field. Conventionally the `systemUser`
169
+ * constant exported from your service's user model
170
+ * @param {string|number} businessId business id this flow is acting on
171
+ * @param {Array<import('sequelize').ModelStatic<any>>} models Sequelize models
172
+ * to enable audit on
173
+ * @param {{ auditEnabled?: boolean }} [opts] when `auditEnabled` is `false`,
174
+ * binds context but suppresses writes; defaults to `true`
175
+ * @returns {void}
176
+ * @see {@link bindAuditRequest} - the JWT-driven equivalent for API handlers
177
+ */,exports.bindAuditRequestForUser=function bindAuditRequestForUser(user,businessId,models,opts={}){const auditEnabled=!1!==opts.auditEnabled;_lodash.default.forEach(models,model=>{
178
+ // See bindAuditRequest for why this is here.
179
+ const attachPromise=attachAudit(model);attachPromise&&"function"==typeof attachPromise.catch&&attachPromise.catch(err=>console.error("attachAudit sync failed for",model.name,err)),modelOptions[model.name]={user,businessId,auditEnabled}})}
180
+ /**
181
+ * Get the `<ModelName>Audit` Sequelize model that {@link attachAudit} created
182
+ * for a parent model. Returns `undefined` if audit was never attached.
183
+ *
184
+ * @example
185
+ * const audits = await findAll(getAuditModel(Customer), filter);
186
+ *
187
+ * @param {import('sequelize').ModelStatic<any>} model parent Sequelize model
188
+ * @returns {import('sequelize').ModelStatic<any> | undefined} the audit model,
189
+ * or `undefined` if {@link attachAudit} has not been called for this model
190
+ * @see {@link getAuditFilter} - companion filter builder for history queries
191
+ */,exports.decrementWithAudit=
192
+ /**
193
+ * Decrement an integer field on a Sequelize instance and write a matching
194
+ * audit row in the same call. Useful for inventory adjustments and other
195
+ * counter-style fields where Sequelize's plain `model.decrement()` would
196
+ * bypass the `afterUpdate` hook.
197
+ *
198
+ * The acting user and businessId come from whatever
199
+ * {@link bindAuditRequest} / {@link bindAuditRequestForUser} was called for
200
+ * this request. If audit is disabled for the model, the decrement still
201
+ * happens but no audit row is written.
202
+ *
203
+ * @example
204
+ * // release inventory on order release
205
+ * await decrementWithAudit('inventory', inventoryEntry, 'quantity', {
206
+ * by: item.quantity,
207
+ * transaction: t
208
+ * });
209
+ *
210
+ * @param {string} modelName name of the parent model (e.g. `'inventory'`)
211
+ * @param {import('sequelize').Model} model the Sequelize instance to mutate
212
+ * @param {string} field the integer/decimal field to decrement
213
+ * @param {{ by?: number, transaction?: import('sequelize').Transaction }} args
214
+ * passed straight through to Sequelize's `decrement()`; transaction is also
215
+ * propagated to the audit write
216
+ * @returns {Promise<import('sequelize').Model>} the updated instance (with
217
+ * `_changed` set on it so internal hooks can observe the change)
218
+ * @see {@link incrementWithAudit} - the +1 counterpart
219
+ */
220
+ async function decrementWithAudit(modelName,model,field,args){const r=await model.decrement(field,args);r._changed=[field];const options={};args.transaction&&(options.transaction=args.transaction);return await auditMe(modelName)(r,options),r}
221
+ /**
222
+ * Increment an integer field on a Sequelize instance and write a matching
223
+ * audit row in the same call. The mirror of {@link decrementWithAudit}.
224
+ *
225
+ * @example
226
+ * // restock from a receivable
227
+ * await incrementWithAudit('inventory', inventoryEntry, 'quantity', {
228
+ * by: item.quantity,
229
+ * transaction: t
230
+ * });
231
+ *
232
+ * @param {string} modelName name of the parent model (e.g. `'inventory'`)
233
+ * @param {import('sequelize').Model} model the Sequelize instance to mutate
234
+ * @param {string} field the integer/decimal field to increment
235
+ * @param {{ by?: number, transaction?: import('sequelize').Transaction }} args
236
+ * passed straight through to Sequelize's `increment()`; transaction is also
237
+ * propagated to the audit write
238
+ * @returns {Promise<import('sequelize').Model>} the updated instance
239
+ * @see {@link decrementWithAudit} - the -1 counterpart
240
+ */,exports.getAuditFilter=
241
+ /**
242
+ * Build a Sequelize `findAll`-style filter for an audit-history query, scoped
243
+ * to the businesses the caller is allowed to read (resolved from
244
+ * {@link accessRightsUtils}).
245
+ *
246
+ * The returned filter joins the parent model so callers can render `oldValue`
247
+ * → `newValue` rows in the UI alongside the parent record.
248
+ *
249
+ * @example
250
+ * // GET /customer/{id}/audit
251
+ * export async function getCustomerAudit(event) {
252
+ * bindAuditRequest(event, userDefaultBid(event), [Customer]);
253
+ * const filter = getAuditFilter(Customer, event.pathParameters.id, {
254
+ * event,
255
+ * offset: 0,
256
+ * limit: 10
257
+ * });
258
+ * const audits = await findAll(getAuditModel(Customer), filter);
259
+ * return success(audits);
260
+ * }
261
+ *
262
+ * @param {import('sequelize').ModelStatic<any>} modelToFilter the parent model
263
+ * whose history is being fetched
264
+ * @param {string|number} id parent record id
265
+ * @param {{ event: import('aws-lambda').APIGatewayProxyEvent, offset?: number, limit?: number }} options
266
+ * `event` is required (drives business-id scoping); `offset` and `limit`
267
+ * are pagination passthroughs
268
+ * @returns {{ where: Object, include: Array<{ model: Object }>, order: Array, offset?: number, limit?: number }}
269
+ * a Sequelize `findAll`-compatible filter
270
+ * @see {@link getAuditModel} - call to get the audit model to query against
271
+ */
272
+ function getAuditFilter(modelToFilter,id,options){const filter={where:{businessId:(0,_accessRightsUtils.accessRightsUtils)(options.event)},include:[{model:modelToFilter}],order:[["createdAt","DESC"]]};return filter.where[modelToFilter.name+"Id"]=id,{...filter,...options}},exports.getAuditModel=function getAuditModel(model){return auditModels[model.name]},exports.incrementWithAudit=async function incrementWithAudit(modelName,model,field,args){const r=await model.increment(field,args);r._changed=[field];const options={};args.transaction&&(options.transaction=args.transaction);return await auditMe(modelName)(r,options),r}
273
+ /***/,exports.modelOptions=void 0;var _lodash=_interopRequireDefault(__webpack_require__(825)),_bluebird=_interopRequireDefault(__webpack_require__(564)),_requestResponse=__webpack_require__(859),_accessRightsUtils=__webpack_require__(673);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}
274
+ /**
275
+ * @file Audit logging for Sequelize models. Each parent model gets a sibling
276
+ * `<ModelName>Audit` table that records every field-level change made through
277
+ * Sequelize hooks (afterCreate / afterUpsert / afterUpdate / afterDestroy).
278
+ *
279
+ * Typical wiring in a domain service:
280
+ *
281
+ * 1. At model `dbSetup` (one-time, at boot):
282
+ * `await attachAudit(MyModel);`
283
+ *
284
+ * 2. At the top of each route handler that mutates the model:
285
+ * `bindAuditRequest(event, businessId, [MyModel]);`
286
+ *
287
+ * 3. To list audit history for a record:
288
+ * `const filter = getAuditFilter(MyModel, id, { event, offset, limit });`
289
+ * `const audits = await findAll(getAuditModel(MyModel), filter);`
290
+ *
291
+ * Audit is **off by default** for any model whose request hasn't been bound —
292
+ * so cron lambdas, untouched endpoints, and unit tests will not write audit
293
+ * rows unless they explicitly opt in. The on/off switch comes from the
294
+ * `custom:SET.auditEnabled` JWT claim resolved by {@link getCompanySettings}.
295
+ *
296
+ * The user identity stamped on each row is read from the JWT via
297
+ * {@link getCurrentUser}; `changedByUser` stores `claims.email`. There is
298
+ * intentionally no foreign key back to a User table — domain services must
299
+ * not read across other services' databases.
300
+ */
301
+ /**
302
+ * Registry of `<ModelName>Audit` Sequelize models, keyed by parent model name.
303
+ * Populated by {@link attachAudit}. Exported for tests; do not mutate from app code.
304
+ *
305
+ * @type {Object<string, import('sequelize').ModelStatic<any>>}
306
+ */const auditModels=exports.auditModels={},modelOptions=exports.modelOptions={},SENSITIVE_FIELDS_PATTERN=/"(token|password|secret|key|credential|auth|securityCode|cvv|pin|ssn)":\s*"[^"]*"/gi;
307
+ /**
308
+ * Per-model per-request audit context, keyed by parent model name. Populated by
309
+ * {@link bindAuditRequest} or {@link bindAuditRequestForUser}. A model with no
310
+ * entry here (or with `auditEnabled === false`) will not write any audit rows.
311
+ * Exported for tests; do not mutate from app code.
312
+ *
313
+ * @type {Object<string, { user: { username: string, id?: number }, businessId: string|number, auditEnabled: boolean }>}
314
+ */
315
+ /**
316
+ * Internal hook factory. Returns the async function that Sequelize invokes on
317
+ * each create/upsert/update/destroy. Reads its per-request state from
318
+ * {@link modelOptions}; emits zero rows when audit is disabled for the model.
319
+ *
320
+ * Sensitive fields inside JSON values (token, password, secret, key,
321
+ * credential, auth, securityCode, cvv, pin, ssn) are masked as
322
+ * `***************` before being persisted. String values longer than 255
323
+ * characters are truncated.
324
+ *
325
+ * Exported only so tests can drive the hook directly. Application code should
326
+ * never call this — use {@link attachAudit}.
327
+ *
328
+ * @param {string} modelName name of the parent Sequelize model
329
+ * @returns {(modelInfo: any, options: { type?: string, transaction?: import('sequelize').Transaction }) => Promise<void>}
330
+ * the hook function Sequelize will call on each lifecycle event
331
+ */
332
+ function auditMe(modelName){return async(modelInfo,options)=>{_lodash.default.isArray(modelInfo)&&(modelInfo=modelInfo[0]);const opts=modelOptions[modelName];if(!opts||!opts.auditEnabled)return;const auditModel=auditModels[modelName],writeAuditRow=async(field,type,valueOld,valueNew)=>{const data={field,type,valueOld:String(valueOld).substring(0,255),valueNew:String(valueNew).substring(0,255),businessId:opts.businessId,changedByUser:opts.user.username};data[modelName+"Id"]=modelInfo.dataValues.id;const newOptions={};return options.transaction&&(newOptions.transaction=options.transaction),auditModel.create(data,newOptions)},checkAudit=async(field,type="INITIAL",valueOld,valueNew)=>{if(!_lodash.default.isEqual(valueOld,valueNew)){if(_lodash.default.isString(valueOld)&&_lodash.default.isString(valueNew)&&(type="INSERT"),_lodash.default.isArray(valueOld)||_lodash.default.isArray(valueNew)){let oldString=JSON.stringify(valueOld||[]),newString=JSON.stringify(valueNew||[]);return oldString=oldString.replace(SENSITIVE_FIELDS_PATTERN,'"$1":"***************"').substring(0,255),newString=newString.replace(SENSITIVE_FIELDS_PATTERN,'"$1":"***************"').substring(0,255),writeAuditRow(field,"UPDATE",oldString,newString)}return _lodash.default.isObject(valueOld)||_lodash.default.isObject(valueNew)?(_lodash.default.forEach(valueOld,(valueSub,keySub)=>{checkAudit(field+" "+keySub,"DELETED",valueSub||"",(valueNew||{})[keySub]||"")}),void _lodash.default.forEach(valueNew,(valueSub,keySub)=>{checkAudit(field+" "+keySub,"INSERT",(valueOld||{})[keySub]||"",valueSub||"")})):writeAuditRow(field,type,valueOld,valueNew)}};return _bluebird.default.map([...modelInfo._changed],async field=>{const valueOld=modelInfo._previousDataValues[field]||"",valueNew=modelInfo.dataValues[field]||"";await checkAudit(field,options.type,valueOld,valueNew)})}}
333
+ /**
334
+ * Define a sibling `<ModelName>Audit` table for the given Sequelize model and
335
+ * wire the four lifecycle hooks (`afterCreate`, `afterUpsert`, `afterUpdate`,
336
+ * `afterDestroy`) that record changes into it.
337
+ *
338
+ * Call this **once per model at boot time** from inside the model's
339
+ * `dbSetup()` function. It is idempotent — calling it again for a model that
340
+ * already has an audit table attached is a no-op.
341
+ *
342
+ * The audit table has no foreign key into any user table; the username of the
343
+ * person who made the change is stamped onto each row from the JWT (set by
344
+ * {@link bindAuditRequest}). This keeps the audit util portable across domain
345
+ * services that own different user models.
346
+ *
347
+ * @example
348
+ * // src/customer/customer.js
349
+ * Customer.dbSetup = async function () {
350
+ * await attachAudit(Customer);
351
+ * };
352
+ *
353
+ * @param {import('sequelize').ModelStatic<any>} model the Sequelize model to audit
354
+ * @returns {Promise<void>} resolves when the audit table's `sync()` completes
355
+ * @see {@link bindAuditRequest} - per-request setup that turns audit on
356
+ * @see {@link getAuditModel} - retrieve the audit model from the parent
357
+ * @see {@link getAuditFilter} - build a filter for an audit history query
358
+ */async function attachAudit(model){if(auditModels[model.name])return;const auditModel=model.sequelize.define(model.name+"Audit",function getAuditSchema(model){const DataTypes=model.sequelize.Sequelize;return{field:{type:DataTypes.STRING,allowNull:!1},type:DataTypes.STRING,valueOld:DataTypes.STRING,valueNew:DataTypes.STRING,changedByUser:{type:DataTypes.STRING,allowNull:!1},businessId:{type:DataTypes.STRING,allowNull:!1}}}(model),{updatedAt:!1,freezeTableName:!0});return auditModel.belongsTo(model,{foreignKey:{allowNull:!0},onDelete:"SET NULL"}),auditModels[model.name]=auditModel,model.addHook("afterCreate",auditMe(model.name)),model.addHook("afterUpsert",auditMe(model.name)),model.addHook("afterUpdate",auditMe(model.name)),model.addHook("afterDestroy",auditMe(model.name)),auditModel.sync()}},
98
359
  /***/183(__unused_webpack_module,exports,__webpack_require__){Object.defineProperty(exports,"__esModule",{value:!0}),exports.watchBucket=
99
360
  /**
100
361
  * bucket watcher watches a s3 bucket and publishes events to a sns topic, this allows you to process files in s3 with a some transformer function
@@ -624,6 +885,6 @@ function createIncludes(event,objectFilters){const query=_lodash.default.get(eve
624
885
  /******/
625
886
  /************************************************************************/var __webpack_exports__={};
626
887
  // This entry needs to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
627
- (()=>{var exports=__webpack_exports__;Object.defineProperty(exports,"__esModule",{value:!0}),exports.watchBucket=exports.userDefaultBid=exports.successHtml=exports.success=exports.stampOwnBusinessId=exports.scopeToPartnerBook=exports.scopeToOwnBusiness=exports.scopeToBookUnionOwn=exports.runMigrations=exports.resolveAccess=exports.requireTicketAccess=exports.requireSuper=exports.requireCrmAccess=exports.publishEvents=exports.parseEvent=exports.parseBody=exports.isSystemUser=exports.isSuperUser=exports.isPartnerUser=exports.handleFile=exports.getModuleInfo=exports.getEffectivePartnerId=exports.getDefaultBusinessIDInfo=exports.getCurrentUserNameFromCognitoEvent=exports.getCurrentUser=exports.getCompanySettings=exports.getBusinessesInfo=exports.getBelongsToPartnerId=exports.getAccessRightsInfo=exports.findAll=exports.failure=exports.ensurePartnerScope=exports.enrichEventWithPartnerAccess=exports.defaultFilters=exports.createSort=exports.createIncludes=exports.createFilters=exports.createAccessHelpers=exports.checkWriteAccess=exports.checkModule=exports.checkIsSuper=exports.assertCanWriteOwnBusiness=exports.assertCanWriteBookUnionOwn=exports.assertCanWriteBookBusiness=exports.accessRightsUtils=void 0;var _handleFile=__webpack_require__(876),_watchBucket=__webpack_require__(183),_publishEvents=__webpack_require__(864),_createIncludes=__webpack_require__(982),_createFilters=__webpack_require__(288),_createSort=__webpack_require__(835),_findAll=__webpack_require__(981),_accessRightsUtils=__webpack_require__(673),_requestResponse=__webpack_require__(859),_migrations=__webpack_require__(871),_defaultFilters=__webpack_require__(207),_accessContext=__webpack_require__(62),_accessGates=__webpack_require__(189),_accessScope=__webpack_require__(513),_accessWrites=__webpack_require__(165),_createAccessHelpers=__webpack_require__(539);exports.handleFile=_handleFile.handleFile,exports.watchBucket=_watchBucket.watchBucket,exports.publishEvents=_publishEvents.publishEvents,exports.createFilters=_createFilters.createFilters,exports.createIncludes=_createIncludes.createIncludes,exports.createSort=_createSort.createSort,exports.findAll=_findAll.findAll,exports.checkModule=_accessRightsUtils.checkModule,exports.checkIsSuper=_accessRightsUtils.checkIsSuper,exports.getAccessRightsInfo=_accessRightsUtils.getAccessRightsInfo,exports.getDefaultBusinessIDInfo=_accessRightsUtils.getDefaultBusinessIDInfo,exports.getModuleInfo=_accessRightsUtils.getModuleInfo,exports.failure=_requestResponse.failure,exports.success=_requestResponse.success,exports.runMigrations=_migrations.runMigrations,exports.getCurrentUser=_requestResponse.getCurrentUser,exports.successHtml=_requestResponse.successHtml,exports.getCurrentUserNameFromCognitoEvent=_requestResponse.getCurrentUserNameFromCognitoEvent,exports.defaultFilters=_defaultFilters.defaultFilters,exports.accessRightsUtils=_accessRightsUtils.accessRightsUtils,exports.parseBody=_requestResponse.parseBody,exports.parseEvent=_requestResponse.parseEvent,exports.getBusinessesInfo=_accessRightsUtils.getBusinessesInfo,exports.userDefaultBid=_accessRightsUtils.userDefaultBid,exports.checkWriteAccess=_accessRightsUtils.checkWriteAccess,exports.isSystemUser=_accessRightsUtils.isSystemUser,exports.isSuperUser=_accessRightsUtils.isSuperUser,exports.isPartnerUser=_accessRightsUtils.isPartnerUser,exports.getBelongsToPartnerId=_accessRightsUtils.getBelongsToPartnerId,exports.getEffectivePartnerId=_accessRightsUtils.getEffectivePartnerId,exports.enrichEventWithPartnerAccess=_accessRightsUtils.enrichEventWithPartnerAccess,exports.getCompanySettings=_accessRightsUtils.getCompanySettings,exports.resolveAccess=_accessContext.resolveAccess,exports.ensurePartnerScope=_accessContext.ensurePartnerScope,exports.requireCrmAccess=_accessGates.requireCrmAccess,exports.requireTicketAccess=_accessGates.requireTicketAccess,exports.requireSuper=_accessGates.requireSuper,exports.scopeToOwnBusiness=_accessScope.scopeToOwnBusiness,exports.scopeToPartnerBook=_accessScope.scopeToPartnerBook,exports.scopeToBookUnionOwn=_accessScope.scopeToBookUnionOwn,exports.assertCanWriteOwnBusiness=_accessWrites.assertCanWriteOwnBusiness,exports.assertCanWriteBookBusiness=_accessWrites.assertCanWriteBookBusiness,exports.assertCanWriteBookUnionOwn=_accessWrites.assertCanWriteBookUnionOwn,exports.stampOwnBusinessId=_accessWrites.stampOwnBusinessId,exports.createAccessHelpers=_createAccessHelpers.createAccessHelpers})();var __webpack_export_target__=exports;for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__]=__webpack_exports__[__webpack_i__];__webpack_exports__.__esModule&&Object.defineProperty(__webpack_export_target__,"__esModule",{value:!0})
888
+ (()=>{var exports=__webpack_exports__;Object.defineProperty(exports,"__esModule",{value:!0}),exports.watchBucket=exports.userDefaultBid=exports.successHtml=exports.success=exports.stampOwnBusinessId=exports.scopeToPartnerBook=exports.scopeToOwnBusiness=exports.scopeToBookUnionOwn=exports.runMigrations=exports.resolveAccess=exports.requireTicketAccess=exports.requireSuper=exports.requireCrmAccess=exports.publishEvents=exports.parseEvent=exports.parseBody=exports.isSystemUser=exports.isSuperUser=exports.isPartnerUser=exports.incrementWithAudit=exports.handleFile=exports.getModuleInfo=exports.getEffectivePartnerId=exports.getDefaultBusinessIDInfo=exports.getCurrentUserNameFromCognitoEvent=exports.getCurrentUser=exports.getCompanySettings=exports.getBusinessesInfo=exports.getBelongsToPartnerId=exports.getAuditModel=exports.getAuditFilter=exports.getAccessRightsInfo=exports.findAll=exports.failure=exports.ensurePartnerScope=exports.enrichEventWithPartnerAccess=exports.defaultFilters=exports.decrementWithAudit=exports.createSort=exports.createIncludes=exports.createFilters=exports.createAccessHelpers=exports.checkWriteAccess=exports.checkModule=exports.checkIsSuper=exports.bindAuditRequestForUser=exports.bindAuditRequest=exports.attachAudit=exports.assertCanWriteOwnBusiness=exports.assertCanWriteBookUnionOwn=exports.assertCanWriteBookBusiness=exports.accessRightsUtils=void 0;var _handleFile=__webpack_require__(876),_watchBucket=__webpack_require__(183),_publishEvents=__webpack_require__(864),_createIncludes=__webpack_require__(982),_createFilters=__webpack_require__(288),_createSort=__webpack_require__(835),_findAll=__webpack_require__(981),_accessRightsUtils=__webpack_require__(673),_requestResponse=__webpack_require__(859),_migrations=__webpack_require__(871),_defaultFilters=__webpack_require__(207),_accessContext=__webpack_require__(62),_accessGates=__webpack_require__(189),_accessScope=__webpack_require__(513),_accessWrites=__webpack_require__(165),_createAccessHelpers=__webpack_require__(539),_audit=__webpack_require__(179);exports.handleFile=_handleFile.handleFile,exports.watchBucket=_watchBucket.watchBucket,exports.publishEvents=_publishEvents.publishEvents,exports.createFilters=_createFilters.createFilters,exports.createIncludes=_createIncludes.createIncludes,exports.createSort=_createSort.createSort,exports.findAll=_findAll.findAll,exports.checkModule=_accessRightsUtils.checkModule,exports.checkIsSuper=_accessRightsUtils.checkIsSuper,exports.getAccessRightsInfo=_accessRightsUtils.getAccessRightsInfo,exports.getDefaultBusinessIDInfo=_accessRightsUtils.getDefaultBusinessIDInfo,exports.getModuleInfo=_accessRightsUtils.getModuleInfo,exports.failure=_requestResponse.failure,exports.success=_requestResponse.success,exports.runMigrations=_migrations.runMigrations,exports.getCurrentUser=_requestResponse.getCurrentUser,exports.successHtml=_requestResponse.successHtml,exports.getCurrentUserNameFromCognitoEvent=_requestResponse.getCurrentUserNameFromCognitoEvent,exports.defaultFilters=_defaultFilters.defaultFilters,exports.accessRightsUtils=_accessRightsUtils.accessRightsUtils,exports.parseBody=_requestResponse.parseBody,exports.parseEvent=_requestResponse.parseEvent,exports.getBusinessesInfo=_accessRightsUtils.getBusinessesInfo,exports.userDefaultBid=_accessRightsUtils.userDefaultBid,exports.checkWriteAccess=_accessRightsUtils.checkWriteAccess,exports.isSystemUser=_accessRightsUtils.isSystemUser,exports.isSuperUser=_accessRightsUtils.isSuperUser,exports.isPartnerUser=_accessRightsUtils.isPartnerUser,exports.getBelongsToPartnerId=_accessRightsUtils.getBelongsToPartnerId,exports.getEffectivePartnerId=_accessRightsUtils.getEffectivePartnerId,exports.enrichEventWithPartnerAccess=_accessRightsUtils.enrichEventWithPartnerAccess,exports.getCompanySettings=_accessRightsUtils.getCompanySettings,exports.resolveAccess=_accessContext.resolveAccess,exports.ensurePartnerScope=_accessContext.ensurePartnerScope,exports.requireCrmAccess=_accessGates.requireCrmAccess,exports.requireTicketAccess=_accessGates.requireTicketAccess,exports.requireSuper=_accessGates.requireSuper,exports.scopeToOwnBusiness=_accessScope.scopeToOwnBusiness,exports.scopeToPartnerBook=_accessScope.scopeToPartnerBook,exports.scopeToBookUnionOwn=_accessScope.scopeToBookUnionOwn,exports.assertCanWriteOwnBusiness=_accessWrites.assertCanWriteOwnBusiness,exports.assertCanWriteBookBusiness=_accessWrites.assertCanWriteBookBusiness,exports.assertCanWriteBookUnionOwn=_accessWrites.assertCanWriteBookUnionOwn,exports.stampOwnBusinessId=_accessWrites.stampOwnBusinessId,exports.createAccessHelpers=_createAccessHelpers.createAccessHelpers,exports.attachAudit=_audit.attachAudit,exports.bindAuditRequest=_audit.bindAuditRequest,exports.bindAuditRequestForUser=_audit.bindAuditRequestForUser,exports.decrementWithAudit=_audit.decrementWithAudit,exports.getAuditFilter=_audit.getAuditFilter,exports.getAuditModel=_audit.getAuditModel,exports.incrementWithAudit=_audit.incrementWithAudit})();var __webpack_export_target__=exports;for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__]=__webpack_exports__[__webpack_i__];__webpack_exports__.__esModule&&Object.defineProperty(__webpack_export_target__,"__esModule",{value:!0})
628
889
  /******/})();
629
890
  //# sourceMappingURL=main.js.map