@ddd-qc/profiles-dvm 0.26.4 → 0.26.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.
@@ -1,4 +1,4 @@
1
- import { CastTipInput, Profile } from './profilesAlt.types';
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;IAED,KAAK,CAAC,OAAO,CAAC,KAAmB;QAC/B,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC;;AA3Be,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, StateChange, SystemSignalProtocol, TipProtocol, ZomeSignalProtocol, CastTipInput, EntryPulse, LinkPulse, Profile, ZomeSignal, } 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 async castTip(input: CastTipInput): Promise<void> {\n return this.call('cast_tip', input);\n }\n}\n"]}
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;AAUD,2DAA2D;AAC3D,MAAM,CAAN,IAAY,eAIX;AAJD,WAAY,eAAe;IAC1B,oCAAiB,CAAA;IACjB,oCAAiB,CAAA;IACjB,oCAAiB,CAAA;AAClB,CAAC,EAJW,eAAe,KAAf,eAAe,QAI1B;AA4BD,OAAO;AACP,MAAM,CAAN,IAAY,sBAKX;AALD,WAAY,sBAAsB;IACjC,2CAAiB,CAAA;IACjB,yCAAe,CAAA;IACf,uCAAa,CAAA;IACb,qCAAW,CAAA;AACZ,CAAC,EALW,sBAAsB,KAAtB,sBAAsB,QAKjC;AA8CD,mDAAmD;AACnD,MAAM,CAAN,IAAY,eAMX;AAND,WAAY,eAAe;IAC1B,gCAAa,CAAA;IACb,gCAAa,CAAA;IACb,kCAAe,CAAA;IACf,gCAAa,CAAA;IACb,8BAAW,CAAA;AACZ,CAAC,EANW,eAAe,KAAf,eAAe,QAM1B","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\nexport interface CastTipInput {\n tip: TipProtocol\n peers: AgentPubKey[]\n}\n\n/** Bool: True if state change just happened (real-time) */\nexport enum StateChangeType {\n\tCreate = 'Create',\n\tUpdate = 'Update',\n\tDelete = 'Delete',\n}\nexport type StateChangeVariantCreate = {Create: boolean}\nexport type StateChangeVariantUpdate = {Update: boolean}\nexport type StateChangeVariantDelete = {Delete: boolean}\nexport type StateChange = \n | StateChangeVariantCreate | StateChangeVariantUpdate | StateChangeVariantDelete;\n\nexport interface LinkPulse {\n link: Link\n state: StateChange\n}\n\nexport interface EntryPulse {\n ah: ActionHash\n state: StateChange\n ts: Timestamp\n author: AgentPubKey\n eh: EntryHash\n def: AppEntryDef\n bytes: Uint8Array\n}\n\n/** */\nexport interface ZomeSignal {\n from: AgentPubKey\n pulses: ZomeSignalProtocol[]\n}\n\n/** */\nexport enum ZomeSignalProtocolType {\n\tSystem = 'System',\n\tEntry = 'Entry',\n\tLink = 'Link',\n\tTip = 'Tip',\n}\nexport type ZomeSignalProtocolVariantSystem = {System: SystemSignalProtocol}\nexport type ZomeSignalProtocolVariantEntry = {Entry: EntryPulse}\nexport type ZomeSignalProtocolVariantLink = {Link: LinkPulse}\nexport type ZomeSignalProtocolVariantTip = {Tip: TipProtocol}\nexport type ZomeSignalProtocol = \n | ZomeSignalProtocolVariantSystem | ZomeSignalProtocolVariantEntry | ZomeSignalProtocolVariantLink | ZomeSignalProtocolVariantTip;\n\n/** Protocol for notifying the ViewModel (UI) of system level events */\nexport type SystemSignalProtocolVariantPostCommitNewStart = {\n type: \"PostCommitNewStart\"\n app_entry_type: string\n}\nexport type SystemSignalProtocolVariantPostCommitNewEnd = {\n type: \"PostCommitNewEnd\"\n app_entry_type: string\n succeeded: boolean\n}\nexport type SystemSignalProtocolVariantPostCommitDeleteStart = {\n type: \"PostCommitDeleteStart\"\n app_entry_type: string\n}\nexport type SystemSignalProtocolVariantPostCommitDeleteEnd = {\n type: \"PostCommitDeleteEnd\"\n app_entry_type: string\n succeeded: boolean\n}\nexport type SystemSignalProtocolVariantSelfCallStart = {\n type: \"SelfCallStart\"\n zome_name: string\n fn_name: string\n}\nexport type SystemSignalProtocolVariantSelfCallEnd = {\n type: \"SelfCallEnd\"\n zome_name: string\n fn_name: string\n succeeded: boolean\n}\nexport type SystemSignalProtocol =\n | SystemSignalProtocolVariantPostCommitNewStart\n | SystemSignalProtocolVariantPostCommitNewEnd\n | SystemSignalProtocolVariantPostCommitDeleteStart\n | SystemSignalProtocolVariantPostCommitDeleteEnd\n | SystemSignalProtocolVariantSelfCallStart\n | SystemSignalProtocolVariantSelfCallEnd;\n\n/** Used by UI ONLY. That's why we use B64 here. */\nexport enum TipProtocolType {\n\tPing = 'Ping',\n\tPong = 'Pong',\n\tEntry = 'Entry',\n\tLink = 'Link',\n\tApp = 'App',\n}\nexport type TipProtocolVariantPing = {Ping: AgentPubKey}\nexport type TipProtocolVariantPong = {Pong: AgentPubKey}\nexport type TipProtocolVariantEntry = {Entry: EntryPulse}\nexport type TipProtocolVariantLink = {Link: LinkPulse}\nexport type TipProtocolVariantApp = {App: Uint8Array}\nexport type TipProtocol = \n | TipProtocolVariantPing | TipProtocolVariantPong | TipProtocolVariantEntry | TipProtocolVariantLink | TipProtocolVariantApp;\n"]}
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"]}
@@ -0,0 +1,20 @@
1
+ import { LitElement } from 'lit';
2
+ import '@holochain-open-dev/elements/dist/elements/select-avatar.js';
3
+ import { Profile } from "../bindings/profilesAlt.types";
4
+ /**
5
+ * @fires save-profile - Fired when the save profile button is clicked
6
+ */
7
+ export declare class EditProfile extends LitElement {
8
+ /** The profile to be edited. */
9
+ profile: Profile | undefined;
10
+ /** -- Methods -- */
11
+ /**
12
+ * Seperate Mailgun token from other fields as we don't want it to be saved in Profiles
13
+ */
14
+ fireSaveProfile(formFields: Record<string, string>): Promise<void>;
15
+ /** */
16
+ handleLangChange(_e: any): Promise<void>;
17
+ /** */
18
+ render(): import("lit-html").TemplateResult<1>;
19
+ static styles: (import("lit").CSSResult | import("lit").CSSResult[])[];
20
+ }
@@ -0,0 +1,163 @@
1
+ import { __decorate } from "tslib";
2
+ import { css, html, LitElement } from 'lit';
3
+ import { customElement, property } from 'lit/decorators.js';
4
+ import { localized, msg, str } from '@lit/localize';
5
+ import { onSubmit, sharedStyles } from '@holochain-open-dev/elements';
6
+ import '@holochain-open-dev/elements/dist/elements/select-avatar.js';
7
+ //import "@shoelace-style/shoelace/dist/components/avatar/avatar.js";
8
+ //import "@shoelace-style/shoelace/dist/components/button/button.js";
9
+ //import "@shoelace-style/shoelace/dist/components/icon/icon.js";
10
+ //import "@shoelace-style/shoelace/dist/components/input/input.js";
11
+ //import "@shoelace-style/shoelace/dist/components/radio/radio.js";
12
+ //import "@shoelace-style/shoelace/dist/components/radio-group/radio-group.js";
13
+ //import "@shoelace-style/shoelace/dist/components/tooltip/tooltip.js";
14
+ const MIN_NICKNAME_LENGTH = 2;
15
+ /**
16
+ * @fires save-profile - Fired when the save profile button is clicked
17
+ */
18
+ let EditProfile = class EditProfile extends LitElement {
19
+ /** -- Methods -- */
20
+ /**
21
+ * Seperate Mailgun token from other fields as we don't want it to be saved in Profiles
22
+ */
23
+ async fireSaveProfile(formFields) {
24
+ console.log("fireSaveProfile()", formFields);
25
+ const nickname = formFields['nickname'];
26
+ delete formFields['nickname'];
27
+ const fields = {};
28
+ //fields['email'] = formFields['email'];
29
+ fields['avatar'] = formFields['avatar'] ? formFields['avatar'] : "";
30
+ fields['lang'] = formFields['option'] ? formFields['option'] : "";
31
+ /** */
32
+ this.dispatchEvent(new CustomEvent('save-profile', {
33
+ detail: { nickname, fields },
34
+ bubbles: true,
35
+ composed: true,
36
+ }));
37
+ }
38
+ /** */
39
+ async handleLangChange(_e) {
40
+ //console.log({langChangeEvent: e});
41
+ const langRadioGroup = this.shadowRoot.getElementById("langRadioGroup");
42
+ console.log({ langRadioGroup });
43
+ const lang = langRadioGroup.value;
44
+ console.log("handleLangChange: lang =", lang);
45
+ this.dispatchEvent(new CustomEvent('lang-selected', { detail: lang, bubbles: true, composed: true }));
46
+ }
47
+ /** */
48
+ render() {
49
+ var _a, _b, _c;
50
+ console.log("<profiles-edit-profile>.render()", this.profile);
51
+ /** */
52
+ return html `
53
+ <form id="profile-form" class="column"
54
+ ${onSubmit(fields => /*await*/ this.fireSaveProfile(fields))}>
55
+
56
+ <div class="row"
57
+ style="justify-content: center; align-self: start; margin-bottom: 16px; width: 100%;">
58
+ <select-avatar
59
+ style="cursor:pointer"
60
+ name="avatar"
61
+ .value=${((_a = this.profile) === null || _a === void 0 ? void 0 : _a.fields['avatar']) || undefined}
62
+ ></select-avatar>
63
+ <label for="nickname">Nickname:</label>
64
+ <input
65
+ type="text"
66
+ name="nickname"
67
+ .label=${msg('Nickname')}
68
+ required
69
+ minLength=${MIN_NICKNAME_LENGTH}
70
+ .value=${((_b = this.profile) === null || _b === void 0 ? void 0 : _b.nickname) || ''}
71
+ .helpText=${msg(str `Min. ${MIN_NICKNAME_LENGTH} characters`)}
72
+ style="margin-left: 16px;"
73
+ >
74
+ </div>
75
+
76
+ <div class="row" style="justify-content: center; margin-bottom: 8px; align-self: start;" >
77
+ <span style="font-size:18px;padding-right:10px;">${msg('Language')}:</span>
78
+ <sl-radio-group id="langRadioGroup" @click="${this.handleLangChange}" .value=${(_c = this.profile) === null || _c === void 0 ? void 0 : _c.fields['lang']}>
79
+ <sl-radio value="en">🇬🇧</sl-radio>
80
+ <sl-radio value="fr-fr">🇫🇷</sl-radio>
81
+ </sl-radio-group>
82
+ </div>
83
+
84
+ <div class="row" style="margin-top: 8px;">
85
+ <button style="flex: 1;" variant="primary" type="submit"
86
+ >${msg('Save Profile')}
87
+ </button>
88
+ </div>
89
+ </form>
90
+ `;
91
+ }
92
+ };
93
+ EditProfile.styles = [sharedStyles, css `
94
+
95
+ sl-radio {
96
+ font-size: larger;
97
+ }
98
+ .small-margin {
99
+ margin-top: 6px;
100
+ }
101
+ .big-margin {
102
+ margin-top: 23px;
103
+ }
104
+
105
+ .fill {
106
+ flex: 1;
107
+ height: 100%;
108
+ }
109
+
110
+ .title {
111
+ font-size: 20px;
112
+ }
113
+
114
+ .center-content {
115
+ align-items: center;
116
+ justify-content: center;
117
+ }
118
+
119
+ .placeholder {
120
+ color: rgba(0, 0, 0, 0.7);
121
+ }
122
+
123
+ .label {
124
+ color: var(--mdc-text-field-label-ink-color, rgba(0, 0, 0, 0.6));
125
+ font-family: var(
126
+ --mdc-typography-caption-font-family,
127
+ var(--mdc-typography-font-family, Roboto, sans-serif)
128
+ );
129
+ font-size: var(--mdc-typography-caption-font-size, 0.79rem);
130
+ font-weight: var(--mdc-typography-caption-font-weight, 400);
131
+ }
132
+
133
+ .flex-scrollable-parent {
134
+ position: relative;
135
+ display: flex;
136
+ flex: 1;
137
+ }
138
+
139
+ .flex-scrollable-container {
140
+ position: absolute;
141
+ top: 0;
142
+ left: 0;
143
+ right: 0;
144
+ bottom: 0;
145
+ }
146
+
147
+ .flex-scrollable-x {
148
+ max-width: 100%;
149
+ overflow-x: auto;
150
+ }
151
+ .flex-scrollable-y {
152
+ max-height: 100%;
153
+ overflow-y: auto;
154
+ }`];
155
+ __decorate([
156
+ property({ type: Object })
157
+ ], EditProfile.prototype, "profile", void 0);
158
+ EditProfile = __decorate([
159
+ localized(),
160
+ customElement('profiles-edit-profile')
161
+ ], EditProfile);
162
+ export { EditProfile };
163
+ //# sourceMappingURL=edit-profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit-profile.js","sourceRoot":"","sources":["../../src/elements/edit-profile.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,UAAU,EAAC,MAAM,KAAK,CAAC;AAC1C,OAAO,EAAE,aA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;;;;;;;;;;;;;MA6D9B,CAAC,AA7DQ,CA6DP;AAtJN;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CACE;AALlB,WAAW;IAFvB,SAAS,EAAE;IACX,aAAa,CAAC,uBAAuB,CAAC;GAC1B,WAAW,CA4JvB","sourcesContent":["import {css, html, LitElement} from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { localized, msg, str } from '@lit/localize';\nimport { onSubmit, sharedStyles } from '@holochain-open-dev/elements';\n\nimport '@holochain-open-dev/elements/dist/elements/select-avatar.js';\nimport {Profile} from \"../bindings/profilesAlt.types\";\n\n\n\n//import \"@shoelace-style/shoelace/dist/components/avatar/avatar.js\";\n//import \"@shoelace-style/shoelace/dist/components/button/button.js\";\n//import \"@shoelace-style/shoelace/dist/components/icon/icon.js\";\n//import \"@shoelace-style/shoelace/dist/components/input/input.js\";\n//import \"@shoelace-style/shoelace/dist/components/radio/radio.js\";\n//import \"@shoelace-style/shoelace/dist/components/radio-group/radio-group.js\";\n//import \"@shoelace-style/shoelace/dist/components/tooltip/tooltip.js\";\n\n\n\nconst MIN_NICKNAME_LENGTH = 2\n\n\n/**\n * @fires save-profile - Fired when the save profile button is clicked\n */\n@localized()\n@customElement('profiles-edit-profile')\nexport class EditProfile extends LitElement {\n\n\n /** The profile to be edited. */\n @property({ type: Object })\n profile: Profile | undefined;\n\n\n /** -- Methods -- */\n\n /**\n * Seperate Mailgun token from other fields as we don't want it to be saved in Profiles\n */\n async fireSaveProfile(formFields: Record<string, string>) {\n console.log(\"fireSaveProfile()\", formFields);\n const nickname = formFields['nickname'];\n delete formFields['nickname'];\n\n const fields = {}\n //fields['email'] = formFields['email'];\n fields['avatar'] = formFields['avatar']? formFields['avatar'] : \"\";\n fields['lang'] = formFields['option']? formFields['option'] : \"\";\n\n\n /** */\n this.dispatchEvent(\n new CustomEvent<Profile>('save-profile', {\n detail: {nickname, fields} as Profile,\n bubbles: true,\n composed: true,\n })\n );\n\n }\n\n\n /** */\n async handleLangChange(_e: any) {\n //console.log({langChangeEvent: e});\n const langRadioGroup = this.shadowRoot!.getElementById(\"langRadioGroup\") as any;\n console.log({langRadioGroup});\n const lang = langRadioGroup.value;\n console.log(\"handleLangChange: lang =\", lang);\n this.dispatchEvent(new CustomEvent('lang-selected', { detail: lang, bubbles: true, composed: true }));\n }\n\n\n /** */\n render() {\n console.log(\"<profiles-edit-profile>.render()\", this.profile);\n\n /** */\n return html`\n <form id=\"profile-form\" class=\"column\"\n ${onSubmit(fields => /*await*/ this.fireSaveProfile(fields))}>\n \n <div class=\"row\"\n style=\"justify-content: center; align-self: start; margin-bottom: 16px; width: 100%;\">\n <select-avatar\n style=\"cursor:pointer\"\n name=\"avatar\"\n .value=${this.profile?.fields['avatar'] || undefined}\n ></select-avatar>\n <label for=\"nickname\">Nickname:</label>\n <input\n type=\"text\"\n name=\"nickname\"\n .label=${msg('Nickname')}\n required\n minLength=${MIN_NICKNAME_LENGTH}\n .value=${this.profile?.nickname || ''}\n .helpText=${msg(str`Min. ${MIN_NICKNAME_LENGTH} characters`)}\n style=\"margin-left: 16px;\"\n >\n </div>\n \n <div class=\"row\" style=\"justify-content: center; margin-bottom: 8px; align-self: start;\" >\n <span style=\"font-size:18px;padding-right:10px;\">${msg('Language')}:</span>\n <sl-radio-group id=\"langRadioGroup\" @click=\"${this.handleLangChange}\" .value=${this.profile?.fields['lang']}>\n <sl-radio value=\"en\">🇬🇧</sl-radio>\n <sl-radio value=\"fr-fr\">🇫🇷</sl-radio>\n </sl-radio-group>\n </div>\n \n <div class=\"row\" style=\"margin-top: 8px;\">\n <button style=\"flex: 1;\" variant=\"primary\" type=\"submit\"\n >${msg('Save Profile')}\n </button>\n </div>\n </form>\n `;\n }\n\n\n static styles = [sharedStyles, css`\n\n sl-radio {\n font-size: larger;\n }\n .small-margin {\n margin-top: 6px;\n }\n .big-margin {\n margin-top: 23px;\n }\n\n .fill {\n flex: 1;\n height: 100%;\n }\n\n .title {\n font-size: 20px;\n }\n\n .center-content {\n align-items: center;\n justify-content: center;\n }\n\n .placeholder {\n color: rgba(0, 0, 0, 0.7);\n }\n\n .label {\n color: var(--mdc-text-field-label-ink-color, rgba(0, 0, 0, 0.6));\n font-family: var(\n --mdc-typography-caption-font-family,\n var(--mdc-typography-font-family, Roboto, sans-serif)\n );\n font-size: var(--mdc-typography-caption-font-size, 0.79rem);\n font-weight: var(--mdc-typography-caption-font-weight, 400);\n }\n\n .flex-scrollable-parent {\n position: relative;\n display: flex;\n flex: 1;\n }\n\n .flex-scrollable-container {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n }\n\n .flex-scrollable-x {\n max-width: 100%;\n overflow-x: auto;\n }\n .flex-scrollable-y {\n max-height: 100%;\n overflow-y: auto;\n }`];\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -3,5 +3,6 @@ export * from "./bindings/profiles.proxy";
3
3
  export * from "./profiles.zvm";
