UNPKG

@gsb-core/core

Version:

GSB core services and classes for platform-independent web applications

279 lines 9.37 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GsbUsageLimit = exports.GsbWfActivity = exports.GsbWfLog = exports.GsbWfCodeLibrary = exports.GsbWfFunction = exports.GsbWfOperation = exports.NotificationDto = exports.GsbSetEntityOptions = exports.GsbGetEntityOptions = exports.GsbDocumentGenerateOp = exports.GsbAdvancedMailMessageOp = exports.GsbNotificationOpRecipients = exports.GsbMailMessageOp = exports.GsbDynamicAttachment = exports.EntPropertyValue = exports.Operation = exports.OperationType = exports.GsbNotification = exports.PermissionType = exports.NotificationType = exports.NotificationChannel = void 0; exports.isGsbFunctionEmpty = isGsbFunctionEmpty; exports.copySettingsFrom = copySettingsFrom; exports.copyNotificationSerializable = copyNotificationSerializable; const gsb_dto_base_model_1 = require("./gsb-dto-base.model"); /** * Notification channel enum */ var NotificationChannel; (function (NotificationChannel) { NotificationChannel[NotificationChannel["StandardInterface"] = 1] = "StandardInterface"; NotificationChannel[NotificationChannel["Email"] = 2] = "Email"; NotificationChannel[NotificationChannel["SMS"] = 4] = "SMS"; NotificationChannel[NotificationChannel["PushNotify"] = 8] = "PushNotify"; })(NotificationChannel || (exports.NotificationChannel = NotificationChannel = {})); /** * Notification type enum */ var NotificationType; (function (NotificationType) { NotificationType[NotificationType["Info"] = 0] = "Info"; NotificationType[NotificationType["Success"] = 1] = "Success"; NotificationType[NotificationType["Warning"] = 2] = "Warning"; NotificationType[NotificationType["Error"] = 3] = "Error"; })(NotificationType || (exports.NotificationType = NotificationType = {})); /** * Permission type enum */ var PermissionType; (function (PermissionType) { PermissionType[PermissionType["None"] = 0] = "None"; PermissionType[PermissionType["View"] = 1] = "View"; PermissionType[PermissionType["Edit"] = 2] = "Edit"; PermissionType[PermissionType["Delete"] = 4] = "Delete"; PermissionType[PermissionType["All"] = 7] = "All"; })(PermissionType || (exports.PermissionType = PermissionType = {})); /** * Represents a GSB Notification entity */ class GsbNotification { constructor(obj) { Object.assign(this, obj); this._entDefName = "GsbNotification"; } } exports.GsbNotification = GsbNotification; /** * Operation types for workflow functions */ var OperationType; (function (OperationType) { OperationType[OperationType["SetProperties"] = 1] = "SetProperties"; OperationType[OperationType["SendSms"] = 2] = "SendSms"; OperationType[OperationType["CallGSBAPI"] = 3] = "CallGSBAPI"; OperationType[OperationType["CallExternalAPI"] = 4] = "CallExternalAPI"; OperationType[OperationType["SendEmail"] = 5] = "SendEmail"; OperationType[OperationType["SendEmailAdvanced"] = 6] = "SendEmailAdvanced"; OperationType[OperationType["RunScriptCode"] = 7] = "RunScriptCode"; OperationType[OperationType["CommitChanges"] = 8] = "CommitChanges"; OperationType[OperationType["GetEntity"] = 9] = "GetEntity"; OperationType[OperationType["SetEntity"] = 10] = "SetEntity"; OperationType[OperationType["DeleteEntity"] = 11] = "DeleteEntity"; OperationType[OperationType["CreatePDFDocument"] = 12] = "CreatePDFDocument"; OperationType[OperationType["SendNotification"] = 13] = "SendNotification"; OperationType[OperationType["SaveEntity"] = 14] = "SaveEntity"; })(OperationType || (exports.OperationType = OperationType = {})); /** * Operation enum for entity operations */ var Operation; (function (Operation) { Operation[Operation["Read"] = 4] = "Read"; Operation[Operation["Execute"] = 16] = "Execute"; Operation[Operation["Create"] = 1] = "Create"; Operation[Operation["Delete"] = 32] = "Delete"; Operation[Operation["List"] = 8] = "List"; Operation[Operation["Update"] = 2] = "Update"; Operation[Operation["Associate"] = 64] = "Associate"; Operation[Operation["Disassociate"] = 128] = "Disassociate"; })(Operation || (exports.Operation = Operation = {})); /** * Property value for setting entity properties */ class EntPropertyValue { constructor(obj) { Object.assign(this, obj); this._entDefName = "EntPropertyValue"; } } exports.EntPropertyValue = EntPropertyValue; /** * Dynamic attachment for email operations */ class GsbDynamicAttachment { constructor(obj) { Object.assign(this, obj); this._entDefName = "GsbDynamicAttachment"; } } exports.GsbDynamicAttachment = GsbDynamicAttachment; /** * Email message operation configuration */ class GsbMailMessageOp { constructor(obj) { Object.assign(this, obj); this._entDefName = "GsbMailMessageOp"; } } exports.GsbMailMessageOp = GsbMailMessageOp; /** * Notification operation recipients configuration */ class GsbNotificationOpRecipients { constructor(obj) { Object.assign(this, obj); this._entDefName = "GsbNotificationOpRecipients"; } } exports.GsbNotificationOpRecipients = GsbNotificationOpRecipients; /** * Advanced email message operation configuration */ class GsbAdvancedMailMessageOp { constructor(obj) { Object.assign(this, obj); this._entDefName = "GsbAdvancedMailMessageOp"; } } exports.GsbAdvancedMailMessageOp = GsbAdvancedMailMessageOp; /** * Document generation operation configuration */ class GsbDocumentGenerateOp { constructor(obj) { Object.assign(this, obj); this._entDefName = "GsbDocumentGenerateOp"; } } exports.GsbDocumentGenerateOp = GsbDocumentGenerateOp; /** * Get entity operation options */ class GsbGetEntityOptions { constructor(obj) { Object.assign(this, obj); this._entDefName = "GsbGetEntityOptions"; } } exports.GsbGetEntityOptions = GsbGetEntityOptions; /** * Set entity operation options */ class GsbSetEntityOptions { constructor(obj) { Object.assign(this, obj); this._entDefName = "GsbSetEntityOptions"; } } exports.GsbSetEntityOptions = GsbSetEntityOptions; /** * Notification data for notification operations */ class NotificationDto extends gsb_dto_base_model_1.GsbDtoBase { } exports.NotificationDto = NotificationDto; /** * Represents a workflow operation */ class GsbWfOperation { constructor(obj) { Object.assign(this, obj); this._entDefName = "GsbWfOperation"; } } exports.GsbWfOperation = GsbWfOperation; /** * Represents a GSB WF Function entity */ class GsbWfFunction { constructor(obj) { Object.assign(this, obj); this._entDefName = "GsbWfFunction"; } } exports.GsbWfFunction = GsbWfFunction; /** * Represents a GSB WF Code Library */ class GsbWfCodeLibrary { constructor(obj) { Object.assign(this, obj); this._entDefName = "GsbWfCodeLibrary"; } } exports.GsbWfCodeLibrary = GsbWfCodeLibrary; /** * Represents a GSB WF Log */ class GsbWfLog { constructor(obj) { Object.assign(this, obj); this._entDefName = "GsbWfLog"; } } exports.GsbWfLog = GsbWfLog; /** * Represents a GSB WF Activity */ class GsbWfActivity { constructor(obj) { Object.assign(this, obj); this._entDefName = "GsbWfActivity"; } } exports.GsbWfActivity = GsbWfActivity; /** * Represents a GSB Usage Limit */ class GsbUsageLimit { constructor(obj) { Object.assign(this, obj); this._entDefName = "GsbUsageLimit"; } } exports.GsbUsageLimit = GsbUsageLimit; /** * Helper function to check if a function is empty */ function isGsbFunctionEmpty(func) { return ((!func.code || func.code.trim() === '') && (!func.operations || func.operations.trim() === '') && (!func.operationsObj || func.operationsObj.length === 0)); } /** * Helper functions for copying and serializing DTOs */ function copySettingsFrom(target, source) { if (source.variation) { target.variation = { ...source.variation }; } target.claims = source.claims; target.disableTransaction = source.disableTransaction; target.appendManyItems = source.appendManyItems; target.nestedOp = source.nestedOp; target.quickMode = source.quickMode; target.skipUserModified = source.skipUserModified; target.resetCreateDates = source.resetCreateDates; target.user = source.user; target.saasTenant = source.saasTenant; target.tenant = source.tenant; if (target.updateCache === undefined) { target.updateCache = source.updateCache; } if (target.skipRefProps === undefined) { target.skipRefProps = source.skipRefProps; } if (target.forceMasterDB === undefined) { target.forceMasterDB = source.forceMasterDB; } } /** * Creates a serializable copy of a notification DTO */ function copyNotificationSerializable(source) { var _a; const result = { allUsers: (_a = source.allUsers) === null || _a === void 0 ? void 0 : _a.map((u) => ({ id: u.id })), mailMessage: source.mailMessage, entity: source.entity, modelInstance: source.modelInstance, notification: source.notification }; copySettingsFrom(result, source); return result; } //# sourceMappingURL=gsb-function.model.js.map