@powerhousedao/renown-package 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/document-models/renown-credential/gen/document-model.js +1 -1
- package/dist/document-models/renown-credential/gen/manager/object.d.ts +1 -1
- package/dist/document-models/renown-credential/gen/object.d.ts +1 -1
- package/dist/document-models/renown-credential/gen/reducer.d.ts +1 -1
- package/dist/document-models/renown-credential/gen/utils.d.ts +1 -1
- package/dist/document-models/renown-credential/gen/utils.js +1 -1
- package/dist/editors/hooks/useRenownCredentialDocument.d.ts +3 -0
- package/dist/editors/hooks/useRenownCredentialDocument.js +8 -0
- package/dist/editors/index.d.ts +1 -0
- package/dist/editors/index.js +1 -0
- package/dist/editors/renown-credential-editor/editor.d.ts +3 -0
- package/dist/editors/renown-credential-editor/editor.js +115 -0
- package/dist/editors/renown-credential-editor/index.d.ts +2 -0
- package/dist/editors/renown-credential-editor/index.js +11 -0
- package/dist/powerhouse.manifest.json +4 -0
- package/dist/processors/renown-credential/migrations.js +2 -2
- package/dist/processors/renown-user/migrations.js +2 -2
- package/dist/style.css +92 -0
- package/dist/subgraphs/renown-credential/resolvers.js +3 -3
- package/dist/subgraphs/renown-credential/schema.js +1 -1
- package/dist/subgraphs/renown-read-model/schema.js +7 -7
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseDocumentClass } from "document-model";
|
|
2
|
-
import {
|
|
2
|
+
import { RenownCredentialPHState } from "../ph-factories.js";
|
|
3
3
|
import { type InitInput, type RevokeInput, type UpdateCredentialSubjectInput, type SetJwtInput, type SetCredentialStatusInput } from "../types.js";
|
|
4
4
|
export default class RenownCredential_Manager extends BaseDocumentClass<RenownCredentialPHState> {
|
|
5
5
|
init(input: InitInput): this;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseDocumentClass, type SignalDispatch } from "document-model";
|
|
2
|
-
import {
|
|
2
|
+
import { RenownCredentialPHState } from "./ph-factories.js";
|
|
3
3
|
import RenownCredential_Manager from "./manager/object.js";
|
|
4
4
|
export * from "./manager/object.js";
|
|
5
5
|
interface RenownCredential extends RenownCredential_Manager {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type StateReducer } from "document-model";
|
|
2
|
-
import {
|
|
2
|
+
import { RenownCredentialPHState } from "./ph-factories.js";
|
|
3
3
|
export declare const stateReducer: StateReducer<RenownCredentialPHState>;
|
|
4
4
|
export declare const reducer: import("document-model").Reducer<RenownCredentialPHState>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CreateDocument, type CreateState, type LoadFromFile, type LoadFromInput } from "document-model";
|
|
2
2
|
import { type RenownCredentialState, type RenownCredentialLocalState } from "./types.js";
|
|
3
|
-
import {
|
|
3
|
+
import { RenownCredentialPHState } from "./ph-factories.js";
|
|
4
4
|
export declare const initialGlobalState: RenownCredentialState;
|
|
5
5
|
export declare const initialLocalState: RenownCredentialLocalState;
|
|
6
6
|
export declare const createState: CreateState<RenownCredentialPHState>;
|
|
@@ -24,7 +24,7 @@ export const createState = (state) => {
|
|
|
24
24
|
};
|
|
25
25
|
export const createDocument = (state) => {
|
|
26
26
|
const document = baseCreateDocument(createState, state);
|
|
27
|
-
document.header.documentType = "renown
|
|
27
|
+
document.header.documentType = "powerhouse/renown-credential";
|
|
28
28
|
// for backwards compatibility, but this is NOT a valid signed document id
|
|
29
29
|
document.header.id = generateId();
|
|
30
30
|
return document;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { RenownCredentialDocument } from "../../document-models/renown-credential/index.js";
|
|
2
|
+
export declare function useRenownCredentialDocument(documentId: string | null | undefined): never[] | [RenownCredentialDocument, import("@powerhousedao/reactor-browser").DocumentDispatch<import("../../document-models/renown-credential/gen/actions.js").RenownCredentialManagerAction>];
|
|
3
|
+
export declare function useSelectedRenownCredentialDocument(): never[] | [RenownCredentialDocument, import("@powerhousedao/reactor-browser").DocumentDispatch<import("../../document-models/renown-credential/gen/actions.js").RenownCredentialManagerAction>];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useDocumentOfType, useSelectedDocumentId, } from "@powerhousedao/reactor-browser";
|
|
2
|
+
export function useRenownCredentialDocument(documentId) {
|
|
3
|
+
return useDocumentOfType(documentId, "powerhouse/renown-credential");
|
|
4
|
+
}
|
|
5
|
+
export function useSelectedRenownCredentialDocument() {
|
|
6
|
+
const selectedDocumentId = useSelectedDocumentId();
|
|
7
|
+
return useRenownCredentialDocument(selectedDocumentId);
|
|
8
|
+
}
|
package/dist/editors/index.d.ts
CHANGED
package/dist/editors/index.js
CHANGED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useSelectedDocument } from "@powerhousedao/reactor-browser";
|
|
3
|
+
import { useCallback, useState } from "react";
|
|
4
|
+
import { actions, } from "../../document-models/renown-credential/index.js";
|
|
5
|
+
import { Form, StringField, TextareaField, Button, } from "@powerhousedao/document-engineering";
|
|
6
|
+
export function Editor(props) {
|
|
7
|
+
const [document, dispatch] = useSelectedDocument();
|
|
8
|
+
if (!document) {
|
|
9
|
+
return _jsx("div", { children: "Loading..." });
|
|
10
|
+
}
|
|
11
|
+
const typedDocument = document;
|
|
12
|
+
// Local form state
|
|
13
|
+
const [isInitializing, setIsInitializing] = useState(false);
|
|
14
|
+
const [isEditingSubject, setIsEditingSubject] = useState(false);
|
|
15
|
+
const [isSettingJwt, setIsSettingJwt] = useState(false);
|
|
16
|
+
const [isSettingStatus, setIsSettingStatus] = useState(false);
|
|
17
|
+
const { state: { global }, } = typedDocument;
|
|
18
|
+
const { context, id: credentialId, type, issuer, issuanceDate, credentialSubject, expirationDate, credentialStatus, jwt, revoked, revokedAt, revocationReason, } = global;
|
|
19
|
+
const isInitialized = issuer && issuanceDate;
|
|
20
|
+
// Initialize credential
|
|
21
|
+
const handleInit = useCallback((values) => {
|
|
22
|
+
try {
|
|
23
|
+
const contextArray = values.context
|
|
24
|
+
? values.context.split(",").map((s) => s.trim())
|
|
25
|
+
: undefined;
|
|
26
|
+
const typeArray = values.type
|
|
27
|
+
? values.type.split(",").map((s) => s.trim())
|
|
28
|
+
: undefined;
|
|
29
|
+
dispatch(actions.init({
|
|
30
|
+
issuer: values.issuer,
|
|
31
|
+
issuanceDate: new Date().toISOString(),
|
|
32
|
+
credentialSubject: values.credentialSubject,
|
|
33
|
+
expirationDate: values.expirationDate || undefined,
|
|
34
|
+
context: contextArray,
|
|
35
|
+
type: typeArray,
|
|
36
|
+
id: values.id,
|
|
37
|
+
}));
|
|
38
|
+
setIsInitializing(false);
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
console.error("Error initializing credential:", error);
|
|
42
|
+
}
|
|
43
|
+
}, [dispatch]);
|
|
44
|
+
// Update credential subject
|
|
45
|
+
const handleUpdateSubject = useCallback((newSubject) => {
|
|
46
|
+
try {
|
|
47
|
+
JSON.parse(newSubject); // Validate JSON
|
|
48
|
+
dispatch(actions.updateCredentialSubject({ credentialSubject: newSubject }));
|
|
49
|
+
setIsEditingSubject(false);
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
console.error("Error updating credential subject:", error);
|
|
53
|
+
}
|
|
54
|
+
}, [dispatch]);
|
|
55
|
+
// Set JWT
|
|
56
|
+
const handleSetJwt = useCallback((newJwt) => {
|
|
57
|
+
dispatch(actions.setJwt({ jwt: newJwt }));
|
|
58
|
+
setIsSettingJwt(false);
|
|
59
|
+
}, [dispatch]);
|
|
60
|
+
// Set credential status
|
|
61
|
+
const handleSetStatus = useCallback((values) => {
|
|
62
|
+
dispatch(actions.setCredentialStatus(values));
|
|
63
|
+
setIsSettingStatus(false);
|
|
64
|
+
}, [dispatch]);
|
|
65
|
+
// Revoke credential
|
|
66
|
+
const handleRevoke = useCallback((reason) => {
|
|
67
|
+
if (window.confirm("Are you sure you want to revoke this credential?")) {
|
|
68
|
+
dispatch(actions.revoke({
|
|
69
|
+
revokedAt: new Date().toISOString(),
|
|
70
|
+
reason,
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
}, [dispatch]);
|
|
74
|
+
return (_jsxs("div", { className: "html-defaults-container min-h-screen bg-gray-50", children: [_jsx("div", { className: "bg-white border-b border-gray-200", children: _jsx("div", { className: "max-w-6xl mx-auto px-4 sm:px-6 lg:px-8", children: _jsx("div", { className: "py-8", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("h1", { className: "text-3xl font-bold text-gray-900", children: "Verifiable Credential" }), revoked && (_jsx("span", { className: "inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-red-100 text-red-800", children: "Revoked" })), !isInitialized && (_jsx("span", { className: "inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-yellow-100 text-yellow-800", children: "Not Initialized" }))] }), issuer && (_jsxs("p", { className: "text-gray-600 mt-2 text-sm", children: ["Issued by: ", _jsx("span", { className: "font-mono", children: issuer })] }))] }), isInitialized && !revoked && (_jsx(Button, { color: "danger", onClick: () => {
|
|
75
|
+
const reason = window.prompt("Enter revocation reason (optional):");
|
|
76
|
+
if (reason !== null) {
|
|
77
|
+
handleRevoke(reason || undefined);
|
|
78
|
+
}
|
|
79
|
+
}, children: "Revoke Credential" }))] }) }) }) }), _jsx("div", { className: "max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-8", children: _jsx("div", { className: "grid grid-cols-1 gap-8", children: !isInitialized ? (
|
|
80
|
+
/* Initialize Section */
|
|
81
|
+
_jsxs("div", { className: "bg-white rounded-xl shadow-md border border-gray-200 overflow-hidden", children: [_jsxs("div", { className: "px-6 py-5 bg-blue-50", children: [_jsx("h2", { className: "text-2xl font-bold text-gray-900", children: "Initialize Credential" }), _jsx("p", { className: "text-sm text-gray-600 mt-1", children: "Create a new W3C Verifiable Credential" })] }), _jsx("div", { className: "p-6", children: _jsx(Form, { onSubmit: (e) => {
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
const formData = new FormData(e.target);
|
|
84
|
+
handleInit({
|
|
85
|
+
issuer: formData.get("issuer"),
|
|
86
|
+
credentialSubject: formData.get("credentialSubject"),
|
|
87
|
+
expirationDate: formData.get("expirationDate"),
|
|
88
|
+
context: formData.get("context"),
|
|
89
|
+
type: formData.get("type"),
|
|
90
|
+
id: formData.get("id"),
|
|
91
|
+
});
|
|
92
|
+
}, children: _jsxs("div", { className: "space-y-6", children: [_jsx(StringField, { name: "issuer", label: "Issuer", required: true, placeholder: "did:example:issuer123", description: "DID or URL of the credential issuer" }), _jsx(TextareaField, { name: "credentialSubject", label: "Credential Subject (JSON)", required: true, placeholder: '{"id": "did:example:subject123", "name": "Alice"}', description: "JSON object containing the claims about the subject", rows: 4 }), _jsx(StringField, { name: "expirationDate", label: "Expiration Date (Optional)", placeholder: "2025-12-31T23:59:59Z", description: "ISO 8601 date when the credential expires" }), _jsx(StringField, { name: "context", label: "Context (Optional)", placeholder: "https://www.w3.org/2018/credentials/v1, https://example.com/contexts/v1", description: "Comma-separated list of context URLs (default: W3C VC context)" }), _jsx(StringField, { name: "type", label: "Type (Optional)", placeholder: "VerifiableCredential, ExampleCredential", description: "Comma-separated list of types (default: VerifiableCredential)" }), _jsx(StringField, { name: "id", label: "Credential ID (Optional)", placeholder: "urn:uuid:...", description: "Unique identifier for this credential" }), _jsx("div", { className: "flex justify-end pt-4", children: _jsx(Button, { type: "submit", children: "Initialize Credential" }) })] }) }) })] })) : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "bg-white rounded-xl shadow-md border border-gray-200 overflow-hidden", children: [_jsx("div", { className: "px-6 py-5 bg-gray-50", children: _jsx("h2", { className: "text-2xl font-bold text-gray-900", children: "Credential Information" }) }), _jsxs("div", { className: "p-6", children: [_jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [_jsxs("div", { className: "bg-gray-50 p-4 rounded-lg border border-gray-200", children: [_jsx("label", { className: "block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2", children: "Credential ID" }), _jsx("p", { className: "text-sm font-mono text-gray-900 break-all", children: credentialId || (_jsx("span", { className: "text-gray-400 italic", children: "Not set" })) })] }), _jsxs("div", { className: "bg-gray-50 p-4 rounded-lg border border-gray-200", children: [_jsx("label", { className: "block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2", children: "Issuer" }), _jsx("p", { className: "text-sm font-mono text-gray-900 break-all", children: issuer })] }), _jsxs("div", { className: "bg-gray-50 p-4 rounded-lg border border-gray-200", children: [_jsx("label", { className: "block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2", children: "Issuance Date" }), _jsx("p", { className: "text-sm text-gray-900", children: issuanceDate
|
|
93
|
+
? new Date(issuanceDate).toLocaleString()
|
|
94
|
+
: "N/A" })] }), _jsxs("div", { className: "bg-gray-50 p-4 rounded-lg border border-gray-200", children: [_jsx("label", { className: "block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2", children: "Expiration Date" }), _jsx("p", { className: "text-sm text-gray-900", children: expirationDate ? (new Date(expirationDate).toLocaleString()) : (_jsx("span", { className: "text-gray-400 italic", children: "No expiration" })) })] })] }), _jsxs("div", { className: "mt-6 bg-gray-50 p-4 rounded-lg border border-gray-200", children: [_jsx("label", { className: "block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2", children: "Context" }), _jsx("div", { className: "flex flex-wrap gap-2", children: context && context.map((ctx, i) => (_jsx("span", { className: "inline-block px-2 py-1 text-xs font-mono bg-blue-100 text-blue-800 rounded", children: ctx }, i))) })] }), _jsxs("div", { className: "mt-6 bg-gray-50 p-4 rounded-lg border border-gray-200", children: [_jsx("label", { className: "block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2", children: "Type" }), _jsx("div", { className: "flex flex-wrap gap-2", children: type && type.map((t, i) => (_jsx("span", { className: "inline-block px-2 py-1 text-xs font-mono bg-green-100 text-green-800 rounded", children: t }, i))) })] })] })] }), _jsxs("div", { className: "bg-white rounded-xl shadow-md border border-gray-200 overflow-hidden", children: [_jsx("div", { className: "px-6 py-5 bg-gray-50", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h2", { className: "text-2xl font-bold text-gray-900", children: "Credential Subject" }), !revoked && !isEditingSubject && (_jsx(Button, { color: "light", onClick: () => setIsEditingSubject(true), children: "Edit Subject" }))] }) }), _jsx("div", { className: "p-6", children: isEditingSubject ? (_jsx(Form, { onSubmit: (e) => {
|
|
95
|
+
e.preventDefault();
|
|
96
|
+
const formData = new FormData(e.target);
|
|
97
|
+
handleUpdateSubject(formData.get("credentialSubject"));
|
|
98
|
+
}, children: _jsxs("div", { className: "space-y-4", children: [_jsx(TextareaField, { name: "credentialSubject", label: "Credential Subject (JSON)", defaultValue: credentialSubject || "", required: true, rows: 8, description: "JSON object containing the claims about the subject" }), _jsxs("div", { className: "flex justify-end space-x-3", children: [_jsx(Button, { color: "light", onClick: () => setIsEditingSubject(false), children: "Cancel" }), _jsx(Button, { type: "submit", children: "Update Subject" })] })] }) })) : (_jsx("pre", { className: "bg-gray-50 p-4 rounded-lg border border-gray-200 overflow-auto text-sm", children: JSON.stringify(JSON.parse(credentialSubject || "{}"), null, 2) })) })] }), _jsxs("div", { className: "bg-white rounded-xl shadow-md border border-gray-200 overflow-hidden", children: [_jsx("div", { className: "px-6 py-5 bg-gray-50", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h2", { className: "text-2xl font-bold text-gray-900", children: "JWT Representation" }), !isSettingJwt && (_jsx(Button, { color: "light", onClick: () => setIsSettingJwt(true), children: jwt ? "Update JWT" : "Set JWT" }))] }) }), _jsx("div", { className: "p-6", children: isSettingJwt ? (_jsx(Form, { onSubmit: (e) => {
|
|
99
|
+
e.preventDefault();
|
|
100
|
+
const formData = new FormData(e.target);
|
|
101
|
+
handleSetJwt(formData.get("jwt"));
|
|
102
|
+
}, children: _jsxs("div", { className: "space-y-4", children: [_jsx(TextareaField, { name: "jwt", label: "JWT Token", defaultValue: jwt || "", required: true, rows: 6, description: "Signed JWT representation of the credential" }), _jsxs("div", { className: "flex justify-end space-x-3", children: [_jsx(Button, { color: "light", onClick: () => setIsSettingJwt(false), children: "Cancel" }), _jsx(Button, { type: "submit", children: "Set JWT" })] })] }) })) : jwt ? (_jsx("div", { className: "bg-gray-50 p-4 rounded-lg border border-gray-200", children: _jsx("p", { className: "text-xs font-mono text-gray-900 break-all", children: jwt }) })) : (_jsx("p", { className: "text-gray-500 italic", children: "No JWT set" })) })] }), _jsxs("div", { className: "bg-white rounded-xl shadow-md border border-gray-200 overflow-hidden", children: [_jsx("div", { className: "px-6 py-5 bg-gray-50", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h2", { className: "text-2xl font-bold text-gray-900", children: "Credential Status (StatusList2021)" }), !credentialStatus && !isSettingStatus && (_jsx(Button, { color: "light", onClick: () => setIsSettingStatus(true), children: "Set Status" }))] }) }), _jsx("div", { className: "p-6", children: isSettingStatus ? (_jsx(Form, { onSubmit: (e) => {
|
|
103
|
+
e.preventDefault();
|
|
104
|
+
const formData = new FormData(e.target);
|
|
105
|
+
handleSetStatus({
|
|
106
|
+
statusId: formData.get("statusId"),
|
|
107
|
+
statusType: formData.get("statusType"),
|
|
108
|
+
statusPurpose: formData.get("statusPurpose"),
|
|
109
|
+
statusListIndex: formData.get("statusListIndex"),
|
|
110
|
+
statusListCredential: formData.get("statusListCredential"),
|
|
111
|
+
});
|
|
112
|
+
}, children: _jsxs("div", { className: "space-y-4", children: [_jsx(StringField, { name: "statusId", label: "Status ID", required: true, placeholder: "https://example.com/status/1" }), _jsx(StringField, { name: "statusType", label: "Status Type", required: true, placeholder: "StatusList2021Entry" }), _jsx(StringField, { name: "statusPurpose", label: "Status Purpose", required: true, placeholder: "revocation", description: "Either 'revocation' or 'suspension'" }), _jsx(StringField, { name: "statusListIndex", label: "Status List Index", required: true, placeholder: "12345" }), _jsx(TextareaField, { name: "statusListCredential", label: "Status List Credential URL", required: true, placeholder: "https://example.com/status-lists/1", rows: 2 }), _jsxs("div", { className: "flex justify-end space-x-3", children: [_jsx(Button, { color: "light", onClick: () => setIsSettingStatus(false), children: "Cancel" }), _jsx(Button, { type: "submit", children: "Set Status" })] })] }) })) : credentialStatus ? (_jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [_jsxs("div", { className: "bg-gray-50 p-4 rounded-lg border border-gray-200", children: [_jsx("label", { className: "block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2", children: "Status ID" }), _jsx("p", { className: "text-sm font-mono text-gray-900 break-all", children: credentialStatus.id })] }), _jsxs("div", { className: "bg-gray-50 p-4 rounded-lg border border-gray-200", children: [_jsx("label", { className: "block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2", children: "Type" }), _jsx("p", { className: "text-sm text-gray-900", children: credentialStatus.type })] }), _jsxs("div", { className: "bg-gray-50 p-4 rounded-lg border border-gray-200", children: [_jsx("label", { className: "block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2", children: "Purpose" }), _jsx("p", { className: "text-sm text-gray-900", children: credentialStatus.statusPurpose })] }), _jsxs("div", { className: "bg-gray-50 p-4 rounded-lg border border-gray-200", children: [_jsx("label", { className: "block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2", children: "List Index" }), _jsx("p", { className: "text-sm text-gray-900", children: credentialStatus.statusListIndex })] }), _jsxs("div", { className: "col-span-2 bg-gray-50 p-4 rounded-lg border border-gray-200", children: [_jsx("label", { className: "block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2", children: "Status List Credential" }), _jsx("p", { className: "text-sm font-mono text-gray-900 break-all", children: credentialStatus.statusListCredential })] })] })) : (_jsx("p", { className: "text-gray-500 italic", children: "No credential status set" })) })] }), revoked && (_jsxs("div", { className: "bg-red-50 rounded-xl shadow-md border border-red-200 overflow-hidden", children: [_jsx("div", { className: "px-6 py-5 bg-red-100", children: _jsx("h2", { className: "text-2xl font-bold text-red-900", children: "Revocation Information" }) }), _jsx("div", { className: "p-6", children: _jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "bg-white p-4 rounded-lg border border-red-200", children: [_jsx("label", { className: "block text-xs font-semibold text-red-600 uppercase tracking-wider mb-2", children: "Revoked At" }), _jsx("p", { className: "text-sm text-gray-900", children: revokedAt
|
|
113
|
+
? new Date(revokedAt).toLocaleString()
|
|
114
|
+
: "N/A" })] }), revocationReason && (_jsxs("div", { className: "bg-white p-4 rounded-lg border border-red-200", children: [_jsx("label", { className: "block text-xs font-semibold text-red-600 uppercase tracking-wider mb-2", children: "Revocation Reason" }), _jsx("p", { className: "text-sm text-gray-900", children: revocationReason })] }))] }) })] }))] })) }) })] }));
|
|
115
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Editor } from "./editor.js";
|
|
2
|
+
export const module = {
|
|
3
|
+
Component: Editor,
|
|
4
|
+
documentTypes: ["powerhouse/renown-credential"],
|
|
5
|
+
config: {
|
|
6
|
+
id: "renown-credential-editor",
|
|
7
|
+
disableExternalControls: true,
|
|
8
|
+
documentToolbarEnabled: true,
|
|
9
|
+
showSwitchboardLink: true,
|
|
10
|
+
},
|
|
11
|
+
};
|
|
@@ -72,6 +72,6 @@ export async function down(db) {
|
|
|
72
72
|
.dropIndex("idx_renown_credential_credential_id")
|
|
73
73
|
.ifExists()
|
|
74
74
|
.execute();
|
|
75
|
-
// Drop renown_credential table
|
|
76
|
-
await db.schema.dropTable("renown_credential").ifExists().execute();
|
|
75
|
+
// Drop renown_credential table with CASCADE to drop dependent objects
|
|
76
|
+
await db.schema.dropTable("renown_credential").ifExists().cascade().execute();
|
|
77
77
|
}
|
|
@@ -31,6 +31,6 @@ export async function down(db) {
|
|
|
31
31
|
// Drop renown_user indexes
|
|
32
32
|
await db.schema.dropIndex("idx_renown_user_eth_address").ifExists().execute();
|
|
33
33
|
await db.schema.dropIndex("idx_renown_user_username").ifExists().execute();
|
|
34
|
-
// Drop renown_user table
|
|
35
|
-
await db.schema.dropTable("renown_user").ifExists().execute();
|
|
34
|
+
// Drop renown_user table with CASCADE to drop dependent objects
|
|
35
|
+
await db.schema.dropTable("renown_user").ifExists().cascade().execute();
|
|
36
36
|
}
|
package/dist/style.css
CHANGED
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
"Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
8
8
|
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
|
|
9
9
|
"Courier New", monospace;
|
|
10
|
+
--color-red-50: oklch(97.1% 0.013 17.38);
|
|
10
11
|
--color-red-100: oklch(93.6% 0.032 17.717);
|
|
12
|
+
--color-red-200: oklch(88.5% 0.062 18.334);
|
|
11
13
|
--color-red-300: oklch(80.8% 0.114 19.571);
|
|
12
14
|
--color-red-400: oklch(70.4% 0.191 22.216);
|
|
13
15
|
--color-red-500: oklch(63.7% 0.237 25.331);
|
|
@@ -99,6 +101,7 @@
|
|
|
99
101
|
--container-2xl: 42rem;
|
|
100
102
|
--container-4xl: 56rem;
|
|
101
103
|
--container-5xl: 64rem;
|
|
104
|
+
--container-6xl: 72rem;
|
|
102
105
|
--text-xs: 0.75rem;
|
|
103
106
|
--text-xs--line-height: calc(1 / 0.75);
|
|
104
107
|
--text-sm: 0.875rem;
|
|
@@ -298,12 +301,21 @@
|
|
|
298
301
|
.static {
|
|
299
302
|
position: static;
|
|
300
303
|
}
|
|
304
|
+
.col-span-2 {
|
|
305
|
+
grid-column: span 2 / span 2;
|
|
306
|
+
}
|
|
301
307
|
.mx-auto {
|
|
302
308
|
margin-inline: auto;
|
|
303
309
|
}
|
|
304
310
|
.mt-1 {
|
|
305
311
|
margin-top: calc(var(--spacing) * 1);
|
|
306
312
|
}
|
|
313
|
+
.mt-2 {
|
|
314
|
+
margin-top: calc(var(--spacing) * 2);
|
|
315
|
+
}
|
|
316
|
+
.mt-6 {
|
|
317
|
+
margin-top: calc(var(--spacing) * 6);
|
|
318
|
+
}
|
|
307
319
|
.mb-2 {
|
|
308
320
|
margin-bottom: calc(var(--spacing) * 2);
|
|
309
321
|
}
|
|
@@ -322,6 +334,9 @@
|
|
|
322
334
|
.grid {
|
|
323
335
|
display: grid;
|
|
324
336
|
}
|
|
337
|
+
.inline-block {
|
|
338
|
+
display: inline-block;
|
|
339
|
+
}
|
|
325
340
|
.inline-flex {
|
|
326
341
|
display: inline-flex;
|
|
327
342
|
}
|
|
@@ -370,6 +385,9 @@
|
|
|
370
385
|
.max-w-5xl {
|
|
371
386
|
max-width: var(--container-5xl);
|
|
372
387
|
}
|
|
388
|
+
.max-w-6xl {
|
|
389
|
+
max-width: var(--container-6xl);
|
|
390
|
+
}
|
|
373
391
|
.flex-1 {
|
|
374
392
|
flex: 1;
|
|
375
393
|
}
|
|
@@ -379,6 +397,9 @@
|
|
|
379
397
|
.grid-cols-1 {
|
|
380
398
|
grid-template-columns: repeat(1, minmax(0, 1fr));
|
|
381
399
|
}
|
|
400
|
+
.flex-wrap {
|
|
401
|
+
flex-wrap: wrap;
|
|
402
|
+
}
|
|
382
403
|
.items-center {
|
|
383
404
|
align-items: center;
|
|
384
405
|
}
|
|
@@ -397,12 +418,25 @@
|
|
|
397
418
|
.gap-2 {
|
|
398
419
|
gap: calc(var(--spacing) * 2);
|
|
399
420
|
}
|
|
421
|
+
.gap-3 {
|
|
422
|
+
gap: calc(var(--spacing) * 3);
|
|
423
|
+
}
|
|
424
|
+
.gap-4 {
|
|
425
|
+
gap: calc(var(--spacing) * 4);
|
|
426
|
+
}
|
|
400
427
|
.gap-6 {
|
|
401
428
|
gap: calc(var(--spacing) * 6);
|
|
402
429
|
}
|
|
403
430
|
.gap-8 {
|
|
404
431
|
gap: calc(var(--spacing) * 8);
|
|
405
432
|
}
|
|
433
|
+
.space-y-4 {
|
|
434
|
+
:where(& > :not(:last-child)) {
|
|
435
|
+
--tw-space-y-reverse: 0;
|
|
436
|
+
margin-block-start: calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));
|
|
437
|
+
margin-block-end: calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)));
|
|
438
|
+
}
|
|
439
|
+
}
|
|
406
440
|
.space-y-6 {
|
|
407
441
|
:where(& > :not(:last-child)) {
|
|
408
442
|
--tw-space-y-reverse: 0;
|
|
@@ -445,9 +479,15 @@
|
|
|
445
479
|
margin-inline-end: calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-x-reverse)));
|
|
446
480
|
}
|
|
447
481
|
}
|
|
482
|
+
.overflow-auto {
|
|
483
|
+
overflow: auto;
|
|
484
|
+
}
|
|
448
485
|
.overflow-hidden {
|
|
449
486
|
overflow: hidden;
|
|
450
487
|
}
|
|
488
|
+
.rounded {
|
|
489
|
+
border-radius: 0.25rem;
|
|
490
|
+
}
|
|
451
491
|
.rounded-full {
|
|
452
492
|
border-radius: calc(infinity * 1px);
|
|
453
493
|
}
|
|
@@ -461,18 +501,43 @@
|
|
|
461
501
|
border-style: var(--tw-border-style);
|
|
462
502
|
border-width: 1px;
|
|
463
503
|
}
|
|
504
|
+
.border-b {
|
|
505
|
+
border-bottom-style: var(--tw-border-style);
|
|
506
|
+
border-bottom-width: 1px;
|
|
507
|
+
}
|
|
464
508
|
.border-gray-200 {
|
|
465
509
|
border-color: var(--color-gray-200);
|
|
466
510
|
}
|
|
511
|
+
.border-red-200 {
|
|
512
|
+
border-color: var(--color-red-200);
|
|
513
|
+
}
|
|
514
|
+
.bg-blue-50 {
|
|
515
|
+
background-color: var(--color-blue-50);
|
|
516
|
+
}
|
|
517
|
+
.bg-blue-100 {
|
|
518
|
+
background-color: var(--color-blue-100);
|
|
519
|
+
}
|
|
467
520
|
.bg-gray-50 {
|
|
468
521
|
background-color: var(--color-gray-50);
|
|
469
522
|
}
|
|
470
523
|
.bg-gray-100 {
|
|
471
524
|
background-color: var(--color-gray-100);
|
|
472
525
|
}
|
|
526
|
+
.bg-green-100 {
|
|
527
|
+
background-color: var(--color-green-100);
|
|
528
|
+
}
|
|
529
|
+
.bg-red-50 {
|
|
530
|
+
background-color: var(--color-red-50);
|
|
531
|
+
}
|
|
532
|
+
.bg-red-100 {
|
|
533
|
+
background-color: var(--color-red-100);
|
|
534
|
+
}
|
|
473
535
|
.bg-white {
|
|
474
536
|
background-color: var(--color-white);
|
|
475
537
|
}
|
|
538
|
+
.bg-yellow-100 {
|
|
539
|
+
background-color: var(--color-yellow-100);
|
|
540
|
+
}
|
|
476
541
|
.object-cover {
|
|
477
542
|
object-fit: cover;
|
|
478
543
|
}
|
|
@@ -482,12 +547,21 @@
|
|
|
482
547
|
.p-6 {
|
|
483
548
|
padding: calc(var(--spacing) * 6);
|
|
484
549
|
}
|
|
550
|
+
.px-2 {
|
|
551
|
+
padding-inline: calc(var(--spacing) * 2);
|
|
552
|
+
}
|
|
553
|
+
.px-3 {
|
|
554
|
+
padding-inline: calc(var(--spacing) * 3);
|
|
555
|
+
}
|
|
485
556
|
.px-4 {
|
|
486
557
|
padding-inline: calc(var(--spacing) * 4);
|
|
487
558
|
}
|
|
488
559
|
.px-6 {
|
|
489
560
|
padding-inline: calc(var(--spacing) * 6);
|
|
490
561
|
}
|
|
562
|
+
.py-1 {
|
|
563
|
+
padding-block: calc(var(--spacing) * 1);
|
|
564
|
+
}
|
|
491
565
|
.py-5 {
|
|
492
566
|
padding-block: calc(var(--spacing) * 5);
|
|
493
567
|
}
|
|
@@ -543,6 +617,9 @@
|
|
|
543
617
|
.break-all {
|
|
544
618
|
word-break: break-all;
|
|
545
619
|
}
|
|
620
|
+
.text-blue-800 {
|
|
621
|
+
color: var(--color-blue-800);
|
|
622
|
+
}
|
|
546
623
|
.text-gray-400 {
|
|
547
624
|
color: var(--color-gray-400);
|
|
548
625
|
}
|
|
@@ -555,6 +632,21 @@
|
|
|
555
632
|
.text-gray-900 {
|
|
556
633
|
color: var(--color-gray-900);
|
|
557
634
|
}
|
|
635
|
+
.text-green-800 {
|
|
636
|
+
color: var(--color-green-800);
|
|
637
|
+
}
|
|
638
|
+
.text-red-600 {
|
|
639
|
+
color: var(--color-red-600);
|
|
640
|
+
}
|
|
641
|
+
.text-red-800 {
|
|
642
|
+
color: var(--color-red-800);
|
|
643
|
+
}
|
|
644
|
+
.text-red-900 {
|
|
645
|
+
color: var(--color-red-900);
|
|
646
|
+
}
|
|
647
|
+
.text-yellow-800 {
|
|
648
|
+
color: var(--color-yellow-800);
|
|
649
|
+
}
|
|
558
650
|
.uppercase {
|
|
559
651
|
text-transform: uppercase;
|
|
560
652
|
}
|
|
@@ -46,7 +46,7 @@ export const getResolvers = (subgraph) => {
|
|
|
46
46
|
revision: doc.header?.revision?.global ?? 0,
|
|
47
47
|
};
|
|
48
48
|
}));
|
|
49
|
-
return docs.filter((doc) => doc.header.documentType === "renown
|
|
49
|
+
return docs.filter((doc) => doc.header.documentType === "powerhouse/renown-credential");
|
|
50
50
|
},
|
|
51
51
|
};
|
|
52
52
|
},
|
|
@@ -54,12 +54,12 @@ export const getResolvers = (subgraph) => {
|
|
|
54
54
|
Mutation: {
|
|
55
55
|
RenownCredential_createDocument: async (_, args) => {
|
|
56
56
|
const { driveId, name } = args;
|
|
57
|
-
const document = await reactor.addDocument("renown
|
|
57
|
+
const document = await reactor.addDocument("powerhouse/renown-credential");
|
|
58
58
|
if (driveId) {
|
|
59
59
|
await reactor.addAction(driveId, addFile({
|
|
60
60
|
name,
|
|
61
61
|
id: document.header.id,
|
|
62
|
-
documentType: "renown
|
|
62
|
+
documentType: "powerhouse/renown-credential",
|
|
63
63
|
}));
|
|
64
64
|
}
|
|
65
65
|
if (name) {
|
|
@@ -3,7 +3,7 @@ export const schema = gql `
|
|
|
3
3
|
"""
|
|
4
4
|
Subgraph definition for Renown Read Model
|
|
5
5
|
"""
|
|
6
|
-
type
|
|
6
|
+
type ReadRenownUser {
|
|
7
7
|
documentId: String!
|
|
8
8
|
username: String
|
|
9
9
|
ethAddress: String
|
|
@@ -26,7 +26,7 @@ export const schema = gql `
|
|
|
26
26
|
usernames: [String!]
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
type
|
|
29
|
+
type ReadRenownCredential {
|
|
30
30
|
documentId: String!
|
|
31
31
|
credentialId: String
|
|
32
32
|
context: [String!]!
|
|
@@ -35,7 +35,7 @@ export const schema = gql `
|
|
|
35
35
|
issuanceDate: DateTime!
|
|
36
36
|
credentialSubject: String!
|
|
37
37
|
expirationDate: DateTime
|
|
38
|
-
credentialStatus:
|
|
38
|
+
credentialStatus: ReadCredentialStatus
|
|
39
39
|
jwt: String
|
|
40
40
|
revoked: Boolean!
|
|
41
41
|
revokedAt: DateTime
|
|
@@ -44,7 +44,7 @@ export const schema = gql `
|
|
|
44
44
|
updatedAt: DateTime
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
type
|
|
47
|
+
type ReadCredentialStatus {
|
|
48
48
|
id: String!
|
|
49
49
|
type: String!
|
|
50
50
|
statusPurpose: String!
|
|
@@ -61,8 +61,8 @@ export const schema = gql `
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
type Query {
|
|
64
|
-
renownUser(input: RenownUserInput!):
|
|
65
|
-
renownUsers(input: RenownUsersInput!): [
|
|
66
|
-
renownCredentials(input: RenownCredentialsInput!): [
|
|
64
|
+
renownUser(input: RenownUserInput!): ReadRenownUser
|
|
65
|
+
renownUsers(input: RenownUsersInput!): [ReadRenownUser!]!
|
|
66
|
+
renownCredentials(input: RenownCredentialsInput!): [ReadRenownCredential!]!
|
|
67
67
|
}
|
|
68
68
|
`;
|