4
4
  export * from "./bindings/profilesAlt.proxy";
5
5
  export * from "./profilesAlt.zvm";
6
+ export * from "./elements/edit-profile";
6
7
  export * from "./profiles.dvm";
7
8
  export * from "./utils";
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ export * from "./bindings/profiles.proxy";
3
3
  export * from "./profiles.zvm";
4
4
  export * from "./bindings/profilesAlt.proxy";
5
5
  export * from "./profilesAlt.zvm";
6
+ export * from "./elements/edit-profile";
6
7
  export * from "./profiles.dvm";
7
8
  export * from "./utils";
8
9
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,gBAAgB,CAAA;AAE9B,cAAc,8BAA8B,CAAA;AAC5C,cAAc,mBAAmB,CAAA;AAEjC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA","sourcesContent":["export * from \"./bindings/profiles.types\"\nexport * from \"./bindings/profiles.proxy\"\nexport * from \"./profiles.zvm\"\n\nexport * from \"./bindings/profilesAlt.proxy\"\nexport * from \"./profilesAlt.zvm\"\n\nexport * from \"./profiles.dvm\"\nexport * from \"./utils\"\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,gBAAgB,CAAA;AAE9B,cAAc,8BAA8B,CAAA;AAC5C,cAAc,mBAAmB,CAAA;AAEjC,cAAc,yBAAyB,CAAA;AACvC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA","sourcesContent":["export * from \"./bindings/profiles.types\"\nexport * from \"./bindings/profiles.proxy\"\nexport * from \"./profiles.zvm\"\n\nexport * from \"./bindings/profilesAlt.proxy\"\nexport * from \"./profilesAlt.zvm\"\n\nexport * from \"./elements/edit-profile\"\nexport * from \"./profiles.dvm\"\nexport * from \"./utils\"\n"]}
@@ -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,CAAA;IAC5E,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\";\nimport {ProfilesAltZvm} from \"./profilesAlt.zvm\";\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
+ {"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,CAAA;IAC5E,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";
@@ -27,21 +27,20 @@ export declare class ProfilesAltZvm extends ZomeViewModelWithSignals {
27
27
  /** -- Perspective -- */
28
28
  get perspective(): ProfilesAltPerspective;
29
29
  private _perspective;
30
- getMyProfile(): Profile | undefined;
30
+ /** -- Getters -- */
31
31
  getProfileAgent(profileId: ActionId): AgentId | undefined;
32
+ getMyProfile(): Profile | undefined;
32
33
  getProfile(agent: AgentId): Profile | undefined;
33
34
  getProfileTs(agent: AgentId): Timestamp | undefined;
34
35
  getAgents(): AgentId[];
35
36
  getNames(): string[];
37
+ /** -- Signals -- */
36
38
  /** */
37
39
  handleLinkPulse(pulse: LinkPulseMat, from: AgentId): Promise<void>;
38
40
  /** */
39
41
  handleEntryPulse(pulse: EntryPulseMat, from: AgentId): Promise<void>;
40
- /** -- perspective -- */
41
- /** Dump perspective as JSON */
42
- exportPerspective(): string;
43
42
  /** */
44
- importPerspective(json: string, canPublish: boolean): Promise<void>;
43
+ dumpSignalLogs(signalLogs: SignalLog[]): void;
45
44
  /** -- Store -- */
46
45
  /** */
47
46
  storeProfile(profileAh: ActionId, profile: Profile, ts: Timestamp): void;
@@ -62,4 +61,9 @@ export declare class ProfilesAltZvm extends ZomeViewModelWithSignals {
62
61
  createProfile(profile: Profile, agentId: AgentId): Promise<void>;
63
62
  /** */
64
63
  updateProfile(profile: Profile, agentId: AgentId): Promise<void>;
64
+ /** -- Import / Export -- */
65
+ /** Dump perspective as JSON */
66
+ exportPerspective(): string;
67
+ /** */
68
+ importPerspective(json: string, canPublish: boolean): Promise<void>;
65
69
  }
@@ -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(),
@@ -37,13 +37,7 @@ export class ProfilesAltZvm extends ZomeViewModelWithSignals {
37
37
  get perspective() {
38
38
  return this._perspective;
39
39
  }
40
- getMyProfile() {
41
- const pair = this._perspective.profiles.get(this.cell.agentId);
42
- if (!pair) {
43
- return undefined;
44
- }
45
- return pair[0];
46
- }
40
+ /** -- Getters -- */
47
41
  getProfileAgent(profileId) {
48
42
  for (const [agentId, profId] of this._perspective.profileByAgent.entries()) {
49
43
  if (profileId.b64 == profId.b64) {
@@ -52,12 +46,20 @@ export class ProfilesAltZvm extends ZomeViewModelWithSignals {
52
46
  }
53
47
  return undefined;
54
48
  }
49
+ getMyProfile() {
50
+ return this.getProfile(this.cell.agentId);
51
+ }
55
52
  getProfile(agent) {
56
53
  const profileAh = this._perspective.profileByAgent.get(agent);
54
+ console.log("ProfilesAltZvm.getProfile()", agent, profileAh);
57
55
  if (!profileAh) {
58
56
  return undefined;
59
57
  }
60
58
  const pair = this._perspective.profiles.get(profileAh);
59
+ console.log("ProfilesAltZvm.getProfile() pair", pair);
60
+ if (!pair) {
61
+ return undefined;
62
+ }
61
63
  return pair[0];
62
64
  }
63
65
  getProfileTs(agent) {
@@ -70,21 +72,31 @@ export class ProfilesAltZvm extends ZomeViewModelWithSignals {
70
72
  }
71
73
  getAgents() { return Array.from(this._perspective.profileByAgent.keys()); }
72
74
  getNames() { return Object.keys(this._perspective.agentByName); }
75
+ /** -- Signals -- */
73
76
  /** */
74
77
  async handleLinkPulse(pulse, from) {
75
78
  /** */
76
79
  switch (pulse.link_type) {
77
80
  case ProfilesLinkType.PrefixPath:
78
81
  case ProfilesLinkType.PathToAgent:
82
+ {
83
+ const agentEh = new EntryId(pulse.target.b64);
84
+ const agentId = AgentId.from(agentEh);
85
+ if (pulse.state != StateChangeType.Delete) {
86
+ await this.findProfile(agentId);
87
+ }
88
+ }
79
89
  break;
80
90
  case ProfilesLinkType.AgentToProfile:
81
- const agentEh = new EntryId(pulse.base.b64); // Make sure its an EntryHash
82
- const agentId = AgentId.from(agentEh);
83
- if (pulse.state == StateChangeType.Delete) {
84
- this.unstoreAgentProfile(agentId, pulse.target);
85
- }
86
- else {
87
- this.storeAgentProfile(agentId, pulse.target);
91
+ {
92
+ const agentEh = new EntryId(pulse.base.b64); // Make sure its an EntryHash
93
+ const agentId = AgentId.from(agentEh);
94
+ if (pulse.state == StateChangeType.Delete) {
95
+ this.unstoreAgentProfile(agentId, pulse.target);
96
+ }
97
+ else {
98
+ this.storeAgentProfile(agentId, pulse.target);
99
+ }
88
100
  }
89
101
  break;
90
102
  }
@@ -92,7 +104,7 @@ export class ProfilesAltZvm extends ZomeViewModelWithSignals {
92
104
  /** */
93
105
  async handleEntryPulse(pulse, from) {
94
106
  switch (pulse.entryType) {
95
- case EntryTypesType.Profile:
107
+ case ProfilesAltUnitEnum.Profile:
96
108
  const profile = decode(pulse.bytes);
97
109
  if (pulse.state != StateChangeType.Delete) {
98
110
  this.storeProfile(pulse.ah, profile, pulse.ts);
@@ -100,33 +112,41 @@ export class ProfilesAltZvm extends ZomeViewModelWithSignals {
100
112
  break;
101
113
  }
102
114
  }
103
- /** -- perspective -- */
104
- /** Dump perspective as JSON */
105
- exportPerspective() {
106
- //console.log("exportPerspective()", perspMat);
107
- const core = this._perspective; // FIXME: check if this actually works as expected
108
- return JSON.stringify(core, null, 2);
109
- }
110
115
  /** */
111
- async importPerspective(json, canPublish) {
112
- const perspective = JSON.parse(json);
113
- if (canPublish) {
114
- for (const [agentId, [profile, _ts]] of perspective.profiles.entries()) {
115
- await this.createProfile(profile, agentId);
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
+ }
116
142
  }
117
- return;
118
- }
119
- /** */
120
- for (const [actionId, [profile, ts]] of perspective.profiles.entries()) {
121
- this.storeProfile(actionId, profile, ts);
122
- }
123
- for (const [agentId, actionId] of perspective.profileByAgent.entries()) {
124
- this.storeAgentProfile(agentId, actionId);
125
- }
143
+ });
144
+ console.table(appSignals);
126
145
  }
127
146
  /** -- Store -- */
128
147
  /** */
129
148
  storeProfile(profileAh, profile, ts) {
149
+ console.log("ProfilesAltZvm.storeProfile()", profileAh, profile.nickname);
130
150
  this._perspective.profiles.set(profileAh, [profile, ts]);
131
151
  const agentId = this.getProfileAgent(profileAh);
132
152
  if (agentId) {
@@ -135,6 +155,7 @@ export class ProfilesAltZvm extends ZomeViewModelWithSignals {
135
155
  }
136
156
  /** */
137
157
  storeAgentProfile(agentId, profileAh) {
158
+ console.log("ProfilesAltZvm.storeAgentProfile()", agentId, profileAh);
138
159
  this._perspective.profileByAgent.set(agentId, profileAh);
139
160
  const pair = this._perspective.profiles.get(profileAh);
140
161
  if (pair) {
@@ -143,6 +164,7 @@ export class ProfilesAltZvm extends ZomeViewModelWithSignals {
143
164
  }
144
165
  /** */
145
166
  unstoreAgentProfile(agentId, profileAh) {
167
+ console.log("ProfilesAltZvm.unstoreAgentProfile()", agentId, profileAh);
146
168
  this._perspective.profileByAgent.delete(agentId);
147
169
  const pair = this._perspective.profiles.get(profileAh);
148
170
  if (pair) {
@@ -157,7 +179,7 @@ export class ProfilesAltZvm extends ZomeViewModelWithSignals {
157
179
  /** */
158
180
  async findProfile(agentId) {
159
181
  const maybeProfilePair = await this.zomeProxy.findProfile(agentId.hash);
160
- console.log("probeProfile() maybeProfilePair", maybeProfilePair);
182
+ console.log("findProfile() maybeProfilePair", maybeProfilePair);
161
183
  if (!maybeProfilePair) {
162
184
  return;
163
185
  }
@@ -179,6 +201,30 @@ export class ProfilesAltZvm extends ZomeViewModelWithSignals {
179
201
  async updateProfile(profile, agentId) {
180
202
  const _ah = await this.zomeProxy.updateProfile([profile, agentId.hash]);
181
203
  }
204
+ /** -- Import / Export -- */
205
+ /** Dump perspective as JSON */
206
+ exportPerspective() {
207
+ //console.log("exportPerspective()", perspMat);
208
+ const core = this._perspective; // FIXME: check if this actually works as expected
209
+ return JSON.stringify(core, null, 2);
210
+ }
211
+ /** */
212
+ async importPerspective(json, canPublish) {
213
+ const perspective = JSON.parse(json);
214
+ if (canPublish) {
215
+ for (const [agentId, [profile, _ts]] of perspective.profiles.entries()) {
216
+ await this.createProfile(profile, agentId);
217
+ }
218
+ return;
219
+ }
220
+ /** */
221
+ for (const [actionId, [profile, ts]] of perspective.profiles.entries()) {
222
+ this.storeProfile(actionId, profile, ts);
223
+ }
224
+ for (const [agentId, actionId] of perspective.profileByAgent.entries()) {
225
+ this.storeAgentProfile(agentId, actionId);
226
+ }
227
+ }
182
228
  }
183
229
  ProfilesAltZvm.ZOME_PROXY = ProfilesAltProxy;
184
230
  //# sourceMappingURL=profilesAlt.zvm.js.map
@@ -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;QA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G,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1E,CAAC;;AA7Me,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 {hashFrom32AndType, 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 getMyProfile(): Profile | undefined {\n const pair = this._perspective.profiles.get(this.cell.agentId)\n if (!pair) {\n return undefined;\n }\n return pair[0];\n }\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 getProfile(agent: AgentId): Profile | 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[0];\n\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\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 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 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 /** -- perspective -- */\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 /** -- Store -- */\n\n\n /** */\n storeProfile(profileAh: ActionId, profile: Profile, ts: Timestamp) {\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 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 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(\"probeProfile() 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"]}
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,8BAA8B,CAAC;AAE9D,OAAO,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAC,mBAAmB,EAAE,mBAAmB,EAAC,MAAM,kCAAkC,CAAC;AAmB1F,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;IAmOhF,CAAC;IA9PC,IAAI,SAAS,KAAsB,OAAO,IAAI,CAAC,UAA8B,CAAC,CAAA,CAAC;IAG/E,KAAK;IACK,UAAU;QAClB,OAAO;QACP,OAAO,IAAI,CA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C,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;;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 [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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ddd-qc/profiles-dvm",
3
- "version": "0.26.4",
3
+ "version": "0.26.6",
4
4
  "description": "DnaViewModel implementation for the Profiles zome.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -11,7 +11,8 @@
11
11
  "scripts": {
12
12
  "ci:tsc": "tsc --version",
13
13
  "lint" : "eslint --ext .ts .",
14
- "build" : "rm -rf dist && tsc"
14
+ "build" : "rm -rf dist && tsc",
15
+ "build:watch": "tsc -w --preserveWatchOutput"
15
16
  },
16
17
  "repository": {
17
18
  "type": "git",