@ddd-qc/profiles-dvm 0.26.5 → 0.26.7
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/bindings/profilesAlt.proxy.d.ts +1 -2
- package/dist/bindings/profilesAlt.proxy.js +0 -3
- package/dist/bindings/profilesAlt.proxy.js.map +1 -1
- package/dist/bindings/profilesAlt.types.d.ts +0 -114
- package/dist/bindings/profilesAlt.types.js +0 -24
- package/dist/bindings/profilesAlt.types.js.map +1 -1
- package/dist/profiles.dvm.js.map +1 -1
- package/dist/profilesAlt.zvm.d.ts +4 -2
- package/dist/profilesAlt.zvm.js +45 -14
- package/dist/profilesAlt.zvm.js.map +1 -1
- package/dist/utils.js +6 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Profile } from './profilesAlt.types';
|
|
2
2
|
import { AgentPubKey, ActionHash } from '@holochain/client';
|
|
3
3
|
import { ZomeProxy } from '@ddd-qc/lit-happ';
|
|
4
4
|
import { ProfilesAltUnitEnum, ProfilesAltLinkType } from './profilesAlt.integrity';
|
|
@@ -15,5 +15,4 @@ export declare class ProfilesAltProxy extends ZomeProxy {
|
|
|
15
15
|
searchAgents(nicknameFilter: string): Promise<AgentPubKey[]>;
|
|
16
16
|
findProfile(agentPubKey: AgentPubKey): Promise<[ActionHash, Profile] | null>;
|
|
17
17
|
probeProfiles(): Promise<void>;
|
|
18
|
-
castTip(input: CastTipInput): Promise<void>;
|
|
19
18
|
}
|
|
@@ -21,9 +21,6 @@ export class ProfilesAltProxy extends ZomeProxy {
|
|
|
21
21
|
async probeProfiles() {
|
|
22
22
|
return this.callBlocking('probe_profiles', null);
|
|
23
23
|
}
|
|
24
|
-
async castTip(input) {
|
|
25
|
-
return this.call('cast_tip', input);
|
|
26
|
-
}
|
|
27
24
|
}
|
|
28
25
|
ProfilesAltProxy.DEFAULT_ZOME_NAME = "profiles";
|
|
29
26
|
ProfilesAltProxy.FN_NAMES = profilesAltFunctionNames;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profilesAlt.proxy.js","sourceRoot":"","sources":["../../src/bindings/profilesAlt.proxy.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAoJ1D,OAAO,EAAC,SAAS,EAAC,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAC,wBAAwB,EAAC,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAC,mBAAmB,EAAE,mBAAmB,EAAC,MAAM,yBAAyB,CAAC;AAEjF;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAM7C,KAAK,CAAC,aAAa,CAAC,IAA4B;QAC9C,OAAO,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,IAA4B;QAC9C,OAAO,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,cAAsB;QACvC,OAAO,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,WAAwB;QACxC,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,OAAO,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC
|
|
1
|
+
{"version":3,"file":"profilesAlt.proxy.js","sourceRoot":"","sources":["../../src/bindings/profilesAlt.proxy.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAoJ1D,OAAO,EAAC,SAAS,EAAC,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAC,wBAAwB,EAAC,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAC,mBAAmB,EAAE,mBAAmB,EAAC,MAAM,yBAAyB,CAAC;AAEjF;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAM7C,KAAK,CAAC,aAAa,CAAC,IAA4B;QAC9C,OAAO,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,IAA4B;QAC9C,OAAO,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,cAAsB;QACvC,OAAO,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,WAAwB;QACxC,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,OAAO,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC;;AAvBe,kCAAiB,GAAG,UAAU,CAAC;AAC/B,yBAAQ,GAAG,wBAAwB,CAAC;AACpC,4BAAW,GAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACjD,2BAAU,GAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC","sourcesContent":["/* This file is generated by zits. Do not edit manually */\n\nimport {EntryTypes, Profile, } from './profilesAlt.types';\nimport {\nWebsocketConnectionOptions,\n/** types.ts */\nHoloHash,\nAgentPubKey,\nDnaHash,\nWasmHash,\nEntryHash,\nActionHash,\nAnyDhtHash,\nExternalHash,\nKitsuneAgent,\nKitsuneSpace,\nHoloHashB64,\nAgentPubKeyB64,\nDnaHashB64,\nWasmHashB64,\nEntryHashB64,\nActionHashB64,\nAnyDhtHashB64,\nInstalledAppId,\nSignature,\nCellId,\nDnaProperties,\nRoleName,\nInstalledCell,\nTimestamp,\nDuration,\nHoloHashed,\nNetworkInfo,\nFetchPoolInfo,\n/** hdk/action.ts */\nSignedActionHashed,\nRegisterAgentActivity,\nActionHashed,\nActionType,\nAction,\nNewEntryAction,\nDna,\nAgentValidationPkg,\nInitZomesComplete,\nCreateLink,\nDeleteLink,\nOpenChain,\nCloseChain,\nUpdate,\nDelete,\nCreate,\n/** hdk/capabilities.ts */\nCapSecret,\nCapClaim,\nGrantedFunctionsType,\nGrantedFunctions,\nZomeCallCapGrant,\nCapAccessType,\nCapAccess,\nCapGrant,\n///** hdk/countersigning.ts */\n//CounterSigningSessionData,\n//PreflightRequest,\n//CounterSigningSessionTimes,\n//ActionBase,\n//CounterSigningAgents,\n//PreflightBytes,\n//Role,\n//CountersigningAgentState,\n/** hdk/dht-ops.ts */\nDhtOpType,\nDhtOp,\ngetDhtOpType,\ngetDhtOpAction,\ngetDhtOpEntry,\ngetDhtOpSignature,\n/** hdk/entry.ts */\nEntryVisibility,\nAppEntryDef,\nEntryType,\nEntryContent,\nEntry,\n/** hdk/record.ts */\nRecord as HcRecord,\nRecordEntry as HcRecordEntry,\n/** hdk/link.ts */\nAnyLinkableHash,\nZomeIndex,\nLinkType,\nLinkTag,\nRateWeight,\nRateBucketId,\nRateUnits,\nLink,\n/** api/admin/types.ts */\nInstalledAppInfoStatus,\nDeactivationReason,\nDisabledAppReason,\nStemCell,\nProvisionedCell,\nClonedCell,\nCellType,\nCellInfo,\nAppInfo,\nMembraneProof,\nFunctionName,\nZomeName,\nZomeDefinition,\nIntegrityZome,\nCoordinatorZome,\nDnaDefinition,\nResourceBytes,\nResourceMap,\nCellProvisioningStrategy,\nCellProvisioning,\nDnaVersionSpec,\nDnaVersionFlexible,\nAppRoleDnaManifest,\nAppRoleManifest,\nAppManifest,\nAppBundle,\nAppBundleSource,\nNetworkSeed,\nZomeLocation,\n } from '@holochain/client';\n\nimport {\n/** Common */\nDhtOpHashB64,\n//DnaHashB64, (duplicate)\n//AnyDhtHashB64, (duplicate)\nDhtOpHash,\n/** DnaFile */\nDnaFile,\nDnaDef,\nZomes,\nWasmCode,\n/** entry-details */\nEntryDetails,\nRecordDetails,\nDetails,\nDetailsType,\nEntryDhtStatus,\n/** Validation */\nValidationStatus,\nValidationReceipt,\n } from '@holochain-open-dev/core-types';\n\nimport {ZomeProxy} from '@ddd-qc/lit-happ';\nimport {profilesAltFunctionNames} from './profilesAlt.fn';\nimport {ProfilesAltUnitEnum, ProfilesAltLinkType} from './profilesAlt.integrity';\n\n/**\n *\n */\nexport class ProfilesAltProxy extends ZomeProxy {\n static readonly DEFAULT_ZOME_NAME = \"profiles\";\n static readonly FN_NAMES = profilesAltFunctionNames;\n static readonly ENTRY_TYPES = Object.values(ProfilesAltUnitEnum);\n static readonly LINK_TYPES = Object.values(ProfilesAltLinkType);\n \n async createProfile(pair: [Profile, AgentPubKey]): Promise<ActionHash> {\n return this.callBlocking('create_profile', pair);\n }\n\n async updateProfile(pair: [Profile, AgentPubKey]): Promise<ActionHash> {\n return this.callBlocking('update_profile', pair);\n }\n\n async searchAgents(nicknameFilter: string): Promise<AgentPubKey[]> {\n return this.call('search_agents', nicknameFilter);\n }\n\n async findProfile(agentPubKey: AgentPubKey): Promise<[ActionHash, Profile] | null> {\n return this.call('find_profile', agentPubKey);\n }\n\n async probeProfiles(): Promise<void> {\n return this.callBlocking('probe_profiles', null);\n }\n}\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { AgentPubKey, EntryHash, ActionHash, Timestamp, AppEntryDef, Link } from '@holochain/client';
|
|
2
1
|
/**
|
|
3
2
|
* Profile entry definition.
|
|
4
3
|
*
|
|
@@ -18,116 +17,3 @@ export type EntryTypes = {
|
|
|
18
17
|
};
|
|
19
18
|
content: Profile;
|
|
20
19
|
};
|
|
21
|
-
export interface CastTipInput {
|
|
22
|
-
tip: TipProtocol;
|
|
23
|
-
peers: AgentPubKey[];
|
|
24
|
-
}
|
|
25
|
-
/** Bool: True if state change just happened (real-time) */
|
|
26
|
-
export declare enum StateChangeType {
|
|
27
|
-
Create = "Create",
|
|
28
|
-
Update = "Update",
|
|
29
|
-
Delete = "Delete"
|
|
30
|
-
}
|
|
31
|
-
export type StateChangeVariantCreate = {
|
|
32
|
-
Create: boolean;
|
|
33
|
-
};
|
|
34
|
-
export type StateChangeVariantUpdate = {
|
|
35
|
-
Update: boolean;
|
|
36
|
-
};
|
|
37
|
-
export type StateChangeVariantDelete = {
|
|
38
|
-
Delete: boolean;
|
|
39
|
-
};
|
|
40
|
-
export type StateChange = StateChangeVariantCreate | StateChangeVariantUpdate | StateChangeVariantDelete;
|
|
41
|
-
export interface LinkPulse {
|
|
42
|
-
link: Link;
|
|
43
|
-
state: StateChange;
|
|
44
|
-
}
|
|
45
|
-
export interface EntryPulse {
|
|
46
|
-
ah: ActionHash;
|
|
47
|
-
state: StateChange;
|
|
48
|
-
ts: Timestamp;
|
|
49
|
-
author: AgentPubKey;
|
|
50
|
-
eh: EntryHash;
|
|
51
|
-
def: AppEntryDef;
|
|
52
|
-
bytes: Uint8Array;
|
|
53
|
-
}
|
|
54
|
-
/** */
|
|
55
|
-
export interface ZomeSignal {
|
|
56
|
-
from: AgentPubKey;
|
|
57
|
-
pulses: ZomeSignalProtocol[];
|
|
58
|
-
}
|
|
59
|
-
/** */
|
|
60
|
-
export declare enum ZomeSignalProtocolType {
|
|
61
|
-
System = "System",
|
|
62
|
-
Entry = "Entry",
|
|
63
|
-
Link = "Link",
|
|
64
|
-
Tip = "Tip"
|
|
65
|
-
}
|
|
66
|
-
export type ZomeSignalProtocolVariantSystem = {
|
|
67
|
-
System: SystemSignalProtocol;
|
|
68
|
-
};
|
|
69
|
-
export type ZomeSignalProtocolVariantEntry = {
|
|
70
|
-
Entry: EntryPulse;
|
|
71
|
-
};
|
|
72
|
-
export type ZomeSignalProtocolVariantLink = {
|
|
73
|
-
Link: LinkPulse;
|
|
74
|
-
};
|
|
75
|
-
export type ZomeSignalProtocolVariantTip = {
|
|
76
|
-
Tip: TipProtocol;
|
|
77
|
-
};
|
|
78
|
-
export type ZomeSignalProtocol = ZomeSignalProtocolVariantSystem | ZomeSignalProtocolVariantEntry | ZomeSignalProtocolVariantLink | ZomeSignalProtocolVariantTip;
|
|
79
|
-
/** Protocol for notifying the ViewModel (UI) of system level events */
|
|
80
|
-
export type SystemSignalProtocolVariantPostCommitNewStart = {
|
|
81
|
-
type: "PostCommitNewStart";
|
|
82
|
-
app_entry_type: string;
|
|
83
|
-
};
|
|
84
|
-
export type SystemSignalProtocolVariantPostCommitNewEnd = {
|
|
85
|
-
type: "PostCommitNewEnd";
|
|
86
|
-
app_entry_type: string;
|
|
87
|
-
succeeded: boolean;
|
|
88
|
-
};
|
|
89
|
-
export type SystemSignalProtocolVariantPostCommitDeleteStart = {
|
|
90
|
-
type: "PostCommitDeleteStart";
|
|
91
|
-
app_entry_type: string;
|
|
92
|
-
};
|
|
93
|
-
export type SystemSignalProtocolVariantPostCommitDeleteEnd = {
|
|
94
|
-
type: "PostCommitDeleteEnd";
|
|
95
|
-
app_entry_type: string;
|
|
96
|
-
succeeded: boolean;
|
|
97
|
-
};
|
|
98
|
-
export type SystemSignalProtocolVariantSelfCallStart = {
|
|
99
|
-
type: "SelfCallStart";
|
|
100
|
-
zome_name: string;
|
|
101
|
-
fn_name: string;
|
|
102
|
-
};
|
|
103
|
-
export type SystemSignalProtocolVariantSelfCallEnd = {
|
|
104
|
-
type: "SelfCallEnd";
|
|
105
|
-
zome_name: string;
|
|
106
|
-
fn_name: string;
|
|
107
|
-
succeeded: boolean;
|
|
108
|
-
};
|
|
109
|
-
export type SystemSignalProtocol = SystemSignalProtocolVariantPostCommitNewStart | SystemSignalProtocolVariantPostCommitNewEnd | SystemSignalProtocolVariantPostCommitDeleteStart | SystemSignalProtocolVariantPostCommitDeleteEnd | SystemSignalProtocolVariantSelfCallStart | SystemSignalProtocolVariantSelfCallEnd;
|
|
110
|
-
/** Used by UI ONLY. That's why we use B64 here. */
|
|
111
|
-
export declare enum TipProtocolType {
|
|
112
|
-
Ping = "Ping",
|
|
113
|
-
Pong = "Pong",
|
|
114
|
-
Entry = "Entry",
|
|
115
|
-
Link = "Link",
|
|
116
|
-
App = "App"
|
|
117
|
-
}
|
|
118
|
-
export type TipProtocolVariantPing = {
|
|
119
|
-
Ping: AgentPubKey;
|
|
120
|
-
};
|
|
121
|
-
export type TipProtocolVariantPong = {
|
|
122
|
-
Pong: AgentPubKey;
|
|
123
|
-
};
|
|
124
|
-
export type TipProtocolVariantEntry = {
|
|
125
|
-
Entry: EntryPulse;
|
|
126
|
-
};
|
|
127
|
-
export type TipProtocolVariantLink = {
|
|
128
|
-
Link: LinkPulse;
|
|
129
|
-
};
|
|
130
|
-
export type TipProtocolVariantApp = {
|
|
131
|
-
App: Uint8Array;
|
|
132
|
-
};
|
|
133
|
-
export type TipProtocol = TipProtocolVariantPing | TipProtocolVariantPong | TipProtocolVariantEntry | TipProtocolVariantLink | TipProtocolVariantApp;
|
|
@@ -3,28 +3,4 @@ export var EntryTypesType;
|
|
|
3
3
|
(function (EntryTypesType) {
|
|
4
4
|
EntryTypesType["Profile"] = "Profile";
|
|
5
5
|
})(EntryTypesType || (EntryTypesType = {}));
|
|
6
|
-
/** Bool: True if state change just happened (real-time) */
|
|
7
|
-
export var StateChangeType;
|
|
8
|
-
(function (StateChangeType) {
|
|
9
|
-
StateChangeType["Create"] = "Create";
|
|
10
|
-
StateChangeType["Update"] = "Update";
|
|
11
|
-
StateChangeType["Delete"] = "Delete";
|
|
12
|
-
})(StateChangeType || (StateChangeType = {}));
|
|
13
|
-
/** */
|
|
14
|
-
export var ZomeSignalProtocolType;
|
|
15
|
-
(function (ZomeSignalProtocolType) {
|
|
16
|
-
ZomeSignalProtocolType["System"] = "System";
|
|
17
|
-
ZomeSignalProtocolType["Entry"] = "Entry";
|
|
18
|
-
ZomeSignalProtocolType["Link"] = "Link";
|
|
19
|
-
ZomeSignalProtocolType["Tip"] = "Tip";
|
|
20
|
-
})(ZomeSignalProtocolType || (ZomeSignalProtocolType = {}));
|
|
21
|
-
/** Used by UI ONLY. That's why we use B64 here. */
|
|
22
|
-
export var TipProtocolType;
|
|
23
|
-
(function (TipProtocolType) {
|
|
24
|
-
TipProtocolType["Ping"] = "Ping";
|
|
25
|
-
TipProtocolType["Pong"] = "Pong";
|
|
26
|
-
TipProtocolType["Entry"] = "Entry";
|
|
27
|
-
TipProtocolType["Link"] = "Link";
|
|
28
|
-
TipProtocolType["App"] = "App";
|
|
29
|
-
})(TipProtocolType || (TipProtocolType = {}));
|
|
30
6
|
//# sourceMappingURL=profilesAlt.types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profilesAlt.types.js","sourceRoot":"","sources":["../../src/bindings/profilesAlt.types.ts"],"names":[],"mappings":"AAAA,0DAA0D;AA8J1D,MAAM,CAAN,IAAY,cAEX;AAFD,WAAY,cAAc;IACzB,qCAAmB,CAAA;AACpB,CAAC,EAFW,cAAc,KAAd,cAAc,QAEzB
|
|
1
|
+
{"version":3,"file":"profilesAlt.types.js","sourceRoot":"","sources":["../../src/bindings/profilesAlt.types.ts"],"names":[],"mappings":"AAAA,0DAA0D;AA8J1D,MAAM,CAAN,IAAY,cAEX;AAFD,WAAY,cAAc;IACzB,qCAAmB,CAAA;AACpB,CAAC,EAFW,cAAc,KAAd,cAAc,QAEzB","sourcesContent":["/* This file is generated by zits. Do not edit manually */\n\nimport {\nWebsocketConnectionOptions,\n/** types.ts */\nHoloHash,\nAgentPubKey,\nDnaHash,\nWasmHash,\nEntryHash,\nActionHash,\nAnyDhtHash,\nExternalHash,\nKitsuneAgent,\nKitsuneSpace,\nHoloHashB64,\nAgentPubKeyB64,\nDnaHashB64,\nWasmHashB64,\nEntryHashB64,\nActionHashB64,\nAnyDhtHashB64,\nInstalledAppId,\nSignature,\nCellId,\nDnaProperties,\nRoleName,\nInstalledCell,\nTimestamp,\nDuration,\nHoloHashed,\nNetworkInfo,\nFetchPoolInfo,\n/** hdk/action.ts */\nSignedActionHashed,\nRegisterAgentActivity,\nActionHashed,\nActionType,\nAction,\nNewEntryAction,\nDna,\nAgentValidationPkg,\nInitZomesComplete,\nCreateLink,\nDeleteLink,\nOpenChain,\nCloseChain,\nUpdate,\nDelete,\nCreate,\n/** hdk/capabilities.ts */\nCapSecret,\nCapClaim,\nGrantedFunctionsType,\nGrantedFunctions,\nZomeCallCapGrant,\nCapAccessType,\nCapAccess,\nCapGrant,\n///** hdk/countersigning.ts */\n//CounterSigningSessionData,\n//PreflightRequest,\n//CounterSigningSessionTimes,\n//ActionBase,\n//CounterSigningAgents,\n//PreflightBytes,\n//Role,\n//CountersigningAgentState,\n/** hdk/dht-ops.ts */\nDhtOpType,\nDhtOp,\ngetDhtOpType,\ngetDhtOpAction,\ngetDhtOpEntry,\ngetDhtOpSignature,\n/** hdk/entry.ts */\nEntryVisibility,\nAppEntryDef,\nEntryType,\nEntryContent,\nEntry,\n/** hdk/record.ts */\nRecord as HcRecord,\nRecordEntry as HcRecordEntry,\n/** hdk/link.ts */\nAnyLinkableHash,\nZomeIndex,\nLinkType,\nLinkTag,\nRateWeight,\nRateBucketId,\nRateUnits,\nLink,\n/** api/admin/types.ts */\nInstalledAppInfoStatus,\nDeactivationReason,\nDisabledAppReason,\nStemCell,\nProvisionedCell,\nClonedCell,\nCellType,\nCellInfo,\nAppInfo,\nMembraneProof,\nFunctionName,\nZomeName,\nZomeDefinition,\nIntegrityZome,\nCoordinatorZome,\nDnaDefinition,\nResourceBytes,\nResourceMap,\nCellProvisioningStrategy,\nCellProvisioning,\nDnaVersionSpec,\nDnaVersionFlexible,\nAppRoleDnaManifest,\nAppRoleManifest,\nAppManifest,\nAppBundle,\nAppBundleSource,\nNetworkSeed,\nZomeLocation,\n } from '@holochain/client';\n\nimport {\n/** Common */\nDhtOpHashB64,\n//DnaHashB64, (duplicate)\n//AnyDhtHashB64, (duplicate)\nDhtOpHash,\n/** DnaFile */\nDnaFile,\nDnaDef,\nZomes,\nWasmCode,\n/** entry-details */\nEntryDetails,\nRecordDetails,\nDetails,\nDetailsType,\nEntryDhtStatus,\n/** Validation */\nValidationStatus,\nValidationReceipt,\n } from '@holochain-open-dev/core-types';\n\n/**\n * Profile entry definition.\n * \n * The profile must include at a minimum the nickname of the agent\n * in order to be able to search for agents by nickname.\n */\nexport interface Profile {\n nickname: string\n fields: Record<string, string>\n}\n\nexport enum EntryTypesType {\n\tProfile = 'Profile',\n}\nexport type EntryTypes = \n | {type: {Profile: null}, content: Profile}\n\n"]}
|
package/dist/profiles.dvm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiles.dvm.js","sourceRoot":"","sources":["../src/profiles.dvm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAIrD,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAG3C,MAAM;AACN,4CAA4C;AAC5C,4CAA4C;AAC5C,IAAI;AAGJ;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,YAAY;IAA7C;;QAIW,kBAAa,GAAiB,IAAI,CAAC,YAAY,CAAC;IA8B3D,CAAC;IA3BC,kBAAkB;IAClB,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,iBAAiB,CAAgB,
|
|
1
|
+
{"version":3,"file":"profiles.dvm.js","sourceRoot":"","sources":["../src/profiles.dvm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAIrD,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAG3C,MAAM;AACN,4CAA4C;AAC5C,4CAA4C;AAC5C,IAAI;AAGJ;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,YAAY;IAA7C;;QAIW,kBAAa,GAAiB,IAAI,CAAC,YAAY,CAAC;IA8B3D,CAAC;IA3BC,kBAAkB;IAClB,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,iBAAiB,CAAgB,CAAC;IAC7E,CAAC;IAED,wBAAwB;IAEd,UAAU;QAClB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI,WAAW;QACb,OAAO,EAAE,CAAA;IACX,CAAC;IAGD,sBAAsB;IAEtB,MAAM;IACN,YAAY,CAAC,MAAiB;QAC5B,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;QACvC,IAAI,MAAM,CAAC,SAAS,KAAK,WAAW,CAAC,iBAAiB,EAAE;YACtD,OAAO;SACR;IACH,CAAC;;AA7Be,kCAAsB,GAAG,UAAU,AAAb,CAAc;AACpC,oBAAQ,GAAG,CAAC,WAAW,CAAC,AAAhB,CAAgB","sourcesContent":["import {delay, DnaViewModel} from \"@ddd-qc/lit-happ\";\nimport {\n AppSignal, AppSignalCb,\n} from \"@holochain/client\";\nimport {ProfilesZvm} from \"./profiles.zvm\";\n\n\n/** */\n// export interface ProfilesDnaPerspective {\n// agentPresences: Record<string, number>,\n// }\n\n\n/**\n * ViewModel fo a DNA holding a Profiles zome\n */\nexport class ProfilesDvm extends DnaViewModel {\n\n static readonly DEFAULT_BASE_ROLE_NAME = \"profiles\";\n static readonly ZVM_DEFS = [ProfilesZvm]\n readonly signalHandler?: AppSignalCb = this.handleSignal;\n\n\n /** QoL Helpers */\n get profilesZvm(): ProfilesZvm {\n return this.getZomeViewModel(ProfilesZvm.DEFAULT_ZOME_NAME) as ProfilesZvm;\n }\n\n /** -- Perspective -- */\n\n protected hasChanged(): boolean {\n return true\n }\n\n get perspective(): unknown {\n return {}\n }\n\n\n /** -- Signaling -- */\n\n /** */\n handleSignal(signal: AppSignal) {\n console.log(\"Received Signal\", signal);\n if (signal.zome_name !== ProfilesZvm.DEFAULT_ZOME_NAME) {\n return;\n }\n }\n\n\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionId, ActionIdMap, AgentId, AgentIdMap, LinkPulseMat, ZomeViewModelWithSignals } from "@ddd-qc/lit-happ";
|
|
1
|
+
import { ActionId, ActionIdMap, AgentId, AgentIdMap, LinkPulseMat, SignalLog, ZomeViewModelWithSignals } from "@ddd-qc/lit-happ";
|
|
2
2
|
import { Profile } from "./bindings/profiles.types";
|
|
3
3
|
import { Timestamp } from "@holochain/client";
|
|
4
4
|
import { ProfilesAltProxy } from "./bindings/profilesAlt.proxy";
|
|
@@ -39,6 +39,8 @@ export declare class ProfilesAltZvm extends ZomeViewModelWithSignals {
|
|
|
39
39
|
handleLinkPulse(pulse: LinkPulseMat, from: AgentId): Promise<void>;
|
|
40
40
|
/** */
|
|
41
41
|
handleEntryPulse(pulse: EntryPulseMat, from: AgentId): Promise<void>;
|
|
42
|
+
/** */
|
|
43
|
+
dumpSignalLogs(signalLogs: SignalLog[]): void;
|
|
42
44
|
/** -- Store -- */
|
|
43
45
|
/** */
|
|
44
46
|
storeProfile(profileAh: ActionId, profile: Profile, ts: Timestamp): void;
|
|
@@ -63,5 +65,5 @@ export declare class ProfilesAltZvm extends ZomeViewModelWithSignals {
|
|
|
63
65
|
/** Dump perspective as JSON */
|
|
64
66
|
exportPerspective(): string;
|
|
65
67
|
/** */
|
|
66
|
-
importPerspective(json: string,
|
|
68
|
+
importPerspective(json: string, _canPublish: boolean): Promise<void>;
|
|
67
69
|
}
|
package/dist/profilesAlt.zvm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ActionIdMap, AgentId, AgentIdMap, EntryId, ZomeViewModelWithSignals } from "@ddd-qc/lit-happ";
|
|
1
|
+
import { ActionIdMap, AgentId, AgentIdMap, enc64, EntryId, materializeEntryPulse, materializeLinkPulse, prettyDate, prettyState, SignalType, StateChangeType, ZomeSignalProtocolType, ZomeViewModelWithSignals } from "@ddd-qc/lit-happ";
|
|
2
2
|
import { decode } from "@msgpack/msgpack";
|
|
3
3
|
import { ProfilesAltProxy } from "./bindings/profilesAlt.proxy";
|
|
4
|
-
import { EntryTypesType, StateChangeType, } from "./bindings/profilesAlt.types";
|
|
5
4
|
import { ProfilesLinkType } from "./bindings/profiles.integrity";
|
|
5
|
+
import { ProfilesAltLinkType, ProfilesAltUnitEnum } from "./bindings/profilesAlt.integrity";
|
|
6
6
|
function createProfilesAltPerspective() {
|
|
7
7
|
return {
|
|
8
8
|
profiles: new ActionIdMap(),
|
|
@@ -104,7 +104,7 @@ export class ProfilesAltZvm extends ZomeViewModelWithSignals {
|
|
|
104
104
|
/** */
|
|
105
105
|
async handleEntryPulse(pulse, from) {
|
|
106
106
|
switch (pulse.entryType) {
|
|
107
|
-
case
|
|
107
|
+
case ProfilesAltUnitEnum.Profile:
|
|
108
108
|
const profile = decode(pulse.bytes);
|
|
109
109
|
if (pulse.state != StateChangeType.Delete) {
|
|
110
110
|
this.storeProfile(pulse.ah, profile, pulse.ts);
|
|
@@ -112,6 +112,37 @@ export class ProfilesAltZvm extends ZomeViewModelWithSignals {
|
|
|
112
112
|
break;
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
+
/** */
|
|
116
|
+
dumpSignalLogs(signalLogs) {
|
|
117
|
+
this.dumpCastLogs();
|
|
118
|
+
console.warn(`Signals received from zome "${this.zomeName}"`);
|
|
119
|
+
let appSignals = [];
|
|
120
|
+
signalLogs
|
|
121
|
+
.filter((log) => log.type == SignalType.Zome)
|
|
122
|
+
.map((log) => {
|
|
123
|
+
const signal = log.zomeSignal;
|
|
124
|
+
const pulses = signal.pulses;
|
|
125
|
+
const timestamp = prettyDate(new Date(log.ts));
|
|
126
|
+
const from = enc64(signal.from) == this.cell.agentId.b64 ? "self" : new AgentId(signal.from);
|
|
127
|
+
for (const pulse of pulses) {
|
|
128
|
+
if (ZomeSignalProtocolType.Tip in pulse) {
|
|
129
|
+
const tip = pulse.Tip;
|
|
130
|
+
const type = Object.keys(tip)[0];
|
|
131
|
+
appSignals.push({ timestamp, from, pulse: ZomeSignalProtocolType.Tip, type, payload: tip });
|
|
132
|
+
}
|
|
133
|
+
if (ZomeSignalProtocolType.Entry in pulse) {
|
|
134
|
+
const entryPulse = materializeEntryPulse(pulse.Entry, Object.values(ProfilesAltUnitEnum));
|
|
135
|
+
const typedEntry = decode(entryPulse.bytes);
|
|
136
|
+
appSignals.push({ timestamp, from, pulse: ZomeSignalProtocolType.Entry, state: prettyState(pulse.Entry.state), type: entryPulse.entryType, payload: typedEntry, ah_base: entryPulse.ah.short, eh_target: entryPulse.eh.short });
|
|
137
|
+
}
|
|
138
|
+
if (ZomeSignalProtocolType.Link in pulse) {
|
|
139
|
+
const linkPulse = materializeLinkPulse(pulse.Link, Object.values(ProfilesAltLinkType));
|
|
140
|
+
appSignals.push({ timestamp, from, pulse: ZomeSignalProtocolType.Link, state: prettyState(pulse.Link.state), type: linkPulse.link_type, payload: linkPulse.tag, ah_base: linkPulse.base.print(), eh_target: linkPulse.target.print() });
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
console.table(appSignals);
|
|
145
|
+
}
|
|
115
146
|
/** -- Store -- */
|
|
116
147
|
/** */
|
|
117
148
|
storeProfile(profileAh, profile, ts) {
|
|
@@ -178,20 +209,20 @@ export class ProfilesAltZvm extends ZomeViewModelWithSignals {
|
|
|
178
209
|
return JSON.stringify(core, null, 2);
|
|
179
210
|
}
|
|
180
211
|
/** */
|
|
181
|
-
async importPerspective(json,
|
|
212
|
+
async importPerspective(json, _canPublish) {
|
|
182
213
|
const perspective = JSON.parse(json);
|
|
183
|
-
if (canPublish) {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
214
|
+
// if (canPublish) {
|
|
215
|
+
// for (const [profileAh, [profile, _ts]] of perspective.profiles.entries()) {
|
|
216
|
+
// await this.createProfile(profile, agentId);
|
|
217
|
+
// }
|
|
218
|
+
// return;
|
|
219
|
+
// }
|
|
189
220
|
/** */
|
|
190
|
-
for (const [
|
|
191
|
-
this.storeProfile(
|
|
221
|
+
for (const [profileAh, [profile, ts]] of perspective.profiles.entries()) {
|
|
222
|
+
this.storeProfile(profileAh, profile, ts);
|
|
192
223
|
}
|
|
193
|
-
for (const [agentId,
|
|
194
|
-
this.storeAgentProfile(agentId,
|
|
224
|
+
for (const [agentId, profileAh] of perspective.profileByAgent.entries()) {
|
|
225
|
+
this.storeAgentProfile(agentId, profileAh);
|
|
195
226
|
}
|
|
196
227
|
}
|
|
197
228
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profilesAlt.zvm.js","sourceRoot":"","sources":["../src/profilesAlt.zvm.ts"],"names":[],"mappings":"AAAA,OAAO,EACK,WAAW,EACrB,OAAO,EACP,UAAU,EAAE,OAAO,EAEnB,wBAAwB,EACzB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EACL,cAAc,EACd,eAAe,GAChB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAmB/D,SAAS,4BAA4B;IACnC,OAAO;QACL,QAAQ,EAAE,IAAI,WAAW,EAAE;QAC3B,cAAc,EAAE,IAAI,UAAU,EAAE;QAChC,WAAW,EAAE,EAAE;KAChB,CAAA;AACH,CAAC;AAGD;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,wBAAwB;IAA5D;;QA8BU,iBAAY,GAA2B,4BAA4B,EAAE,CAAC;IAmMhF,CAAC;IA9NC,IAAI,SAAS,KAAsB,OAAO,IAAI,CAAC,UAA8B,CAAC,CAAA,CAAC;IAG/E,KAAK;IACK,UAAU;QAClB,OAAO;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IAGD,MAAM;IACN,KAAK,CAAC,2BAA2B;QAC/B,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAChC,CAAC;IAED,MAAM;IACN,aAAa;QACX,IAAI,CAAC,gB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,IAAI,WAAW,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE;YACtE,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;SAC1C;QACD,KAAK,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,WAAW,CAAC,cAAc,CAAC,OAAO,EAAE,EAAE;YACtE,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;SAC3C;IACH,CAAC;;AA5Ne,yBAAU,GAAG,gBAAgB,AAAnB,CAAoB","sourcesContent":["import {\n ActionId, ActionIdMap,\n AgentId,\n AgentIdMap, EntryId,\n LinkPulseMat,\n ZomeViewModelWithSignals\n} from \"@ddd-qc/lit-happ\";\nimport {Profile} from \"./bindings/profiles.types\";\nimport {Timestamp} from \"@holochain/client\";\nimport {decode} from \"@msgpack/msgpack\";\nimport {ProfilesAltProxy} from \"./bindings/profilesAlt.proxy\";\nimport {\n EntryTypesType,\n StateChangeType,\n} from \"./bindings/profilesAlt.types\";\nimport {EntryPulseMat} from \"@ddd-qc/lit-happ/dist/ZomeViewModelWithSignals\";\nimport {ProfilesLinkType} from \"./bindings/profiles.integrity\";\n\n\n/** */\nexport interface ProfilesAltPerspectiveCore {\n /* ActionId -> Profile */\n profiles: ActionIdMap<[Profile, Timestamp]>,\n /* AgentId -> ActionId */\n profileByAgent: AgentIdMap<ActionId>,\n}\n\nexport interface ProfilesAltPerspectiveLive {\n /** Nickname -> AgentId */\n agentByName: Record<string, AgentId>,\n}\n\nexport type ProfilesAltPerspective = ProfilesAltPerspectiveCore & ProfilesAltPerspectiveLive;\n\n\nfunction createProfilesAltPerspective(): ProfilesAltPerspective {\n return {\n profiles: new ActionIdMap(),\n profileByAgent: new AgentIdMap(),\n agentByName: {},\n }\n}\n\n\n/**\n *\n */\nexport class ProfilesAltZvm extends ZomeViewModelWithSignals {\n\n static readonly ZOME_PROXY = ProfilesAltProxy;\n get zomeProxy(): ProfilesAltProxy {return this._zomeProxy as ProfilesAltProxy;}\n\n\n /* */\n protected hasChanged(): boolean {\n // TODO\n return true;\n }\n\n\n /** */\n async initializePerspectiveOnline(): Promise<void> {\n await this.probeAllProfiles();\n }\n\n /** */\n probeAllInner() {\n this.probeAllProfiles();\n }\n\n /** -- Perspective -- */\n\n /* */\n get perspective(): ProfilesAltPerspective {\n return this._perspective;\n }\n\n private _perspective: ProfilesAltPerspective = createProfilesAltPerspective();\n\n\n /** -- Getters -- */\n\n getProfileAgent(profileId: ActionId): AgentId | undefined {\n for (const [agentId, profId] of this._perspective.profileByAgent.entries()) {\n if (profileId.b64 == profId.b64) {\n return agentId;\n }\n }\n return undefined;\n }\n\n getMyProfile(): Profile | undefined {\n return this.getProfile(this.cell.agentId);\n }\n\n getProfile(agent: AgentId): Profile | undefined {\n const profileAh = this._perspective.profileByAgent.get(agent);\n console.log(\"ProfilesAltZvm.getProfile()\", agent, profileAh);\n if (!profileAh) {\n return undefined;\n }\n const pair = this._perspective.profiles.get(profileAh);\n console.log(\"ProfilesAltZvm.getProfile() pair\", pair);\n if (!pair) {\n return undefined;\n }\n return pair[0];\n }\n\n getProfileTs(agent: AgentId): Timestamp | undefined {\n const profileAh = this._perspective.profileByAgent.get(agent);\n if (!profileAh) {\n return undefined;\n }\n const pair = this._perspective.profiles.get(profileAh);\n return pair[1];\n }\n\n getAgents(): AgentId[] { return Array.from(this._perspective.profileByAgent.keys())}\n\n getNames(): string[] { return Object.keys(this._perspective.agentByName)}\n\n\n /** -- Signals -- */\n\n /** */\n async handleLinkPulse(pulse: LinkPulseMat, from: AgentId): Promise<void> {\n /** */\n switch (pulse.link_type) {\n case ProfilesLinkType.PrefixPath:\n case ProfilesLinkType.PathToAgent: {\n const agentEh = new EntryId(pulse.target.b64);\n const agentId = AgentId.from(agentEh);\n if (pulse.state != StateChangeType.Delete) {\n await this.findProfile(agentId);\n }\n }\n break;\n case ProfilesLinkType.AgentToProfile: {\n const agentEh = new EntryId(pulse.base.b64); // Make sure its an EntryHash\n const agentId = AgentId.from(agentEh);\n if (pulse.state == StateChangeType.Delete) {\n this.unstoreAgentProfile(agentId, pulse.target)\n } else {\n this.storeAgentProfile(agentId, pulse.target)\n }\n }\n break;\n }\n }\n\n\n /** */\n async handleEntryPulse(pulse: EntryPulseMat, from: AgentId) {\n switch (pulse.entryType) {\n case EntryTypesType.Profile:\n const profile = decode(pulse.bytes) as Profile;\n if (pulse.state != StateChangeType.Delete) {\n this.storeProfile(pulse.ah, profile, pulse.ts);\n }\n break;\n }\n }\n\n\n\n /** -- Store -- */\n\n /** */\n storeProfile(profileAh: ActionId, profile: Profile, ts: Timestamp) {\n console.log(\"ProfilesAltZvm.storeProfile()\", profileAh, profile.nickname);\n this._perspective.profiles.set(profileAh, [profile, ts]);\n const agentId = this.getProfileAgent(profileAh);\n if (agentId) {\n this._perspective.agentByName[profile.nickname] = agentId;\n }\n }\n\n /** */\n storeAgentProfile(agentId: AgentId, profileAh: ActionId) {\n console.log(\"ProfilesAltZvm.storeAgentProfile()\", agentId, profileAh);\n this._perspective.profileByAgent.set(agentId, profileAh);\n const pair = this._perspective.profiles.get(profileAh);\n if (pair) {\n this._perspective.agentByName[pair[0].nickname] = agentId;\n }\n }\n\n /** */\n unstoreAgentProfile(agentId: AgentId, profileAh: ActionId) {\n console.log(\"ProfilesAltZvm.unstoreAgentProfile()\", agentId, profileAh);\n this._perspective.profileByAgent.delete(agentId);\n const pair = this._perspective.profiles.get(profileAh);\n if (pair) {\n delete this._perspective.agentByName[pair[0].nickname];\n }\n }\n\n\n /** -- Methods -- */\n\n /** */\n async probeAllProfiles()/*: Promise<Record<AgentPubKeyB64, ProfileMat>>*/ {\n await this.zomeProxy.probeProfiles();\n }\n\n\n /** */\n async findProfile(agentId: AgentId): Promise<Profile | undefined> {\n const maybeProfilePair = await this.zomeProxy.findProfile(agentId.hash);\n console.log(\"findProfile() maybeProfilePair\", maybeProfilePair);\n if (!maybeProfilePair) {\n return;\n }\n return maybeProfilePair[1];\n }\n\n\n /** */\n async createMyProfile(profile: Profile): Promise<void> {\n const _ah = await this.zomeProxy.createProfile([profile, this.cell.agentId.hash]);\n }\n\n\n /** */\n async updateMyProfile(profile: Profile): Promise<void> {\n const _ah = await this.zomeProxy.updateProfile([profile, this.cell.agentId.hash]);\n }\n\n\n /** */\n async createProfile(profile: Profile, agentId: AgentId): Promise<void> {\n const _ah = await this.zomeProxy.createProfile([profile, agentId.hash]);\n }\n\n\n /** */\n async updateProfile(profile: Profile, agentId: AgentId): Promise<void> {\n const _ah = await this.zomeProxy.updateProfile([profile, agentId.hash]);\n }\n\n\n\n /** -- Import / Export -- */\n\n /** Dump perspective as JSON */\n exportPerspective(): string {\n //console.log(\"exportPerspective()\", perspMat);\n const core = this._perspective as ProfilesAltPerspectiveCore; // FIXME: check if this actually works as expected\n return JSON.stringify(core, null, 2);\n }\n\n\n /** */\n async importPerspective(json: string, canPublish: boolean) {\n const perspective = JSON.parse(json) as ProfilesAltPerspectiveCore;\n if (canPublish) {\n for (const [agentId, [profile, _ts]] of perspective.profiles.entries()) {\n await this.createProfile(profile, agentId);\n }\n return;\n }\n /** */\n for (const [actionId, [profile, ts]] of perspective.profiles.entries()) {\n this.storeProfile(actionId, profile, ts);\n }\n for (const [agentId, actionId] of perspective.profileByAgent.entries()) {\n this.storeAgentProfile(agentId, actionId);\n }\n }\n\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"profilesAlt.zvm.js","sourceRoot":"","sources":["../src/profilesAlt.zvm.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EACX,OAAO,EACP,UAAU,EACV,KAAK,EACL,OAAO,EACO,qBAAqB,EAAE,oBAAoB,EACzD,UAAU,EACV,WAAW,EAEX,UAAU,EAAE,eAAe,EAI3B,sBAAsB,EACtB,wBAAwB,EACzB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAC,gBAAgB,EAAC,MAAM,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ACjH,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACvC,CAAC;IAGD,MAAM;IACN,KAAK,CAAC,iBAAiB,CAAC,IAAY,EAAE,WAAoB;QACxD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAA+B,CAAC;QACnE,oBAAoB;QACpB,gFAAgF;QAChF,kDAAkD;QAClD,MAAM;QACN,YAAY;QACZ,IAAI;QACJ,MAAM;QACN,KAAK,MAAM,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,IAAI,WAAW,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE;YACvE,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;SAC3C;QACD,KAAK,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,IAAI,WAAW,CAAC,cAAc,CAAC,OAAO,EAAE,EAAE;YACvE,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;SAC5C;IACH,CAAC;;AA5Pe,yBAAU,GAAG,gBAAgB,AAAnB,CAAoB","sourcesContent":["import {\n ActionId,\n ActionIdMap,\n AgentId,\n AgentIdMap,\n enc64,\n EntryId,\n LinkPulseMat, materializeEntryPulse, materializeLinkPulse,\n prettyDate,\n prettyState,\n SignalLog,\n SignalType, StateChangeType,\n TipProtocol,\n ZomeSignal,\n ZomeSignalProtocol,\n ZomeSignalProtocolType,\n ZomeViewModelWithSignals\n} from \"@ddd-qc/lit-happ\";\nimport {Profile} from \"./bindings/profiles.types\";\nimport {Timestamp} from \"@holochain/client\";\nimport {decode} from \"@msgpack/msgpack\";\nimport {ProfilesAltProxy} from \"./bindings/profilesAlt.proxy\";\nimport {EntryPulseMat} from \"@ddd-qc/lit-happ/dist/ZomeViewModelWithSignals\";\nimport {ProfilesLinkType} from \"./bindings/profiles.integrity\";\nimport {ProfilesAltLinkType, ProfilesAltUnitEnum} from \"./bindings/profilesAlt.integrity\";\n\n\n/** */\nexport interface ProfilesAltPerspectiveCore {\n /* ActionId -> Profile */\n profiles: ActionIdMap<[Profile, Timestamp]>,\n /* AgentId -> ActionId */\n profileByAgent: AgentIdMap<ActionId>,\n}\n\nexport interface ProfilesAltPerspectiveLive {\n /** Nickname -> AgentId */\n agentByName: Record<string, AgentId>,\n}\n\nexport type ProfilesAltPerspective = ProfilesAltPerspectiveCore & ProfilesAltPerspectiveLive;\n\n\nfunction createProfilesAltPerspective(): ProfilesAltPerspective {\n return {\n profiles: new ActionIdMap(),\n profileByAgent: new AgentIdMap(),\n agentByName: {},\n }\n}\n\n\n/**\n *\n */\nexport class ProfilesAltZvm extends ZomeViewModelWithSignals {\n\n static readonly ZOME_PROXY = ProfilesAltProxy;\n get zomeProxy(): ProfilesAltProxy {return this._zomeProxy as ProfilesAltProxy;}\n\n\n /* */\n protected hasChanged(): boolean {\n // TODO\n return true;\n }\n\n\n /** */\n async initializePerspectiveOnline(): Promise<void> {\n await this.probeAllProfiles();\n }\n\n /** */\n probeAllInner() {\n this.probeAllProfiles();\n }\n\n /** -- Perspective -- */\n\n /* */\n get perspective(): ProfilesAltPerspective {\n return this._perspective;\n }\n\n private _perspective: ProfilesAltPerspective = createProfilesAltPerspective();\n\n\n /** -- Getters -- */\n\n getProfileAgent(profileId: ActionId): AgentId | undefined {\n for (const [agentId, profId] of this._perspective.profileByAgent.entries()) {\n if (profileId.b64 == profId.b64) {\n return agentId;\n }\n }\n return undefined;\n }\n\n getMyProfile(): Profile | undefined {\n return this.getProfile(this.cell.agentId);\n }\n\n getProfile(agent: AgentId): Profile | undefined {\n const profileAh = this._perspective.profileByAgent.get(agent);\n console.log(\"ProfilesAltZvm.getProfile()\", agent, profileAh);\n if (!profileAh) {\n return undefined;\n }\n const pair = this._perspective.profiles.get(profileAh);\n console.log(\"ProfilesAltZvm.getProfile() pair\", pair);\n if (!pair) {\n return undefined;\n }\n return pair[0];\n }\n\n getProfileTs(agent: AgentId): Timestamp | undefined {\n const profileAh = this._perspective.profileByAgent.get(agent);\n if (!profileAh) {\n return undefined;\n }\n const pair = this._perspective.profiles.get(profileAh);\n return pair[1];\n }\n\n getAgents(): AgentId[] { return Array.from(this._perspective.profileByAgent.keys())}\n\n getNames(): string[] { return Object.keys(this._perspective.agentByName)}\n\n\n /** -- Signals -- */\n\n /** */\n async handleLinkPulse(pulse: LinkPulseMat, from: AgentId): Promise<void> {\n /** */\n switch (pulse.link_type) {\n case ProfilesLinkType.PrefixPath:\n case ProfilesLinkType.PathToAgent: {\n const agentEh = new EntryId(pulse.target.b64);\n const agentId = AgentId.from(agentEh);\n if (pulse.state != StateChangeType.Delete) {\n await this.findProfile(agentId);\n }\n }\n break;\n case ProfilesLinkType.AgentToProfile: {\n const agentEh = new EntryId(pulse.base.b64); // Make sure its an EntryHash\n const agentId = AgentId.from(agentEh);\n if (pulse.state == StateChangeType.Delete) {\n this.unstoreAgentProfile(agentId, pulse.target)\n } else {\n this.storeAgentProfile(agentId, pulse.target)\n }\n }\n break;\n }\n }\n\n\n /** */\n async handleEntryPulse(pulse: EntryPulseMat, from: AgentId) {\n switch (pulse.entryType) {\n case ProfilesAltUnitEnum.Profile:\n const profile = decode(pulse.bytes) as Profile;\n if (pulse.state != StateChangeType.Delete) {\n this.storeProfile(pulse.ah, profile, pulse.ts);\n }\n break;\n }\n }\n\n\n /** */\n dumpSignalLogs(signalLogs: SignalLog[]) {\n this.dumpCastLogs();\n console.warn(`Signals received from zome \"${this.zomeName}\"`);\n let appSignals: any[] = [];\n signalLogs\n .filter((log) => log.type == SignalType.Zome)\n .map((log) => {\n const signal = log.zomeSignal as ZomeSignal;\n const pulses = signal.pulses as ZomeSignalProtocol[];\n const timestamp = prettyDate(new Date(log.ts));\n const from = enc64(signal.from) == this.cell.agentId.b64? \"self\" : new AgentId(signal.from);\n for (const pulse of pulses) {\n if (ZomeSignalProtocolType.Tip in pulse) {\n const tip: TipProtocol = pulse.Tip;\n const type = Object.keys(tip)[0];\n appSignals.push({timestamp, from, pulse: ZomeSignalProtocolType.Tip, type, payload: tip});\n }\n if (ZomeSignalProtocolType.Entry in pulse) {\n const entryPulse = materializeEntryPulse(pulse.Entry, Object.values(ProfilesAltUnitEnum));\n const typedEntry = decode(entryPulse.bytes);\n appSignals.push({timestamp, from, pulse: ZomeSignalProtocolType.Entry, state: prettyState(pulse.Entry.state), type: entryPulse.entryType, payload: typedEntry, ah_base: entryPulse.ah.short, eh_target: entryPulse.eh.short});\n }\n if (ZomeSignalProtocolType.Link in pulse) {\n const linkPulse = materializeLinkPulse(pulse.Link, Object.values(ProfilesAltLinkType));\n appSignals.push({timestamp, from, pulse: ZomeSignalProtocolType.Link, state: prettyState(pulse.Link.state), type: linkPulse.link_type, payload: linkPulse.tag, ah_base: linkPulse.base.print(), eh_target: linkPulse.target.print()});\n }\n }\n });\n console.table(appSignals);\n }\n\n\n /** -- Store -- */\n\n /** */\n storeProfile(profileAh: ActionId, profile: Profile, ts: Timestamp) {\n console.log(\"ProfilesAltZvm.storeProfile()\", profileAh, profile.nickname);\n this._perspective.profiles.set(profileAh, [profile, ts]);\n const agentId = this.getProfileAgent(profileAh);\n if (agentId) {\n this._perspective.agentByName[profile.nickname] = agentId;\n }\n }\n\n /** */\n storeAgentProfile(agentId: AgentId, profileAh: ActionId) {\n console.log(\"ProfilesAltZvm.storeAgentProfile()\", agentId, profileAh);\n this._perspective.profileByAgent.set(agentId, profileAh);\n const pair = this._perspective.profiles.get(profileAh);\n if (pair) {\n this._perspective.agentByName[pair[0].nickname] = agentId;\n }\n }\n\n /** */\n unstoreAgentProfile(agentId: AgentId, profileAh: ActionId) {\n console.log(\"ProfilesAltZvm.unstoreAgentProfile()\", agentId, profileAh);\n this._perspective.profileByAgent.delete(agentId);\n const pair = this._perspective.profiles.get(profileAh);\n if (pair) {\n delete this._perspective.agentByName[pair[0].nickname];\n }\n }\n\n\n /** -- Methods -- */\n\n /** */\n async probeAllProfiles()/*: Promise<Record<AgentPubKeyB64, ProfileMat>>*/ {\n await this.zomeProxy.probeProfiles();\n }\n\n\n /** */\n async findProfile(agentId: AgentId): Promise<Profile | undefined> {\n const maybeProfilePair = await this.zomeProxy.findProfile(agentId.hash);\n console.log(\"findProfile() maybeProfilePair\", maybeProfilePair);\n if (!maybeProfilePair) {\n return;\n }\n return maybeProfilePair[1];\n }\n\n\n /** */\n async createMyProfile(profile: Profile): Promise<void> {\n const _ah = await this.zomeProxy.createProfile([profile, this.cell.agentId.hash]);\n }\n\n\n /** */\n async updateMyProfile(profile: Profile): Promise<void> {\n const _ah = await this.zomeProxy.updateProfile([profile, this.cell.agentId.hash]);\n }\n\n\n /** */\n async createProfile(profile: Profile, agentId: AgentId): Promise<void> {\n const _ah = await this.zomeProxy.createProfile([profile, agentId.hash]);\n }\n\n\n /** */\n async updateProfile(profile: Profile, agentId: AgentId): Promise<void> {\n const _ah = await this.zomeProxy.updateProfile([profile, agentId.hash]);\n }\n\n\n\n /** -- Import / Export -- */\n\n /** Dump perspective as JSON */\n exportPerspective(): string {\n //console.log(\"exportPerspective()\", perspMat);\n const core = this._perspective as ProfilesAltPerspectiveCore; // FIXME: check if this actually works as expected\n return JSON.stringify(core, null, 2);\n }\n\n\n /** */\n async importPerspective(json: string, _canPublish: boolean) {\n const perspective = JSON.parse(json) as ProfilesAltPerspectiveCore;\n // if (canPublish) {\n // for (const [profileAh, [profile, _ts]] of perspective.profiles.entries()) {\n // await this.createProfile(profile, agentId);\n // }\n // return;\n // }\n /** */\n for (const [profileAh, [profile, ts]] of perspective.profiles.entries()) {\n this.storeProfile(profileAh, profile, ts);\n }\n for (const [agentId, profileAh] of perspective.profileByAgent.entries()) {\n this.storeAgentProfile(agentId, profileAh);\n }\n }\n\n\n}\n"]}
|
package/dist/utils.js
CHANGED
|
@@ -13,8 +13,13 @@ export function getInitials(nickname) {
|
|
|
13
13
|
}
|
|
14
14
|
/** */
|
|
15
15
|
export function agent2avatar(key, profilesPerspective) {
|
|
16
|
+
const maybeProfileId = profilesPerspective.profileByAgent.get(key);
|
|
17
|
+
if (!maybeProfileId) {
|
|
18
|
+
console.log("ProfileAh not found for agent", key, profilesPerspective.profiles);
|
|
19
|
+
throw Error("ProfileAh not found for agent");
|
|
20
|
+
}
|
|
16
21
|
let profile = { nickname: "unknown", fields: {} };
|
|
17
|
-
const maybeProfilePair = profilesPerspective.profiles.get(
|
|
22
|
+
const maybeProfilePair = profilesPerspective.profiles.get(maybeProfileId);
|
|
18
23
|
if (maybeProfilePair) {
|
|
19
24
|
profile = maybeProfilePair[0];
|
|
20
25
|
}
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,IAAI,EAAiB,MAAM,KAAK,CAAC;AAGzC,MAAM;AACN,MAAM,UAAU,WAAW,CAAC,QAAgB;IACxC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACtD,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;QAClB,QAAQ,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;KACrE;SAAM;QACH,QAAQ,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;KACxC;IACD,OAAO,QAAQ,CAAC;AACpB,CAAC;AAID,MAAM;AACN,MAAM,UAAU,YAAY,CAAC,GAAY,EAAE,mBAA2C;IAClF,IAAI,OAAO,GAAG,EAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAe,CA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;IAC1E,IAAI,gBAAgB,EAAE;QAClB,OAAO,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAA;KAChC;SAAM;QACH,OAAO,CAAC,GAAG,CAAC,6BAA6B,EAAE,GAAG,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;KACjF;IACD,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC/C,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC3C,MAAM,MAAM,GACR,SAAS,CAAA,CAAC,CAAC,IAAI,CAAA;;yBAEE,SAAS;;aAErB,CAAC,CAAC,CAAC,IAAI,CAAA;oEACgD,QAAQ;iBAC3D,CAAC;IACd,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAC7B,CAAC","sourcesContent":["import {ProfilesAltPerspective} from \"./profilesAlt.zvm\";\nimport {Profile as ProfileMat} from \"./bindings/profiles.types\";\nimport {html, TemplateResult} from \"lit\";\nimport {AgentId} from \"@ddd-qc/cell-proxy\";\n\n/** */\nexport function getInitials(nickname: string): string {\n const names = nickname.split(' ');\n let initials = names[0].substring(0, 1).toUpperCase();\n if (names.length > 1) {\n initials += names[names.length - 1].substring(0, 1).toUpperCase();\n } else {\n initials += names[0].substring(1, 2);\n }\n return initials;\n}\n\n\n\n/** */\nexport function agent2avatar(key: AgentId, profilesPerspective: ProfilesAltPerspective): [ProfileMat, TemplateResult<1>] {\n const maybeProfileId = profilesPerspective.profileByAgent.get(key);\n if (!maybeProfileId) {\n console.log(\"ProfileAh not found for agent\", key, profilesPerspective.profiles);\n throw Error(\"ProfileAh not found for agent\")\n }\n let profile = {nickname: \"unknown\", fields: {}} as ProfileMat;\n const maybeProfilePair = profilesPerspective.profiles.get(maybeProfileId);\n if (maybeProfilePair) {\n profile = maybeProfilePair[0]\n } else {\n console.log(\"Profile not found for agent\", key, profilesPerspective.profiles);\n }\n const initials = getInitials(profile.nickname);\n const avatarUrl = profile.fields['avatar'];\n const avatar =\n avatarUrl? html`\n <sl-avatar class=\"activityAvatar\" style=\"box-shadow: 1px 1px 1px 1px rgba(130, 122, 122, 0.88)\">\n <img src=${avatarUrl}>\n </sl-avatar> \n ` : html`\n <sl-avatar class=\"activityAvatar\" shape=\"circle\" initials=${initials} color-scheme=\"Accent2\"></sl-avatar>\n `;\n return [profile, avatar];\n}\n"]}
|