@tearleads/client-sdk 0.1.214 → 0.1.216
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/data/persistence/container-contents/documentContainerProjectionPersistence.d.ts +32 -0
- package/data/persistence/container-contents/documentContainerProjectionPersistence.js +35 -28
- package/data/persistence/container-contents/documentContainerProjectionPersistence.js.map +1 -1
- package/data/persistence/container-contents/documentPlacement.d.ts +20 -0
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/workflows/container-contents/container-state/purge/purgeTree.js +2 -2
- package/workflows/container-contents/container-state/purge/purgeTree.js.map +1 -1
- package/workflows/container-contents/documentLinks/documentLinkIntent.js +4 -4
- package/workflows/container-contents/documentLinks/documentLinkIntent.js.map +1 -1
- package/workflows/container-contents/documentLinks/index.js +4 -11
- package/workflows/container-contents/documentLinks/index.js.map +1 -1
- package/workflows/container-contents/documentMove/documentMoveIntent.js +2 -3
- package/workflows/container-contents/documentMove/documentMoveIntent.js.map +1 -1
- package/workflows/container-contents/documentMove/documentMoveVanishedRefresh.js +2 -2
- package/workflows/container-contents/documentMove/documentMoveVanishedRefresh.js.map +1 -1
- package/workflows/container-contents/documentQueries/documentSubtreeQueries.js +3 -3
- package/workflows/container-contents/documentQueries/documentSubtreeQueries.js.map +1 -1
- package/workflows/container-contents/documentQueries/index.js +3 -3
- package/workflows/container-contents/documentQueries/index.js.map +1 -1
- package/workflows/container-contents/index.d.ts +1 -1
- package/workflows/container-contents/index.js +1 -1
- package/workflows/container-contents/index.js.map +1 -1
- package/workflows/container-contents/syncPause/discoveryGuard.js +2 -2
- package/workflows/container-contents/syncPause/discoveryGuard.js.map +1 -1
- package/workflows/container-contents/documentLinks/index.d.ts +0 -46
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,0BAA0B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L,uCAAuC,EACvC,2CAA2C,EAC3C,sCAAsC,GACvC,MAAM,WAAW,CAAC;AAKnB,OAAO,EACL,sCAAsC,EACtC,sCAAsC,GACvC,MAAM,aAAa,CAAC;AACrB,OAAO,EAEL,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,4BAA4B,CAAC","sourcesContent":["export { DocumentContainerProjectionRepository } from \"../../data/persistence/container-contents/documentContainerProjectionPersistence\";\nexport {\n didRegainSyncPrerequisites,\n isDatabaseUnavailableError,\n} from \"../../data/sync/syncCoordinator\";\nexport {\n type DocumentAttributionRangesInput,\n type DocumentAttributionRangesPage,\n loadDocumentAttributionRanges,\n} from \"./attribution/documentAttributionRanges\";\nexport {\n type ContainerSyncWatermarkLane,\n ContainerSyncWatermarkRepository,\n createContainerContentsSyncLane,\n createContainerParentSyncLane,\n defaultContainerContentsPersistence,\n} from \"./containerPersistence\";\nexport {\n type ContainerDocumentLinkInput,\n type ContainerDocumentQueries,\n type ContainerDocumentSidebarRow,\n type ContainerDocumentTombstone,\n type ContainerItemRow,\n type ContainerItemSort,\n type ContainerItemSortDirection,\n type ContainerItemSortKey,\n createContainerDocumentQueriesFromRuntime,\n} from \"./documentQueries\";\nexport {\n activateDocumentLink,\n addDocumentLink,\n canMutateDocumentLink,\n canMutateLocalDocumentLink,\n type DocumentStructuralMutationHost,\n type MergeDocumentSummary,\n moveDocumentLink,\n moveLocalDocumentLink,\n removeDocumentLink,\n type SetLinkedContainerIdsForDocument,\n} from \"./documentQueries/documentStructure\";\nexport type { PendingDownloadQueueItem } from \"./documentQueries/pendingDownloads\";\nexport {\n type BlobInfo,\n type BlobInfoAttachmentKind,\n type BlobInfoDocumentReference,\n type BlobInfoInput,\n type BlobInfoList,\n type BlobInfoSort,\n type BlobInfoSortDirection,\n type BlobInfoSortKey,\n listBlobInfo,\n} from \"./info/blobInfo\";\nexport {\n type ContainerInfo,\n type ContainerInfoGrant,\n type ContainerInfoGrantRow,\n type ContainerInfoPathEntry,\n type ContainerInfoRemoteMode,\n type ContainerInfoSecurityDetails,\n type ContainerShareAccessLevel,\n loadContainerInfo,\n} from \"./info/containerInfo\";\nexport {\n type DocumentInfo,\n type DocumentInfoAttachment,\n type DocumentInfoAuthorizingContainerPath,\n type DocumentInfoLocalDetails,\n type DocumentInfoRemoteAttachmentBinding,\n type DocumentInfoRemoteDetails,\n type DocumentInfoRemoteMode,\n loadDocumentInfo,\n} from \"./info/documentInfo\";\nexport {\n type ContainerMetadataPatch,\n hasContainerMetadataDocumentUpdateEvent,\n persistContainerMetadataStateFromRuntime,\n renameContainerMetadataStateFromRuntime,\n syncContainerMetadataState,\n} from \"./metadata\";\nexport {\n type ContainerMetadataDocument,\n createInitializedContainerMetadataDocument,\n getDefaultContainerName,\n readContainerMetadataValue,\n writeContainerMetadataValue,\n} from \"./metadata/containerMetadataDocument\";\nexport {\n listPendingWrites,\n type PendingWriteQueueItem,\n type PendingWriteQueueItemStatus,\n type PendingWriteQueueObjectKind,\n type PendingWriteQueueOperation,\n type PendingWriteQueueOperationKind,\n type PendingWriteQueueOperationStatus,\n} from \"./pendingWrites\";\nexport {\n type ContainerContentsProjectionUserKeyResolver,\n createContainerContentsDocumentProjectionUserKeyResolver,\n createContainerContentsProjectionUserKeyResolver,\n didContainerContentsProjectionKeyRuntimeChange,\n} from \"./projectionKeys\";\nexport type { RecoveryFolder } from \"./recovery/folderRecovery\";\nexport {\n type ContainerContentsRootAdopter,\n type ContainerContentsRootAdoptionInput,\n type ContainerContentsStoreWorkflowRuntime,\n type ContainerContentsWorkflowRuntime,\n type ContainerContentsWorkflowRuntimeAuth,\n type ContainerContentsWorkflowRuntimeCrypto,\n type ContainerContentsWorkflowRuntimeGroups,\n type ContainerContentsWorkflowRuntimeInfra,\n type ContainerContentsWorkflowRuntimeInput,\n type ContainerContentsWorkflowRuntimeInputGroups,\n type ContainerContentsWorkflowRuntimeState,\n type ContainerContentsWorkflowRuntimeUtil,\n createContainerContentsDocumentsRuntime,\n createContainerContentsStoreWorkflowRuntime,\n createContainerContentsWorkflowRuntime,\n} from \"./runtime\";\nexport type {\n ContainerDocumentObjectSyncState,\n ContainerDocumentObjectSyncStatus,\n} from \"./syncState\";\nexport {\n createContainerDocumentObjectSyncState,\n syncedContainerDocumentObjectSyncState,\n} from \"./syncState\";\nexport {\n type ContainerSystemSlotDefinition,\n deriveContainerSystemSlot,\n} from \"./systemSlot\";\nexport {\n purgeLocalContainerDocument,\n purgeRemoteContainerDocument,\n} from \"./tombstones/documentPurge\";\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ContainerSyncWatermarkRepository, containerContentsSyncLane, } from "../../../data/persistence/container-contents/containerSyncWatermarkPersistence.js";
|
|
2
|
-
import {
|
|
2
|
+
import { DocumentContainerProjectionRepository } from "../../../data/persistence/container-contents/documentContainerProjectionPersistence.js";
|
|
3
3
|
import { upsertDiscoveredDocuments } from "../../../data/persistence/documents/documentsPersistence.js";
|
|
4
4
|
import { runSerializedSqlMutation } from "../../../data/sqlite/sqlExec.js";
|
|
5
5
|
/**
|
|
@@ -15,7 +15,7 @@ export function guardDocumentDiscoveryWrites(input) {
|
|
|
15
15
|
? skipped
|
|
16
16
|
: write(lockedExecSql));
|
|
17
17
|
return {
|
|
18
|
-
replaceDocumentLinksBatch: (inputs, stillCurrent) => whileCurrent(undefined, (lockedExecSql) =>
|
|
18
|
+
replaceDocumentLinksBatch: (inputs, stillCurrent) => whileCurrent(undefined, (lockedExecSql) => new DocumentContainerProjectionRepository(lockedExecSql).replaceDocumentLinksBatch(inputs), stillCurrent),
|
|
19
19
|
saveContainerDocumentWatermark: (containerId, watermark, stillCurrent) => whileCurrent(undefined, async (lockedExecSql) => {
|
|
20
20
|
await new ContainerSyncWatermarkRepository(lockedExecSql).saveWatermark(containerContentsSyncLane(containerId), watermark);
|
|
21
21
|
}, stillCurrent),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discoveryGuard.js","sourceRoot":"","sources":["discoveryGuard.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,yBAAyB,GAC1B,MAAM,gFAAgF,CAAC;AACxF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"discoveryGuard.js","sourceRoot":"","sources":["discoveryGuard.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,yBAAyB,GAC1B,MAAM,gFAAgF,CAAC;AACxF,OAAO,EAAE,qCAAqC,EAAE,MAAM,qFAAqF,CAAC;AAC5I,OAAO,EAAE,yBAAyB,EAAE,MAAM,0DAA0D,CAAC;AACrG,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAYxE;;;;;;;GAOG;AACH,MAAM,UAAU,4BAA4B,CAAC,KAI5C;IACC,MAAM,YAAY,GAAG,CACnB,OAAU,EACV,KAA6C,EAC7C,YAAoC,EACxB,EAAE,CACd,wBAAwB,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,CAC9D,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,MAAM,YAAY,EAAE,CAAC;QACzC,CAAC,CAAC,OAAO;QACT,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CACzB,CAAC;IACJ,OAAO;QACL,yBAAyB,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,CAClD,YAAY,CACV,SAAS,EACT,CAAC,aAAa,EAAE,EAAE,CAChB,IAAI,qCAAqC,CACvC,aAAa,CACd,CAAC,yBAAyB,CAAC,MAAM,CAAC,EACrC,YAAY,CACb;QACH,8BAA8B,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,CACvE,YAAY,CACV,SAAS,EACT,KAAK,EAAE,aAAa,EAAE,EAAE;YACtB,MAAM,IAAI,gCAAgC,CACxC,aAAa,CACd,CAAC,aAAa,CAAC,yBAAyB,CAAC,WAAW,CAAC,EAAE,SAAS,CAAC,CAAC;QACrE,CAAC,EACD,YAAY,CACb;QACH,yBAAyB,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,CAClD,YAAY,CACV,EAAE,EACF,CAAC,aAAa,EAAE,EAAE,CAAC,yBAAyB,CAAC,aAAa,EAAE,MAAM,CAAC,EACnE,YAAY,CACb;QACH,KAAK,CAAC,yBAAyB,CAAC,GAAG,IAAI;YACrC,MAAM,YAAY,GAAG,MAAM,KAAK,CAAC,yBAAyB,CAAC,GAAG,IAAI,CAAC,CAAC;YACpE,OAAO;gBACL,GAAG,YAAY;gBACf,SAAS,EAAE,KAAK,IAAI,EAAE,CACpB,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,YAAY,CAAC,SAAS,EAAE,CAAC;aACxD,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import {\n ContainerSyncWatermarkRepository,\n containerContentsSyncLane,\n} from \"../../../data/persistence/container-contents/containerSyncWatermarkPersistence\";\nimport { DocumentContainerProjectionRepository } from \"../../../data/persistence/container-contents/documentContainerProjectionPersistence\";\nimport { upsertDiscoveredDocuments } from \"../../../data/persistence/documents/documentsPersistence\";\nimport { runSerializedSqlMutation } from \"../../../data/sqlite/sqlExec\";\nimport type { ExecSql } from \"../../../data/sqlite/sqlSchema\";\nimport type { DiscoverContainerDocumentsOptions } from \"../documentDiscovery/documentDiscoveryTypes\";\n\ntype PauseGuardedDiscovery = Pick<\n DiscoverContainerDocumentsOptions,\n | \"replaceDocumentLinksBatch\"\n | \"saveContainerDocumentWatermark\"\n | \"upsertDiscoveredDocuments\"\n | \"verifyDiscoveredDocuments\"\n>;\n\n/**\n * Binds a discovery lane's writes to its generation and its organization staying\n * unpaused. Access changes and pauses invalidate in-flight listings, so the\n * apply stops at its next check. Each write already started rechecks under\n * the SQLite mutation lock held by the reset or pause cleanup. A stale listing therefore never restores documents, links, or the\n * watermark the cleanup removed; a watermark saved after the cleanup would\n * otherwise make the listing after a resume skip every unchanged document.\n */\nexport function guardDocumentDiscoveryWrites(input: {\n readonly execSql: ExecSql;\n readonly isPaused: () => boolean;\n readonly verifyDiscoveredDocuments: DiscoverContainerDocumentsOptions[\"verifyDiscoveredDocuments\"];\n}): PauseGuardedDiscovery {\n const whileCurrent = <T>(\n skipped: T,\n write: (lockedExecSql: ExecSql) => Promise<T>,\n stillCurrent: () => Promise<boolean>,\n ): Promise<T> =>\n runSerializedSqlMutation(input.execSql, async (lockedExecSql) =>\n input.isPaused() || !(await stillCurrent())\n ? skipped\n : write(lockedExecSql),\n );\n return {\n replaceDocumentLinksBatch: (inputs, stillCurrent) =>\n whileCurrent(\n undefined,\n (lockedExecSql) =>\n new DocumentContainerProjectionRepository(\n lockedExecSql,\n ).replaceDocumentLinksBatch(inputs),\n stillCurrent,\n ),\n saveContainerDocumentWatermark: (containerId, watermark, stillCurrent) =>\n whileCurrent(\n undefined,\n async (lockedExecSql) => {\n await new ContainerSyncWatermarkRepository(\n lockedExecSql,\n ).saveWatermark(containerContentsSyncLane(containerId), watermark);\n },\n stillCurrent,\n ),\n upsertDiscoveredDocuments: (inputs, stillCurrent) =>\n whileCurrent(\n [],\n (lockedExecSql) => upsertDiscoveredDocuments(lockedExecSql, inputs),\n stillCurrent,\n ),\n async verifyDiscoveredDocuments(...args) {\n const verification = await input.verifyDiscoveredDocuments(...args);\n return {\n ...verification,\n isCurrent: async () =>\n !input.isPaused() && (await verification.isCurrent()),\n };\n },\n };\n}\n"]}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { ProjectionUserKeyResolver } from "../../../data/keyingProjectionVerification/index.js";
|
|
2
|
-
import type { ExecSql } from "../../../data/sqlite/sqlSchema.js";
|
|
3
|
-
import { type DocumentLinkSetFailureHandler, type LinkSetAttachmentReuse, type RelinkRemoteDocumentResult, RemoteDocumentService, type RemoteDocumentServiceApi } from "../../documents/index.js";
|
|
4
|
-
import type { SubtreePurgeRoot } from "../../documents/purge/subtreePurgeScope.js";
|
|
5
|
-
import { type PrincipalPolicyOperation } from "../../principals/runtimePolicyWarmer.js";
|
|
6
|
-
import type { ContainerContentsWorkflowRuntime } from "../runtime.js";
|
|
7
|
-
export type ContainerDocumentLinkApi = RemoteDocumentServiceApi;
|
|
8
|
-
type ContainerDocumentLinkOperation = Parameters<RemoteDocumentService["relinkRemoteDocument"]>[0]["operation"];
|
|
9
|
-
type RemoteDocumentPersistedState = RelinkRemoteDocumentResult["persistedState"];
|
|
10
|
-
export interface ContainerDocumentLinkRuntime extends Pick<ContainerContentsWorkflowRuntime, "auth" | "crypto" | "infra" | "resolveTrustedUserIdentity" | "state" | "util"> {
|
|
11
|
-
apiClient: ContainerDocumentLinkApi & Pick<ContainerContentsWorkflowRuntime["apiClient"], "getPrincipalPolicyPages" | "getProjectionPolicyHistoryPages">;
|
|
12
|
-
}
|
|
13
|
-
export type { RemoteDocumentPersistedState };
|
|
14
|
-
export declare function initializeDocumentLinksSchema(execSql: ExecSql): Promise<void>;
|
|
15
|
-
export declare function listDocumentLinkedContainerIds(execSql: ExecSql, documentId: string): Promise<ReadonlyArray<string>>;
|
|
16
|
-
export declare function replaceDocumentLinks(execSql: ExecSql, documentId: string, containerIds: ReadonlyArray<string>): Promise<void>;
|
|
17
|
-
export declare function relinkRemoteContainerDocument(input: {
|
|
18
|
-
attachmentReuse?: LinkSetAttachmentReuse | undefined;
|
|
19
|
-
beforeSubmit?: (() => Promise<boolean>) | undefined;
|
|
20
|
-
documentId: string;
|
|
21
|
-
expectedSubtreeRoot?: SubtreePurgeRoot | undefined;
|
|
22
|
-
isCurrent?: (() => boolean) | undefined;
|
|
23
|
-
noteId: string;
|
|
24
|
-
onFailure?: DocumentLinkSetFailureHandler | undefined;
|
|
25
|
-
operation: ContainerDocumentLinkOperation;
|
|
26
|
-
/** A workflow root's token; each leg otherwise discovers on its own. */
|
|
27
|
-
policyOperation?: PrincipalPolicyOperation | undefined;
|
|
28
|
-
resolveProjectionUserKey: ProjectionUserKeyResolver;
|
|
29
|
-
rotationSnapshot?: Uint8Array | undefined;
|
|
30
|
-
runtime: ContainerDocumentLinkRuntime;
|
|
31
|
-
targetContainerId: string;
|
|
32
|
-
}): Promise<RelinkRemoteDocumentResult | null>;
|
|
33
|
-
export declare function unlinkRemoteContainerDocument(input: {
|
|
34
|
-
attachmentReuse?: LinkSetAttachmentReuse | undefined;
|
|
35
|
-
beforeSubmit?: (() => Promise<boolean>) | undefined;
|
|
36
|
-
documentId: string;
|
|
37
|
-
expectedSubtreeRoot?: SubtreePurgeRoot | undefined;
|
|
38
|
-
isCurrent?: (() => boolean) | undefined;
|
|
39
|
-
noteId: string;
|
|
40
|
-
onFailure?: DocumentLinkSetFailureHandler | undefined;
|
|
41
|
-
policyOperation?: PrincipalPolicyOperation | undefined;
|
|
42
|
-
resolveProjectionUserKey: ProjectionUserKeyResolver;
|
|
43
|
-
rotationSnapshot: Uint8Array;
|
|
44
|
-
runtime: ContainerDocumentLinkRuntime;
|
|
45
|
-
targetContainerId: string;
|
|
46
|
-
}): Promise<RelinkRemoteDocumentResult | null>;
|