piper-utils 1.1.66 → 1.1.67
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 +253 -1
- package/bin/main.js.map +1 -1
- package/package.json +1 -1
- package/src/audit/audit.js +422 -0
- package/src/audit/audit.test.js +313 -0
- package/src/index.js +16 -0
package/bin/main.js
CHANGED
|
@@ -95,6 +95,258 @@ 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=
|
|
99
|
+
/**
|
|
100
|
+
* Define a sibling `<ModelName>Audit` table for the given Sequelize model and
|
|
101
|
+
* wire the four lifecycle hooks (`afterCreate`, `afterUpsert`, `afterUpdate`,
|
|
102
|
+
* `afterDestroy`) that record changes into it.
|
|
103
|
+
*
|
|
104
|
+
* Call this **once per model at boot time** from inside the model's
|
|
105
|
+
* `dbSetup()` function. It is idempotent — calling it again for a model that
|
|
106
|
+
* already has an audit table attached is a no-op.
|
|
107
|
+
*
|
|
108
|
+
* The audit table has no foreign key into any user table; the username of the
|
|
109
|
+
* person who made the change is stamped onto each row from the JWT (set by
|
|
110
|
+
* {@link bindAuditRequest}). This keeps the audit util portable across domain
|
|
111
|
+
* services that own different user models.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* // src/customer/customer.js
|
|
115
|
+
* Customer.dbSetup = async function () {
|
|
116
|
+
* await attachAudit(Customer);
|
|
117
|
+
* };
|
|
118
|
+
*
|
|
119
|
+
* @param {import('sequelize').ModelStatic<any>} model the Sequelize model to audit
|
|
120
|
+
* @returns {Promise<void>} resolves when the audit table's `sync()` completes
|
|
121
|
+
* @see {@link bindAuditRequest} - per-request setup that turns audit on
|
|
122
|
+
* @see {@link getAuditModel} - retrieve the audit model from the parent
|
|
123
|
+
* @see {@link getAuditFilter} - build a filter for an audit history query
|
|
124
|
+
*/
|
|
125
|
+
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}}}
|
|
126
|
+
/**
|
|
127
|
+
* Internal hook factory. Returns the async function that Sequelize invokes on
|
|
128
|
+
* each create/upsert/update/destroy. Reads its per-request state from
|
|
129
|
+
* {@link modelOptions}; emits zero rows when audit is disabled for the model.
|
|
130
|
+
*
|
|
131
|
+
* Sensitive fields inside JSON values (token, password, secret, key,
|
|
132
|
+
* credential, auth, securityCode, cvv, pin, ssn) are masked as
|
|
133
|
+
* `***************` before being persisted. String values longer than 255
|
|
134
|
+
* characters are truncated.
|
|
135
|
+
*
|
|
136
|
+
* Exported only so tests can drive the hook directly. Application code should
|
|
137
|
+
* never call this — use {@link attachAudit}.
|
|
138
|
+
*
|
|
139
|
+
* @param {string} modelName name of the parent Sequelize model
|
|
140
|
+
* @returns {(modelInfo: any, options: { type?: string, transaction?: import('sequelize').Transaction }) => Promise<void>}
|
|
141
|
+
* the hook function Sequelize will call on each lifecycle event
|
|
142
|
+
*/(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()}
|
|
143
|
+
/**
|
|
144
|
+
* Bind per-request audit context for one or more models. Call this **once at
|
|
145
|
+
* the top of each route handler** that mutates an audited model.
|
|
146
|
+
*
|
|
147
|
+
* Resolves the acting user from the JWT claims on the event
|
|
148
|
+
* (via {@link getCurrentUser}) and reads the company `auditEnabled` flag from
|
|
149
|
+
* the `custom:SET` claim (via {@link getCompanySettings}). If the company has
|
|
150
|
+
* `auditEnabled: false` then no rows will be written for the bound models on
|
|
151
|
+
* this request.
|
|
152
|
+
*
|
|
153
|
+
* Audit is **off by default** for any model that has not been bound this
|
|
154
|
+
* request — a route that omits this call writes no audit rows.
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* // src/customer/customerRoutes.js
|
|
158
|
+
* export async function updateCustomer(event) {
|
|
159
|
+
* checkModule('customer', event);
|
|
160
|
+
* const businessId = checkWriteAccess(event);
|
|
161
|
+
* bindAuditRequest(event, businessId, [Customer]);
|
|
162
|
+
* // ...mutate Customer here; rows are written automatically by hooks
|
|
163
|
+
* }
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* // Bind several models in one call when a handler touches more than one
|
|
167
|
+
* bindAuditRequest(event, businessId, [Order, Payment, Receivable]);
|
|
168
|
+
*
|
|
169
|
+
* @param {import('aws-lambda').APIGatewayProxyEvent} event API Gateway event
|
|
170
|
+
* with `requestContext.authorizer.claims` (must include `email` and
|
|
171
|
+
* optionally `custom:UID`, `custom:SET`)
|
|
172
|
+
* @param {string|number} businessId business id this request acts on; stamped
|
|
173
|
+
* onto every audit row written for the bound models
|
|
174
|
+
* @param {Array<import('sequelize').ModelStatic<any>>} models Sequelize models
|
|
175
|
+
* to enable audit on for the duration of this request
|
|
176
|
+
* @returns {void}
|
|
177
|
+
* @see {@link bindAuditRequestForUser} - the equivalent for non-JWT contexts
|
|
178
|
+
* (webhooks, integration crons, Cognito triggers)
|
|
179
|
+
* @see {@link attachAudit} - one-time setup that creates the audit table
|
|
180
|
+
*/,exports.auditMe=auditMe,exports.auditModels=void 0,exports.bindAuditRequest=function bindAuditRequest(event,businessId,models){const user=(0,_requestResponse.getCurrentUser)(event),auditEnabled=!!((0,_accessRightsUtils.getCompanySettings)(event)||{}).auditEnabled;_lodash.default.forEach(models,model=>{modelOptions[model.name]={user,businessId,auditEnabled}})}
|
|
181
|
+
/**
|
|
182
|
+
* Bind per-request audit context for **system-driven flows** that do not carry
|
|
183
|
+
* an API Gateway JWT — for example, payment-gateway webhooks, integration
|
|
184
|
+
* crons (QuickBooks/Inbox/etc.), Cognito triggers, or batch jobs.
|
|
185
|
+
*
|
|
186
|
+
* Use {@link bindAuditRequest} instead whenever you have a JWT-authenticated
|
|
187
|
+
* API event; that path automatically resolves the user and the company's
|
|
188
|
+
* `auditEnabled` flag from claims.
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* // payment webhook from the gateway — no JWT, but we still want audit
|
|
192
|
+
* import { systemUser } from '../user/user.js';
|
|
193
|
+
*
|
|
194
|
+
* export async function webhook(event) {
|
|
195
|
+
* const businessId = event.queryStringParameters.businessId;
|
|
196
|
+
* bindAuditRequestForUser(systemUser, businessId, [Order, Payment]);
|
|
197
|
+
* // ...mutate Order/Payment; audit rows are written by hooks
|
|
198
|
+
* }
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* // turn audit OFF explicitly for a system flow that should not be audited
|
|
202
|
+
* bindAuditRequestForUser(systemUser, businessId, [Order], { auditEnabled: false });
|
|
203
|
+
*
|
|
204
|
+
* @param {{ username: string, id?: number }} user identity stamped onto each
|
|
205
|
+
* audit row's `changedByUser` field. Conventionally the `systemUser`
|
|
206
|
+
* constant exported from your service's user model
|
|
207
|
+
* @param {string|number} businessId business id this flow is acting on
|
|
208
|
+
* @param {Array<import('sequelize').ModelStatic<any>>} models Sequelize models
|
|
209
|
+
* to enable audit on
|
|
210
|
+
* @param {{ auditEnabled?: boolean }} [opts] when `auditEnabled` is `false`,
|
|
211
|
+
* binds context but suppresses writes; defaults to `true`
|
|
212
|
+
* @returns {void}
|
|
213
|
+
* @see {@link bindAuditRequest} - the JWT-driven equivalent for API handlers
|
|
214
|
+
*/,exports.bindAuditRequestForUser=function bindAuditRequestForUser(user,businessId,models,opts={}){const auditEnabled=!1!==opts.auditEnabled;_lodash.default.forEach(models,model=>{modelOptions[model.name]={user,businessId,auditEnabled}})}
|
|
215
|
+
/**
|
|
216
|
+
* Get the `<ModelName>Audit` Sequelize model that {@link attachAudit} created
|
|
217
|
+
* for a parent model. Returns `undefined` if audit was never attached.
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* const audits = await findAll(getAuditModel(Customer), filter);
|
|
221
|
+
*
|
|
222
|
+
* @param {import('sequelize').ModelStatic<any>} model parent Sequelize model
|
|
223
|
+
* @returns {import('sequelize').ModelStatic<any> | undefined} the audit model,
|
|
224
|
+
* or `undefined` if {@link attachAudit} has not been called for this model
|
|
225
|
+
* @see {@link getAuditFilter} - companion filter builder for history queries
|
|
226
|
+
*/,exports.decrementWithAudit=
|
|
227
|
+
/**
|
|
228
|
+
* Decrement an integer field on a Sequelize instance and write a matching
|
|
229
|
+
* audit row in the same call. Useful for inventory adjustments and other
|
|
230
|
+
* counter-style fields where Sequelize's plain `model.decrement()` would
|
|
231
|
+
* bypass the `afterUpdate` hook.
|
|
232
|
+
*
|
|
233
|
+
* The acting user and businessId come from whatever
|
|
234
|
+
* {@link bindAuditRequest} / {@link bindAuditRequestForUser} was called for
|
|
235
|
+
* this request. If audit is disabled for the model, the decrement still
|
|
236
|
+
* happens but no audit row is written.
|
|
237
|
+
*
|
|
238
|
+
* @example
|
|
239
|
+
* // release inventory on order release
|
|
240
|
+
* await decrementWithAudit('inventory', inventoryEntry, 'quantity', {
|
|
241
|
+
* by: item.quantity,
|
|
242
|
+
* transaction: t
|
|
243
|
+
* });
|
|
244
|
+
*
|
|
245
|
+
* @param {string} modelName name of the parent model (e.g. `'inventory'`)
|
|
246
|
+
* @param {import('sequelize').Model} model the Sequelize instance to mutate
|
|
247
|
+
* @param {string} field the integer/decimal field to decrement
|
|
248
|
+
* @param {{ by?: number, transaction?: import('sequelize').Transaction }} args
|
|
249
|
+
* passed straight through to Sequelize's `decrement()`; transaction is also
|
|
250
|
+
* propagated to the audit write
|
|
251
|
+
* @returns {Promise<import('sequelize').Model>} the updated instance (with
|
|
252
|
+
* `_changed` set on it so internal hooks can observe the change)
|
|
253
|
+
* @see {@link incrementWithAudit} - the +1 counterpart
|
|
254
|
+
*/
|
|
255
|
+
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}
|
|
256
|
+
/**
|
|
257
|
+
* Increment an integer field on a Sequelize instance and write a matching
|
|
258
|
+
* audit row in the same call. The mirror of {@link decrementWithAudit}.
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
* // restock from a receivable
|
|
262
|
+
* await incrementWithAudit('inventory', inventoryEntry, 'quantity', {
|
|
263
|
+
* by: item.quantity,
|
|
264
|
+
* transaction: t
|
|
265
|
+
* });
|
|
266
|
+
*
|
|
267
|
+
* @param {string} modelName name of the parent model (e.g. `'inventory'`)
|
|
268
|
+
* @param {import('sequelize').Model} model the Sequelize instance to mutate
|
|
269
|
+
* @param {string} field the integer/decimal field to increment
|
|
270
|
+
* @param {{ by?: number, transaction?: import('sequelize').Transaction }} args
|
|
271
|
+
* passed straight through to Sequelize's `increment()`; transaction is also
|
|
272
|
+
* propagated to the audit write
|
|
273
|
+
* @returns {Promise<import('sequelize').Model>} the updated instance
|
|
274
|
+
* @see {@link decrementWithAudit} - the -1 counterpart
|
|
275
|
+
*/,exports.getAuditFilter=
|
|
276
|
+
/**
|
|
277
|
+
* Build a Sequelize `findAll`-style filter for an audit-history query, scoped
|
|
278
|
+
* to the businesses the caller is allowed to read (resolved from
|
|
279
|
+
* {@link accessRightsUtils}).
|
|
280
|
+
*
|
|
281
|
+
* The returned filter joins the parent model so callers can render `oldValue`
|
|
282
|
+
* → `newValue` rows in the UI alongside the parent record.
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* // GET /customer/{id}/audit
|
|
286
|
+
* export async function getCustomerAudit(event) {
|
|
287
|
+
* bindAuditRequest(event, userDefaultBid(event), [Customer]);
|
|
288
|
+
* const filter = getAuditFilter(Customer, event.pathParameters.id, {
|
|
289
|
+
* event,
|
|
290
|
+
* offset: 0,
|
|
291
|
+
* limit: 10
|
|
292
|
+
* });
|
|
293
|
+
* const audits = await findAll(getAuditModel(Customer), filter);
|
|
294
|
+
* return success(audits);
|
|
295
|
+
* }
|
|
296
|
+
*
|
|
297
|
+
* @param {import('sequelize').ModelStatic<any>} modelToFilter the parent model
|
|
298
|
+
* whose history is being fetched
|
|
299
|
+
* @param {string|number} id parent record id
|
|
300
|
+
* @param {{ event: import('aws-lambda').APIGatewayProxyEvent, offset?: number, limit?: number }} options
|
|
301
|
+
* `event` is required (drives business-id scoping); `offset` and `limit`
|
|
302
|
+
* are pagination passthroughs
|
|
303
|
+
* @returns {{ where: Object, include: Array<{ model: Object }>, order: Array, offset?: number, limit?: number }}
|
|
304
|
+
* a Sequelize `findAll`-compatible filter
|
|
305
|
+
* @see {@link getAuditModel} - call to get the audit model to query against
|
|
306
|
+
*/
|
|
307
|
+
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}
|
|
308
|
+
/***/,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}}
|
|
309
|
+
/**
|
|
310
|
+
* @file Audit logging for Sequelize models. Each parent model gets a sibling
|
|
311
|
+
* `<ModelName>Audit` table that records every field-level change made through
|
|
312
|
+
* Sequelize hooks (afterCreate / afterUpsert / afterUpdate / afterDestroy).
|
|
313
|
+
*
|
|
314
|
+
* Typical wiring in a domain service:
|
|
315
|
+
*
|
|
316
|
+
* 1. At model `dbSetup` (one-time, at boot):
|
|
317
|
+
* `await attachAudit(MyModel);`
|
|
318
|
+
*
|
|
319
|
+
* 2. At the top of each route handler that mutates the model:
|
|
320
|
+
* `bindAuditRequest(event, businessId, [MyModel]);`
|
|
321
|
+
*
|
|
322
|
+
* 3. To list audit history for a record:
|
|
323
|
+
* `const filter = getAuditFilter(MyModel, id, { event, offset, limit });`
|
|
324
|
+
* `const audits = await findAll(getAuditModel(MyModel), filter);`
|
|
325
|
+
*
|
|
326
|
+
* Audit is **off by default** for any model whose request hasn't been bound —
|
|
327
|
+
* so cron lambdas, untouched endpoints, and unit tests will not write audit
|
|
328
|
+
* rows unless they explicitly opt in. The on/off switch comes from the
|
|
329
|
+
* `custom:SET.auditEnabled` JWT claim resolved by {@link getCompanySettings}.
|
|
330
|
+
*
|
|
331
|
+
* The user identity stamped on each row is read from the JWT via
|
|
332
|
+
* {@link getCurrentUser}; `changedByUser` stores `claims.email`. There is
|
|
333
|
+
* intentionally no foreign key back to a User table — domain services must
|
|
334
|
+
* not read across other services' databases.
|
|
335
|
+
*/
|
|
336
|
+
/**
|
|
337
|
+
* Registry of `<ModelName>Audit` Sequelize models, keyed by parent model name.
|
|
338
|
+
* Populated by {@link attachAudit}. Exported for tests; do not mutate from app code.
|
|
339
|
+
*
|
|
340
|
+
* @type {Object<string, import('sequelize').ModelStatic<any>>}
|
|
341
|
+
*/const auditModels=exports.auditModels={},modelOptions=exports.modelOptions={},SENSITIVE_FIELDS_PATTERN=/"(token|password|secret|key|credential|auth|securityCode|cvv|pin|ssn)":\s*"[^"]*"/gi;
|
|
342
|
+
/**
|
|
343
|
+
* Per-model per-request audit context, keyed by parent model name. Populated by
|
|
344
|
+
* {@link bindAuditRequest} or {@link bindAuditRequestForUser}. A model with no
|
|
345
|
+
* entry here (or with `auditEnabled === false`) will not write any audit rows.
|
|
346
|
+
* Exported for tests; do not mutate from app code.
|
|
347
|
+
*
|
|
348
|
+
* @type {Object<string, { user: { username: string, id?: number }, businessId: string|number, auditEnabled: boolean }>}
|
|
349
|
+
*/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)})}}},
|
|
98
350
|
/***/183(__unused_webpack_module,exports,__webpack_require__){Object.defineProperty(exports,"__esModule",{value:!0}),exports.watchBucket=
|
|
99
351
|
/**
|
|
100
352
|
* 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 +876,6 @@ function createIncludes(event,objectFilters){const query=_lodash.default.get(eve
|
|
|
624
876
|
/******/
|
|
625
877
|
/************************************************************************/var __webpack_exports__={};
|
|
626
878
|
// 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})
|
|
879
|
+
(()=>{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
880
|
/******/})();
|
|
629
881
|
//# sourceMappingURL=main.js.map
|