@powerhousedao/renown-package 0.0.0 → 0.0.2
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/index.d.ts +1 -0
- package/dist/document-models/index.js +1 -0
- package/dist/document-models/renown-credential/gen/actions.d.ts +3 -0
- package/dist/document-models/renown-credential/gen/actions.js +1 -0
- package/dist/document-models/renown-credential/gen/creators.d.ts +1 -0
- package/dist/document-models/renown-credential/gen/creators.js +1 -0
- package/dist/document-models/renown-credential/gen/document-model.d.ts +2 -0
- package/dist/document-models/renown-credential/gen/document-model.js +59 -0
- package/dist/document-models/renown-credential/gen/index.d.ts +7 -0
- package/dist/document-models/renown-credential/gen/index.js +6 -0
- package/dist/document-models/renown-credential/gen/manager/actions.d.ts +11 -0
- package/dist/document-models/renown-credential/gen/manager/actions.js +1 -0
- package/dist/document-models/renown-credential/gen/manager/creators.d.ts +4 -0
- package/dist/document-models/renown-credential/gen/manager/creators.js +4 -0
- package/dist/document-models/renown-credential/gen/manager/error.d.ts +1 -0
- package/dist/document-models/renown-credential/gen/manager/error.js +1 -0
- package/dist/document-models/renown-credential/gen/manager/object.d.ts +7 -0
- package/dist/document-models/renown-credential/gen/manager/object.js +10 -0
- package/dist/document-models/renown-credential/gen/manager/operations.d.ts +7 -0
- package/dist/document-models/renown-credential/gen/manager/operations.js +1 -0
- package/dist/document-models/renown-credential/gen/object.d.ts +14 -0
- package/dist/document-models/renown-credential/gen/object.js +25 -0
- package/dist/document-models/renown-credential/gen/ph-factories.d.ts +26 -0
- package/dist/document-models/renown-credential/gen/ph-factories.js +55 -0
- package/dist/document-models/renown-credential/gen/reducer.d.ts +4 -0
- package/dist/document-models/renown-credential/gen/reducer.js +24 -0
- package/dist/document-models/renown-credential/gen/schema/index.d.ts +2 -0
- package/dist/document-models/renown-credential/gen/schema/index.js +2 -0
- package/dist/document-models/renown-credential/gen/schema/types.d.ts +156 -0
- package/dist/document-models/renown-credential/gen/schema/types.js +1 -0
- package/dist/document-models/renown-credential/gen/schema/zod.d.ts +12 -0
- package/dist/document-models/renown-credential/gen/schema/zod.js +30 -0
- package/dist/document-models/renown-credential/gen/types.d.ts +9 -0
- package/dist/document-models/renown-credential/gen/types.js +1 -0
- package/dist/document-models/renown-credential/gen/utils.d.ts +21 -0
- package/dist/document-models/renown-credential/gen/utils.js +47 -0
- package/dist/document-models/renown-credential/index.d.ts +25 -0
- package/dist/document-models/renown-credential/index.js +21 -0
- package/dist/document-models/renown-credential/src/reducers/manager.d.ts +2 -0
- package/dist/document-models/renown-credential/src/reducers/manager.js +23 -0
- package/dist/document-models/renown-credential/src/tests/document-model.test.d.ts +5 -0
- package/dist/document-models/renown-credential/src/tests/document-model.test.js +18 -0
- package/dist/document-models/renown-credential/src/tests/manager.test.d.ts +5 -0
- package/dist/document-models/renown-credential/src/tests/manager.test.js +32 -0
- package/dist/document-models/renown-credential/src/utils.d.ts +1 -0
- package/dist/document-models/renown-credential/src/utils.js +1 -0
- package/dist/editors/renown-user-editor/editor.js +5 -5
- package/dist/index.d.ts +1 -1
- package/dist/powerhouse.manifest.json +4 -0
- package/dist/style.css +133 -139
- package/dist/subgraphs/index.d.ts +1 -0
- package/dist/subgraphs/index.js +1 -0
- package/dist/subgraphs/renown-credential/index.d.ts +10 -0
- package/dist/subgraphs/renown-credential/index.js +11 -0
- package/dist/subgraphs/renown-credential/resolvers.d.ts +2 -0
- package/dist/subgraphs/renown-credential/resolvers.js +96 -0
- package/dist/subgraphs/renown-credential/schema.d.ts +2 -0
- package/dist/subgraphs/renown-credential/schema.js +60 -0
- package/dist/subgraphs/renown-read-model/resolvers.js +3 -99
- package/dist/subgraphs/renown-read-model/schema.js +2 -28
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./manager/actions.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./manager/creators.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./manager/creators.js";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export const documentModel = {
|
|
2
|
+
author: {
|
|
3
|
+
name: "Powerhouse Inc.",
|
|
4
|
+
website: "https://www.powerhouse.inc",
|
|
5
|
+
},
|
|
6
|
+
description: "A Renown Credential",
|
|
7
|
+
extension: "phrc",
|
|
8
|
+
id: "renown/credential",
|
|
9
|
+
name: "RenownCredential",
|
|
10
|
+
specifications: [
|
|
11
|
+
{
|
|
12
|
+
changeLog: [],
|
|
13
|
+
modules: [
|
|
14
|
+
{
|
|
15
|
+
description: "",
|
|
16
|
+
id: "ea1ea725-62a9-4e97-8f89-6b153b7af4ee",
|
|
17
|
+
name: "manager",
|
|
18
|
+
operations: [
|
|
19
|
+
{
|
|
20
|
+
description: "",
|
|
21
|
+
errors: [],
|
|
22
|
+
examples: [],
|
|
23
|
+
id: "366dfd44-377f-42d7-949d-a8d82b6a909d",
|
|
24
|
+
name: "INIT",
|
|
25
|
+
reducer: "",
|
|
26
|
+
schema: 'input InitInput {\n "Add your inputs here"\n jwt: String!\n issuer: String\n subject: String\n audience: String\n payload: String\n}',
|
|
27
|
+
scope: "global",
|
|
28
|
+
template: "",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
description: "",
|
|
32
|
+
errors: [],
|
|
33
|
+
examples: [],
|
|
34
|
+
id: "8d8ed639-f7c4-43a5-8644-85729bd5b7dc",
|
|
35
|
+
name: "REVOKE",
|
|
36
|
+
reducer: "",
|
|
37
|
+
schema: "input RevokeInput {\n jwt: String\n}",
|
|
38
|
+
scope: "global",
|
|
39
|
+
template: "",
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
state: {
|
|
45
|
+
global: {
|
|
46
|
+
examples: [],
|
|
47
|
+
initialValue: '"{\\n \\"jwt\\": null,\\n \\"revoked\\": null,\\n \\"issuer\\": null,\\n \\"subject\\": null,\\n \\"audience\\": null,\\n \\"payload\\": null\\n}"',
|
|
48
|
+
schema: 'type RenownCredentialState {\n "Add your global state fields here"\n jwt: String\n revoked: Boolean\n issuer: String\n subject: String\n audience: String\n payload: String\n}',
|
|
49
|
+
},
|
|
50
|
+
local: {
|
|
51
|
+
examples: [],
|
|
52
|
+
initialValue: '""',
|
|
53
|
+
schema: "",
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
version: 1,
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./actions.js";
|
|
2
|
+
export * from "./document-model.js";
|
|
3
|
+
export * from "./object.js";
|
|
4
|
+
export * from "./types.js";
|
|
5
|
+
export * as actions from "./creators.js";
|
|
6
|
+
export type { RenownCredentialPHState } from "./ph-factories.js";
|
|
7
|
+
export { createRenownCredentialDocument, createState, defaultPHState, defaultGlobalState, defaultLocalState, } from "./ph-factories.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./actions.js";
|
|
2
|
+
export * from "./document-model.js";
|
|
3
|
+
export * from "./object.js";
|
|
4
|
+
export * from "./types.js";
|
|
5
|
+
export * as actions from "./creators.js";
|
|
6
|
+
export { createRenownCredentialDocument, createState, defaultPHState, defaultGlobalState, defaultLocalState, } from "./ph-factories.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Action } from "document-model";
|
|
2
|
+
import type { InitInput, RevokeInput } from "../types.js";
|
|
3
|
+
export type InitAction = Action & {
|
|
4
|
+
type: "INIT";
|
|
5
|
+
input: InitInput;
|
|
6
|
+
};
|
|
7
|
+
export type RevokeAction = Action & {
|
|
8
|
+
type: "REVOKE";
|
|
9
|
+
input: RevokeInput;
|
|
10
|
+
};
|
|
11
|
+
export type RenownCredentialManagerAction = InitAction | RevokeAction;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createAction } from "document-model";
|
|
2
|
+
import { z } from "../types.js";
|
|
3
|
+
export const init = (input) => createAction("INIT", { ...input }, undefined, z.InitInputSchema, "global");
|
|
4
|
+
export const revoke = (input) => createAction("REVOKE", { ...input }, undefined, z.RevokeInputSchema, "global");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const errors: {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const errors = {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BaseDocumentClass } from "document-model";
|
|
2
|
+
import { RenownCredentialPHState } from "../ph-factories.js";
|
|
3
|
+
import { type InitInput, type RevokeInput } from "../types.js";
|
|
4
|
+
export default class RenownCredential_Manager extends BaseDocumentClass<RenownCredentialPHState> {
|
|
5
|
+
init(input: InitInput): this;
|
|
6
|
+
revoke(input: RevokeInput): this;
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseDocumentClass } from "document-model";
|
|
2
|
+
import { init, revoke } from "./creators.js";
|
|
3
|
+
export default class RenownCredential_Manager extends BaseDocumentClass {
|
|
4
|
+
init(input) {
|
|
5
|
+
return this.dispatch(init(input));
|
|
6
|
+
}
|
|
7
|
+
revoke(input) {
|
|
8
|
+
return this.dispatch(revoke(input));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type SignalDispatch } from "document-model";
|
|
2
|
+
import { type InitAction, type RevokeAction } from "./actions.js";
|
|
3
|
+
import { type RenownCredentialState } from "../types.js";
|
|
4
|
+
export interface RenownCredentialManagerOperations {
|
|
5
|
+
initOperation: (state: RenownCredentialState, action: InitAction, dispatch?: SignalDispatch) => void;
|
|
6
|
+
revokeOperation: (state: RenownCredentialState, action: RevokeAction, dispatch?: SignalDispatch) => void;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseDocumentClass, type SignalDispatch } from "document-model";
|
|
2
|
+
import { RenownCredentialPHState } from "./ph-factories.js";
|
|
3
|
+
import RenownCredential_Manager from "./manager/object.js";
|
|
4
|
+
export * from "./manager/object.js";
|
|
5
|
+
interface RenownCredential extends RenownCredential_Manager {
|
|
6
|
+
}
|
|
7
|
+
declare class RenownCredential extends BaseDocumentClass<RenownCredentialPHState> {
|
|
8
|
+
static fileExtension: string;
|
|
9
|
+
constructor(initialState?: Partial<RenownCredentialPHState>, dispatch?: SignalDispatch);
|
|
10
|
+
saveToFile(path: string, name?: string): Promise<string>;
|
|
11
|
+
loadFromFile(path: string): Promise<void>;
|
|
12
|
+
static fromFile(path: string): Promise<RenownCredential>;
|
|
13
|
+
}
|
|
14
|
+
export { RenownCredential };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BaseDocumentClass, applyMixins, } from "document-model";
|
|
2
|
+
import { reducer } from "./reducer.js";
|
|
3
|
+
import { createDocument } from "./utils.js";
|
|
4
|
+
import RenownCredential_Manager from "./manager/object.js";
|
|
5
|
+
export * from "./manager/object.js";
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
|
|
7
|
+
class RenownCredential extends BaseDocumentClass {
|
|
8
|
+
static fileExtension = "phrc";
|
|
9
|
+
constructor(initialState, dispatch) {
|
|
10
|
+
super(reducer, createDocument(initialState), dispatch);
|
|
11
|
+
}
|
|
12
|
+
saveToFile(path, name) {
|
|
13
|
+
return super.saveToFile(path, RenownCredential.fileExtension, name);
|
|
14
|
+
}
|
|
15
|
+
loadFromFile(path) {
|
|
16
|
+
return super.loadFromFile(path);
|
|
17
|
+
}
|
|
18
|
+
static async fromFile(path) {
|
|
19
|
+
const document = new this();
|
|
20
|
+
await document.loadFromFile(path);
|
|
21
|
+
return document;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
applyMixins(RenownCredential, [RenownCredential_Manager]);
|
|
25
|
+
export { RenownCredential };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Factory methods for creating RenownCredentialDocument instances
|
|
3
|
+
*/
|
|
4
|
+
import { type PHAuthState, type PHDocumentState, type PHBaseState } from "document-model";
|
|
5
|
+
import type { RenownCredentialDocument, RenownCredentialLocalState, RenownCredentialState } from "./types.js";
|
|
6
|
+
export type RenownCredentialPHState = PHBaseState & {
|
|
7
|
+
global: RenownCredentialState;
|
|
8
|
+
local: RenownCredentialLocalState;
|
|
9
|
+
};
|
|
10
|
+
export declare function defaultGlobalState(): RenownCredentialState;
|
|
11
|
+
export declare function defaultLocalState(): RenownCredentialLocalState;
|
|
12
|
+
export declare function defaultPHState(): RenownCredentialPHState;
|
|
13
|
+
export declare function createGlobalState(state?: Partial<RenownCredentialState>): RenownCredentialState;
|
|
14
|
+
export declare function createLocalState(state?: Partial<RenownCredentialLocalState>): RenownCredentialLocalState;
|
|
15
|
+
export declare function createState(baseState?: Partial<PHBaseState>, globalState?: Partial<RenownCredentialState>, localState?: Partial<RenownCredentialLocalState>): RenownCredentialPHState;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a RenownCredentialDocument with custom global and local state
|
|
18
|
+
* This properly handles the PHBaseState requirements while allowing
|
|
19
|
+
* document-specific state to be set.
|
|
20
|
+
*/
|
|
21
|
+
export declare function createRenownCredentialDocument(state?: Partial<{
|
|
22
|
+
auth?: Partial<PHAuthState>;
|
|
23
|
+
document?: Partial<PHDocumentState>;
|
|
24
|
+
global?: Partial<RenownCredentialState>;
|
|
25
|
+
local?: Partial<RenownCredentialLocalState>;
|
|
26
|
+
}>): RenownCredentialDocument;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Factory methods for creating RenownCredentialDocument instances
|
|
3
|
+
*/
|
|
4
|
+
import { createBaseState, defaultBaseState, } from "document-model";
|
|
5
|
+
import { createDocument } from "./utils.js";
|
|
6
|
+
export function defaultGlobalState() {
|
|
7
|
+
return {
|
|
8
|
+
jwt: null,
|
|
9
|
+
revoked: null,
|
|
10
|
+
issuer: null,
|
|
11
|
+
subject: null,
|
|
12
|
+
audience: null,
|
|
13
|
+
payload: null,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export function defaultLocalState() {
|
|
17
|
+
return {};
|
|
18
|
+
}
|
|
19
|
+
export function defaultPHState() {
|
|
20
|
+
return {
|
|
21
|
+
...defaultBaseState(),
|
|
22
|
+
global: defaultGlobalState(),
|
|
23
|
+
local: defaultLocalState(),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export function createGlobalState(state) {
|
|
27
|
+
return {
|
|
28
|
+
...defaultGlobalState(),
|
|
29
|
+
...(state || {}),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export function createLocalState(state) {
|
|
33
|
+
return {
|
|
34
|
+
...defaultLocalState(),
|
|
35
|
+
...(state || {}),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export function createState(baseState, globalState, localState) {
|
|
39
|
+
return {
|
|
40
|
+
...createBaseState(baseState?.auth, baseState?.document),
|
|
41
|
+
global: createGlobalState(globalState),
|
|
42
|
+
local: createLocalState(localState),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Creates a RenownCredentialDocument with custom global and local state
|
|
47
|
+
* This properly handles the PHBaseState requirements while allowing
|
|
48
|
+
* document-specific state to be set.
|
|
49
|
+
*/
|
|
50
|
+
export function createRenownCredentialDocument(state) {
|
|
51
|
+
const document = createDocument(state
|
|
52
|
+
? createState(createBaseState(state.auth, state.document), state.global, state.local)
|
|
53
|
+
: undefined);
|
|
54
|
+
return document;
|
|
55
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type StateReducer } from "document-model";
|
|
2
|
+
import { RenownCredentialPHState } from "./ph-factories.js";
|
|
3
|
+
export declare const stateReducer: StateReducer<RenownCredentialPHState>;
|
|
4
|
+
export declare const reducer: import("document-model").Reducer<RenownCredentialPHState>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// TODO: remove eslint-disable rules once refactor is done
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
4
|
+
import { isDocumentAction, createReducer, } from "document-model";
|
|
5
|
+
import { z } from "./types.js";
|
|
6
|
+
import { reducer as ManagerReducer } from "../src/reducers/manager.js";
|
|
7
|
+
export const stateReducer = (state, action, dispatch) => {
|
|
8
|
+
if (isDocumentAction(action)) {
|
|
9
|
+
return state;
|
|
10
|
+
}
|
|
11
|
+
switch (action.type) {
|
|
12
|
+
case "INIT":
|
|
13
|
+
z.InitInputSchema().parse(action.input);
|
|
14
|
+
ManagerReducer.initOperation(state[action.scope], action, dispatch);
|
|
15
|
+
break;
|
|
16
|
+
case "REVOKE":
|
|
17
|
+
z.RevokeInputSchema().parse(action.input);
|
|
18
|
+
ManagerReducer.revokeOperation(state[action.scope], action, dispatch);
|
|
19
|
+
break;
|
|
20
|
+
default:
|
|
21
|
+
return state;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
export const reducer = createReducer(stateReducer);
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
export type Maybe<T> = T | null;
|
|
2
|
+
export type InputMaybe<T> = T | null | undefined;
|
|
3
|
+
export type Exact<T extends {
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
}> = {
|
|
6
|
+
[K in keyof T]: T[K];
|
|
7
|
+
};
|
|
8
|
+
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
|
|
9
|
+
[SubKey in K]?: Maybe<T[SubKey]>;
|
|
10
|
+
};
|
|
11
|
+
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & {
|
|
12
|
+
[SubKey in K]: Maybe<T[SubKey]>;
|
|
13
|
+
};
|
|
14
|
+
export type MakeEmpty<T extends {
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}, K extends keyof T> = {
|
|
17
|
+
[_ in K]?: never;
|
|
18
|
+
};
|
|
19
|
+
export type Incremental<T> = T | {
|
|
20
|
+
[P in keyof T]?: P extends " $fragmentName" | "__typename" ? T[P] : never;
|
|
21
|
+
};
|
|
22
|
+
/** All built-in and custom scalars, mapped to their actual values */
|
|
23
|
+
export type Scalars = {
|
|
24
|
+
ID: {
|
|
25
|
+
input: string;
|
|
26
|
+
output: string;
|
|
27
|
+
};
|
|
28
|
+
String: {
|
|
29
|
+
input: string;
|
|
30
|
+
output: string;
|
|
31
|
+
};
|
|
32
|
+
Boolean: {
|
|
33
|
+
input: boolean;
|
|
34
|
+
output: boolean;
|
|
35
|
+
};
|
|
36
|
+
Int: {
|
|
37
|
+
input: number;
|
|
38
|
+
output: number;
|
|
39
|
+
};
|
|
40
|
+
Float: {
|
|
41
|
+
input: number;
|
|
42
|
+
output: number;
|
|
43
|
+
};
|
|
44
|
+
Amount: {
|
|
45
|
+
input: {
|
|
46
|
+
unit?: string;
|
|
47
|
+
value?: number;
|
|
48
|
+
};
|
|
49
|
+
output: {
|
|
50
|
+
unit?: string;
|
|
51
|
+
value?: number;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
Amount_Crypto: {
|
|
55
|
+
input: {
|
|
56
|
+
unit: string;
|
|
57
|
+
value: string;
|
|
58
|
+
};
|
|
59
|
+
output: {
|
|
60
|
+
unit: string;
|
|
61
|
+
value: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
Amount_Currency: {
|
|
65
|
+
input: {
|
|
66
|
+
unit: string;
|
|
67
|
+
value: string;
|
|
68
|
+
};
|
|
69
|
+
output: {
|
|
70
|
+
unit: string;
|
|
71
|
+
value: string;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
Amount_Fiat: {
|
|
75
|
+
input: {
|
|
76
|
+
unit: string;
|
|
77
|
+
value: number;
|
|
78
|
+
};
|
|
79
|
+
output: {
|
|
80
|
+
unit: string;
|
|
81
|
+
value: number;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
Amount_Money: {
|
|
85
|
+
input: number;
|
|
86
|
+
output: number;
|
|
87
|
+
};
|
|
88
|
+
Amount_Percentage: {
|
|
89
|
+
input: number;
|
|
90
|
+
output: number;
|
|
91
|
+
};
|
|
92
|
+
Amount_Tokens: {
|
|
93
|
+
input: number;
|
|
94
|
+
output: number;
|
|
95
|
+
};
|
|
96
|
+
Currency: {
|
|
97
|
+
input: string;
|
|
98
|
+
output: string;
|
|
99
|
+
};
|
|
100
|
+
Date: {
|
|
101
|
+
input: string;
|
|
102
|
+
output: string;
|
|
103
|
+
};
|
|
104
|
+
DateTime: {
|
|
105
|
+
input: string;
|
|
106
|
+
output: string;
|
|
107
|
+
};
|
|
108
|
+
EmailAddress: {
|
|
109
|
+
input: string;
|
|
110
|
+
output: string;
|
|
111
|
+
};
|
|
112
|
+
EthereumAddress: {
|
|
113
|
+
input: string;
|
|
114
|
+
output: string;
|
|
115
|
+
};
|
|
116
|
+
OID: {
|
|
117
|
+
input: string;
|
|
118
|
+
output: string;
|
|
119
|
+
};
|
|
120
|
+
OLabel: {
|
|
121
|
+
input: string;
|
|
122
|
+
output: string;
|
|
123
|
+
};
|
|
124
|
+
PHID: {
|
|
125
|
+
input: string;
|
|
126
|
+
output: string;
|
|
127
|
+
};
|
|
128
|
+
URL: {
|
|
129
|
+
input: string;
|
|
130
|
+
output: string;
|
|
131
|
+
};
|
|
132
|
+
Upload: {
|
|
133
|
+
input: File;
|
|
134
|
+
output: File;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
export type InitInput = {
|
|
138
|
+
audience?: InputMaybe<Scalars["String"]["input"]>;
|
|
139
|
+
issuer?: InputMaybe<Scalars["String"]["input"]>;
|
|
140
|
+
/** Add your inputs here */
|
|
141
|
+
jwt: Scalars["String"]["input"];
|
|
142
|
+
payload?: InputMaybe<Scalars["String"]["input"]>;
|
|
143
|
+
subject?: InputMaybe<Scalars["String"]["input"]>;
|
|
144
|
+
};
|
|
145
|
+
export type RenownCredentialState = {
|
|
146
|
+
audience: Maybe<Scalars["String"]["output"]>;
|
|
147
|
+
issuer: Maybe<Scalars["String"]["output"]>;
|
|
148
|
+
/** Add your global state fields here */
|
|
149
|
+
jwt: Maybe<Scalars["String"]["output"]>;
|
|
150
|
+
payload: Maybe<Scalars["String"]["output"]>;
|
|
151
|
+
revoked: Maybe<Scalars["Boolean"]["output"]>;
|
|
152
|
+
subject: Maybe<Scalars["String"]["output"]>;
|
|
153
|
+
};
|
|
154
|
+
export type RevokeInput = {
|
|
155
|
+
jwt?: InputMaybe<Scalars["String"]["input"]>;
|
|
156
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { InitInput, RenownCredentialState, RevokeInput } from "./types.js";
|
|
3
|
+
type Properties<T> = Required<{
|
|
4
|
+
[K in keyof T]: z.ZodType<T[K], any, T[K]>;
|
|
5
|
+
}>;
|
|
6
|
+
type definedNonNullAny = {};
|
|
7
|
+
export declare const isDefinedNonNullAny: (v: any) => v is definedNonNullAny;
|
|
8
|
+
export declare const definedNonNullAnySchema: z.ZodEffects<z.ZodAny, definedNonNullAny, any>;
|
|
9
|
+
export declare function InitInputSchema(): z.ZodObject<Properties<InitInput>>;
|
|
10
|
+
export declare function RenownCredentialStateSchema(): z.ZodObject<Properties<RenownCredentialState>>;
|
|
11
|
+
export declare function RevokeInputSchema(): z.ZodObject<Properties<RevokeInput>>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const isDefinedNonNullAny = (v) => v !== undefined && v !== null;
|
|
3
|
+
export const definedNonNullAnySchema = z
|
|
4
|
+
.any()
|
|
5
|
+
.refine((v) => isDefinedNonNullAny(v));
|
|
6
|
+
export function InitInputSchema() {
|
|
7
|
+
return z.object({
|
|
8
|
+
audience: z.string().nullish(),
|
|
9
|
+
issuer: z.string().nullish(),
|
|
10
|
+
jwt: z.string(),
|
|
11
|
+
payload: z.string().nullish(),
|
|
12
|
+
subject: z.string().nullish(),
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
export function RenownCredentialStateSchema() {
|
|
16
|
+
return z.object({
|
|
17
|
+
__typename: z.literal("RenownCredentialState").optional(),
|
|
18
|
+
audience: z.string().nullable(),
|
|
19
|
+
issuer: z.string().nullable(),
|
|
20
|
+
jwt: z.string().nullable(),
|
|
21
|
+
payload: z.string().nullable(),
|
|
22
|
+
revoked: z.boolean().nullable(),
|
|
23
|
+
subject: z.string().nullable(),
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export function RevokeInputSchema() {
|
|
27
|
+
return z.object({
|
|
28
|
+
jwt: z.string().nullish(),
|
|
29
|
+
});
|
|
30
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PHDocument } from "document-model";
|
|
2
|
+
import type { RenownCredentialAction } from "./actions.js";
|
|
3
|
+
import type { RenownCredentialPHState } from "./ph-factories.js";
|
|
4
|
+
import type { RenownCredentialState } from "./schema/types.js";
|
|
5
|
+
export { z } from "./schema/index.js";
|
|
6
|
+
export type * from "./schema/types.js";
|
|
7
|
+
type RenownCredentialLocalState = Record<PropertyKey, never>;
|
|
8
|
+
export type RenownCredentialDocument = PHDocument<RenownCredentialPHState>;
|
|
9
|
+
export type { RenownCredentialState, RenownCredentialLocalState, RenownCredentialAction, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { z } from "./schema/index.js";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type CreateDocument, type CreateState, type LoadFromFile, type LoadFromInput } from "document-model";
|
|
2
|
+
import { type RenownCredentialState, type RenownCredentialLocalState } from "./types.js";
|
|
3
|
+
import { RenownCredentialPHState } from "./ph-factories.js";
|
|
4
|
+
export declare const initialGlobalState: RenownCredentialState;
|
|
5
|
+
export declare const initialLocalState: RenownCredentialLocalState;
|
|
6
|
+
export declare const createState: CreateState<RenownCredentialPHState>;
|
|
7
|
+
export declare const createDocument: CreateDocument<RenownCredentialPHState>;
|
|
8
|
+
export declare const saveToFile: (document: any, path: string, name?: string) => Promise<string>;
|
|
9
|
+
export declare const saveToFileHandle: (document: any, input: any) => Promise<void>;
|
|
10
|
+
export declare const loadFromFile: LoadFromFile<RenownCredentialPHState>;
|
|
11
|
+
export declare const loadFromInput: LoadFromInput<RenownCredentialPHState>;
|
|
12
|
+
declare const utils: {
|
|
13
|
+
fileExtension: string;
|
|
14
|
+
createState: CreateState<RenownCredentialPHState>;
|
|
15
|
+
createDocument: CreateDocument<RenownCredentialPHState>;
|
|
16
|
+
saveToFile: (document: any, path: string, name?: string) => Promise<string>;
|
|
17
|
+
saveToFileHandle: (document: any, input: any) => Promise<void>;
|
|
18
|
+
loadFromFile: LoadFromFile<RenownCredentialPHState>;
|
|
19
|
+
loadFromInput: LoadFromInput<RenownCredentialPHState>;
|
|
20
|
+
};
|
|
21
|
+
export default utils;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { baseCreateDocument, baseSaveToFile, baseSaveToFileHandle, baseLoadFromFile, baseLoadFromInput, defaultBaseState, generateId, } from "document-model";
|
|
2
|
+
import { reducer } from "./reducer.js";
|
|
3
|
+
export const initialGlobalState = {
|
|
4
|
+
jwt: null,
|
|
5
|
+
revoked: null,
|
|
6
|
+
issuer: null,
|
|
7
|
+
subject: null,
|
|
8
|
+
audience: null,
|
|
9
|
+
payload: null,
|
|
10
|
+
};
|
|
11
|
+
export const initialLocalState = {};
|
|
12
|
+
export const createState = (state) => {
|
|
13
|
+
return {
|
|
14
|
+
...defaultBaseState(),
|
|
15
|
+
global: { ...initialGlobalState, ...(state?.global ?? {}) },
|
|
16
|
+
local: { ...initialLocalState, ...(state?.local ?? {}) },
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export const createDocument = (state) => {
|
|
20
|
+
const document = baseCreateDocument(createState, state);
|
|
21
|
+
document.header.documentType = "renown/credential";
|
|
22
|
+
// for backwards compatibility, but this is NOT a valid signed document id
|
|
23
|
+
document.header.id = generateId();
|
|
24
|
+
return document;
|
|
25
|
+
};
|
|
26
|
+
export const saveToFile = (document, path, name) => {
|
|
27
|
+
return baseSaveToFile(document, path, "phrc", name);
|
|
28
|
+
};
|
|
29
|
+
export const saveToFileHandle = (document, input) => {
|
|
30
|
+
return baseSaveToFileHandle(document, input);
|
|
31
|
+
};
|
|
32
|
+
export const loadFromFile = (path) => {
|
|
33
|
+
return baseLoadFromFile(path, reducer);
|
|
34
|
+
};
|
|
35
|
+
export const loadFromInput = (input) => {
|
|
36
|
+
return baseLoadFromInput(input, reducer);
|
|
37
|
+
};
|
|
38
|
+
const utils = {
|
|
39
|
+
fileExtension: "phrc",
|
|
40
|
+
createState,
|
|
41
|
+
createDocument,
|
|
42
|
+
saveToFile,
|
|
43
|
+
saveToFileHandle,
|
|
44
|
+
loadFromFile,
|
|
45
|
+
loadFromInput,
|
|
46
|
+
};
|
|
47
|
+
export default utils;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a scaffold file meant for customization.
|
|
3
|
+
* Delete the file and run the code generator again to have it reset
|
|
4
|
+
*/
|
|
5
|
+
import { type DocumentModelModule } from "document-model";
|
|
6
|
+
import { reducer } from "./gen/reducer.js";
|
|
7
|
+
import { documentModel } from "./gen/document-model.js";
|
|
8
|
+
import type { RenownCredentialPHState } from "./gen/ph-factories.js";
|
|
9
|
+
declare const utils: {
|
|
10
|
+
fileExtension: string;
|
|
11
|
+
createState: import("document-model").CreateState<RenownCredentialPHState>;
|
|
12
|
+
createDocument: import("document-model").CreateDocument<RenownCredentialPHState>;
|
|
13
|
+
saveToFile: (document: any, path: string, name?: string) => Promise<string>;
|
|
14
|
+
saveToFileHandle: (document: any, input: any) => Promise<void>;
|
|
15
|
+
loadFromFile: import("document-model").LoadFromFile<RenownCredentialPHState>;
|
|
16
|
+
loadFromInput: import("document-model").LoadFromInput<RenownCredentialPHState>;
|
|
17
|
+
};
|
|
18
|
+
declare const actions: {
|
|
19
|
+
init: (input: import("./index.js").InitInput) => import("./gen/actions.js").InitAction;
|
|
20
|
+
revoke: (input: import("./index.js").RevokeInput) => import("./gen/actions.js").RevokeAction;
|
|
21
|
+
};
|
|
22
|
+
export declare const module: DocumentModelModule<RenownCredentialPHState>;
|
|
23
|
+
export { reducer, actions, utils, documentModel };
|
|
24
|
+
export * from "./gen/types.js";
|
|
25
|
+
export * from "./src/utils.js";
|