UNPKG

@cerbos/files

Version:
976 lines 34.9 kB
"use strict"; // Code generated by protoc-gen-ts_proto. DO NOT EDIT. // source: cerbos/policy/v1/policy.proto Object.defineProperty(exports, "__esModule", { value: true }); exports.Schemas_Schema = exports.Schemas_IgnoreWhen = exports.Schemas = exports.Output_When = exports.Output = exports.Match_ExprList = exports.Match = exports.Condition = exports.Variables_LocalEntry = exports.Variables = exports.ExportVariables_DefinitionsEntry = exports.ExportVariables = exports.Constants_LocalEntry = exports.Constants = exports.ExportConstants_DefinitionsEntry = exports.ExportConstants = exports.RoleDef = exports.DerivedRoles = exports.PrincipalRule_Action = exports.PrincipalRule = exports.PrincipalPolicy = exports.RoleRule = exports.RolePolicy = exports.ResourceRule = exports.ResourcePolicy = exports.Metadata_AnnotationsEntry = exports.Metadata = exports.SourceAttributes_AttributesEntry = exports.SourceAttributes = exports.Policy_VariablesEntry = exports.Policy = exports.ScopePermissions = exports.protobufPackage = void 0; exports.scopePermissionsFromJSON = scopePermissionsFromJSON; exports.scopePermissionsToJSON = scopePermissionsToJSON; /* eslint-disable */ const effect_1 = require("../../effect/v1/effect"); exports.protobufPackage = "cerbos.policy.v1"; var ScopePermissions; (function (ScopePermissions) { ScopePermissions[ScopePermissions["SCOPE_PERMISSIONS_UNSPECIFIED"] = 0] = "SCOPE_PERMISSIONS_UNSPECIFIED"; ScopePermissions[ScopePermissions["SCOPE_PERMISSIONS_OVERRIDE_PARENT"] = 1] = "SCOPE_PERMISSIONS_OVERRIDE_PARENT"; ScopePermissions[ScopePermissions["SCOPE_PERMISSIONS_REQUIRE_PARENTAL_CONSENT_FOR_ALLOWS"] = 2] = "SCOPE_PERMISSIONS_REQUIRE_PARENTAL_CONSENT_FOR_ALLOWS"; })(ScopePermissions || (exports.ScopePermissions = ScopePermissions = {})); function scopePermissionsFromJSON(object) { switch (object) { case 0: case "SCOPE_PERMISSIONS_UNSPECIFIED": return ScopePermissions.SCOPE_PERMISSIONS_UNSPECIFIED; case 1: case "SCOPE_PERMISSIONS_OVERRIDE_PARENT": return ScopePermissions.SCOPE_PERMISSIONS_OVERRIDE_PARENT; case 2: case "SCOPE_PERMISSIONS_REQUIRE_PARENTAL_CONSENT_FOR_ALLOWS": return ScopePermissions.SCOPE_PERMISSIONS_REQUIRE_PARENTAL_CONSENT_FOR_ALLOWS; default: throw new globalThis.Error("Unrecognized enum value " + object + " for enum ScopePermissions"); } } function scopePermissionsToJSON(object) { switch (object) { case ScopePermissions.SCOPE_PERMISSIONS_UNSPECIFIED: return "SCOPE_PERMISSIONS_UNSPECIFIED"; case ScopePermissions.SCOPE_PERMISSIONS_OVERRIDE_PARENT: return "SCOPE_PERMISSIONS_OVERRIDE_PARENT"; case ScopePermissions.SCOPE_PERMISSIONS_REQUIRE_PARENTAL_CONSENT_FOR_ALLOWS: return "SCOPE_PERMISSIONS_REQUIRE_PARENTAL_CONSENT_FOR_ALLOWS"; default: throw new globalThis.Error("Unrecognized enum value " + object + " for enum ScopePermissions"); } } exports.Policy = { fromJSON(object) { return { apiVersion: isSet(object.apiVersion) ? globalThis.String(object.apiVersion) : "", disabled: isSet(object.disabled) ? globalThis.Boolean(object.disabled) : false, description: isSet(object.description) ? globalThis.String(object.description) : "", metadata: isSet(object.metadata) ? exports.Metadata.fromJSON(object.metadata) : undefined, policyType: isSet(object.resourcePolicy) ? { $case: "resourcePolicy", resourcePolicy: exports.ResourcePolicy.fromJSON(object.resourcePolicy), } : isSet(object.principalPolicy) ? { $case: "principalPolicy", principalPolicy: exports.PrincipalPolicy.fromJSON(object.principalPolicy), } : isSet(object.derivedRoles) ? { $case: "derivedRoles", derivedRoles: exports.DerivedRoles.fromJSON(object.derivedRoles), } : isSet(object.exportVariables) ? { $case: "exportVariables", exportVariables: exports.ExportVariables.fromJSON(object.exportVariables), } : isSet(object.rolePolicy) ? { $case: "rolePolicy", rolePolicy: exports.RolePolicy.fromJSON(object.rolePolicy), } : isSet(object.exportConstants) ? { $case: "exportConstants", exportConstants: exports.ExportConstants.fromJSON(object.exportConstants), } : undefined, variables: isObject(object.variables) ? Object.entries(object.variables).reduce((acc, [key, value]) => { acc[key] = String(value); return acc; }, {}) : {}, jsonSchema: isSet(object.$schema) ? globalThis.String(object.$schema) : "", }; }, toJSON(message) { const obj = {}; if (message.apiVersion !== "") { obj.apiVersion = message.apiVersion; } if (message.disabled !== false) { obj.disabled = message.disabled; } if (message.description !== "") { obj.description = message.description; } if (message.metadata !== undefined) { obj.metadata = exports.Metadata.toJSON(message.metadata); } if (message.policyType?.$case === "resourcePolicy") { obj.resourcePolicy = exports.ResourcePolicy.toJSON(message.policyType.resourcePolicy); } else if (message.policyType?.$case === "principalPolicy") { obj.principalPolicy = exports.PrincipalPolicy.toJSON(message.policyType.principalPolicy); } else if (message.policyType?.$case === "derivedRoles") { obj.derivedRoles = exports.DerivedRoles.toJSON(message.policyType.derivedRoles); } else if (message.policyType?.$case === "exportVariables") { obj.exportVariables = exports.ExportVariables.toJSON(message.policyType.exportVariables); } else if (message.policyType?.$case === "rolePolicy") { obj.rolePolicy = exports.RolePolicy.toJSON(message.policyType.rolePolicy); } else if (message.policyType?.$case === "exportConstants") { obj.exportConstants = exports.ExportConstants.toJSON(message.policyType.exportConstants); } if (message.variables) { const entries = Object.entries(message.variables); if (entries.length > 0) { obj.variables = {}; entries.forEach(([k, v]) => { obj.variables[k] = v; }); } } if (message.jsonSchema !== "") { obj.$schema = message.jsonSchema; } return obj; }, }; exports.Policy_VariablesEntry = { fromJSON(object) { return { key: isSet(object.key) ? globalThis.String(object.key) : "", value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, toJSON(message) { const obj = {}; if (message.key !== "") { obj.key = message.key; } if (message.value !== "") { obj.value = message.value; } return obj; }, }; exports.SourceAttributes = { fromJSON(object) { return { attributes: isObject(object.attributes) ? Object.entries(object.attributes).reduce((acc, [key, value]) => { acc[key] = value; return acc; }, {}) : {}, }; }, toJSON(message) { const obj = {}; if (message.attributes) { const entries = Object.entries(message.attributes); if (entries.length > 0) { obj.attributes = {}; entries.forEach(([k, v]) => { obj.attributes[k] = v; }); } } return obj; }, }; exports.SourceAttributes_AttributesEntry = { fromJSON(object) { return { key: isSet(object.key) ? globalThis.String(object.key) : "", value: isSet(object?.value) ? object.value : undefined, }; }, toJSON(message) { const obj = {}; if (message.key !== "") { obj.key = message.key; } if (message.value !== undefined) { obj.value = message.value; } return obj; }, }; exports.Metadata = { fromJSON(object) { return { sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", annotations: isObject(object.annotations) ? Object.entries(object.annotations).reduce((acc, [key, value]) => { acc[key] = String(value); return acc; }, {}) : {}, hash: isSet(object.hash) ? String(object.hash) : undefined, storeIdentifer: isSet(object.storeIdentifer) ? globalThis.String(object.storeIdentifer) : "", storeIdentifier: isSet(object.storeIdentifier) ? globalThis.String(object.storeIdentifier) : "", sourceAttributes: isSet(object.sourceAttributes) ? exports.SourceAttributes.fromJSON(object.sourceAttributes) : undefined, }; }, toJSON(message) { const obj = {}; if (message.sourceFile !== "") { obj.sourceFile = message.sourceFile; } if (message.annotations) { const entries = Object.entries(message.annotations); if (entries.length > 0) { obj.annotations = {}; entries.forEach(([k, v]) => { obj.annotations[k] = v; }); } } if (message.hash !== undefined) { obj.hash = message.hash; } if (message.storeIdentifer !== "") { obj.storeIdentifer = message.storeIdentifer; } if (message.storeIdentifier !== "") { obj.storeIdentifier = message.storeIdentifier; } if (message.sourceAttributes !== undefined) { obj.sourceAttributes = exports.SourceAttributes.toJSON(message.sourceAttributes); } return obj; }, }; exports.Metadata_AnnotationsEntry = { fromJSON(object) { return { key: isSet(object.key) ? globalThis.String(object.key) : "", value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, toJSON(message) { const obj = {}; if (message.key !== "") { obj.key = message.key; } if (message.value !== "") { obj.value = message.value; } return obj; }, }; exports.ResourcePolicy = { fromJSON(object) { return { resource: isSet(object.resource) ? globalThis.String(object.resource) : "", version: isSet(object.version) ? globalThis.String(object.version) : "", importDerivedRoles: globalThis.Array.isArray(object?.importDerivedRoles) ? object.importDerivedRoles.map((e) => globalThis.String(e)) : [], rules: globalThis.Array.isArray(object?.rules) ? object.rules.map((e) => exports.ResourceRule.fromJSON(e)) : [], scope: isSet(object.scope) ? globalThis.String(object.scope) : "", schemas: isSet(object.schemas) ? exports.Schemas.fromJSON(object.schemas) : undefined, variables: isSet(object.variables) ? exports.Variables.fromJSON(object.variables) : undefined, scopePermissions: isSet(object.scopePermissions) ? scopePermissionsFromJSON(object.scopePermissions) : 0, constants: isSet(object.constants) ? exports.Constants.fromJSON(object.constants) : undefined, }; }, toJSON(message) { const obj = {}; if (message.resource !== "") { obj.resource = message.resource; } if (message.version !== "") { obj.version = message.version; } if (message.importDerivedRoles?.length) { obj.importDerivedRoles = message.importDerivedRoles; } if (message.rules?.length) { obj.rules = message.rules.map((e) => exports.ResourceRule.toJSON(e)); } if (message.scope !== "") { obj.scope = message.scope; } if (message.schemas !== undefined) { obj.schemas = exports.Schemas.toJSON(message.schemas); } if (message.variables !== undefined) { obj.variables = exports.Variables.toJSON(message.variables); } if (message.scopePermissions !== 0) { obj.scopePermissions = scopePermissionsToJSON(message.scopePermissions); } if (message.constants !== undefined) { obj.constants = exports.Constants.toJSON(message.constants); } return obj; }, }; exports.ResourceRule = { fromJSON(object) { return { actions: globalThis.Array.isArray(object?.actions) ? object.actions.map((e) => globalThis.String(e)) : [], derivedRoles: globalThis.Array.isArray(object?.derivedRoles) ? object.derivedRoles.map((e) => globalThis.String(e)) : [], roles: globalThis.Array.isArray(object?.roles) ? object.roles.map((e) => globalThis.String(e)) : [], condition: isSet(object.condition) ? exports.Condition.fromJSON(object.condition) : undefined, effect: isSet(object.effect) ? (0, effect_1.effectFromJSON)(object.effect) : 0, name: isSet(object.name) ? globalThis.String(object.name) : "", output: isSet(object.output) ? exports.Output.fromJSON(object.output) : undefined, }; }, toJSON(message) { const obj = {}; if (message.actions?.length) { obj.actions = message.actions; } if (message.derivedRoles?.length) { obj.derivedRoles = message.derivedRoles; } if (message.roles?.length) { obj.roles = message.roles; } if (message.condition !== undefined) { obj.condition = exports.Condition.toJSON(message.condition); } if (message.effect !== 0) { obj.effect = (0, effect_1.effectToJSON)(message.effect); } if (message.name !== "") { obj.name = message.name; } if (message.output !== undefined) { obj.output = exports.Output.toJSON(message.output); } return obj; }, }; exports.RolePolicy = { fromJSON(object) { return { policyType: isSet(object.role) ? { $case: "role", role: globalThis.String(object.role) } : undefined, parentRoles: globalThis.Array.isArray(object?.parentRoles) ? object.parentRoles.map((e) => globalThis.String(e)) : [], scope: isSet(object.scope) ? globalThis.String(object.scope) : "", rules: globalThis.Array.isArray(object?.rules) ? object.rules.map((e) => exports.RoleRule.fromJSON(e)) : [], scopePermissions: isSet(object.scopePermissions) ? scopePermissionsFromJSON(object.scopePermissions) : 0, }; }, toJSON(message) { const obj = {}; if (message.policyType?.$case === "role") { obj.role = message.policyType.role; } if (message.parentRoles?.length) { obj.parentRoles = message.parentRoles; } if (message.scope !== "") { obj.scope = message.scope; } if (message.rules?.length) { obj.rules = message.rules.map((e) => exports.RoleRule.toJSON(e)); } if (message.scopePermissions !== 0) { obj.scopePermissions = scopePermissionsToJSON(message.scopePermissions); } return obj; }, }; exports.RoleRule = { fromJSON(object) { return { resource: isSet(object.resource) ? globalThis.String(object.resource) : "", allowActions: globalThis.Array.isArray(object?.allowActions) ? object.allowActions.map((e) => globalThis.String(e)) : [], condition: isSet(object.condition) ? exports.Condition.fromJSON(object.condition) : undefined, }; }, toJSON(message) { const obj = {}; if (message.resource !== "") { obj.resource = message.resource; } if (message.allowActions?.length) { obj.allowActions = message.allowActions; } if (message.condition !== undefined) { obj.condition = exports.Condition.toJSON(message.condition); } return obj; }, }; exports.PrincipalPolicy = { fromJSON(object) { return { principal: isSet(object.principal) ? globalThis.String(object.principal) : "", version: isSet(object.version) ? globalThis.String(object.version) : "", rules: globalThis.Array.isArray(object?.rules) ? object.rules.map((e) => exports.PrincipalRule.fromJSON(e)) : [], scope: isSet(object.scope) ? globalThis.String(object.scope) : "", variables: isSet(object.variables) ? exports.Variables.fromJSON(object.variables) : undefined, scopePermissions: isSet(object.scopePermissions) ? scopePermissionsFromJSON(object.scopePermissions) : 0, constants: isSet(object.constants) ? exports.Constants.fromJSON(object.constants) : undefined, }; }, toJSON(message) { const obj = {}; if (message.principal !== "") { obj.principal = message.principal; } if (message.version !== "") { obj.version = message.version; } if (message.rules?.length) { obj.rules = message.rules.map((e) => exports.PrincipalRule.toJSON(e)); } if (message.scope !== "") { obj.scope = message.scope; } if (message.variables !== undefined) { obj.variables = exports.Variables.toJSON(message.variables); } if (message.scopePermissions !== 0) { obj.scopePermissions = scopePermissionsToJSON(message.scopePermissions); } if (message.constants !== undefined) { obj.constants = exports.Constants.toJSON(message.constants); } return obj; }, }; exports.PrincipalRule = { fromJSON(object) { return { resource: isSet(object.resource) ? globalThis.String(object.resource) : "", actions: globalThis.Array.isArray(object?.actions) ? object.actions.map((e) => exports.PrincipalRule_Action.fromJSON(e)) : [], }; }, toJSON(message) { const obj = {}; if (message.resource !== "") { obj.resource = message.resource; } if (message.actions?.length) { obj.actions = message.actions.map((e) => exports.PrincipalRule_Action.toJSON(e)); } return obj; }, }; exports.PrincipalRule_Action = { fromJSON(object) { return { action: isSet(object.action) ? globalThis.String(object.action) : "", condition: isSet(object.condition) ? exports.Condition.fromJSON(object.condition) : undefined, effect: isSet(object.effect) ? (0, effect_1.effectFromJSON)(object.effect) : 0, name: isSet(object.name) ? globalThis.String(object.name) : "", output: isSet(object.output) ? exports.Output.fromJSON(object.output) : undefined, }; }, toJSON(message) { const obj = {}; if (message.action !== "") { obj.action = message.action; } if (message.condition !== undefined) { obj.condition = exports.Condition.toJSON(message.condition); } if (message.effect !== 0) { obj.effect = (0, effect_1.effectToJSON)(message.effect); } if (message.name !== "") { obj.name = message.name; } if (message.output !== undefined) { obj.output = exports.Output.toJSON(message.output); } return obj; }, }; exports.DerivedRoles = { fromJSON(object) { return { name: isSet(object.name) ? globalThis.String(object.name) : "", definitions: globalThis.Array.isArray(object?.definitions) ? object.definitions.map((e) => exports.RoleDef.fromJSON(e)) : [], variables: isSet(object.variables) ? exports.Variables.fromJSON(object.variables) : undefined, constants: isSet(object.constants) ? exports.Constants.fromJSON(object.constants) : undefined, }; }, toJSON(message) { const obj = {}; if (message.name !== "") { obj.name = message.name; } if (message.definitions?.length) { obj.definitions = message.definitions.map((e) => exports.RoleDef.toJSON(e)); } if (message.variables !== undefined) { obj.variables = exports.Variables.toJSON(message.variables); } if (message.constants !== undefined) { obj.constants = exports.Constants.toJSON(message.constants); } return obj; }, }; exports.RoleDef = { fromJSON(object) { return { name: isSet(object.name) ? globalThis.String(object.name) : "", parentRoles: globalThis.Array.isArray(object?.parentRoles) ? object.parentRoles.map((e) => globalThis.String(e)) : [], condition: isSet(object.condition) ? exports.Condition.fromJSON(object.condition) : undefined, }; }, toJSON(message) { const obj = {}; if (message.name !== "") { obj.name = message.name; } if (message.parentRoles?.length) { obj.parentRoles = message.parentRoles; } if (message.condition !== undefined) { obj.condition = exports.Condition.toJSON(message.condition); } return obj; }, }; exports.ExportConstants = { fromJSON(object) { return { name: isSet(object.name) ? globalThis.String(object.name) : "", definitions: isObject(object.definitions) ? Object.entries(object.definitions).reduce((acc, [key, value]) => { acc[key] = value; return acc; }, {}) : {}, }; }, toJSON(message) { const obj = {}; if (message.name !== "") { obj.name = message.name; } if (message.definitions) { const entries = Object.entries(message.definitions); if (entries.length > 0) { obj.definitions = {}; entries.forEach(([k, v]) => { obj.definitions[k] = v; }); } } return obj; }, }; exports.ExportConstants_DefinitionsEntry = { fromJSON(object) { return { key: isSet(object.key) ? globalThis.String(object.key) : "", value: isSet(object?.value) ? object.value : undefined, }; }, toJSON(message) { const obj = {}; if (message.key !== "") { obj.key = message.key; } if (message.value !== undefined) { obj.value = message.value; } return obj; }, }; exports.Constants = { fromJSON(object) { return { import: globalThis.Array.isArray(object?.import) ? object.import.map((e) => globalThis.String(e)) : [], local: isObject(object.local) ? Object.entries(object.local).reduce((acc, [key, value]) => { acc[key] = value; return acc; }, {}) : {}, }; }, toJSON(message) { const obj = {}; if (message.import?.length) { obj.import = message.import; } if (message.local) { const entries = Object.entries(message.local); if (entries.length > 0) { obj.local = {}; entries.forEach(([k, v]) => { obj.local[k] = v; }); } } return obj; }, }; exports.Constants_LocalEntry = { fromJSON(object) { return { key: isSet(object.key) ? globalThis.String(object.key) : "", value: isSet(object?.value) ? object.value : undefined, }; }, toJSON(message) { const obj = {}; if (message.key !== "") { obj.key = message.key; } if (message.value !== undefined) { obj.value = message.value; } return obj; }, }; exports.ExportVariables = { fromJSON(object) { return { name: isSet(object.name) ? globalThis.String(object.name) : "", definitions: isObject(object.definitions) ? Object.entries(object.definitions).reduce((acc, [key, value]) => { acc[key] = String(value); return acc; }, {}) : {}, }; }, toJSON(message) { const obj = {}; if (message.name !== "") { obj.name = message.name; } if (message.definitions) { const entries = Object.entries(message.definitions); if (entries.length > 0) { obj.definitions = {}; entries.forEach(([k, v]) => { obj.definitions[k] = v; }); } } return obj; }, }; exports.ExportVariables_DefinitionsEntry = { fromJSON(object) { return { key: isSet(object.key) ? globalThis.String(object.key) : "", value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, toJSON(message) { const obj = {}; if (message.key !== "") { obj.key = message.key; } if (message.value !== "") { obj.value = message.value; } return obj; }, }; exports.Variables = { fromJSON(object) { return { import: globalThis.Array.isArray(object?.import) ? object.import.map((e) => globalThis.String(e)) : [], local: isObject(object.local) ? Object.entries(object.local).reduce((acc, [key, value]) => { acc[key] = String(value); return acc; }, {}) : {}, }; }, toJSON(message) { const obj = {}; if (message.import?.length) { obj.import = message.import; } if (message.local) { const entries = Object.entries(message.local); if (entries.length > 0) { obj.local = {}; entries.forEach(([k, v]) => { obj.local[k] = v; }); } } return obj; }, }; exports.Variables_LocalEntry = { fromJSON(object) { return { key: isSet(object.key) ? globalThis.String(object.key) : "", value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, toJSON(message) { const obj = {}; if (message.key !== "") { obj.key = message.key; } if (message.value !== "") { obj.value = message.value; } return obj; }, }; exports.Condition = { fromJSON(object) { return { condition: isSet(object.match) ? { $case: "match", match: exports.Match.fromJSON(object.match) } : isSet(object.script) ? { $case: "script", script: globalThis.String(object.script) } : undefined, }; }, toJSON(message) { const obj = {}; if (message.condition?.$case === "match") { obj.match = exports.Match.toJSON(message.condition.match); } else if (message.condition?.$case === "script") { obj.script = message.condition.script; } return obj; }, }; exports.Match = { fromJSON(object) { return { op: isSet(object.all) ? { $case: "all", all: exports.Match_ExprList.fromJSON(object.all) } : isSet(object.any) ? { $case: "any", any: exports.Match_ExprList.fromJSON(object.any) } : isSet(object.none) ? { $case: "none", none: exports.Match_ExprList.fromJSON(object.none) } : isSet(object.expr) ? { $case: "expr", expr: globalThis.String(object.expr) } : undefined, }; }, toJSON(message) { const obj = {}; if (message.op?.$case === "all") { obj.all = exports.Match_ExprList.toJSON(message.op.all); } else if (message.op?.$case === "any") { obj.any = exports.Match_ExprList.toJSON(message.op.any); } else if (message.op?.$case === "none") { obj.none = exports.Match_ExprList.toJSON(message.op.none); } else if (message.op?.$case === "expr") { obj.expr = message.op.expr; } return obj; }, }; exports.Match_ExprList = { fromJSON(object) { return { of: globalThis.Array.isArray(object?.of) ? object.of.map((e) => exports.Match.fromJSON(e)) : [], }; }, toJSON(message) { const obj = {}; if (message.of?.length) { obj.of = message.of.map((e) => exports.Match.toJSON(e)); } return obj; }, }; exports.Output = { fromJSON(object) { return { expr: isSet(object.expr) ? globalThis.String(object.expr) : "", when: isSet(object.when) ? exports.Output_When.fromJSON(object.when) : undefined, }; }, toJSON(message) { const obj = {}; if (message.expr !== "") { obj.expr = message.expr; } if (message.when !== undefined) { obj.when = exports.Output_When.toJSON(message.when); } return obj; }, }; exports.Output_When = { fromJSON(object) { return { ruleActivated: isSet(object.ruleActivated) ? globalThis.String(object.ruleActivated) : "", conditionNotMet: isSet(object.conditionNotMet) ? globalThis.String(object.conditionNotMet) : "", }; }, toJSON(message) { const obj = {}; if (message.ruleActivated !== "") { obj.ruleActivated = message.ruleActivated; } if (message.conditionNotMet !== "") { obj.conditionNotMet = message.conditionNotMet; } return obj; }, }; exports.Schemas = { fromJSON(object) { return { principalSchema: isSet(object.principalSchema) ? exports.Schemas_Schema.fromJSON(object.principalSchema) : undefined, resourceSchema: isSet(object.resourceSchema) ? exports.Schemas_Schema.fromJSON(object.resourceSchema) : undefined, }; }, toJSON(message) { const obj = {}; if (message.principalSchema !== undefined) { obj.principalSchema = exports.Schemas_Schema.toJSON(message.principalSchema); } if (message.resourceSchema !== undefined) { obj.resourceSchema = exports.Schemas_Schema.toJSON(message.resourceSchema); } return obj; }, }; exports.Schemas_IgnoreWhen = { fromJSON(object) { return { actions: globalThis.Array.isArray(object?.actions) ? object.actions.map((e) => globalThis.String(e)) : [], }; }, toJSON(message) { const obj = {}; if (message.actions?.length) { obj.actions = message.actions; } return obj; }, }; exports.Schemas_Schema = { fromJSON(object) { return { ref: isSet(object.ref) ? globalThis.String(object.ref) : "", ignoreWhen: isSet(object.ignoreWhen) ? exports.Schemas_IgnoreWhen.fromJSON(object.ignoreWhen) : undefined, }; }, toJSON(message) { const obj = {}; if (message.ref !== "") { obj.ref = message.ref; } if (message.ignoreWhen !== undefined) { obj.ignoreWhen = exports.Schemas_IgnoreWhen.toJSON(message.ignoreWhen); } return obj; }, }; function isObject(value) { return typeof value === "object" && value !== null; } function isSet(value) { return value !== null && value !== undefined; } //# sourceMappingURL=policy.js.map