UNPKG

@sphereon/ssi-sdk.data-store

Version:

75 lines 4.16 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.CreateDigitalCredential1708525189001 = void 0; class CreateDigitalCredential1708525189001 { constructor() { this.name = 'CreateDigitalCredential1708525189001'; } up(queryRunner) { return __awaiter(this, void 0, void 0, function* () { yield queryRunner.query(`CREATE TYPE "digital_document_type" AS ENUM('VC', 'VP', 'C', 'P')`); yield queryRunner.query(`CREATE TYPE "digital_regulation_type" AS ENUM('PID', 'QEAA', 'EAA', 'NON_REGULATED')`); yield queryRunner.query(`CREATE TYPE "digital_credential_document_format" AS ENUM('JSON_LD', 'JWT', 'SD_JWT', 'MSO_MDOC')`); yield queryRunner.query(`CREATE TYPE "digital_credential_credential_role" AS ENUM('ISSUER', 'VERIFIER', 'HOLDER', 'FEDERATION_TRUST_ANCHOR')`); yield queryRunner.query(`CREATE TYPE "digital_credential_correlation_type" AS ENUM('DID', 'KID', 'URL', 'X509_SAN')`); yield queryRunner.query(`CREATE TYPE "digital_credential_state_type" AS ENUM('REVOKED', 'VERIFIED', 'EXPIRED')`); // TODO FK for parent yield queryRunner.query(` CREATE TABLE "DigitalCredential" ( "id" uuid NOT NULL DEFAULT uuid_generate_v4(), "parent_id" text, "document_type" "digital_document_type" NOT NULL, "regulation_type" "digital_regulation_type" NOT NULL DEFAULT 'NON_REGULATED'::"digital_regulation_type", "document_format" "digital_credential_document_format" NOT NULL, "credential_role" "digital_credential_credential_role" NOT NULL, "raw_document" text NOT NULL, "uniform_document" text NOT NULL, "credential_id" text, "hash" text NOT NULL, "kms_key_ref" text, "identifier_method" text, "issuer_correlation_type" "digital_credential_correlation_type" NOT NULL, "subject_correlation_type" "digital_credential_correlation_type", "issuer_correlation_id" text NOT NULL, "subject_correlation_id" text, "verified_state" "digital_credential_state_type", "issuer_signed" boolean, "rp_correlation_id" text, "rp_correlation_type" "digital_credential_correlation_type", "tenant_id" text, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "presented_at" DATE, "valid_from" DATE, "valid_until" DATE, "verified_at" DATE, "revoked_at" DATE, PRIMARY KEY ("id"), UNIQUE ("hash", "credential_role") ) `); }); } down(queryRunner) { return __awaiter(this, void 0, void 0, function* () { yield queryRunner.query(`DROP TABLE "DigitalCredential"`); yield queryRunner.query(`DROP TYPE "digital_credential_state_type"`); yield queryRunner.query(`DROP TYPE "digital_credential_correlation_type"`); yield queryRunner.query(`DROP TYPE "digital_credential_document_format"`); yield queryRunner.query(`DROP TYPE "digital_credential_credential_role"`); yield queryRunner.query(`DROP TYPE "digital_regulation_type"`); yield queryRunner.query(`DROP TYPE "digital_document_type"`); }); } } exports.CreateDigitalCredential1708525189001 = CreateDigitalCredential1708525189001; //# sourceMappingURL=1708525189001-CreateDigitalCredential.js.map