Browse Source

chore: a bit more planning

pull/188/head
Matthew Raymer 3 weeks ago
parent
commit
649786ae01
  1. 182
      doc/activeDid-migration-plan.md

182
doc/activeDid-migration-plan.md

@ -408,16 +408,198 @@ async $accountSettings(did?: string, defaults: Settings = {}): Promise<Settings>
- **Impact**: Fallback logic needs to check new table - **Impact**: Fallback logic needs to check new table
- **Risk**: **MEDIUM** - Invite processing component - **Risk**: **MEDIUM** - Invite processing component
**Current Implementation:**
```vue
<script lang="ts">
export default class InviteOneAcceptView extends Vue {
activeDid = ""; // Component data
async mounted() {
// Load or generate identity
const settings = await this.$accountSettings();
this.activeDid = settings.activeDid || "";
// Identity creation should be handled by router guard, but keep as fallback for deep links
if (!this.activeDid) {
logger.info(
"[InviteOneAcceptView] No active DID found, creating identity as fallback",
);
this.activeDid = await generateSaveAndActivateIdentity();
}
// ... rest of initialization
}
}
</script>
```
**Required Changes:**
```vue
<script lang="ts">
export default class InviteOneAcceptView extends Vue {
activeDid = ""; // Component data still needed
async mounted() {
// This will automatically work if $accountSettings() is updated
const settings = await this.$accountSettings();
this.activeDid = settings.activeDid || "";
// Fallback logic remains the same - the API layer handles the new table
if (!this.activeDid) {
logger.info(
"[InviteOneAcceptView] No active DID found, creating identity as fallback",
);
this.activeDid = await generateSaveAndActivateIdentity();
}
// ... rest of initialization
}
}
</script>
```
**Key Insight**: This component will work automatically since it uses
`$accountSettings()`. The fallback logic doesn't need changes.
2. **`ClaimView.vue`** - Settings retrieval 2. **`ClaimView.vue`** - Settings retrieval
- **Current**: Gets `activeDid` from `$accountSettings()` - **Current**: Gets `activeDid` from `$accountSettings()`
- **Impact**: Will automatically work if API is updated - **Impact**: Will automatically work if API is updated
- **Risk**: **LOW** - Depends on API layer updates - **Risk**: **LOW** - Depends on API layer updates
**Current Implementation:**
```vue
<script lang="ts">
export default class ClaimView extends Vue {
activeDid = ""; // Component data
async created() {
const settings = await this.$accountSettings();
this.activeDid = settings.activeDid || "";
this.apiServer = settings.apiServer || "";
// ... rest of initialization
}
// Helper method that uses activeDid
didInfo(did: string): string {
return serverUtil.didInfo(
did,
this.activeDid, // Uses component data
this.allMyDids,
this.allContacts,
);
}
}
</script>
```
**Required Changes:**
```vue
<script lang="ts">
export default class ClaimView extends Vue {
activeDid = ""; // Component data still needed
async created() {
// This will automatically work if $accountSettings() is updated
const settings = await this.$accountSettings();
this.activeDid = settings.activeDid || "";
this.apiServer = settings.apiServer || "";
// ... rest of initialization
}
// No changes needed - method will work automatically
didInfo(did: string): string {
return serverUtil.didInfo(
did,
this.activeDid, // Uses component data
this.allMyDids,
this.allContacts,
);
}
}
</script>
```
**Key Insight**: This component requires zero changes since it already
uses the proper API method. It's the lowest risk component.
3. **`ContactAmountsView.vue`** - Direct settings access 3. **`ContactAmountsView.vue`** - Direct settings access
- **Current**: Accesses `activeDid` directly from settings - **Current**: Accesses `activeDid` directly from settings
- **Impact**: Must update to use new API methods - **Impact**: Must update to use new API methods
- **Risk**: **MEDIUM** - Financial display component - **Risk**: **MEDIUM** - Financial display component
**Current Implementation:**
```vue
<script lang="ts">
export default class ContactAmountsView extends Vue {
activeDid = ""; // Component data
async created() {
try {
const contactDid = this.$route.query["contactDid"] as string;
const contact = await this.$getContact(contactDid);
this.contact = contact;
// Direct access to settings table - this needs to change
const settings = await this.$getSettings(MASTER_SETTINGS_KEY);
this.activeDid = settings?.activeDid || "";
if (this.activeDid && this.contact) {
this.loadGives(this.activeDid, this.contact);
}
} catch (err: any) {
// ... error handling
}
}
async loadGives(activeDid: string, contact: Contact) {
// Uses activeDid parameter
// ... implementation
}
}
</script>
```
**Required Changes:**
```vue
<script lang="ts">
export default class ContactAmountsView extends Vue {
activeDid = ""; // Component data still needed
async created() {
try {
const contactDid = this.$route.query["contactDid"] as string;
const contact = await this.$getContact(contactDid);
this.contact = contact;
// Use the proper API method instead of direct settings access
const settings = await this.$accountSettings();
this.activeDid = settings.activeDid || "";
if (this.activeDid && this.contact) {
this.loadGives(this.activeDid, this.contact);
}
} catch (err: any) {
// ... error handling
}
}
// No changes needed - method will work automatically
async loadGives(activeDid: string, contact: Contact) {
// Uses activeDid parameter
// ... implementation
}
}
</script>
```
**Key Insight**: This component needs one specific change - replace
`$getSettings(MASTER_SETTINGS_KEY)` with `$accountSettings()`. The
rest of the component works automatically.
### **Service Layer Impact** ### **Service Layer Impact**
1. **`WebPlatformService.ts`** 1. **`WebPlatformService.ts`**

Loading…
Cancel
Save