@inixiative/archive 0.12.0 → 0.12.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inixiative/archive",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/index.ts",
package/src/client.ts CHANGED
@@ -6,6 +6,7 @@ import {
6
6
  destinationToken,
7
7
  destinationUrl,
8
8
  } from './config';
9
+ import type { RoutingPreview, SyncResult } from './remote';
9
10
  import type { ArchiveStore } from './store';
10
11
 
11
12
  export { type ArchiveDestination, archiveDestinationSchema } from './config';
@@ -106,7 +107,10 @@ export async function publishArchive(
106
107
  throw new Error('Archive changed repeatedly during publication; retry sync');
107
108
  }
108
109
 
109
- export async function routingPreview(store: ArchiveStore, destinations: ArchiveDestination[]) {
110
+ export async function routingPreview(
111
+ store: ArchiveStore,
112
+ destinations: ArchiveDestination[],
113
+ ): Promise<RoutingPreview> {
110
114
  return (await store.list()).map((archive) => ({
111
115
  id: archive.id,
112
116
  projectId: archive.projectId,
@@ -122,8 +126,11 @@ export async function routingPreview(store: ArchiveStore, destinations: ArchiveD
122
126
  }));
123
127
  }
124
128
 
125
- export async function syncArchives(store: ArchiveStore, destinations: ArchiveDestination[]) {
126
- const results: { id: string; destination: string; status: string }[] = [];
129
+ export async function syncArchives(
130
+ store: ArchiveStore,
131
+ destinations: ArchiveDestination[],
132
+ ): Promise<SyncResult[]> {
133
+ const results: SyncResult[] = [];
127
134
  for (const archive of await store.list())
128
135
  for (const destination of destinations.filter((d) => d.projectId === archive.projectId)) {
129
136
  try {
package/src/remote.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  import { existsSync, readFileSync } from 'node:fs';
2
2
  import { join } from 'node:path';
3
3
  import { defaultHome } from './agents';
4
- import type { routingPreview, syncArchives } from './client';
5
- import type { DescribedDestination } from './config';
4
+ import type { ArchiveDestination, DescribedDestination } from './config';
6
5
  import type { ArchiveChunk, ArchiveSnapshot } from './index';
7
6
  import { archiveKey, archiveSnapshotSchema } from './index';
8
7
  import type { ArchiveFilter, ArchiveSettings, TagDefinition } from './schemas';
@@ -23,8 +22,16 @@ export type DestinationStatus = DescribedDestination & { delivered: number; pend
23
22
  /** A hosted Archive library a held Signet may write to. */
24
23
  export type ArchiveLibrary = { integrationId: string; resourceId: string; name: string };
25
24
  export type ArchiveLibraries = { paired: boolean; libraries: ArchiveLibrary[] };
26
- export type RoutingPreview = Awaited<ReturnType<typeof routingPreview>>;
27
- export type SyncResult = Awaited<ReturnType<typeof syncArchives>>[number];
25
+ export type RoutedDestination = Pick<ArchiveDestination, 'kind' | 'url'> & {
26
+ integrationId?: string;
27
+ };
28
+ export type RoutingPreview = (Pick<
29
+ ArchiveListing,
30
+ 'id' | 'projectId' | 'tags' | 'suggestedTags'
31
+ > & {
32
+ destinations: RoutedDestination[];
33
+ })[];
34
+ export type SyncResult = { id: string; destination: string; status: string };
28
35
  /** A project routed to a hosted Archive library through Kingdom. */
29
36
  export type KingdomRoute = { projectId: string; integrationId: string; resourceId: string };
30
37