UNPKG

@sphereon/ssi-sdk.issuance-branding

Version:

1,472 lines (1,469 loc) • 52.7 kB
"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // plugin.schema.json var require_plugin_schema = __commonJS({ "plugin.schema.json"(exports, module2) { module2.exports = { IIssuanceBranding: { components: { schemas: { IAddCredentialBrandingArgs: { type: "object", properties: { issuerCorrelationId: { type: "string" }, vcHash: { type: "string" }, localeBranding: { type: "array", items: { $ref: "#/components/schemas/IBasicCredentialLocaleBranding" } } }, required: ["issuerCorrelationId", "vcHash", "localeBranding"], additionalProperties: false }, IBasicCredentialLocaleBranding: { type: "object", properties: { alias: { type: "string" }, locale: { type: "string" }, description: { type: "string" }, logo: { $ref: "#/components/schemas/IBasicImageAttributes" }, background: { $ref: "#/components/schemas/IBasicBackgroundAttributes" }, text: { $ref: "#/components/schemas/IBasicTextAttributes" }, claims: { type: "array", items: { $ref: "#/components/schemas/IBasicCredentialClaim" } } }, additionalProperties: false }, IBasicImageAttributes: { type: "object", properties: { uri: { type: "string" }, dataUri: { type: "string" }, mediaType: { type: "string" }, alt: { type: "string" }, dimensions: { $ref: "#/components/schemas/IBasicImageDimensions" } }, additionalProperties: false }, IBasicImageDimensions: { type: "object", additionalProperties: false, properties: { width: { type: "number" }, height: { type: "number" } }, required: ["height", "width"] }, IBasicBackgroundAttributes: { type: "object", properties: { color: { type: "string" }, image: { $ref: "#/components/schemas/IBasicImageAttributes" } }, additionalProperties: false }, IBasicTextAttributes: { type: "object", additionalProperties: false, properties: { color: { type: "string" } } }, IBasicCredentialClaim: { type: "object", additionalProperties: false, properties: { key: { type: "string" }, name: { type: "string" } }, required: ["key", "name"] }, ICredentialBranding: { type: "object", properties: { id: { type: "string" }, issuerCorrelationId: { type: "string" }, vcHash: { type: "string" }, localeBranding: { type: "array", items: { $ref: "#/components/schemas/ICredentialLocaleBranding" } }, createdAt: { type: "string", format: "date-time" }, lastUpdatedAt: { type: "string", format: "date-time" } }, required: ["id", "issuerCorrelationId", "vcHash", "localeBranding", "createdAt", "lastUpdatedAt"], additionalProperties: false }, ICredentialLocaleBranding: { type: "object", properties: { id: { type: "string" }, alias: { type: "string" }, locale: { type: "string" }, logo: { $ref: "#/components/schemas/IImageAttributes" }, description: { type: "string" }, background: { $ref: "#/components/schemas/IBackgroundAttributes" }, text: { $ref: "#/components/schemas/ITextAttributes" }, createdAt: { type: "string", format: "date-time" }, lastUpdatedAt: { type: "string", format: "date-time" }, claims: { type: "array", items: { $ref: "#/components/schemas/ICredentialClaim" } } }, additionalProperties: false, required: ["createdAt", "id", "lastUpdatedAt"] }, IImageAttributes: { type: "object", properties: { id: { type: "string" }, uri: { type: "string" }, dataUri: { type: "string" }, mediaType: { type: "string" }, alt: { type: "string" }, dimensions: { $ref: "#/components/schemas/IImageDimensions" } }, required: ["id"], additionalProperties: false }, IImageDimensions: { type: "object", properties: { id: { type: "string" }, width: { type: "number" }, height: { type: "number" } }, required: ["id", "width", "height"], additionalProperties: false }, IBackgroundAttributes: { type: "object", properties: { id: { type: "string" }, color: { type: "string" }, image: { $ref: "#/components/schemas/IImageAttributes" } }, required: ["id"], additionalProperties: false }, ITextAttributes: { type: "object", properties: { id: { type: "string" }, color: { type: "string" } }, required: ["id"], additionalProperties: false }, ICredentialClaim: { type: "object", properties: { id: { type: "string" }, key: { type: "string" }, name: { type: "string" } }, required: ["id", "key", "name"], additionalProperties: false }, IAddCredentialLocaleBrandingArgs: { type: "object", properties: { credentialBrandingId: { type: "string" }, localeBranding: { type: "array", items: { $ref: "#/components/schemas/IBasicCredentialLocaleBranding" } } }, required: ["credentialBrandingId", "localeBranding"], additionalProperties: false }, IAddIssuerBrandingArgs: { type: "object", properties: { issuerCorrelationId: { type: "string" }, localeBranding: { type: "array", items: { $ref: "#/components/schemas/IBasicIssuerLocaleBranding" } } }, required: ["issuerCorrelationId", "localeBranding"], additionalProperties: false }, IBasicIssuerLocaleBranding: { type: "object", properties: { clientUri: { type: "string" }, tosUri: { type: "string" }, policyUri: { type: "string" }, contacts: { type: "array", items: { type: "string" } }, alias: { type: "string" }, locale: { type: "string" }, description: { type: "string" }, logo: { $ref: "#/components/schemas/IBasicImageAttributes" }, background: { $ref: "#/components/schemas/IBasicBackgroundAttributes" }, text: { $ref: "#/components/schemas/IBasicTextAttributes" } }, additionalProperties: false }, IIssuerBranding: { type: "object", properties: { id: { type: "string" }, issuerCorrelationId: { type: "string" }, localeBranding: { type: "array", items: { $ref: "#/components/schemas/IIssuerLocaleBranding" } }, createdAt: { type: "string", format: "date-time" }, lastUpdatedAt: { type: "string", format: "date-time" } }, required: ["id", "issuerCorrelationId", "localeBranding", "createdAt", "lastUpdatedAt"], additionalProperties: false }, IIssuerLocaleBranding: { type: "object", properties: { id: { type: "string" }, alias: { type: "string" }, locale: { type: "string" }, logo: { $ref: "#/components/schemas/IImageAttributes" }, description: { type: "string" }, background: { $ref: "#/components/schemas/IBackgroundAttributes" }, text: { $ref: "#/components/schemas/ITextAttributes" }, createdAt: { type: "string", format: "date-time" }, lastUpdatedAt: { type: "string", format: "date-time" }, clientUri: { type: "string" }, tosUri: { type: "string" }, policyUri: { type: "string" }, contacts: { type: "array", items: { type: "string" } } }, additionalProperties: false, required: ["createdAt", "id", "lastUpdatedAt"] }, IAddIssuerLocaleBrandingArgs: { type: "object", properties: { issuerBrandingId: { type: "string" }, localeBranding: { type: "array", items: { $ref: "#/components/schemas/IBasicIssuerLocaleBranding" } } }, required: ["issuerBrandingId", "localeBranding"], additionalProperties: false }, ICredentialBrandingFromArgs: { type: "object", properties: { localeBranding: { $ref: "#/components/schemas/IBasicCredentialLocaleBranding" } }, required: ["localeBranding"], additionalProperties: false }, IGetCredentialBrandingArgs: { type: "object", properties: { filter: { $ref: "#/components/schemas/FindCredentialBrandingArgs" } }, additionalProperties: false }, FindCredentialBrandingArgs: { type: "array", items: { $ref: "#/components/schemas/ICredentialBrandingFilter" } }, ICredentialBrandingFilter: { type: "object", additionalProperties: false, properties: { id: { type: "string" }, issuerCorrelationId: { type: "string" }, vcHash: { type: "string" }, createdAt: { type: "string", format: "date-time" }, lastUpdatedAt: { type: "string", format: "date-time" }, localeBranding: { $ref: "#/components/schemas/IPartialCredentialLocaleBranding" } } }, IPartialCredentialLocaleBranding: { type: "object", properties: { id: { type: "string" }, alias: { type: "string" }, locale: { type: "string" }, description: { type: "string" }, createdAt: { type: "string", format: "date-time" }, lastUpdatedAt: { type: "string", format: "date-time" }, logo: { $ref: "#/components/schemas/IPartialImageAttributes" }, background: { $ref: "#/components/schemas/IPartialBackgroundAttributes" }, text: { $ref: "#/components/schemas/IPartialTextAttributes" }, claims: { $ref: "#/components/schemas/IPartialCredentialClaim" } }, additionalProperties: false }, IPartialImageAttributes: { type: "object", properties: { id: { type: "string" }, uri: { type: "string" }, dataUri: { type: "string" }, mediaType: { type: "string" }, alt: { type: "string" }, dimensions: { $ref: "#/components/schemas/IPartialImageDimensions" } }, additionalProperties: false }, IPartialImageDimensions: { type: "object", additionalProperties: false, properties: { id: { type: "string" }, width: { type: "number" }, height: { type: "number" } } }, IPartialBackgroundAttributes: { type: "object", properties: { id: { type: "string" }, color: { type: "string" }, image: { $ref: "#/components/schemas/IPartialImageAttributes" } }, additionalProperties: false }, IPartialTextAttributes: { type: "object", additionalProperties: false, properties: { id: { type: "string" }, color: { type: "string" } } }, IPartialCredentialClaim: { type: "object", additionalProperties: false, properties: { id: { type: "string" }, key: { type: "string" }, name: { type: "string" } } }, IGetCredentialLocaleBrandingArgs: { type: "object", properties: { filter: { $ref: "#/components/schemas/FindCredentialLocaleBrandingArgs" } }, additionalProperties: false }, FindCredentialLocaleBrandingArgs: { type: "array", items: { $ref: "#/components/schemas/ICredentialLocaleBrandingFilter" } }, ICredentialLocaleBrandingFilter: { type: "object", properties: { id: { type: "string" }, alias: { type: "string" }, locale: { type: "string" }, description: { type: "string" }, createdAt: { type: "string", format: "date-time" }, lastUpdatedAt: { type: "string", format: "date-time" }, logo: { $ref: "#/components/schemas/IPartialImageAttributes" }, background: { $ref: "#/components/schemas/IPartialBackgroundAttributes" }, text: { $ref: "#/components/schemas/IPartialTextAttributes" }, claims: { $ref: "#/components/schemas/IPartialCredentialClaim" }, credentialBranding: { $ref: "#/components/schemas/IPartialCredentialBranding" } }, additionalProperties: false }, IPartialCredentialBranding: { type: "object", properties: { id: { type: "string" }, issuerCorrelationId: { type: "string" }, vcHash: { type: "string" }, createdAt: { type: "string", format: "date-time" }, lastUpdatedAt: { type: "string", format: "date-time" }, localeBranding: { $ref: "#/components/schemas/IPartialCredentialLocaleBranding" } }, additionalProperties: false }, IGetIssuerBrandingArgs: { type: "object", properties: { filter: { $ref: "#/components/schemas/FindIssuerBrandingArgs" } }, additionalProperties: false }, FindIssuerBrandingArgs: { type: "array", items: { $ref: "#/components/schemas/IIssuerBrandingFilter" } }, IIssuerBrandingFilter: { type: "object", additionalProperties: false, properties: { id: { type: "string" }, issuerCorrelationId: { type: "string" }, createdAt: { type: "string", format: "date-time" }, lastUpdatedAt: { type: "string", format: "date-time" }, localeBranding: { $ref: "#/components/schemas/IPartialIssuerLocaleBranding" } } }, IPartialIssuerLocaleBranding: { type: "object", properties: { clientUri: { type: "string" }, tosUri: { type: "string" }, policyUri: { type: "string" }, id: { type: "string" }, alias: { type: "string" }, locale: { type: "string" }, description: { type: "string" }, createdAt: { type: "string", format: "date-time" }, lastUpdatedAt: { type: "string", format: "date-time" }, logo: { $ref: "#/components/schemas/IPartialImageAttributes" }, background: { $ref: "#/components/schemas/IPartialBackgroundAttributes" }, text: { $ref: "#/components/schemas/IPartialTextAttributes" }, contacts: { type: "string" } }, additionalProperties: false }, IGetIssuerLocaleBrandingArgs: { type: "object", properties: { filter: { $ref: "#/components/schemas/FindIssuerLocaleBrandingArgs" } }, additionalProperties: false }, FindIssuerLocaleBrandingArgs: { type: "array", items: { $ref: "#/components/schemas/IIssuerLocaleBrandingFilter" } }, IIssuerLocaleBrandingFilter: { type: "object", properties: { clientUri: { type: "string" }, tosUri: { type: "string" }, policyUri: { type: "string" }, id: { type: "string" }, alias: { type: "string" }, locale: { type: "string" }, description: { type: "string" }, createdAt: { type: "string", format: "date-time" }, lastUpdatedAt: { type: "string", format: "date-time" }, logo: { $ref: "#/components/schemas/IPartialImageAttributes" }, background: { $ref: "#/components/schemas/IPartialBackgroundAttributes" }, text: { $ref: "#/components/schemas/IPartialTextAttributes" }, contacts: { type: "string" }, issuerBranding: { $ref: "#/components/schemas/IPartialIssuerBranding" } }, additionalProperties: false }, IPartialIssuerBranding: { type: "object", properties: { id: { type: "string" }, issuerCorrelationId: { type: "string" }, createdAt: { type: "string", format: "date-time" }, lastUpdatedAt: { type: "string", format: "date-time" }, localeBranding: { $ref: "#/components/schemas/IPartialIssuerLocaleBranding" } }, additionalProperties: false }, IIssuerBrandingFromArgs: { type: "object", properties: { localeBranding: { $ref: "#/components/schemas/IBasicIssuerLocaleBranding" } }, required: ["localeBranding"], additionalProperties: false }, IRemoveCredentialBrandingArgs: { type: "object", properties: { filter: { $ref: "#/components/schemas/FindCredentialBrandingArgs" } }, required: ["filter"], additionalProperties: false }, IDeletionResult: { type: "object", properties: { result: { type: "boolean" }, error: { type: "string" } }, required: ["result"], additionalProperties: false }, IRemoveCredentialLocaleBrandingArgs: { type: "object", properties: { filter: { $ref: "#/components/schemas/FindCredentialLocaleBrandingArgs" } }, required: ["filter"], additionalProperties: false }, IRemoveIssuerBrandingArgs: { type: "object", properties: { filter: { $ref: "#/components/schemas/FindIssuerBrandingArgs" } }, required: ["filter"], additionalProperties: false }, IRemoveIssuerLocaleBrandingArgs: { type: "object", properties: { filter: { $ref: "#/components/schemas/FindIssuerLocaleBrandingArgs" } }, required: ["filter"], additionalProperties: false }, IUpdateCredentialBrandingArgs: { type: "object", properties: { credentialBranding: { $ref: '#/components/schemas/Omit<ICredentialBranding,("localeBranding"|"createdAt"|"lastUpdatedAt")>' } }, required: ["credentialBranding"], additionalProperties: false }, 'Omit<ICredentialBranding,("localeBranding"|"createdAt"|"lastUpdatedAt")>': { $ref: '#/components/schemas/Pick<ICredentialBranding,Exclude<("id"|"issuerCorrelationId"|"vcHash"|"localeBranding"|"createdAt"|"lastUpdatedAt"),("localeBranding"|"createdAt"|"lastUpdatedAt")>>' }, 'Pick<ICredentialBranding,Exclude<("id"|"issuerCorrelationId"|"vcHash"|"localeBranding"|"createdAt"|"lastUpdatedAt"),("localeBranding"|"createdAt"|"lastUpdatedAt")>>': { type: "object", properties: { id: { type: "string" }, issuerCorrelationId: { type: "string" }, vcHash: { type: "string" } }, required: ["id", "issuerCorrelationId", "vcHash"], additionalProperties: false }, IUpdateCredentialLocaleBrandingArgs: { type: "object", properties: { localeBranding: { $ref: '#/components/schemas/Omit<ILocaleBranding,("createdAt"|"lastUpdatedAt")>' } }, required: ["localeBranding"], additionalProperties: false }, 'Omit<ILocaleBranding,("createdAt"|"lastUpdatedAt")>': { $ref: '#/components/schemas/Pick<ILocaleBranding,Exclude<("id"|"alias"|"locale"|"logo"|"description"|"background"|"text"|"createdAt"|"lastUpdatedAt"),("createdAt"|"lastUpdatedAt")>>' }, 'Pick<ILocaleBranding,Exclude<("id"|"alias"|"locale"|"logo"|"description"|"background"|"text"|"createdAt"|"lastUpdatedAt"),("createdAt"|"lastUpdatedAt")>>': { type: "object", properties: { id: { type: "string" }, alias: { type: "string" }, locale: { type: "string" }, logo: { $ref: "#/components/schemas/IImageAttributes" }, description: { type: "string" }, background: { $ref: "#/components/schemas/IBackgroundAttributes" }, text: { $ref: "#/components/schemas/ITextAttributes" } }, required: ["id"], additionalProperties: false }, IUpdateIssuerBrandingArgs: { type: "object", properties: { issuerBranding: { $ref: '#/components/schemas/Omit<IIssuerBranding,("localeBranding"|"createdAt"|"lastUpdatedAt")>' } }, required: ["issuerBranding"], additionalProperties: false }, 'Omit<IIssuerBranding,("localeBranding"|"createdAt"|"lastUpdatedAt")>': { $ref: '#/components/schemas/Pick<IIssuerBranding,Exclude<("id"|"issuerCorrelationId"|"localeBranding"|"createdAt"|"lastUpdatedAt"),("localeBranding"|"createdAt"|"lastUpdatedAt")>>' }, 'Pick<IIssuerBranding,Exclude<("id"|"issuerCorrelationId"|"localeBranding"|"createdAt"|"lastUpdatedAt"),("localeBranding"|"createdAt"|"lastUpdatedAt")>>': { type: "object", properties: { id: { type: "string" }, issuerCorrelationId: { type: "string" } }, required: ["id", "issuerCorrelationId"], additionalProperties: false }, IUpdateIssuerLocaleBrandingArgs: { type: "object", properties: { localeBranding: { $ref: '#/components/schemas/Omit<ILocaleBranding,("createdAt"|"lastUpdatedAt")>' } }, required: ["localeBranding"], additionalProperties: false } }, methods: { ibAddCredentialBranding: { description: "", arguments: { $ref: "#/components/schemas/IAddCredentialBrandingArgs" }, returnType: { $ref: "#/components/schemas/ICredentialBranding" } }, ibAddCredentialLocaleBranding: { description: "", arguments: { $ref: "#/components/schemas/IAddCredentialLocaleBrandingArgs" }, returnType: { $ref: "#/components/schemas/ICredentialBranding" } }, ibAddIssuerBranding: { description: "", arguments: { $ref: "#/components/schemas/IAddIssuerBrandingArgs" }, returnType: { $ref: "#/components/schemas/IIssuerBranding" } }, ibAddIssuerLocaleBranding: { description: "", arguments: { $ref: "#/components/schemas/IAddIssuerLocaleBrandingArgs" }, returnType: { $ref: "#/components/schemas/IIssuerBranding" } }, ibCredentialLocaleBrandingFrom: { description: "", arguments: { $ref: "#/components/schemas/ICredentialBrandingFromArgs" }, returnType: { $ref: "#/components/schemas/IBasicCredentialLocaleBranding" } }, ibGetCredentialBranding: { description: "", arguments: { $ref: "#/components/schemas/IGetCredentialBrandingArgs" }, returnType: { type: "array", items: { $ref: "#/components/schemas/ICredentialBranding" } } }, ibGetCredentialLocaleBranding: { description: "", arguments: { $ref: "#/components/schemas/IGetCredentialLocaleBrandingArgs" }, returnType: { type: "array", items: { $ref: "#/components/schemas/ICredentialLocaleBranding" } } }, ibGetIssuerBranding: { description: "", arguments: { $ref: "#/components/schemas/IGetIssuerBrandingArgs" }, returnType: { type: "array", items: { $ref: "#/components/schemas/IIssuerBranding" } } }, ibGetIssuerLocaleBranding: { description: "", arguments: { $ref: "#/components/schemas/IGetIssuerLocaleBrandingArgs" }, returnType: { type: "array", items: { $ref: "#/components/schemas/IIssuerLocaleBranding" } } }, ibIssuerLocaleBrandingFrom: { description: "", arguments: { $ref: "#/components/schemas/IIssuerBrandingFromArgs" }, returnType: { $ref: "#/components/schemas/IBasicIssuerLocaleBranding" } }, ibRemoveCredentialBranding: { description: "", arguments: { $ref: "#/components/schemas/IRemoveCredentialBrandingArgs" }, returnType: { $ref: "#/components/schemas/IDeletionResult" } }, ibRemoveCredentialLocaleBranding: { description: "", arguments: { $ref: "#/components/schemas/IRemoveCredentialLocaleBrandingArgs" }, returnType: { $ref: "#/components/schemas/IDeletionResult" } }, ibRemoveIssuerBranding: { description: "", arguments: { $ref: "#/components/schemas/IRemoveIssuerBrandingArgs" }, returnType: { $ref: "#/components/schemas/IDeletionResult" } }, ibRemoveIssuerLocaleBranding: { description: "", arguments: { $ref: "#/components/schemas/IRemoveIssuerLocaleBrandingArgs" }, returnType: { $ref: "#/components/schemas/IDeletionResult" } }, ibUpdateCredentialBranding: { description: "", arguments: { $ref: "#/components/schemas/IUpdateCredentialBrandingArgs" }, returnType: { $ref: "#/components/schemas/ICredentialBranding" } }, ibUpdateCredentialLocaleBranding: { description: "", arguments: { $ref: "#/components/schemas/IUpdateCredentialLocaleBrandingArgs" }, returnType: { $ref: "#/components/schemas/ICredentialLocaleBranding" } }, ibUpdateIssuerBranding: { description: "", arguments: { $ref: "#/components/schemas/IUpdateIssuerBrandingArgs" }, returnType: { $ref: "#/components/schemas/IIssuerBranding" } }, ibUpdateIssuerLocaleBranding: { description: "", arguments: { $ref: "#/components/schemas/IUpdateIssuerLocaleBrandingArgs" }, returnType: { $ref: "#/components/schemas/IIssuerLocaleBranding" } } } } } }; } }); // src/index.ts var index_exports = {}; __export(index_exports, { IssuanceBranding: () => IssuanceBranding, issuanceBrandingMethods: () => issuanceBrandingMethods, schema: () => schema }); module.exports = __toCommonJS(index_exports); // src/agent/IssuanceBranding.ts var import_ssi_sdk = require("@sphereon/ssi-sdk.core"); var import_debug = __toESM(require("debug"), 1); var debug = (0, import_debug.default)("sphereon:ssi-sdk:issuance-branding"); var issuanceBrandingMethods = [ "ibAddCredentialBranding", "ibGetCredentialBranding", "ibUpdateCredentialBranding", "ibRemoveCredentialBranding", "ibAddCredentialLocaleBranding", "ibGetCredentialLocaleBranding", "ibRemoveCredentialLocaleBranding", "ibUpdateCredentialLocaleBranding", "ibCredentialLocaleBrandingFrom", "ibAddIssuerBranding", "ibGetIssuerBranding", "ibUpdateIssuerBranding", "ibRemoveIssuerBranding", "ibAddIssuerLocaleBranding", "ibGetIssuerLocaleBranding", "ibRemoveIssuerLocaleBranding", "ibUpdateIssuerLocaleBranding", "ibIssuerLocaleBrandingFrom" ]; var EMPTY_IMAGE_ATTRIBUTES = { mediaType: void 0, dataUri: void 0, dimensions: void 0 }; var IssuanceBranding = class { static { __name(this, "IssuanceBranding"); } schema = schema.IIssuanceBranding; methods = { ibAddCredentialBranding: this.ibAddCredentialBranding.bind(this), ibGetCredentialBranding: this.ibGetCredentialBranding.bind(this), ibUpdateCredentialBranding: this.ibUpdateCredentialBranding.bind(this), ibRemoveCredentialBranding: this.ibRemoveCredentialBranding.bind(this), ibAddCredentialLocaleBranding: this.ibAddCredentialLocaleBranding.bind(this), ibGetCredentialLocaleBranding: this.ibGetCredentialLocaleBranding.bind(this), ibRemoveCredentialLocaleBranding: this.ibRemoveCredentialLocaleBranding.bind(this), ibUpdateCredentialLocaleBranding: this.ibUpdateCredentialLocaleBranding.bind(this), ibCredentialLocaleBrandingFrom: this.ibCredentialLocaleBrandingFrom.bind(this), ibAddIssuerBranding: this.ibAddIssuerBranding.bind(this), ibGetIssuerBranding: this.ibGetIssuerBranding.bind(this), ibUpdateIssuerBranding: this.ibUpdateIssuerBranding.bind(this), ibRemoveIssuerBranding: this.inRemoveIssuerBranding.bind(this), ibAddIssuerLocaleBranding: this.ibAddIssuerLocaleBranding.bind(this), ibGetIssuerLocaleBranding: this.ibAGetIssuerLocaleBranding.bind(this), ibRemoveIssuerLocaleBranding: this.ibRemoveIssuerLocaleBranding.bind(this), ibUpdateIssuerLocaleBranding: this.ibUpdateIssuerLocaleBranding.bind(this), ibIssuerLocaleBrandingFrom: this.ibIssuerLocaleBrandingFrom.bind(this) }; store; constructor(options) { this.store = options.store; } /** {@inheritDoc IIssuanceBranding.ibAddCredentialBranding} */ async ibAddCredentialBranding(args, context) { const localeBranding = await Promise.all(args.localeBranding.map((localeBranding2) => this.setAdditionalImageAttributes(localeBranding2))); const credentialBranding = { ...args, localeBranding }; debug("Adding credential branding", credentialBranding); return this.store.addCredentialBranding(credentialBranding); } /** {@inheritDoc IIssuanceBranding.ibGetCredentialBranding} */ async ibGetCredentialBranding(args) { debug("Getting credential branding", args); return this.store.getCredentialBranding(args); } /** {@inheritDoc IIssuanceBranding.ibUpdateCredentialBranding} */ async ibUpdateCredentialBranding(args, context) { debug("Updating credential branding", args); return this.store.updateCredentialBranding(args); } /** {@inheritDoc IIssuanceBranding.ibRemoveCredentialBranding} */ async ibRemoveCredentialBranding(args, context) { debug("Removing credential branding", args); return this.store.removeCredentialBranding(args).then(() => ({ result: true })).catch((error) => ({ result: false, error: error.message })); } /** {@inheritDoc IIssuanceBranding.ibAddCredentialLocaleBranding} */ async ibAddCredentialLocaleBranding(args, context) { const localeBranding = await Promise.all(args.localeBranding.map((localeBranding2) => this.setAdditionalImageAttributes(localeBranding2))); const addCredentialLocaleBrandingArgs = { ...args, localeBranding }; debug("Adding credential locale branding", addCredentialLocaleBrandingArgs); return this.store.addCredentialLocaleBranding(addCredentialLocaleBrandingArgs); } /** {@inheritDoc IIssuanceBranding.ibGetCredentialLocaleBranding} */ async ibGetCredentialLocaleBranding(args) { debug("Getting credential locale branding", args); return this.store.getCredentialLocaleBranding(args); } /** {@inheritDoc IIssuanceBranding.ibRemoveCredentialLocaleBranding} */ async ibRemoveCredentialLocaleBranding(args, context) { debug("Removing credential locale branding", args); return this.store.removeCredentialLocaleBranding(args).then(() => ({ result: true })).catch((error) => ({ result: false, error: error.message })); } /** {@inheritDoc IIssuanceBranding.ibUpdateCredentialLocaleBranding} */ async ibUpdateCredentialLocaleBranding(args, context) { const localeBranding = await this.setAdditionalImageAttributes(args.localeBranding); const updateCredentialLocaleBrandingArgs = { ...args, localeBranding }; debug("Updating credential locale branding", updateCredentialLocaleBrandingArgs); return this.store.updateCredentialLocaleBranding(updateCredentialLocaleBrandingArgs); } /** {@inheritDoc IIssuanceBranding.ibCredentialLocaleBrandingFrom} */ async ibCredentialLocaleBrandingFrom(args, context) { debug("get credential locale branding from", args); return this.setAdditionalImageAttributes(args.localeBranding); } /** {@inheritDoc IIssuanceBranding.ibAddIssuerBranding} */ async ibAddIssuerBranding(args, context) { const localeBranding = await Promise.all(args.localeBranding.map((localeBranding2) => this.setAdditionalImageAttributes(localeBranding2))); const issuerBranding = { ...args, localeBranding }; debug("Adding issuer branding", issuerBranding); return this.store.addIssuerBranding(issuerBranding); } /** {@inheritDoc IIssuanceBranding.ibGetIssuerBranding} */ async ibGetIssuerBranding(args) { debug("Getting issuer branding", args); return this.store.getIssuerBranding(args); } /** {@inheritDoc IIssuanceBranding.ibUpdateIssuerBranding} */ async ibUpdateIssuerBranding(args, context) { debug("Updating issuer branding", args); return this.store.updateIssuerBranding(args); } /** {@inheritDoc IIssuanceBranding.inRemoveIssuerBranding} */ async inRemoveIssuerBranding(args, context) { debug("Removing issuer branding", args); return this.store.removeIssuerBranding(args).then(() => ({ result: true })).catch((error) => ({ result: false, error: error.message })); } /** {@inheritDoc IIssuanceBranding.ibAddIssuerLocaleBranding} */ async ibAddIssuerLocaleBranding(args, context) { const localeBranding = await Promise.all(args.localeBranding.map((localeBranding2) => this.setAdditionalImageAttributes(localeBranding2))); const addIssuerLocaleBrandingArgs = { ...args, localeBranding }; debug("Adding issuer locale branding", addIssuerLocaleBrandingArgs); return this.store.addIssuerLocaleBranding(addIssuerLocaleBrandingArgs); } /** {@inheritDoc IIssuanceBranding.ibAGetIssuerLocaleBranding} */ async ibAGetIssuerLocaleBranding(args) { debug("Getting issuer locale branding", args); return this.store.getIssuerLocaleBranding(args); } /** {@inheritDoc IIssuanceBranding.ibRemoveIssuerLocaleBranding} */ async ibRemoveIssuerLocaleBranding(args, context) { debug("Removing issuer locale branding", args); return this.store.removeIssuerLocaleBranding(args).then(() => ({ result: true })).catch((error) => ({ result: false, error: error.message })); } /** {@inheritDoc IIssuanceBranding.ibUpdateIssuerLocaleBranding} */ async ibUpdateIssuerLocaleBranding(args, context) { const localeBranding = await this.setAdditionalImageAttributes(args.localeBranding); const updateIssuerLocaleBrandingArgs = { ...args, localeBranding }; debug("Updating issuer locale branding", updateIssuerLocaleBrandingArgs); return this.store.updateIssuerLocaleBranding(updateIssuerLocaleBrandingArgs); } /** {@inheritDoc IIssuanceBranding.ibIssuerLocaleBrandingFrom} */ async ibIssuerLocaleBrandingFrom(args, context) { debug("get issuer locale branding from", args); return this.setAdditionalImageAttributes(args.localeBranding); } // todo: We really should add a cache for urls. We now fetch the same images multiple times in case the logo/background image is the same for multiple locales. async setAdditionalImageAttributes(localeBranding) { return { ...localeBranding, ...localeBranding.logo && { logo: { ...localeBranding.logo, ...localeBranding