@docstack/client 0.1.8 → 0.2.0

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.
@@ -0,0 +1,26 @@
1
+ import Class from "../class.js";
2
+ import type ClientStack from "../stack.js";
3
+ import { TransactionStage, StagedEntry } from "./stage.js";
4
+ /**
5
+ * Resolves a class from the transaction's own stage: the ADR-0043 rule
6
+ * (the batch outranks the store - it is what is about to be committed) applied to
7
+ * staging. A patch chain's job can create documents of a class an earlier patch
8
+ * staged (ADR-0044), and the sweep must judge them by that staged model, not by a
9
+ * committed predecessor or a not-found. Built DETACHED - `Class.get` + `setModel`,
10
+ * never `buildFromModel`, which writes rev-less models (ADR-0043).
11
+ */
12
+ export declare const classFromStage: (stack: ClientStack, stage: TransactionStage, className: string) => Class | null;
13
+ /**
14
+ * The validation sweep - the transaction's atomicity boundary in practice.
15
+ *
16
+ * Runs read-only checks against public stack APIs: it decides whether a document
17
+ * *could* be written, and touches nothing. Stage time runs it so a bad write fails at
18
+ * the call site with zero consequences; commit re-runs it so the batch is judged
19
+ * against the world as it stands at commit. The commit-time pipeline (the plugin's
20
+ * `bulkDocs`) remains the sole authority - this sweep is a deliberate subset, and a
21
+ * document it passes can still be refused there, atomically for the whole batch.
22
+ */
23
+ export declare const sweepEntry: (stack: ClientStack, stage: TransactionStage, entry: StagedEntry, options?: {
24
+ allowClassModels?: boolean;
25
+ skipPolicy?: boolean;
26
+ }) => Promise<void>;
package/lib/index.d.ts CHANGED
@@ -18,9 +18,19 @@ export type { SchedulerOptions, SchedulerHost, JobScheduleState, TickReport, Ski
18
18
  * application hands over, so DocStack never learns about Google Drive, Firestore or
19
19
  * anything else, and no consumer pays for a transport it does not use.
20
20
  */
21
- export { StackSyncHandle, DocStackSyncHandle, SyncSchemaMismatchError, SYNC_META_DOC_ID, readRemoteSchemaVersion, publishSchemaVersion, createReplicationFilter, isInternalDoc, resolveInternalClasses, createClassFilter, hasClassRules, DATA_MODEL_CLASSES, withFilterIdentity, describeFilter, INTERNAL_DOC_IDS, INTERNAL_DOC_ID_PREFIXES, INTERNAL_DOC_CLASSES, OPTIONAL_INTERNAL_DOC_CLASSES, StackWriteGuardError, StackLockedError, deriveKeyId, isEncryptedPayload, deriveTenantScope, classTenants, } from "./core/index.js";
21
+ export { StackSyncHandle, DocStackSyncHandle, SyncSchemaMismatchError, SYNC_META_DOC_ID, readRemoteSchemaVersion, readRemoteConsumerSchemaVersion, publishSchemaVersion, createReplicationFilter, isInternalDoc, resolveInternalClasses, createClassFilter, hasClassRules, DATA_MODEL_CLASSES, withFilterIdentity, describeFilter, INTERNAL_DOC_IDS, INTERNAL_DOC_ID_PREFIXES, INTERNAL_DOC_CLASSES, OPTIONAL_INTERNAL_DOC_CLASSES, StackWriteGuardError, StackLockedError, deriveKeyId, isEncryptedPayload, deriveTenantScope, classTenants, } from "./core/index.js";
22
22
  export { SYSTEM_SEEDED_DOC_IDS, collectQueryClasses } from "./core/index.js";
23
23
  export type { EncryptedPayload, ClassBuildOptions } from "./core/index.js";
24
+ /**
25
+ * Named write transactions (ADR-0039).
26
+ *
27
+ * Opt-in per stack via `transactions: true`. A handle stages validated writes in
28
+ * memory and reads its own staged state overlaid on committed state; `commit`
29
+ * flushes the journal as one batch through the full authoring pipeline, and the
30
+ * report states the storage adapter's honest atomicity guarantee.
31
+ */
32
+ export { TransactionEngine, TransactionHandle, TransactionDb, TransactionsDisabledError, TransactionStateError, TransactionValidationError, TransactionConflictError, TransactionUnsupportedDocError, } from "./core/index.js";
33
+ export type { TransactionCommitReport, TransactionStatus } from "./core/index.js";
24
34
  /**
25
35
  * Moving application content between stacks, without the datamodel that describes it.
26
36
  */
@@ -37,5 +47,5 @@ export type { SyncDirection, SyncState, SyncStatus, StackSyncOptions, DocStackSy
37
47
  * Note that `Document` shadows the DOM's global `Document` in whichever module imports
38
48
  * it; alias it (`import type { Document as DocStackDocument }`) in code that needs both.
39
49
  */
40
- export type { AttributeType, AttributeTypeConfig, AttributeModel, ClassModel, DomainModel, TriggerModel, Document, RelationDocument, Patch, SelectAST, UnionAST, ClientCredentials, DocstackReady, StackConfig, StackOptions, } from "@docstack/shared";
50
+ export type { AttributeType, AttributeTypeConfig, AttributeModel, ClassModel, DomainModel, TriggerModel, Document, RelationDocument, Patch, PatchJob, SelectAST, UnionAST, ClientCredentials, DocstackReady, StackConfig, StackOptions, } from "@docstack/shared";
41
51
  export default DocStack;