UNPKG

@rnaga/wp-node

Version:

👉 **[View Full Documentation at rnaga.github.io/wp-node →](https://rnaga.github.io/wp-node/)**

87 lines (86 loc) • 3.11 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.TrxUtil = void 0; const constants_1 = require("../../constants"); const component_1 = require("../../decorators/component"); const transactions_1 = require("../../transactions"); const components_1 = require("../components"); const tables_1 = require("../tables"); const query_util_1 = require("./query.util"); let TrxUtil = class TrxUtil { components; tables; #props = new Map(); constructor(components, tables) { this.components = components; this.tables = tables; } usingBlog(blogId) { this.tables.index = blogId; for (const [, obj] of this.#props.entries()) { obj.tables.index = blogId; } } get(target) { if (this.#props.has(target)) { return this.#props.get(target); } const component = this.components.get(target); component.tables.index = this.tables.index; if (component?.queryUtil && component.queryUtil instanceof query_util_1.QueryUtil) { component.queryUtil.usingBlog(this.tables.index); } this.#props.set(target, component); return component; } get user() { return this.get(transactions_1.UserTrx); } get term() { return this.get(transactions_1.TermTrx); } get site() { return this.get(transactions_1.SiteTrx); } get signup() { return this.get(transactions_1.SignupTrx); } get seeder() { return this.get(transactions_1.SeederTrx); } get registrationLog() { return this.get(transactions_1.RegistrationLogTrx); } get post() { return this.get(transactions_1.PostTrx); } get options() { return this.get(transactions_1.OptionsTrx); } get meta() { return this.get(transactions_1.MetaTrx); } get link() { return this.get(transactions_1.LinkTrx); } get comment() { return this.get(transactions_1.CommentTrx); } get blog() { return this.get(transactions_1.BlogTrx); } }; exports.TrxUtil = TrxUtil; exports.TrxUtil = TrxUtil = __decorate([ (0, component_1.component)({ scope: constants_1.Scope.Transient }), __metadata("design:paramtypes", [components_1.Components, tables_1.Tables]) ], TrxUtil);