UNPKG

@kilterset/auth0-actions-testing

Version:

Test and develop Auth0 Actions or Okta CIC Actions locally.

32 lines 1.8 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.postUserRegistration = void 0; const define_1 = require("../define"); const user_1 = require("../user"); const request_1 = require("../request"); const transaction_1 = require("../transaction"); const connection_1 = require("../connection"); const chance_1 = require("../chance"); const identity_1 = require("../identity"); exports.postUserRegistration = (0, define_1.define)(({ params }) => { var _a, _b, _c, _d; const tenantId = ((_a = params.tenant) === null || _a === void 0 ? void 0 : _a.id) || chance_1.chance.auth0().tenantId(); const hostname = ((_b = params.request) === null || _b === void 0 ? void 0 : _b.hostname) || `${tenantId}.auth0.com`; const connectionValue = params.connection ? params.connection : (0, connection_1.connection)(); const identities = ((_c = params.user) === null || _c === void 0 ? void 0 : _c.identities) || []; identities.splice(0, 1, (0, identity_1.identity)(Object.assign({ connection: connectionValue.name, provider: connectionValue.strategy }, (identities[0] || {})))); const userValue = (0, user_1.user)(Object.assign(Object.assign({}, params.user), { identities })); const requestValue = (0, request_1.request)(Object.assign(Object.assign({ hostname }, params.request), { query: Object.assign({ connection: connectionValue.name }, (_d = params.request) === null || _d === void 0 ? void 0 : _d.query) })); const transactionValue = (0, transaction_1.transaction)(); return { transaction: transactionValue, connection: connectionValue, tenant: { id: tenantId }, request: requestValue, user: userValue, secrets: {}, }; }); //# sourceMappingURL=post-user-registration.js.map