@medicine-wheel/storage-provider 0.15.4 → 0.15.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.
@@ -320,6 +320,8 @@ export interface StorageProvider {
320
320
  getAllCeremonies(limit?: number): Promise<CeremonyLog[]>;
321
321
  /** Cardinality of the whole ceremony collection — see `countNodes()`. */
322
322
  countCeremonies(): Promise<number>;
323
+ /** Removes one ceremony record. The route refuses while a closing, a beat or a diary entry names it. */
324
+ deleteCeremony(id: string): Promise<void>;
323
325
  registerInquiryWeave(record: WeaveRecord): Promise<void>;
324
326
  getInquiryWeave(id: string): Promise<WeaveRecord | null>;
325
327
  listInquiryWeaves(filters?: InquiryWeaveFilters): Promise<WeaveRecord[]>;
package/dist/jsonl.d.ts CHANGED
@@ -36,6 +36,7 @@ export declare class JsonlProvider implements StorageProvider {
36
36
  getCeremoniesByType(type: CeremonyType): Promise<CeremonyLog[]>;
37
37
  getAllCeremonies(limit?: number): Promise<CeremonyLog[]>;
38
38
  countCeremonies(): Promise<number>;
39
+ deleteCeremony(id: string): Promise<void>;
39
40
  registerInquiryWeave(record: WeaveRecord): Promise<void>;
40
41
  getInquiryWeave(id: string): Promise<WeaveRecord | null>;
41
42
  listInquiryWeaves(filters?: InquiryWeaveFilters): Promise<WeaveRecord[]>;
package/dist/jsonl.js CHANGED
@@ -208,6 +208,11 @@ export class JsonlProvider {
208
208
  async countCeremonies() {
209
209
  return countJsonl(this.ceremoniesFile);
210
210
  }
211
+ async deleteCeremony(id) {
212
+ await withWriteLock(this.ceremoniesFile, () => {
213
+ writeJsonl(this.ceremoniesFile, this.readCeremonies().filter((record) => record.id !== id));
214
+ });
215
+ }
211
216
  async registerInquiryWeave(record) {
212
217
  await this.upsertById(this.inquiryWeavesFile, record);
213
218
  }
@@ -381,6 +386,9 @@ export class JsonlProvider {
381
386
  ...(typeof extra.circle_id === 'string'
382
387
  ? { circle_id: extra.circle_id }
383
388
  : {}),
389
+ ...(typeof extra.subject_id === 'string'
390
+ ? { subject_id: extra.subject_id }
391
+ : {}),
384
392
  };
385
393
  }
386
394
  }
package/dist/neon.d.ts CHANGED
@@ -46,6 +46,7 @@ export declare class NeonProvider implements StorageProvider {
46
46
  registerDiaryEntry(record: DiaryEntryRecord): Promise<DiaryEntryRecord>;
47
47
  getDiaryEntry(id: string): Promise<DiaryEntryRecord | null>;
48
48
  listDiaryEntries(filters?: DiaryEntryFilters): Promise<DiaryEntryRecord[]>;
49
+ deleteCeremony(id: string): Promise<void>;
49
50
  deleteDiaryEntry(id: string): Promise<void>;
50
51
  private ensureDiaryEntriesTable;
51
52
  registerCeremonyEvent(record: CeremonyEventRecord): Promise<CeremonyEventRecord>;
package/dist/neon.js CHANGED
@@ -215,13 +215,13 @@ export class NeonProvider {
215
215
  async logCeremony(ceremony) {
216
216
  await this.db `
217
217
  INSERT INTO ceremonies (id, type, direction, participants, medicines_used, intentions, timestamp, research_context,
218
- relations_honored, episode_path, episode_number, source, closes, circle_id)
218
+ relations_honored, episode_path, episode_number, source, closes, circle_id, subject_id)
219
219
  VALUES (${ceremony.id}, ${ceremony.type}, ${ceremony.direction},
220
220
  ${JSON.stringify(ceremony.participants)}, ${JSON.stringify(ceremony.medicines_used)},
221
221
  ${JSON.stringify(ceremony.intentions)}, ${ceremony.timestamp}, ${ceremony.research_context || null},
222
222
  ${ceremony.relations_honored ? JSON.stringify(ceremony.relations_honored) : null},
223
223
  ${ceremony.episode_path ?? null}, ${ceremony.episode_number ?? null}, ${ceremony.source ?? null},
224
- ${ceremony.closes ?? null}, ${ceremony.circle_id ?? null})
224
+ ${ceremony.closes ?? null}, ${ceremony.circle_id ?? null}, ${ceremony.subject_id ?? null})
225
225
  ON CONFLICT (id) DO UPDATE SET
226
226
  type = EXCLUDED.type,
227
227
  direction = EXCLUDED.direction,
@@ -235,7 +235,8 @@ export class NeonProvider {
235
235
  episode_number = EXCLUDED.episode_number,
236
236
  source = EXCLUDED.source,
237
237
  closes = EXCLUDED.closes,
238
- circle_id = EXCLUDED.circle_id
238
+ circle_id = EXCLUDED.circle_id,
239
+ subject_id = EXCLUDED.subject_id
239
240
  `;
240
241
  }
241
242
  async getCeremony(id) {
@@ -279,6 +280,7 @@ export class NeonProvider {
279
280
  ...(typeof row.source === 'string' && row.source ? { source: row.source } : {}),
280
281
  ...(typeof row.closes === 'string' && row.closes ? { closes: row.closes } : {}),
281
282
  ...(typeof row.circle_id === 'string' && row.circle_id ? { circle_id: row.circle_id } : {}),
283
+ ...(typeof row.subject_id === 'string' && row.subject_id ? { subject_id: row.subject_id } : {}),
282
284
  };
283
285
  }
284
286
  // ── Inquiry Weave Operations ──
@@ -438,6 +440,9 @@ export class NeonProvider {
438
440
  .filter((record) => record !== null);
439
441
  return filterAndOrderDiaryEntries(records, filters);
440
442
  }
443
+ async deleteCeremony(id) {
444
+ await this.db `DELETE FROM ceremonies WHERE id = ${id}`;
445
+ }
441
446
  async deleteDiaryEntry(id) {
442
447
  await this.db `DELETE FROM diary_entries WHERE id = ${id}`;
443
448
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medicine-wheel/storage-provider",
3
- "version": "0.15.4",
3
+ "version": "0.15.6",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -16,7 +16,7 @@
16
16
  "dependencies": {
17
17
  "@neondatabase/serverless": "^0.10.0",
18
18
  "@upstash/redis": "^1.34.3",
19
- "@medicine-wheel/ontology-core": "^0.15.4"
19
+ "@medicine-wheel/ontology-core": "^0.15.6"
20
20
  },
21
21
  "devDependencies": {
22
22
  "typescript": "^5.7.0"