@powerhousedao/shared 6.1.0-dev.15 → 6.1.0-dev.17
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/dist/analytics/index.d.ts +1 -1
- package/dist/clis/args/access-token.mjs +1 -1
- package/dist/clis/args/{common-BQ2pvhCr.d.mts → common-DxMY8vx1.d.mts} +3 -3
- package/dist/clis/args/{common-BQ2pvhCr.d.mts.map → common-DxMY8vx1.d.mts.map} +1 -1
- package/dist/clis/args/{common-DPYlcz-d.mjs → common-fPNESurz.mjs} +4 -9
- package/dist/clis/args/{common-DPYlcz-d.mjs.map → common-fPNESurz.mjs.map} +1 -1
- package/dist/clis/args/common.d.mts +1 -1
- package/dist/clis/args/common.mjs +1 -1
- package/dist/clis/args/connect.d.mts +222 -16
- package/dist/clis/args/connect.d.mts.map +1 -1
- package/dist/clis/args/connect.mjs +138 -4
- package/dist/clis/args/connect.mjs.map +1 -1
- package/dist/clis/args/{generate-BJPBa0mK.mjs → generate-CTTdiwMD.mjs} +2 -2
- package/dist/clis/args/{generate-BJPBa0mK.mjs.map → generate-CTTdiwMD.mjs.map} +1 -1
- package/dist/clis/args/generate.mjs +1 -1
- package/dist/clis/args/{help-rztSuf9S.mjs → help-CfBzQJpL.mjs} +3 -3
- package/dist/clis/args/{help-rztSuf9S.mjs.map → help-CfBzQJpL.mjs.map} +1 -1
- package/dist/clis/args/help.mjs +1 -1
- package/dist/clis/args/index.d.mts +4 -4
- package/dist/clis/args/index.mjs +5 -5
- package/dist/clis/args/init.mjs +1 -1
- package/dist/clis/args/inspect.mjs +1 -1
- package/dist/clis/args/install.mjs +1 -1
- package/dist/clis/args/list.mjs +1 -1
- package/dist/clis/args/login.mjs +1 -1
- package/dist/clis/args/migrate.mjs +1 -1
- package/dist/clis/args/publish.mjs +1 -1
- package/dist/clis/args/registry.mjs +1 -1
- package/dist/clis/args/{service-C2ZiQIg6.d.mts → service-DbbCQSks.d.mts} +2 -2
- package/dist/clis/args/service-DbbCQSks.d.mts.map +1 -0
- package/dist/clis/args/service.d.mts +1 -1
- package/dist/clis/args/service.mjs +1 -1
- package/dist/clis/args/switchboard.mjs +1 -1
- package/dist/clis/args/uninstall.mjs +1 -1
- package/dist/clis/args/unpublish.mjs +1 -1
- package/dist/clis/args/vetra.d.mts +1 -1
- package/dist/clis/args/vetra.mjs +1 -1
- package/dist/clis/constants.d.mts +53 -1
- package/dist/clis/constants.d.mts.map +1 -1
- package/dist/clis/index.d.mts +680 -20
- package/dist/clis/index.d.mts.map +1 -1
- package/dist/clis/index.mjs +527 -10
- package/dist/clis/index.mjs.map +1 -1
- package/dist/config-loader-BPXmnFbm.js +141 -0
- package/dist/config-loader-BPXmnFbm.js.map +1 -0
- package/dist/connect/config-loader.d.ts +78 -0
- package/dist/connect/config-loader.d.ts.map +1 -0
- package/dist/connect/config-loader.js +2 -0
- package/dist/connect/index.d.ts +282 -257
- package/dist/connect/index.d.ts.map +1 -1
- package/dist/connect/index.js +251 -106
- package/dist/connect/index.js.map +1 -1
- package/dist/connect/json-adapter.d.ts +24 -0
- package/dist/connect/json-adapter.d.ts.map +1 -0
- package/dist/connect/json-adapter.js +28 -0
- package/dist/connect/json-adapter.js.map +1 -0
- package/dist/{constants-xNwF0jSl.d.ts → constants-C_EQX4DY.d.ts} +1 -1
- package/dist/constants-C_EQX4DY.d.ts.map +1 -0
- package/dist/constants.d.ts +1 -1
- package/dist/document-drive/index.d.ts +2 -2
- package/dist/document-drive/index.d.ts.map +1 -1
- package/dist/document-model/index.d.ts +4 -4
- package/dist/document-model/index.js +1 -1
- package/dist/document-model/mock.d.ts +1 -1
- package/dist/document-model/utils.d.ts +2 -2
- package/dist/document-model/utils.js +1 -1
- package/dist/{index-C_iVZe7f.d.ts → index-CQDIrK1k.d.ts} +1 -1
- package/dist/index-CQDIrK1k.d.ts.map +1 -0
- package/dist/{index-C2dRwmuW.d.ts → index-DalC_-i7.d.ts} +2 -2
- package/dist/{index-C2dRwmuW.d.ts.map → index-DalC_-i7.d.ts.map} +1 -1
- package/dist/index.d.ts +7 -6
- package/dist/{mock-Cgn-VBF_.d.ts → mock-CbrXTFOF.d.ts} +1 -1
- package/dist/{mock-Cgn-VBF_.d.ts.map → mock-CbrXTFOF.d.ts.map} +1 -1
- package/dist/processors/index.d.ts +1 -1
- package/dist/registry/index.d.ts +2 -1
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/{types-BFDlQkXZ.d.ts → types-C1in4fl3.d.ts} +1 -1
- package/dist/{types-BFDlQkXZ.d.ts.map → types-C1in4fl3.d.ts.map} +1 -1
- package/dist/{actions-BqyQ1_K7.d.ts → types-CC6ib3_2.d.ts} +1327 -1327
- package/dist/types-CC6ib3_2.d.ts.map +1 -0
- package/dist/{types-DA_0pilk.d.ts → types-CVqmv94G.d.ts} +3 -109
- package/dist/types-CVqmv94G.d.ts.map +1 -0
- package/dist/types-DgDE_nr0.d.ts +159 -0
- package/dist/types-DgDE_nr0.d.ts.map +1 -0
- package/dist/{utils-CJF4w5Bp.d.ts → utils-BEByNOHo.d.ts} +1 -1
- package/dist/utils-BEByNOHo.d.ts.map +1 -0
- package/dist/{utils-bCWnsmtD.js → utils-DKOFCM0Q.js} +1 -1
- package/dist/{utils-bCWnsmtD.js.map → utils-DKOFCM0Q.js.map} +1 -1
- package/package.json +5 -3
- package/dist/actions-BqyQ1_K7.d.ts.map +0 -1
- package/dist/clis/args/service-C2ZiQIg6.d.mts.map +0 -1
- package/dist/constants-xNwF0jSl.d.ts.map +0 -1
- package/dist/index-C_iVZe7f.d.ts.map +0 -1
- package/dist/types-DA_0pilk.d.ts.map +0 -1
- package/dist/utils-CJF4w5Bp.d.ts.map +0 -1
|
@@ -1,58 +1,9 @@
|
|
|
1
|
-
import { f as IAnalyticsStore } from "./types-
|
|
1
|
+
import { f as IAnalyticsStore } from "./types-C1in4fl3.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { Draft } from "mutative";
|
|
4
4
|
import { OperationWithContext } from "@powerhousedao/shared/document-model";
|
|
5
5
|
import { FC, ReactNode } from "react";
|
|
6
6
|
|
|
7
|
-
//#region document-model/signatures.d.ts
|
|
8
|
-
/**
|
|
9
|
-
* A signature of an action.
|
|
10
|
-
*
|
|
11
|
-
* This will be refactored in a future release.
|
|
12
|
-
*/
|
|
13
|
-
type Signature = [string, string, string, string, string];
|
|
14
|
-
/**
|
|
15
|
-
* A user action signer.
|
|
16
|
-
*/
|
|
17
|
-
type UserActionSigner = {
|
|
18
|
-
address: string;
|
|
19
|
-
networkId: string;
|
|
20
|
-
chainId: number;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* An app action signer.
|
|
24
|
-
*/
|
|
25
|
-
type AppActionSigner = {
|
|
26
|
-
name: string;
|
|
27
|
-
key: string;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* An action signer.
|
|
31
|
-
*/
|
|
32
|
-
type ActionSigner = {
|
|
33
|
-
user: UserActionSigner;
|
|
34
|
-
app: AppActionSigner;
|
|
35
|
-
signatures: Signature[];
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Information to verify the document creator.
|
|
39
|
-
*/
|
|
40
|
-
type PHDocumentSignatureInfo = {
|
|
41
|
-
/**
|
|
42
|
-
* The public key of the document creator.
|
|
43
|
-
**/
|
|
44
|
-
publicKey: JsonWebKey; /** The nonce that was appended to the message to create the signature. */
|
|
45
|
-
nonce: string;
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Configuration for hashing document state in operations.
|
|
49
|
-
*/
|
|
50
|
-
type HashConfig = {
|
|
51
|
-
/** The hashing algorithm to use (e.g., "sha1", "sha256") */algorithm: string; /** The encoding format for the hash output (e.g., "base64", "hex") */
|
|
52
|
-
encoding: string; /** Optional algorithm-specific parameters */
|
|
53
|
-
params?: Record<string, unknown>;
|
|
54
|
-
};
|
|
55
|
-
//#endregion
|
|
56
7
|
//#region processors/constants.d.ts
|
|
57
8
|
declare const PROCESSOR_APPS: readonly ["connect", "switchboard"];
|
|
58
9
|
declare const DEFAULT_RELATIONAL_PROCESSOR_DB_NAME = "relational-db";
|
|
@@ -18618,195 +18569,971 @@ declare class Command<T> {
|
|
|
18618
18569
|
execute(): Promise<T>;
|
|
18619
18570
|
}
|
|
18620
18571
|
//#endregion
|
|
18621
|
-
//#region
|
|
18622
|
-
type ProcessorDispatchResult = {
|
|
18623
|
-
id: string;
|
|
18624
|
-
status: string;
|
|
18625
|
-
};
|
|
18626
|
-
interface IProcessorDispatch {
|
|
18627
|
-
execute(docId: string, branch: string, actions: Action[], signal?: AbortSignal, meta?: Record<string, unknown>): Promise<ProcessorDispatchResult>;
|
|
18628
|
-
}
|
|
18629
|
-
interface IProcessorHostModule {
|
|
18630
|
-
analyticsStore: IAnalyticsStore;
|
|
18631
|
-
relationalDb: IRelationalDb;
|
|
18632
|
-
processorApp: ProcessorApp;
|
|
18633
|
-
dispatch: IProcessorDispatch;
|
|
18634
|
-
getReadModel<T>(name: string): T;
|
|
18635
|
-
config?: Map<string, unknown>;
|
|
18636
|
-
}
|
|
18572
|
+
//#region document-model/signatures.d.ts
|
|
18637
18573
|
/**
|
|
18638
|
-
*
|
|
18639
|
-
*
|
|
18640
|
-
*
|
|
18574
|
+
* A signature of an action.
|
|
18575
|
+
*
|
|
18576
|
+
* This will be refactored in a future release.
|
|
18641
18577
|
*/
|
|
18642
|
-
type
|
|
18643
|
-
documentType?: string[];
|
|
18644
|
-
scope?: string[];
|
|
18645
|
-
branch?: string[];
|
|
18646
|
-
documentId?: string[];
|
|
18647
|
-
};
|
|
18578
|
+
type Signature = [string, string, string, string, string];
|
|
18648
18579
|
/**
|
|
18649
|
-
*
|
|
18580
|
+
* A user action signer.
|
|
18650
18581
|
*/
|
|
18651
|
-
|
|
18652
|
-
|
|
18653
|
-
|
|
18654
|
-
|
|
18655
|
-
|
|
18656
|
-
onOperations(operations: OperationWithContext[]): Promise<void>;
|
|
18657
|
-
/**
|
|
18658
|
-
* Called when the processor is disconnected.
|
|
18659
|
-
* Used to clean up any resources allocated during processor creation.
|
|
18660
|
-
*/
|
|
18661
|
-
onDisconnect(): Promise<void>;
|
|
18662
|
-
}
|
|
18582
|
+
type UserActionSigner = {
|
|
18583
|
+
address: string;
|
|
18584
|
+
networkId: string;
|
|
18585
|
+
chainId: number;
|
|
18586
|
+
};
|
|
18663
18587
|
/**
|
|
18664
|
-
*
|
|
18588
|
+
* An app action signer.
|
|
18665
18589
|
*/
|
|
18666
|
-
type
|
|
18667
|
-
|
|
18668
|
-
|
|
18669
|
-
startFrom?: "beginning" | "current";
|
|
18590
|
+
type AppActionSigner = {
|
|
18591
|
+
name: string;
|
|
18592
|
+
key: string;
|
|
18670
18593
|
};
|
|
18671
18594
|
/**
|
|
18672
|
-
*
|
|
18673
|
-
* Called once per drive when the drive is first detected or when the factory is registered.
|
|
18595
|
+
* An action signer.
|
|
18674
18596
|
*/
|
|
18675
|
-
type
|
|
18676
|
-
|
|
18677
|
-
|
|
18678
|
-
|
|
18679
|
-
type TrackedProcessor = {
|
|
18680
|
-
processorId: string;
|
|
18681
|
-
factoryId: string;
|
|
18682
|
-
driveId: string;
|
|
18683
|
-
processorIndex: number;
|
|
18684
|
-
record: ProcessorRecord;
|
|
18685
|
-
lastOrdinal: number;
|
|
18686
|
-
status: ProcessorStatus;
|
|
18687
|
-
lastError: string | undefined;
|
|
18688
|
-
lastErrorTimestamp: Date | undefined;
|
|
18689
|
-
retry: () => Promise<void>;
|
|
18597
|
+
type ActionSigner = {
|
|
18598
|
+
user: UserActionSigner;
|
|
18599
|
+
app: AppActionSigner;
|
|
18600
|
+
signatures: Signature[];
|
|
18690
18601
|
};
|
|
18691
18602
|
/**
|
|
18692
|
-
*
|
|
18603
|
+
* Information to verify the document creator.
|
|
18693
18604
|
*/
|
|
18694
|
-
|
|
18695
|
-
/**
|
|
18696
|
-
* Registers a processor factory.
|
|
18697
|
-
* Immediately creates processors for all existing drives.
|
|
18698
|
-
*/
|
|
18699
|
-
registerFactory(identifier: string, factory: ProcessorFactory): Promise<void>;
|
|
18700
|
-
/**
|
|
18701
|
-
* Unregisters a processor factory and disconnects all processors it created.
|
|
18702
|
-
*/
|
|
18703
|
-
unregisterFactory(identifier: string): Promise<void>;
|
|
18704
|
-
/**
|
|
18705
|
-
* Gets a tracked processor by its ID.
|
|
18706
|
-
*/
|
|
18707
|
-
get(processorId: string): TrackedProcessor | undefined;
|
|
18605
|
+
type PHDocumentSignatureInfo = {
|
|
18708
18606
|
/**
|
|
18709
|
-
*
|
|
18710
|
-
|
|
18711
|
-
|
|
18712
|
-
|
|
18713
|
-
type ProcessorApp = (typeof PROCESSOR_APPS)[number];
|
|
18714
|
-
type ProcessorApps = readonly ProcessorApp[];
|
|
18715
|
-
//#endregion
|
|
18716
|
-
//#region processors/relational/types.d.ts
|
|
18717
|
-
type IRelationalQueryMethods = "selectFrom" | "selectNoFrom" | "with" | "withRecursive";
|
|
18718
|
-
type IRelationalQueryBuilder<Schema = unknown> = Pick<QueryCreator<Schema>, IRelationalQueryMethods> & {
|
|
18719
|
-
withSchema: (schema: string) => IRelationalQueryBuilder<Schema>;
|
|
18607
|
+
* The public key of the document creator.
|
|
18608
|
+
**/
|
|
18609
|
+
publicKey: JsonWebKey; /** The nonce that was appended to the message to create the signature. */
|
|
18610
|
+
nonce: string;
|
|
18720
18611
|
};
|
|
18721
|
-
type HashAlgorithms = "fnv1a";
|
|
18722
|
-
type IBaseRelationalDb<Schema = unknown> = Kysely<Schema>;
|
|
18723
18612
|
/**
|
|
18724
|
-
*
|
|
18725
|
-
|
|
18726
|
-
|
|
18727
|
-
|
|
18728
|
-
|
|
18729
|
-
|
|
18730
|
-
queryNamespace<NamespaceSchema>(namespace: string): IRelationalQueryBuilder<NamespaceSchema>;
|
|
18613
|
+
* Configuration for hashing document state in operations.
|
|
18614
|
+
*/
|
|
18615
|
+
type HashConfig = {
|
|
18616
|
+
/** The hashing algorithm to use (e.g., "sha1", "sha256") */algorithm: string; /** The encoding format for the hash output (e.g., "base64", "hex") */
|
|
18617
|
+
encoding: string; /** Optional algorithm-specific parameters */
|
|
18618
|
+
params?: Record<string, unknown>;
|
|
18731
18619
|
};
|
|
18732
|
-
|
|
18733
|
-
|
|
18734
|
-
interface IRelationalDbProcessor<TDatabaseSchema = unknown> extends IProcessor {
|
|
18735
|
-
namespace: string;
|
|
18736
|
-
query: IRelationalQueryBuilder<TDatabaseSchema>;
|
|
18737
|
-
filter: ProcessorFilter;
|
|
18738
|
-
initAndUpgrade(): Promise<void>;
|
|
18739
|
-
}
|
|
18740
|
-
declare const IS_RELATIONAL_DB_PROCESSOR: unique symbol;
|
|
18620
|
+
//#endregion
|
|
18621
|
+
//#region document-model/state.d.ts
|
|
18741
18622
|
/**
|
|
18742
|
-
*
|
|
18743
|
-
* This class abstracts database initialization, migration management, and resource cleanup,
|
|
18744
|
-
* allowing derived classes to focus on business logic.
|
|
18623
|
+
* Creates a default PHAuthState
|
|
18745
18624
|
*/
|
|
18746
|
-
declare
|
|
18747
|
-
protected _namespace: string;
|
|
18748
|
-
protected _filter: ProcessorFilter;
|
|
18749
|
-
protected relationalDb: IRelationalDb<TDatabaseSchema>;
|
|
18750
|
-
constructor(_namespace: string, _filter: ProcessorFilter, relationalDb: IRelationalDb<TDatabaseSchema>);
|
|
18751
|
-
static [IS_RELATIONAL_DB_PROCESSOR]: boolean;
|
|
18752
|
-
/**
|
|
18753
|
-
* Returns the namespace for a given drive id.
|
|
18754
|
-
* This method can be overridden by derived classes to provide a custom namespace.
|
|
18755
|
-
*/
|
|
18756
|
-
static getNamespace(driveId: string): string;
|
|
18757
|
-
static query<Schema>(this: RelationalDbProcessorClass<Schema>, driveId: string, db: IRelationalDb<any>): IRelationalQueryBuilder<Schema>;
|
|
18758
|
-
/**
|
|
18759
|
-
* Processes a list of operations with context.
|
|
18760
|
-
* Called when operations match this processor's filter.
|
|
18761
|
-
*/
|
|
18762
|
-
abstract onOperations(operations: OperationWithContext[]): Promise<void>;
|
|
18763
|
-
/**
|
|
18764
|
-
* Returns the filter for the processor.
|
|
18765
|
-
* This method can be overridden by derived classes to provide a custom filter.
|
|
18766
|
-
*/
|
|
18767
|
-
get filter(): ProcessorFilter;
|
|
18768
|
-
/**
|
|
18769
|
-
* Returns the namespace used by the processor.
|
|
18770
|
-
*/
|
|
18771
|
-
get namespace(): string;
|
|
18772
|
-
get query(): IRelationalQueryBuilder<TDatabaseSchema>;
|
|
18773
|
-
/**
|
|
18774
|
-
* Abstract method that derived classes must implement.
|
|
18775
|
-
* This method is meant to be called on subclasses to initialize and upgrade the database.
|
|
18776
|
-
*/
|
|
18777
|
-
abstract initAndUpgrade(): Promise<void>;
|
|
18778
|
-
/**
|
|
18779
|
-
* Called when the processor is disconnected.
|
|
18780
|
-
* This method is meant to be overridden by subclasses to clean up resources.
|
|
18781
|
-
*/
|
|
18782
|
-
abstract onDisconnect(): Promise<void>;
|
|
18783
|
-
}
|
|
18784
|
-
//#endregion
|
|
18785
|
-
//#region processors/relational/utils.d.ts
|
|
18625
|
+
declare function defaultAuthState(): PHAuthState;
|
|
18786
18626
|
/**
|
|
18787
|
-
*
|
|
18788
|
-
* @param str The string to hash.
|
|
18789
|
-
* @param length The length of the hash. Defaults to 10.
|
|
18790
|
-
* @param algorithm The hashing algorithm to use. Defaults to "fnv1a".
|
|
18791
|
-
* @returns The hashed string.
|
|
18627
|
+
* Creates a default PHDocumentState
|
|
18792
18628
|
*/
|
|
18793
|
-
declare function
|
|
18629
|
+
declare function defaultDocumentState(): PHDocumentState;
|
|
18794
18630
|
/**
|
|
18795
|
-
* Creates a
|
|
18796
|
-
* @param baseDb The base RelationalDb instance to enhance.
|
|
18797
|
-
* @param baseOptions The default options for namespace creation. Hashes namespace by default.
|
|
18798
|
-
* @returns The enhanced RelationalDb instance.
|
|
18631
|
+
* Creates a default PHBaseState with auth and document properties
|
|
18799
18632
|
*/
|
|
18800
|
-
declare function
|
|
18801
|
-
type NamespaceOptions = {
|
|
18802
|
-
hashNamespace?: boolean;
|
|
18803
|
-
};
|
|
18804
|
-
declare function createNamespacedDb<Schema>(db: IBaseRelationalDb<any>, namespace: string, options?: NamespaceOptions): Promise<IRelationalDb<Schema>>;
|
|
18805
|
-
declare function createNamespacedQueryBuilder<Schema>(db: IBaseRelationalDb<any>, namespace: string, options?: NamespaceOptions): IRelationalQueryBuilder<Schema>;
|
|
18633
|
+
declare function defaultBaseState(): PHBaseState;
|
|
18806
18634
|
/**
|
|
18807
|
-
*
|
|
18808
|
-
|
|
18809
|
-
|
|
18635
|
+
* Creates a PHAuthState with the given properties
|
|
18636
|
+
*/
|
|
18637
|
+
declare function createAuthState(auth?: Partial<PHAuthState>): PHAuthState;
|
|
18638
|
+
/**
|
|
18639
|
+
* Creates a PHDocumentState with the given properties
|
|
18640
|
+
*/
|
|
18641
|
+
declare function createDocumentState(document?: Partial<PHDocumentState>): PHDocumentState;
|
|
18642
|
+
/**
|
|
18643
|
+
* Creates a PHBaseState with the given auth and document properties
|
|
18644
|
+
*/
|
|
18645
|
+
declare function createBaseState(auth?: Partial<PHAuthState>, document?: Partial<PHDocumentState>): PHBaseState;
|
|
18646
|
+
/**
|
|
18647
|
+
* The document state of the document.
|
|
18648
|
+
*/
|
|
18649
|
+
type PHDocumentState = {
|
|
18650
|
+
/**
|
|
18651
|
+
* The current document model schema version of the document. This is used
|
|
18652
|
+
* with the UPGRADE_DOCUMENT operation to specify the DocumentModelModule
|
|
18653
|
+
* version to use for reducer execution.
|
|
18654
|
+
*/
|
|
18655
|
+
version: number; /** Hash configuration for operation state verification */
|
|
18656
|
+
hash: HashConfig; /** True if and only if the document has been deleted */
|
|
18657
|
+
isDeleted?: boolean; /** The timestamp when the document was deleted, in UTC ISO format */
|
|
18658
|
+
deletedAtUtcIso?: string; /** Optional: who deleted the document */
|
|
18659
|
+
deletedBy?: string; /** Optional: reason for deletion */
|
|
18660
|
+
deletionReason?: string;
|
|
18661
|
+
};
|
|
18662
|
+
/**
|
|
18663
|
+
* The authentication state of the document.
|
|
18664
|
+
*
|
|
18665
|
+
* This has yet to be implemented.
|
|
18666
|
+
*/
|
|
18667
|
+
type PHAuthState = {};
|
|
18668
|
+
/**
|
|
18669
|
+
* The base state of the document.
|
|
18670
|
+
*/
|
|
18671
|
+
type PHBaseState = {
|
|
18672
|
+
/** Carries authentication information. */auth: PHAuthState; /** Carries information about the document. */
|
|
18673
|
+
document: PHDocumentState;
|
|
18674
|
+
};
|
|
18675
|
+
declare function defaultGlobalState(): DocumentModelGlobalState;
|
|
18676
|
+
declare function defaultLocalState(): DocumentModelLocalState;
|
|
18677
|
+
declare function defaultPHState(): DocumentModelPHState;
|
|
18678
|
+
declare function createGlobalState(state?: Partial<DocumentModelGlobalState>): DocumentModelGlobalState;
|
|
18679
|
+
declare function createLocalState(state?: Partial<DocumentModelLocalState>): DocumentModelLocalState;
|
|
18680
|
+
declare function createState(baseState?: Partial<PHBaseState>, globalState?: Partial<DocumentModelGlobalState>, localState?: Partial<DocumentModelLocalState>): DocumentModelPHState;
|
|
18681
|
+
//#endregion
|
|
18682
|
+
//#region document-model/operations.d.ts
|
|
18683
|
+
declare function setNameOperation<TDocument extends PHDocument>(document: TDocument, input: {
|
|
18684
|
+
name: string;
|
|
18685
|
+
}): TDocument & {
|
|
18686
|
+
header: {
|
|
18687
|
+
name: string;
|
|
18688
|
+
id: string;
|
|
18689
|
+
sig: PHDocumentSignatureInfo;
|
|
18690
|
+
documentType: string;
|
|
18691
|
+
createdAtUtcIso: string;
|
|
18692
|
+
slug: string;
|
|
18693
|
+
branch: string;
|
|
18694
|
+
revision: {
|
|
18695
|
+
[scope: string]: number;
|
|
18696
|
+
};
|
|
18697
|
+
lastModifiedAtUtcIso: string;
|
|
18698
|
+
protocolVersions?: {
|
|
18699
|
+
[key: string]: number;
|
|
18700
|
+
};
|
|
18701
|
+
meta?: PHDocumentMeta;
|
|
18702
|
+
};
|
|
18703
|
+
};
|
|
18704
|
+
declare function setPreferredEditorOperation<TDocument extends PHDocument>(document: TDocument, input: {
|
|
18705
|
+
preferredEditor: string | null;
|
|
18706
|
+
}): TDocument;
|
|
18707
|
+
declare function undoOperation<TDocument extends PHDocument>(document: TDocument, action: Action, skip: number): {
|
|
18708
|
+
document: TDocument;
|
|
18709
|
+
action: Action;
|
|
18710
|
+
skip: number;
|
|
18711
|
+
reuseLastOperationIndex: boolean;
|
|
18712
|
+
};
|
|
18713
|
+
/**
|
|
18714
|
+
* V2 of undoOperation for protocol version 2+.
|
|
18715
|
+
* Key differences from undoOperation:
|
|
18716
|
+
* - Never reuses operation index (always increments)
|
|
18717
|
+
* - Always sets skip=1 (consecutive NOOPs are handled during rebuild/GC)
|
|
18718
|
+
* - No complex skip calculation - simpler model where each UNDO is independent
|
|
18719
|
+
*/
|
|
18720
|
+
declare function undoOperationV2<TDocument extends PHDocument>(document: TDocument, action: Action, skip: number): {
|
|
18721
|
+
document: TDocument;
|
|
18722
|
+
action: Action;
|
|
18723
|
+
skip: number;
|
|
18724
|
+
reuseLastOperationIndex: false;
|
|
18725
|
+
};
|
|
18726
|
+
declare function redoOperation<TDocument extends PHDocument>(document: TDocument, action: Action, skip: number): {
|
|
18727
|
+
document: TDocument;
|
|
18728
|
+
action: Action;
|
|
18729
|
+
skip: number;
|
|
18730
|
+
reuseLastOperationIndex: boolean;
|
|
18731
|
+
};
|
|
18732
|
+
declare function loadStateOperation<TState extends PHBaseState>(document: PHDocument<TState>, action: LoadStateActionInput): PHDocument<TState>;
|
|
18733
|
+
/**
|
|
18734
|
+
* An operation that was applied to a {@link BaseDocument}.
|
|
18735
|
+
*
|
|
18736
|
+
* @remarks
|
|
18737
|
+
* Wraps an action with an index, to be added to the operations history of a Document.
|
|
18738
|
+
* The `index` field is used to keep all operations in order and enable replaying the
|
|
18739
|
+
* document's history from the beginning. Note that indices and skips are relative to
|
|
18740
|
+
* a specific reactor. Example below:
|
|
18741
|
+
*
|
|
18742
|
+
* For (index, skip, ts, action)
|
|
18743
|
+
* A - [(0, 0, 1, "A0"), (1, 0, 2, "A1")]
|
|
18744
|
+
* B - [(0, 0, 0, "B0"), (1, 0, 3, "B1")]
|
|
18745
|
+
* ...
|
|
18746
|
+
* B gets A's Operations Scenario:
|
|
18747
|
+
* B' - [(0, 0, 0, "B0"), (1, 0, 3, "B1"), (2, 1, 1, "A0"), (3, 0, 2, "A1"), (4, 0, 3, "B1")]
|
|
18748
|
+
* Then A needs to end up with:
|
|
18749
|
+
* A' - [(0, 0, 1, "A0"), (1, 0, 2, "A1"), (2, 2, 0, "B0"), (3, 0, 1, "A0"), (4, 0, 2, "A1"), (5, 0, 3, "B1")]
|
|
18750
|
+
* So that both A and B end up with the stream of actions (action):
|
|
18751
|
+
* [("B0"), ("A0"), ("A1"), ("B1")]
|
|
18752
|
+
*
|
|
18753
|
+
* @typeParam A - The type of the action.
|
|
18754
|
+
*/
|
|
18755
|
+
type Operation = {
|
|
18756
|
+
/**
|
|
18757
|
+
* This is a stable id, derived from various document and action properties
|
|
18758
|
+
* in deriveOperationId().
|
|
18759
|
+
*
|
|
18760
|
+
* It _cannot_ be an arbitrary string.
|
|
18761
|
+
*
|
|
18762
|
+
* It it also not unique per operation, as reshuffled operations will keep'
|
|
18763
|
+
* the same id they had before they were reshuffled. This means that the
|
|
18764
|
+
* IOperationStore may have multiple operations with the same operation id.
|
|
18765
|
+
**/
|
|
18766
|
+
id: string; /** Position of the operation in the history. This is relative to a specific reactor -- they may not all agree on this value. */
|
|
18767
|
+
index: number; /** The number of operations skipped with this Operation. This is relative to a specific reactor -- they may not all agree on this value. */
|
|
18768
|
+
skip: number; /** Timestamp of when the operation was added */
|
|
18769
|
+
timestampUtcMs: string; /** Hash of the resulting document data after the operation */
|
|
18770
|
+
hash: string; /** Error message for a failed action */
|
|
18771
|
+
error?: string; /** The resulting state after the operation */
|
|
18772
|
+
resultingState?: string;
|
|
18773
|
+
/**
|
|
18774
|
+
* The action that was applied to the document to produce this operation.
|
|
18775
|
+
*/
|
|
18776
|
+
action: Action;
|
|
18777
|
+
};
|
|
18778
|
+
/**
|
|
18779
|
+
* The operations history of the document by scope.
|
|
18780
|
+
*
|
|
18781
|
+
* This will be removed in a future release.
|
|
18782
|
+
*
|
|
18783
|
+
* TODO: Type should be Partial<Record<string, Operation[]>>,
|
|
18784
|
+
* but that is a breaking change for codegen + external doc models.
|
|
18785
|
+
*/
|
|
18786
|
+
type DocumentOperations = Record<string, Operation[]>;
|
|
18787
|
+
type OperationContext = {
|
|
18788
|
+
documentId: string;
|
|
18789
|
+
documentType: string;
|
|
18790
|
+
scope: string;
|
|
18791
|
+
branch: string;
|
|
18792
|
+
resultingState?: string;
|
|
18793
|
+
ordinal: number;
|
|
18794
|
+
};
|
|
18795
|
+
type OperationWithContext$1 = {
|
|
18796
|
+
operation: Operation;
|
|
18797
|
+
context: OperationContext;
|
|
18798
|
+
};
|
|
18799
|
+
//#endregion
|
|
18800
|
+
//#region document-model/documents.d.ts
|
|
18801
|
+
/** Meta information about the document. */
|
|
18802
|
+
type PHDocumentMeta = {
|
|
18803
|
+
/** The preferred editor for the document. */preferredEditor?: string;
|
|
18804
|
+
};
|
|
18805
|
+
/**
|
|
18806
|
+
* The header of a document.
|
|
18807
|
+
*/
|
|
18808
|
+
type PHDocumentHeader = {
|
|
18809
|
+
/**
|
|
18810
|
+
* The id of the document.
|
|
18811
|
+
*
|
|
18812
|
+
* This is a Ed25519 signature and is immutable.
|
|
18813
|
+
**/
|
|
18814
|
+
id: string;
|
|
18815
|
+
/**
|
|
18816
|
+
* Information to verify the document creator.
|
|
18817
|
+
*
|
|
18818
|
+
* This is immutable.
|
|
18819
|
+
**/
|
|
18820
|
+
sig: PHDocumentSignatureInfo;
|
|
18821
|
+
/**
|
|
18822
|
+
* The type of the document.
|
|
18823
|
+
*
|
|
18824
|
+
* This is used as part of the signature payload and thus, cannot be changed
|
|
18825
|
+
* after the document header has been created.
|
|
18826
|
+
**/
|
|
18827
|
+
documentType: string;
|
|
18828
|
+
/**
|
|
18829
|
+
* The timestamp of the creation date of the document, in UTC ISO format.
|
|
18830
|
+
*
|
|
18831
|
+
* This is used as part of the signature payload and thus, cannot be changed
|
|
18832
|
+
* after the document header has been created.
|
|
18833
|
+
**/
|
|
18834
|
+
createdAtUtcIso: string; /** The slug of the document. */
|
|
18835
|
+
slug: string; /** The name of the document. */
|
|
18836
|
+
name: string; /** The branch of this document. */
|
|
18837
|
+
branch: string;
|
|
18838
|
+
/**
|
|
18839
|
+
* The revision of each scope of the document. This object is updated every
|
|
18840
|
+
* time any _other_ scope is updated.
|
|
18841
|
+
*/
|
|
18842
|
+
revision: {
|
|
18843
|
+
[scope: string]: number;
|
|
18844
|
+
};
|
|
18845
|
+
/**
|
|
18846
|
+
* The timestamp of the last change in the document, in UTC ISO format.
|
|
18847
|
+
**/
|
|
18848
|
+
lastModifiedAtUtcIso: string;
|
|
18849
|
+
/**
|
|
18850
|
+
* This is a map from protocol name to version. A protocol can be any set of
|
|
18851
|
+
* rules that are applied to the document.
|
|
18852
|
+
*
|
|
18853
|
+
* Examples of protocols include:
|
|
18854
|
+
*
|
|
18855
|
+
* - "base-reducer"
|
|
18856
|
+
*/
|
|
18857
|
+
protocolVersions?: {
|
|
18858
|
+
[key: string]: number;
|
|
18859
|
+
}; /** Meta information about the document. */
|
|
18860
|
+
meta?: PHDocumentMeta;
|
|
18861
|
+
};
|
|
18862
|
+
/**
|
|
18863
|
+
* The base type of a document model.
|
|
18864
|
+
*
|
|
18865
|
+
* @remarks
|
|
18866
|
+
* This type is extended by all Document models.
|
|
18867
|
+
*
|
|
18868
|
+
* @typeParam TState - The type of the document state.
|
|
18869
|
+
*/
|
|
18870
|
+
type PHDocument<TState extends PHBaseState = PHBaseState> = {
|
|
18871
|
+
/** The header of the document. */header: PHDocumentHeader; /** The document model specific state. */
|
|
18872
|
+
state: TState;
|
|
18873
|
+
/**
|
|
18874
|
+
* The initial state of the document, enabling replaying operations.
|
|
18875
|
+
*
|
|
18876
|
+
* This will be removed in a future release.
|
|
18877
|
+
*/
|
|
18878
|
+
initialState: TState;
|
|
18879
|
+
/**
|
|
18880
|
+
* The operations history of the document.
|
|
18881
|
+
*
|
|
18882
|
+
* This will be removed in a future release.
|
|
18883
|
+
*/
|
|
18884
|
+
operations: DocumentOperations;
|
|
18885
|
+
/**
|
|
18886
|
+
* A list of undone operations
|
|
18887
|
+
*
|
|
18888
|
+
* This will be removed in a future release.
|
|
18889
|
+
*/
|
|
18890
|
+
clipboard: Operation[];
|
|
18891
|
+
};
|
|
18892
|
+
declare function isNoopOperation<TOp extends {
|
|
18893
|
+
type: string;
|
|
18894
|
+
skip: number;
|
|
18895
|
+
hash: string;
|
|
18896
|
+
}>(op: Partial<TOp>): boolean;
|
|
18897
|
+
declare function isUndoRedo(action: Action): action is UndoRedoAction;
|
|
18898
|
+
declare function isUndo(action: Action): action is UndoAction;
|
|
18899
|
+
declare function isDocumentAction(action: Action): action is DocumentAction;
|
|
18900
|
+
/**
|
|
18901
|
+
* Creates a new document. When `documentType` is given the header is stamped
|
|
18902
|
+
* with it and the document-scope operations are seeded.
|
|
18903
|
+
*/
|
|
18904
|
+
declare function baseCreateDocument<TState extends PHBaseState = PHBaseState>(createState: CreateState<TState>, initialState?: Partial<TState>, documentType?: string): PHDocument<TState>;
|
|
18905
|
+
declare function hashDocumentStateForScope(document: {
|
|
18906
|
+
state: {
|
|
18907
|
+
[key: string]: unknown;
|
|
18908
|
+
};
|
|
18909
|
+
}, scope?: string): string;
|
|
18910
|
+
declare function readOnly<T>(value: T): Readonly<T>;
|
|
18911
|
+
/**
|
|
18912
|
+
* Maps skipped operations in an array of operations.
|
|
18913
|
+
* Skipped operations are operations that are ignored during processing.
|
|
18914
|
+
* @param operations - The array of operations to map.
|
|
18915
|
+
* @param skippedHeadOperations - The number of operations to skip at the head of the array of operations.
|
|
18916
|
+
* @returns An array of mapped operations with ignore flag indicating if the operation is skipped.
|
|
18917
|
+
* @throws Error if the operation index is invalid and there are missing operations.
|
|
18918
|
+
*/
|
|
18919
|
+
declare function mapSkippedOperations(operations: Operation[], skippedHeadOperations?: number): MappedOperation[];
|
|
18920
|
+
/**
|
|
18921
|
+
* V2 version of mapSkippedOperations for protocol version 2+.
|
|
18922
|
+
* In V2, all NOOPs have skip=1 and consecutive NOOPs form chains.
|
|
18923
|
+
* N consecutive NOOPs at any point skip N preceding content operations.
|
|
18924
|
+
*
|
|
18925
|
+
* Algorithm: Process from end to start
|
|
18926
|
+
* - When hitting a NOOP: increment chain length, mark as ignored
|
|
18927
|
+
* - When hitting a non-NOOP:
|
|
18928
|
+
* - If chain > 0: decrement chain, mark as ignored (this op was undone)
|
|
18929
|
+
* - If chain == 0: mark as not ignored (apply this op)
|
|
18930
|
+
*/
|
|
18931
|
+
declare function mapSkippedOperationsV2(operations: Operation[]): MappedOperation[];
|
|
18932
|
+
/**
|
|
18933
|
+
* V2 garbage collect that returns only operations that should be applied for state.
|
|
18934
|
+
* Uses the V2 model where consecutive NOOPs form chains.
|
|
18935
|
+
* Unlike V1 garbageCollect, this preserves ALL operations but marks which to apply.
|
|
18936
|
+
*/
|
|
18937
|
+
declare function garbageCollectV2<TOpIndex extends OperationIndex>(sortedOperations: TOpIndex[]): TOpIndex[];
|
|
18938
|
+
declare function sortMappedOperations(operations: DocumentOperationsIgnoreMap): MappedOperation[];
|
|
18939
|
+
declare function replayDocument<TState extends PHBaseState = PHBaseState>(initialState: TState, operations: DocumentOperations, reducer: Reducer<TState>, header: PHDocumentHeader, dispatch?: SignalDispatch, skipHeaderOperations?: SkipHeaderOperations, options?: ReplayDocumentOptions): PHDocument<TState>;
|
|
18940
|
+
declare function parseResultingState<TState>(state: string | null | undefined): TState;
|
|
18941
|
+
declare enum IntegrityIssueType {
|
|
18942
|
+
UNEXPECTED_INDEX = "UNEXPECTED_INDEX"
|
|
18943
|
+
}
|
|
18944
|
+
declare enum IntegrityIssueSubType {
|
|
18945
|
+
DUPLICATED_INDEX = "DUPLICATED_INDEX",
|
|
18946
|
+
MISSING_INDEX = "MISSING_INDEX"
|
|
18947
|
+
}
|
|
18948
|
+
type IntegrityIssue = {
|
|
18949
|
+
operation: OperationIndex;
|
|
18950
|
+
issue: IntegrityIssueType;
|
|
18951
|
+
category: IntegrityIssueSubType;
|
|
18952
|
+
message: string;
|
|
18953
|
+
};
|
|
18954
|
+
type Reshuffle = (startIndex: OperationIndex, opsA: Operation[], opsB: Operation[]) => Operation[];
|
|
18955
|
+
declare function checkCleanedOperationsIntegrity(sortedOperations: OperationIndex[]): IntegrityIssue[];
|
|
18956
|
+
declare function garbageCollect<TOpIndex extends OperationIndex>(sortedOperations: TOpIndex[]): TOpIndex[];
|
|
18957
|
+
declare function addUndo(sortedOperations: Operation[]): Operation[];
|
|
18958
|
+
declare function sortOperations<TOpIndex extends OperationIndex>(operations: TOpIndex[]): TOpIndex[];
|
|
18959
|
+
declare function reshuffleByTimestamp<TOp extends OperationIndex>(startIndex: OperationIndex, opsA: TOp[], opsB: TOp[]): TOp[];
|
|
18960
|
+
declare function reshuffleByTimestampAndIndex<TOp extends OperationIndex>(startIndex: OperationIndex, opsA: TOp[], opsB: TOp[]): TOp[];
|
|
18961
|
+
declare function operationsAreEqual<TOp extends {
|
|
18962
|
+
index: number;
|
|
18963
|
+
skip: number;
|
|
18964
|
+
type?: string;
|
|
18965
|
+
scope?: string;
|
|
18966
|
+
input?: unknown;
|
|
18967
|
+
}>(op1: TOp, op2: TOp): boolean;
|
|
18968
|
+
declare function attachBranch(trunk: Operation[], newBranch: Operation[]): [Operation[], Operation[]];
|
|
18969
|
+
declare function precedes(op1: OperationIndex, op2: OperationIndex): boolean;
|
|
18970
|
+
declare function split(sortedTargetOperations: Operation[], sortedMergeOperations: Operation[]): [Operation[], Operation[], Operation[]];
|
|
18971
|
+
declare function merge(sortedTargetOperations: Operation[], sortedMergeOperations: Operation[], reshuffle: Reshuffle): Operation[];
|
|
18972
|
+
declare function nextSkipNumber(sortedOperations: OperationIndex[]): number;
|
|
18973
|
+
declare function checkOperationsIntegrity(operations: Operation[]): IntegrityIssue[];
|
|
18974
|
+
declare function groupOperationsByScope(operations: Operation[]): Partial<Record<string, Operation[]>>;
|
|
18975
|
+
type PrepareOperationsResult = {
|
|
18976
|
+
validOperations: Operation[];
|
|
18977
|
+
invalidOperations: Operation[];
|
|
18978
|
+
duplicatedOperations: Operation[];
|
|
18979
|
+
integrityIssues: IntegrityIssue[];
|
|
18980
|
+
};
|
|
18981
|
+
declare function prepareOperations(operationsHistory: Operation[], newOperations: Operation[]): PrepareOperationsResult;
|
|
18982
|
+
declare function removeExistingOperations(newOperations: Operation[], operationsHistory: Operation[]): Operation[];
|
|
18983
|
+
/**
|
|
18984
|
+
* Skips header operations and returns the remaining operations.
|
|
18985
|
+
*
|
|
18986
|
+
* @param operations - The array of operations.
|
|
18987
|
+
* @param skipHeaderOperation - The skip header operation index.
|
|
18988
|
+
* @returns The remaining operations after skipping header operations.
|
|
18989
|
+
*/
|
|
18990
|
+
declare function skipHeaderOperations(operations: Operation[], skipHeaderOperation: SkipHeaderOperationIndex): Operation[];
|
|
18991
|
+
declare function garbageCollectDocumentOperations(documentOperations: DocumentOperations): DocumentOperations;
|
|
18992
|
+
/**
|
|
18993
|
+
* Filters out duplicated operations from the target operations array based on their IDs.
|
|
18994
|
+
* If an operation has an ID, it is considered duplicated if there is another operation in the source operations array with the same ID.
|
|
18995
|
+
* If an operation does not have an ID, it is considered unique and will not be filtered out.
|
|
18996
|
+
* @param targetOperations - The array of target operations to filter.
|
|
18997
|
+
* @param sourceOperations - The array of source operations to compare against.
|
|
18998
|
+
* @returns An array of operations with duplicates filtered out.
|
|
18999
|
+
*/
|
|
19000
|
+
declare function filterDuplicatedOperations<T extends {
|
|
19001
|
+
id?: string | number;
|
|
19002
|
+
}>(targetOperations: T[], sourceOperations: T[]): T[];
|
|
19003
|
+
declare function filterDocumentOperationsResultingState(documentOperations?: DocumentOperations): {
|
|
19004
|
+
[x: string]: Operation[] | {
|
|
19005
|
+
id: string;
|
|
19006
|
+
index: number;
|
|
19007
|
+
skip: number;
|
|
19008
|
+
timestampUtcMs: string;
|
|
19009
|
+
hash: string;
|
|
19010
|
+
error?: string;
|
|
19011
|
+
action: Action;
|
|
19012
|
+
}[];
|
|
19013
|
+
};
|
|
19014
|
+
/**
|
|
19015
|
+
* Calculates the difference between two arrays of operations.
|
|
19016
|
+
* Returns an array of operations that are present in `clearedOperationsA` but not in `clearedOperationsB`.
|
|
19017
|
+
*
|
|
19018
|
+
* @template TOp - The type of the operations.
|
|
19019
|
+
* @param {TOp[]} clearedOperationsA - The first array of operations.
|
|
19020
|
+
* @param {TOp[]} clearedOperationsB - The second array of operations.
|
|
19021
|
+
* @returns {TOp[]} - The difference between the two arrays of operations.
|
|
19022
|
+
*/
|
|
19023
|
+
declare function diffOperations<TOp extends OperationIndex>(clearedOperationsA: TOp[], clearedOperationsB: TOp[]): TOp[];
|
|
19024
|
+
declare function getDocumentLastModified(document: PHDocument): string;
|
|
19025
|
+
/**
|
|
19026
|
+
* Updates the document header with the latest revision number and
|
|
19027
|
+
* date of last modification.
|
|
19028
|
+
*
|
|
19029
|
+
* @param document The current state of the document.
|
|
19030
|
+
* @param scope The scope of the operation.
|
|
19031
|
+
* @param lastModifiedTimestamp Optional timestamp to use directly, avoiding a scan of all operations.
|
|
19032
|
+
* @returns The updated document state.
|
|
19033
|
+
*/
|
|
19034
|
+
declare function updateHeaderRevision(document: PHDocument, scope: string, lastModifiedTimestamp?: string): PHDocument;
|
|
19035
|
+
//#endregion
|
|
19036
|
+
//#region document-model/actions.d.ts
|
|
19037
|
+
/**
|
|
19038
|
+
* Cancels the last `count` operations.
|
|
19039
|
+
*
|
|
19040
|
+
* @param count - Number of operations to cancel
|
|
19041
|
+
* @category Actions
|
|
19042
|
+
*/
|
|
19043
|
+
declare const undo: (count?: number, scope?: string) => UndoAction;
|
|
19044
|
+
/**
|
|
19045
|
+
* Cancels the last `count` {@link undo | UNDO} operations.
|
|
19046
|
+
*
|
|
19047
|
+
* @param count - Number of UNDO operations to cancel
|
|
19048
|
+
* @category Actions
|
|
19049
|
+
*/
|
|
19050
|
+
declare const redo: (count?: number, scope?: string) => RedoAction;
|
|
19051
|
+
/**
|
|
19052
|
+
* Joins multiple operations into a single {@link loadState | LOAD_STATE} operation.
|
|
19053
|
+
*
|
|
19054
|
+
* @remarks
|
|
19055
|
+
* Useful to keep operations history smaller. Operations to prune are selected by index,
|
|
19056
|
+
* similar to the {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice | slice} method in Arrays.
|
|
19057
|
+
*
|
|
19058
|
+
* @param start - Index of the first operation to prune
|
|
19059
|
+
* @param end - Index of the last operation to prune
|
|
19060
|
+
* @category Actions
|
|
19061
|
+
*/
|
|
19062
|
+
declare const prune: (start?: number, end?: number, scope?: string) => SchemaPruneAction;
|
|
19063
|
+
/**
|
|
19064
|
+
* Replaces the state of the document.
|
|
19065
|
+
*
|
|
19066
|
+
* @remarks
|
|
19067
|
+
* This action shouldn't be used directly. It is dispatched by the {@link prune} action.
|
|
19068
|
+
*
|
|
19069
|
+
* @param state - State to be set in the document.
|
|
19070
|
+
* @param operations - Number of operations that were removed from the previous state.
|
|
19071
|
+
* @category Actions
|
|
19072
|
+
*/
|
|
19073
|
+
declare const loadState: <TState extends PHBaseState = PHBaseState>(state: TState & {
|
|
19074
|
+
name: string;
|
|
19075
|
+
}, operations: number) => LoadStateAction;
|
|
19076
|
+
declare const noop: (scope?: string) => NOOPAction;
|
|
19077
|
+
/**
|
|
19078
|
+
* Helper function to be used by action creators.
|
|
19079
|
+
*
|
|
19080
|
+
* @remarks
|
|
19081
|
+
* Creates an action with the given type and input properties. The input
|
|
19082
|
+
* properties default to an empty object.
|
|
19083
|
+
*
|
|
19084
|
+
* @typeParam A - Type of the action to be returned.
|
|
19085
|
+
*
|
|
19086
|
+
* @param type - The type of the action.
|
|
19087
|
+
* @param input - The input properties of the action.
|
|
19088
|
+
* @param attachments - The attachments included in the action.
|
|
19089
|
+
* @param validator - The validator to use for the input properties.
|
|
19090
|
+
* @param scope - The scope of the action, can either be 'global' or 'local'.
|
|
19091
|
+
* @param skip - The number of operations to skip before this new action is applied.
|
|
19092
|
+
*
|
|
19093
|
+
* @throws Error if the type is empty or not a string.
|
|
19094
|
+
*
|
|
19095
|
+
* @returns The new action.
|
|
19096
|
+
*/
|
|
19097
|
+
declare function createAction<TAction extends Action>(type: TAction["type"], input?: TAction["input"], attachments?: TAction["attachments"], validator?: () => {
|
|
19098
|
+
parse(v: unknown): TAction["input"];
|
|
19099
|
+
}, scope?: Action["scope"]): TAction;
|
|
19100
|
+
/**
|
|
19101
|
+
* This function should be used instead of { ...action } to ensure
|
|
19102
|
+
* that extra properties are not included in the action.
|
|
19103
|
+
*/
|
|
19104
|
+
declare const actionFromAction: (action: Action) => Action;
|
|
19105
|
+
declare const operationFromAction: (action: Action, index: number, skip: number, context: OperationContext) => Operation;
|
|
19106
|
+
declare const operationFromOperation: (operation: Operation, index: number, skip: number, context: OperationContext) => Operation;
|
|
19107
|
+
declare const operationWithContext: (operation: Operation, context: ActionContext) => Operation;
|
|
19108
|
+
declare const actionContext: () => ActionContext;
|
|
19109
|
+
declare const actionSigner: (user: UserActionSigner, app: AppActionSigner, signatures?: Signature[]) => ActionSigner;
|
|
19110
|
+
declare function buildOperationSignature(context: ActionSignatureContext, signMethod: ActionSigningHandler): Promise<Signature>;
|
|
19111
|
+
declare function buildSignedAction<TState extends PHBaseState = PHBaseState>(action: Action, reducer: Reducer<TState>, document: PHDocument<TState>, signer: ActionSigner, signHandler: ActionSigningHandler): Promise<Operation>;
|
|
19112
|
+
declare function verifyOperationSignature(signature: Signature, signer: Omit<ActionSigner, "signatures">, verifyHandler: ActionVerificationHandler): Promise<boolean>;
|
|
19113
|
+
/**
|
|
19114
|
+
* Changes the name of the document.
|
|
19115
|
+
*
|
|
19116
|
+
* @param name - The name to be set in the document.
|
|
19117
|
+
* @category Actions
|
|
19118
|
+
*/
|
|
19119
|
+
declare const setName: (name: string | {
|
|
19120
|
+
name: string;
|
|
19121
|
+
}) => SetNameAction;
|
|
19122
|
+
/**
|
|
19123
|
+
* Changes the preferred editor recorded in the document header meta.
|
|
19124
|
+
*
|
|
19125
|
+
* Passing `null` clears the preferred editor.
|
|
19126
|
+
*
|
|
19127
|
+
* @category Actions
|
|
19128
|
+
*/
|
|
19129
|
+
declare const setPreferredEditor: (input: string | null | {
|
|
19130
|
+
preferredEditor: string | null;
|
|
19131
|
+
}) => SetPreferredEditorAction;
|
|
19132
|
+
declare const setModelName: (input: SetModelNameInput) => SetModelNameAction;
|
|
19133
|
+
declare const setModelId: (input: SetModelIdInput) => SetModelIdAction;
|
|
19134
|
+
declare const setModelExtension: (input: SetModelExtensionInput) => SetModelExtensionAction;
|
|
19135
|
+
declare const setModelDescription: (input: SetModelDescriptionInput) => SetModelDescriptionAction;
|
|
19136
|
+
declare const setAuthorName: (input: SetAuthorNameInput) => SetAuthorNameAction;
|
|
19137
|
+
declare const setAuthorWebsite: (input: SetAuthorWebsiteInput) => SetAuthorWebsiteAction;
|
|
19138
|
+
declare const addModule: (input: AddModuleInput) => AddModuleAction;
|
|
19139
|
+
declare const setModuleName: (input: SetModuleNameInput) => SetModuleNameAction;
|
|
19140
|
+
declare const setModuleDescription: (input: SetModuleDescriptionInput) => SetModuleDescriptionAction;
|
|
19141
|
+
declare const deleteModule: (input: DeleteModuleInput) => DeleteModuleAction;
|
|
19142
|
+
declare const reorderModules: (input: ReorderModulesInput) => ReorderModulesAction;
|
|
19143
|
+
declare const addOperation: (input: AddOperationInput) => AddOperationAction;
|
|
19144
|
+
declare const setOperationName: (input: SetOperationNameInput) => SetOperationNameAction;
|
|
19145
|
+
declare const setOperationScope: (input: SetOperationScopeInput) => SetOperationScopeAction;
|
|
19146
|
+
declare const setOperationSchema: (input: SetOperationSchemaInput) => SetOperationSchemaAction;
|
|
19147
|
+
declare const setOperationDescription: (input: SetOperationDescriptionInput) => SetOperationDescriptionAction;
|
|
19148
|
+
declare const setOperationTemplate: (input: SetOperationTemplateInput) => SetOperationTemplateAction;
|
|
19149
|
+
declare const setOperationReducer: (input: SetOperationReducerInput) => SetOperationReducerAction;
|
|
19150
|
+
declare const moveOperation: (input: MoveOperationInput) => MoveOperationAction;
|
|
19151
|
+
declare const deleteOperation: (input: DeleteOperationInput) => DeleteOperationAction;
|
|
19152
|
+
declare const reorderModuleOperations: (input: ReorderModuleOperationsInput) => ReorderModuleOperationsAction;
|
|
19153
|
+
declare const addOperationError: (input: AddOperationErrorInput) => AddOperationErrorAction;
|
|
19154
|
+
declare const setOperationErrorCode: (input: SetOperationErrorCodeInput) => SetOperationErrorCodeAction;
|
|
19155
|
+
declare const setOperationErrorName: (input: SetOperationErrorNameInput) => SetOperationErrorNameAction;
|
|
19156
|
+
declare const setOperationErrorDescription: (input: SetOperationErrorDescriptionInput) => SetOperationErrorDescriptionAction;
|
|
19157
|
+
declare const setOperationErrorTemplate: (input: SetOperationErrorTemplateInput) => SetOperationErrorTemplateAction;
|
|
19158
|
+
declare const deleteOperationError: (input: DeleteOperationErrorInput) => DeleteOperationErrorAction;
|
|
19159
|
+
declare const reorderOperationErrors: (input: ReorderOperationErrorsInput) => ReorderOperationErrorsAction;
|
|
19160
|
+
declare const addOperationExample: (input: AddOperationExampleInput) => AddOperationExampleAction;
|
|
19161
|
+
declare const updateOperationExample: (input: UpdateOperationExampleInput) => UpdateOperationExampleAction;
|
|
19162
|
+
declare const deleteOperationExample: (input: DeleteOperationExampleInput) => DeleteOperationExampleAction;
|
|
19163
|
+
declare const reorderOperationExamples: (input: ReorderOperationExamplesInput) => ReorderOperationExamplesAction;
|
|
19164
|
+
declare const operationExampleCreators: {
|
|
19165
|
+
addOperationExample: (input: AddOperationExampleInput) => AddOperationExampleAction;
|
|
19166
|
+
updateOperationExample: (input: UpdateOperationExampleInput) => UpdateOperationExampleAction;
|
|
19167
|
+
deleteOperationExample: (input: DeleteOperationExampleInput) => DeleteOperationExampleAction;
|
|
19168
|
+
reorderOperationExamples: (input: ReorderOperationExamplesInput) => ReorderOperationExamplesAction;
|
|
19169
|
+
};
|
|
19170
|
+
declare const setStateSchema: (input: SetStateSchemaInput) => SetStateSchemaAction;
|
|
19171
|
+
declare const setInitialState: (input: SetInitialStateInput) => SetInitialStateAction;
|
|
19172
|
+
declare const addStateExample: (input: AddStateExampleInput) => AddStateExampleAction;
|
|
19173
|
+
declare const updateStateExample: (input: UpdateStateExampleInput) => UpdateStateExampleAction;
|
|
19174
|
+
declare const deleteStateExample: (input: DeleteStateExampleInput) => DeleteStateExampleAction;
|
|
19175
|
+
declare const reorderStateExamples: (input: ReorderStateExamplesInput) => ReorderStateExamplesAction;
|
|
19176
|
+
declare const addChangeLogItem: (input: AddChangeLogItemInput) => AddChangeLogItemAction;
|
|
19177
|
+
declare const updateChangeLogItem: (input: UpdateChangeLogItemInput) => UpdateChangeLogItemAction;
|
|
19178
|
+
declare const deleteChangeLogItem: (input: DeleteChangeLogItemInput) => DeleteChangeLogItemAction;
|
|
19179
|
+
declare const reorderChangeLogItems: (input: ReorderChangeLogItemsInput) => ReorderChangeLogItemsAction;
|
|
19180
|
+
declare const releaseNewVersion: () => ReleaseNewVersionAction;
|
|
19181
|
+
declare const baseActions: {
|
|
19182
|
+
setName: (name: string | {
|
|
19183
|
+
name: string;
|
|
19184
|
+
}) => SetNameAction;
|
|
19185
|
+
setPreferredEditor: (input: string | null | {
|
|
19186
|
+
preferredEditor: string | null;
|
|
19187
|
+
}) => SetPreferredEditorAction;
|
|
19188
|
+
undo: (count?: number, scope?: string) => UndoAction;
|
|
19189
|
+
redo: (count?: number, scope?: string) => RedoAction;
|
|
19190
|
+
prune: (start?: number, end?: number, scope?: string) => SchemaPruneAction;
|
|
19191
|
+
loadState: <TState extends PHBaseState = PHBaseState>(state: TState & {
|
|
19192
|
+
name: string;
|
|
19193
|
+
}, operations: number) => LoadStateAction;
|
|
19194
|
+
noop: (scope?: string) => NOOPAction;
|
|
19195
|
+
};
|
|
19196
|
+
declare const documentModelActions: {
|
|
19197
|
+
setModelName: (input: SetModelNameInput) => SetModelNameAction;
|
|
19198
|
+
setModelId: (input: SetModelIdInput) => SetModelIdAction;
|
|
19199
|
+
setModelExtension: (input: SetModelExtensionInput) => SetModelExtensionAction;
|
|
19200
|
+
setModelDescription: (input: SetModelDescriptionInput) => SetModelDescriptionAction;
|
|
19201
|
+
setAuthorName: (input: SetAuthorNameInput) => SetAuthorNameAction;
|
|
19202
|
+
setAuthorWebsite: (input: SetAuthorWebsiteInput) => SetAuthorWebsiteAction;
|
|
19203
|
+
addModule: (input: AddModuleInput) => AddModuleAction;
|
|
19204
|
+
setModuleName: (input: SetModuleNameInput) => SetModuleNameAction;
|
|
19205
|
+
setModuleDescription: (input: SetModuleDescriptionInput) => SetModuleDescriptionAction;
|
|
19206
|
+
deleteModule: (input: DeleteModuleInput) => DeleteModuleAction;
|
|
19207
|
+
reorderModules: (input: ReorderModulesInput) => ReorderModulesAction;
|
|
19208
|
+
addOperation: (input: AddOperationInput) => AddOperationAction;
|
|
19209
|
+
setOperationName: (input: SetOperationNameInput) => SetOperationNameAction;
|
|
19210
|
+
setOperationScope: (input: SetOperationScopeInput) => SetOperationScopeAction;
|
|
19211
|
+
setOperationSchema: (input: SetOperationSchemaInput) => SetOperationSchemaAction;
|
|
19212
|
+
setOperationDescription: (input: SetOperationDescriptionInput) => SetOperationDescriptionAction;
|
|
19213
|
+
setOperationTemplate: (input: SetOperationTemplateInput) => SetOperationTemplateAction;
|
|
19214
|
+
setOperationReducer: (input: SetOperationReducerInput) => SetOperationReducerAction;
|
|
19215
|
+
moveOperation: (input: MoveOperationInput) => MoveOperationAction;
|
|
19216
|
+
deleteOperation: (input: DeleteOperationInput) => DeleteOperationAction;
|
|
19217
|
+
reorderModuleOperations: (input: ReorderModuleOperationsInput) => ReorderModuleOperationsAction;
|
|
19218
|
+
addOperationError: (input: AddOperationErrorInput) => AddOperationErrorAction;
|
|
19219
|
+
setOperationErrorCode: (input: SetOperationErrorCodeInput) => SetOperationErrorCodeAction;
|
|
19220
|
+
setOperationErrorName: (input: SetOperationErrorNameInput) => SetOperationErrorNameAction;
|
|
19221
|
+
setOperationErrorDescription: (input: SetOperationErrorDescriptionInput) => SetOperationErrorDescriptionAction;
|
|
19222
|
+
setOperationErrorTemplate: (input: SetOperationErrorTemplateInput) => SetOperationErrorTemplateAction;
|
|
19223
|
+
deleteOperationError: (input: DeleteOperationErrorInput) => DeleteOperationErrorAction;
|
|
19224
|
+
reorderOperationErrors: (input: ReorderOperationErrorsInput) => ReorderOperationErrorsAction;
|
|
19225
|
+
addOperationExample: (input: AddOperationExampleInput) => AddOperationExampleAction;
|
|
19226
|
+
updateOperationExample: (input: UpdateOperationExampleInput) => UpdateOperationExampleAction;
|
|
19227
|
+
deleteOperationExample: (input: DeleteOperationExampleInput) => DeleteOperationExampleAction;
|
|
19228
|
+
reorderOperationExamples: (input: ReorderOperationExamplesInput) => ReorderOperationExamplesAction;
|
|
19229
|
+
setStateSchema: (input: SetStateSchemaInput) => SetStateSchemaAction;
|
|
19230
|
+
setInitialState: (input: SetInitialStateInput) => SetInitialStateAction;
|
|
19231
|
+
addStateExample: (input: AddStateExampleInput) => AddStateExampleAction;
|
|
19232
|
+
updateStateExample: (input: UpdateStateExampleInput) => UpdateStateExampleAction;
|
|
19233
|
+
deleteStateExample: (input: DeleteStateExampleInput) => DeleteStateExampleAction;
|
|
19234
|
+
reorderStateExamples: (input: ReorderStateExamplesInput) => ReorderStateExamplesAction;
|
|
19235
|
+
addChangeLogItem: (input: AddChangeLogItemInput) => AddChangeLogItemAction;
|
|
19236
|
+
updateChangeLogItem: (input: UpdateChangeLogItemInput) => UpdateChangeLogItemAction;
|
|
19237
|
+
deleteChangeLogItem: (input: DeleteChangeLogItemInput) => DeleteChangeLogItemAction;
|
|
19238
|
+
reorderChangeLogItems: (input: ReorderChangeLogItemsInput) => ReorderChangeLogItemsAction;
|
|
19239
|
+
releaseNewVersion: () => ReleaseNewVersionAction;
|
|
19240
|
+
};
|
|
19241
|
+
declare const actions: {
|
|
19242
|
+
setModelName: (input: SetModelNameInput) => SetModelNameAction;
|
|
19243
|
+
setModelId: (input: SetModelIdInput) => SetModelIdAction;
|
|
19244
|
+
setModelExtension: (input: SetModelExtensionInput) => SetModelExtensionAction;
|
|
19245
|
+
setModelDescription: (input: SetModelDescriptionInput) => SetModelDescriptionAction;
|
|
19246
|
+
setAuthorName: (input: SetAuthorNameInput) => SetAuthorNameAction;
|
|
19247
|
+
setAuthorWebsite: (input: SetAuthorWebsiteInput) => SetAuthorWebsiteAction;
|
|
19248
|
+
addModule: (input: AddModuleInput) => AddModuleAction;
|
|
19249
|
+
setModuleName: (input: SetModuleNameInput) => SetModuleNameAction;
|
|
19250
|
+
setModuleDescription: (input: SetModuleDescriptionInput) => SetModuleDescriptionAction;
|
|
19251
|
+
deleteModule: (input: DeleteModuleInput) => DeleteModuleAction;
|
|
19252
|
+
reorderModules: (input: ReorderModulesInput) => ReorderModulesAction;
|
|
19253
|
+
addOperation: (input: AddOperationInput) => AddOperationAction;
|
|
19254
|
+
setOperationName: (input: SetOperationNameInput) => SetOperationNameAction;
|
|
19255
|
+
setOperationScope: (input: SetOperationScopeInput) => SetOperationScopeAction;
|
|
19256
|
+
setOperationSchema: (input: SetOperationSchemaInput) => SetOperationSchemaAction;
|
|
19257
|
+
setOperationDescription: (input: SetOperationDescriptionInput) => SetOperationDescriptionAction;
|
|
19258
|
+
setOperationTemplate: (input: SetOperationTemplateInput) => SetOperationTemplateAction;
|
|
19259
|
+
setOperationReducer: (input: SetOperationReducerInput) => SetOperationReducerAction;
|
|
19260
|
+
moveOperation: (input: MoveOperationInput) => MoveOperationAction;
|
|
19261
|
+
deleteOperation: (input: DeleteOperationInput) => DeleteOperationAction;
|
|
19262
|
+
reorderModuleOperations: (input: ReorderModuleOperationsInput) => ReorderModuleOperationsAction;
|
|
19263
|
+
addOperationError: (input: AddOperationErrorInput) => AddOperationErrorAction;
|
|
19264
|
+
setOperationErrorCode: (input: SetOperationErrorCodeInput) => SetOperationErrorCodeAction;
|
|
19265
|
+
setOperationErrorName: (input: SetOperationErrorNameInput) => SetOperationErrorNameAction;
|
|
19266
|
+
setOperationErrorDescription: (input: SetOperationErrorDescriptionInput) => SetOperationErrorDescriptionAction;
|
|
19267
|
+
setOperationErrorTemplate: (input: SetOperationErrorTemplateInput) => SetOperationErrorTemplateAction;
|
|
19268
|
+
deleteOperationError: (input: DeleteOperationErrorInput) => DeleteOperationErrorAction;
|
|
19269
|
+
reorderOperationErrors: (input: ReorderOperationErrorsInput) => ReorderOperationErrorsAction;
|
|
19270
|
+
addOperationExample: (input: AddOperationExampleInput) => AddOperationExampleAction;
|
|
19271
|
+
updateOperationExample: (input: UpdateOperationExampleInput) => UpdateOperationExampleAction;
|
|
19272
|
+
deleteOperationExample: (input: DeleteOperationExampleInput) => DeleteOperationExampleAction;
|
|
19273
|
+
reorderOperationExamples: (input: ReorderOperationExamplesInput) => ReorderOperationExamplesAction;
|
|
19274
|
+
setStateSchema: (input: SetStateSchemaInput) => SetStateSchemaAction;
|
|
19275
|
+
setInitialState: (input: SetInitialStateInput) => SetInitialStateAction;
|
|
19276
|
+
addStateExample: (input: AddStateExampleInput) => AddStateExampleAction;
|
|
19277
|
+
updateStateExample: (input: UpdateStateExampleInput) => UpdateStateExampleAction;
|
|
19278
|
+
deleteStateExample: (input: DeleteStateExampleInput) => DeleteStateExampleAction;
|
|
19279
|
+
reorderStateExamples: (input: ReorderStateExamplesInput) => ReorderStateExamplesAction;
|
|
19280
|
+
addChangeLogItem: (input: AddChangeLogItemInput) => AddChangeLogItemAction;
|
|
19281
|
+
updateChangeLogItem: (input: UpdateChangeLogItemInput) => UpdateChangeLogItemAction;
|
|
19282
|
+
deleteChangeLogItem: (input: DeleteChangeLogItemInput) => DeleteChangeLogItemAction;
|
|
19283
|
+
reorderChangeLogItems: (input: ReorderChangeLogItemsInput) => ReorderChangeLogItemsAction;
|
|
19284
|
+
releaseNewVersion: () => ReleaseNewVersionAction;
|
|
19285
|
+
setName: (name: string | {
|
|
19286
|
+
name: string;
|
|
19287
|
+
}) => SetNameAction;
|
|
19288
|
+
setPreferredEditor: (input: string | null | {
|
|
19289
|
+
preferredEditor: string | null;
|
|
19290
|
+
}) => SetPreferredEditorAction;
|
|
19291
|
+
undo: (count?: number, scope?: string) => UndoAction;
|
|
19292
|
+
redo: (count?: number, scope?: string) => RedoAction;
|
|
19293
|
+
prune: (start?: number, end?: number, scope?: string) => SchemaPruneAction;
|
|
19294
|
+
loadState: <TState extends PHBaseState = PHBaseState>(state: TState & {
|
|
19295
|
+
name: string;
|
|
19296
|
+
}, operations: number) => LoadStateAction;
|
|
19297
|
+
noop: (scope?: string) => NOOPAction;
|
|
19298
|
+
};
|
|
19299
|
+
/**
|
|
19300
|
+
* The context of an action.
|
|
19301
|
+
*/
|
|
19302
|
+
type ActionContext = {
|
|
19303
|
+
/** The index of the previous operation, showing intended ordering. */prevOpIndex?: number; /** The hash of the previous operation, showing intended state. */
|
|
19304
|
+
prevOpHash?: string; /** A nonce, to cover specific signing attacks and to prevent replay attacks from no-ops. */
|
|
19305
|
+
nonce?: string; /** The signer of the action. */
|
|
19306
|
+
signer?: ActionSigner;
|
|
19307
|
+
};
|
|
19308
|
+
/**
|
|
19309
|
+
* Defines the basic structure of an action.
|
|
19310
|
+
*/
|
|
19311
|
+
type Action = {
|
|
19312
|
+
/** The id of the action. This is distinct from the operation id. */id: string; /** The name of the action. */
|
|
19313
|
+
type: string; /** The timestamp of the action. */
|
|
19314
|
+
timestampUtcMs: string; /** The payload of the action. */
|
|
19315
|
+
input: unknown; /** The scope of the action */
|
|
19316
|
+
scope: string;
|
|
19317
|
+
/**
|
|
19318
|
+
* The attachments included in the action.
|
|
19319
|
+
*
|
|
19320
|
+
* This will be refactored in a future release.
|
|
19321
|
+
*/
|
|
19322
|
+
attachments?: AttachmentInput[]; /** The context of the action. */
|
|
19323
|
+
context?: ActionContext;
|
|
19324
|
+
};
|
|
19325
|
+
/**
|
|
19326
|
+
* The attributes stored for a file. Namely, attachments of a document.
|
|
19327
|
+
*/
|
|
19328
|
+
type Attachment = {
|
|
19329
|
+
/** The binary data of the attachment in Base64 */data: string; /** The MIME type of the attachment */
|
|
19330
|
+
mimeType: string;
|
|
19331
|
+
extension?: string | null;
|
|
19332
|
+
fileName?: string | null;
|
|
19333
|
+
};
|
|
19334
|
+
type AttachmentInput = Attachment & {
|
|
19335
|
+
hash: string;
|
|
19336
|
+
};
|
|
19337
|
+
type ActionWithAttachment = Action & {
|
|
19338
|
+
attachments: AttachmentInput[];
|
|
19339
|
+
};
|
|
19340
|
+
/**
|
|
19341
|
+
* String type representing an attachment in a Document.
|
|
19342
|
+
*
|
|
19343
|
+
* @remarks
|
|
19344
|
+
* Attachment string is formatted as `attachment://<filename>`.
|
|
19345
|
+
*/
|
|
19346
|
+
type AttachmentRef = string;
|
|
19347
|
+
//#endregion
|
|
19348
|
+
//#region processors/types.d.ts
|
|
19349
|
+
type ProcessorDispatchResult = {
|
|
19350
|
+
id: string;
|
|
19351
|
+
status: string;
|
|
19352
|
+
};
|
|
19353
|
+
interface IProcessorDispatch {
|
|
19354
|
+
execute(docId: string, branch: string, actions: Action[], signal?: AbortSignal, meta?: Record<string, unknown>): Promise<ProcessorDispatchResult>;
|
|
19355
|
+
}
|
|
19356
|
+
interface IProcessorHostModule {
|
|
19357
|
+
analyticsStore: IAnalyticsStore;
|
|
19358
|
+
relationalDb: IRelationalDb;
|
|
19359
|
+
processorApp: ProcessorApp;
|
|
19360
|
+
dispatch: IProcessorDispatch;
|
|
19361
|
+
getReadModel<T>(name: string): T;
|
|
19362
|
+
config?: Map<string, unknown>;
|
|
19363
|
+
}
|
|
19364
|
+
/**
|
|
19365
|
+
* Filter for matching operations to processors.
|
|
19366
|
+
* All fields are optional arrays - when provided, operations must match at least one value in each specified field.
|
|
19367
|
+
* When a field is undefined or empty, it matches all values for that field.
|
|
19368
|
+
*/
|
|
19369
|
+
type ProcessorFilter = {
|
|
19370
|
+
documentType?: string[];
|
|
19371
|
+
scope?: string[];
|
|
19372
|
+
branch?: string[];
|
|
19373
|
+
documentId?: string[];
|
|
19374
|
+
};
|
|
19375
|
+
/**
|
|
19376
|
+
* Describes an object that can process operations.
|
|
19377
|
+
*/
|
|
19378
|
+
interface IProcessor {
|
|
19379
|
+
/**
|
|
19380
|
+
* Processes a list of operations with context.
|
|
19381
|
+
* Called when operations match this processor's filter.
|
|
19382
|
+
*/
|
|
19383
|
+
onOperations(operations: OperationWithContext[]): Promise<void>;
|
|
19384
|
+
/**
|
|
19385
|
+
* Called when the processor is disconnected.
|
|
19386
|
+
* Used to clean up any resources allocated during processor creation.
|
|
19387
|
+
*/
|
|
19388
|
+
onDisconnect(): Promise<void>;
|
|
19389
|
+
}
|
|
19390
|
+
/**
|
|
19391
|
+
* Relates a processor to its filter configuration.
|
|
19392
|
+
*/
|
|
19393
|
+
type ProcessorRecord = {
|
|
19394
|
+
processor: IProcessor;
|
|
19395
|
+
filter: ProcessorFilter;
|
|
19396
|
+
startFrom?: "beginning" | "current";
|
|
19397
|
+
};
|
|
19398
|
+
/**
|
|
19399
|
+
* A factory function that creates processor records for a given drive.
|
|
19400
|
+
* Called once per drive when the drive is first detected or when the factory is registered.
|
|
19401
|
+
*/
|
|
19402
|
+
type ProcessorFactory = (driveHeader: PHDocumentHeader, processorApp?: ProcessorApp) => Promise<ProcessorRecord[]> | ProcessorRecord[];
|
|
19403
|
+
/** Takes a processor host module and builds processor factories using its context */
|
|
19404
|
+
type ProcessorFactoryBuilder = (module: IProcessorHostModule) => Promise<ProcessorFactory> | ProcessorFactory;
|
|
19405
|
+
type ProcessorStatus = "active" | "errored";
|
|
19406
|
+
type TrackedProcessor = {
|
|
19407
|
+
processorId: string;
|
|
19408
|
+
factoryId: string;
|
|
19409
|
+
driveId: string;
|
|
19410
|
+
processorIndex: number;
|
|
19411
|
+
record: ProcessorRecord;
|
|
19412
|
+
lastOrdinal: number;
|
|
19413
|
+
status: ProcessorStatus;
|
|
19414
|
+
lastError: string | undefined;
|
|
19415
|
+
lastErrorTimestamp: Date | undefined;
|
|
19416
|
+
retry: () => Promise<void>;
|
|
19417
|
+
};
|
|
19418
|
+
/**
|
|
19419
|
+
* Manages processor creation and destruction based on drive operations.
|
|
19420
|
+
*/
|
|
19421
|
+
interface IProcessorManager {
|
|
19422
|
+
/**
|
|
19423
|
+
* Registers a processor factory.
|
|
19424
|
+
* Immediately creates processors for all existing drives.
|
|
19425
|
+
*/
|
|
19426
|
+
registerFactory(identifier: string, factory: ProcessorFactory): Promise<void>;
|
|
19427
|
+
/**
|
|
19428
|
+
* Unregisters a processor factory and disconnects all processors it created.
|
|
19429
|
+
*/
|
|
19430
|
+
unregisterFactory(identifier: string): Promise<void>;
|
|
19431
|
+
/**
|
|
19432
|
+
* Gets a tracked processor by its ID.
|
|
19433
|
+
*/
|
|
19434
|
+
get(processorId: string): TrackedProcessor | undefined;
|
|
19435
|
+
/**
|
|
19436
|
+
* Gets all tracked processors.
|
|
19437
|
+
*/
|
|
19438
|
+
getAll(): TrackedProcessor[];
|
|
19439
|
+
}
|
|
19440
|
+
type ProcessorApp = (typeof PROCESSOR_APPS)[number];
|
|
19441
|
+
type ProcessorApps = readonly ProcessorApp[];
|
|
19442
|
+
//#endregion
|
|
19443
|
+
//#region processors/relational/types.d.ts
|
|
19444
|
+
type IRelationalQueryMethods = "selectFrom" | "selectNoFrom" | "with" | "withRecursive";
|
|
19445
|
+
type IRelationalQueryBuilder<Schema = unknown> = Pick<QueryCreator<Schema>, IRelationalQueryMethods> & {
|
|
19446
|
+
withSchema: (schema: string) => IRelationalQueryBuilder<Schema>;
|
|
19447
|
+
};
|
|
19448
|
+
type HashAlgorithms = "fnv1a";
|
|
19449
|
+
type IBaseRelationalDb<Schema = unknown> = Kysely<Schema>;
|
|
19450
|
+
/**
|
|
19451
|
+
* The standardized relational database interface for relational db processors.
|
|
19452
|
+
* This abstraction provides type-safe database operations while hiding the underlying
|
|
19453
|
+
* database framework implementation details.
|
|
19454
|
+
**/
|
|
19455
|
+
type IRelationalDb<Schema = unknown> = IBaseRelationalDb<Schema> & {
|
|
19456
|
+
createNamespace<NamespaceSchema>(namespace: string): Promise<IRelationalDb<ExtractProcessorSchemaOrSelf<NamespaceSchema>>>;
|
|
19457
|
+
queryNamespace<NamespaceSchema>(namespace: string): IRelationalQueryBuilder<NamespaceSchema>;
|
|
19458
|
+
};
|
|
19459
|
+
type ExtractProcessorSchemaOrSelf<TProcessor> = TProcessor extends RelationalDbProcessor<infer TSchema> ? TSchema : TProcessor;
|
|
19460
|
+
type RelationalDbProcessorClass<TSchema> = typeof RelationalDbProcessor<TSchema>;
|
|
19461
|
+
interface IRelationalDbProcessor<TDatabaseSchema = unknown> extends IProcessor {
|
|
19462
|
+
namespace: string;
|
|
19463
|
+
query: IRelationalQueryBuilder<TDatabaseSchema>;
|
|
19464
|
+
filter: ProcessorFilter;
|
|
19465
|
+
initAndUpgrade(): Promise<void>;
|
|
19466
|
+
}
|
|
19467
|
+
declare const IS_RELATIONAL_DB_PROCESSOR: unique symbol;
|
|
19468
|
+
/**
|
|
19469
|
+
* Base class for relational db processors that require a relational database storage.
|
|
19470
|
+
* This class abstracts database initialization, migration management, and resource cleanup,
|
|
19471
|
+
* allowing derived classes to focus on business logic.
|
|
19472
|
+
*/
|
|
19473
|
+
declare abstract class RelationalDbProcessor<TDatabaseSchema = unknown> implements IRelationalDbProcessor<TDatabaseSchema> {
|
|
19474
|
+
protected _namespace: string;
|
|
19475
|
+
protected _filter: ProcessorFilter;
|
|
19476
|
+
protected relationalDb: IRelationalDb<TDatabaseSchema>;
|
|
19477
|
+
constructor(_namespace: string, _filter: ProcessorFilter, relationalDb: IRelationalDb<TDatabaseSchema>);
|
|
19478
|
+
static [IS_RELATIONAL_DB_PROCESSOR]: boolean;
|
|
19479
|
+
/**
|
|
19480
|
+
* Returns the namespace for a given drive id.
|
|
19481
|
+
* This method can be overridden by derived classes to provide a custom namespace.
|
|
19482
|
+
*/
|
|
19483
|
+
static getNamespace(driveId: string): string;
|
|
19484
|
+
static query<Schema>(this: RelationalDbProcessorClass<Schema>, driveId: string, db: IRelationalDb<any>): IRelationalQueryBuilder<Schema>;
|
|
19485
|
+
/**
|
|
19486
|
+
* Processes a list of operations with context.
|
|
19487
|
+
* Called when operations match this processor's filter.
|
|
19488
|
+
*/
|
|
19489
|
+
abstract onOperations(operations: OperationWithContext[]): Promise<void>;
|
|
19490
|
+
/**
|
|
19491
|
+
* Returns the filter for the processor.
|
|
19492
|
+
* This method can be overridden by derived classes to provide a custom filter.
|
|
19493
|
+
*/
|
|
19494
|
+
get filter(): ProcessorFilter;
|
|
19495
|
+
/**
|
|
19496
|
+
* Returns the namespace used by the processor.
|
|
19497
|
+
*/
|
|
19498
|
+
get namespace(): string;
|
|
19499
|
+
get query(): IRelationalQueryBuilder<TDatabaseSchema>;
|
|
19500
|
+
/**
|
|
19501
|
+
* Abstract method that derived classes must implement.
|
|
19502
|
+
* This method is meant to be called on subclasses to initialize and upgrade the database.
|
|
19503
|
+
*/
|
|
19504
|
+
abstract initAndUpgrade(): Promise<void>;
|
|
19505
|
+
/**
|
|
19506
|
+
* Called when the processor is disconnected.
|
|
19507
|
+
* This method is meant to be overridden by subclasses to clean up resources.
|
|
19508
|
+
*/
|
|
19509
|
+
abstract onDisconnect(): Promise<void>;
|
|
19510
|
+
}
|
|
19511
|
+
//#endregion
|
|
19512
|
+
//#region processors/relational/utils.d.ts
|
|
19513
|
+
/**
|
|
19514
|
+
* Hashes a string to a lowercase base-26 string.
|
|
19515
|
+
* @param str The string to hash.
|
|
19516
|
+
* @param length The length of the hash. Defaults to 10.
|
|
19517
|
+
* @param algorithm The hashing algorithm to use. Defaults to "fnv1a".
|
|
19518
|
+
* @returns The hashed string.
|
|
19519
|
+
*/
|
|
19520
|
+
declare function hashNamespace(str: string, length?: number): string;
|
|
19521
|
+
/**
|
|
19522
|
+
* Creates a RelationalDb instance with namespace support.
|
|
19523
|
+
* @param baseDb The base RelationalDb instance to enhance.
|
|
19524
|
+
* @param baseOptions The default options for namespace creation. Hashes namespace by default.
|
|
19525
|
+
* @returns The enhanced RelationalDb instance.
|
|
19526
|
+
*/
|
|
19527
|
+
declare function createRelationalDb<Schema>(baseDb: IBaseRelationalDb<Schema>, baseOptions?: NamespaceOptions): IRelationalDb<Schema>;
|
|
19528
|
+
type NamespaceOptions = {
|
|
19529
|
+
hashNamespace?: boolean;
|
|
19530
|
+
};
|
|
19531
|
+
declare function createNamespacedDb<Schema>(db: IBaseRelationalDb<any>, namespace: string, options?: NamespaceOptions): Promise<IRelationalDb<Schema>>;
|
|
19532
|
+
declare function createNamespacedQueryBuilder<Schema>(db: IBaseRelationalDb<any>, namespace: string, options?: NamespaceOptions): IRelationalQueryBuilder<Schema>;
|
|
19533
|
+
/**
|
|
19534
|
+
* Returns a query builder for a RelationalDb instance.
|
|
19535
|
+
* @param query The RelationalDb instance to convert.
|
|
19536
|
+
* @returns The IRelationalQueryBuilder instance.
|
|
18810
19537
|
*/
|
|
18811
19538
|
declare function relationalDbToQueryBuilder<TSchema>(query: IBaseRelationalDb<TSchema>): IRelationalQueryBuilder<TSchema>;
|
|
18812
19539
|
//#endregion
|
|
@@ -19888,1181 +20615,454 @@ type LoadStateActionInput = {
|
|
|
19888
20615
|
state: LoadStateActionStateInput;
|
|
19889
20616
|
};
|
|
19890
20617
|
type LoadStateActionStateInput = {
|
|
19891
|
-
data?: InputMaybe<Scalars["Unknown"]["input"]>;
|
|
19892
|
-
name: Scalars["String"]["input"];
|
|
19893
|
-
};
|
|
19894
|
-
type MutationLoadStateArgs = {
|
|
19895
|
-
input: SchemaLoadStateAction;
|
|
19896
|
-
};
|
|
19897
|
-
type MutationPruneArgs = {
|
|
19898
|
-
input: SchemaPruneAction;
|
|
19899
|
-
};
|
|
19900
|
-
type MutationRedoArgs = {
|
|
19901
|
-
input: SchemaRedoAction;
|
|
19902
|
-
};
|
|
19903
|
-
type MutationSetNameArgs = {
|
|
19904
|
-
input: SchemaSetNameAction;
|
|
19905
|
-
};
|
|
19906
|
-
type MutationUndoArgs = {
|
|
19907
|
-
input: SchemaUndoAction;
|
|
19908
|
-
};
|
|
19909
|
-
type Prune = "PRUNE";
|
|
19910
|
-
type SchemaPruneAction = {
|
|
19911
|
-
id: Scalars["String"]["output"];
|
|
19912
|
-
timestampUtcMs: Scalars["DateTime"]["output"];
|
|
19913
|
-
input: PruneActionInput;
|
|
19914
|
-
type: Prune;
|
|
19915
|
-
scope: string;
|
|
19916
|
-
};
|
|
19917
|
-
type PruneActionInput = {
|
|
19918
|
-
end?: InputMaybe<Scalars["Int"]["input"]>;
|
|
19919
|
-
start?: InputMaybe<Scalars["Int"]["input"]>;
|
|
19920
|
-
};
|
|
19921
|
-
type Query = {
|
|
19922
|
-
__typename?: "Query";
|
|
19923
|
-
document: Maybe<IDocument>;
|
|
19924
|
-
};
|
|
19925
|
-
type Redo = "REDO";
|
|
19926
|
-
type RedoActionInput = {
|
|
19927
|
-
count: Scalars["Int"]["input"];
|
|
19928
|
-
};
|
|
19929
|
-
type SchemaRedoAction = {
|
|
19930
|
-
id: Scalars["String"]["output"];
|
|
19931
|
-
timestampUtcMs: Scalars["DateTime"]["output"];
|
|
19932
|
-
input: RedoActionInput;
|
|
19933
|
-
type: Redo;
|
|
19934
|
-
scope: string;
|
|
19935
|
-
};
|
|
19936
|
-
type Set_Name = "SET_NAME";
|
|
19937
|
-
type SetNameActionInput = {
|
|
19938
|
-
name: Scalars["String"]["input"];
|
|
19939
|
-
};
|
|
19940
|
-
type SchemaSetNameAction = {
|
|
19941
|
-
id: Scalars["String"]["output"];
|
|
19942
|
-
timestampUtcMs: Scalars["DateTime"]["output"];
|
|
19943
|
-
input: SetNameActionInput;
|
|
19944
|
-
type: Set_Name;
|
|
19945
|
-
scope: "global";
|
|
19946
|
-
};
|
|
19947
|
-
type SetNameOperation = IOperation & {
|
|
19948
|
-
__typename?: "SetNameOperation";
|
|
19949
|
-
hash: Scalars["String"]["output"];
|
|
19950
|
-
index: Scalars["Int"]["output"];
|
|
19951
|
-
input: Scalars["String"]["output"];
|
|
19952
|
-
timestamp: Scalars["DateTime"]["output"];
|
|
19953
|
-
type: Scalars["String"]["output"];
|
|
19954
|
-
};
|
|
19955
|
-
type Set_PreferredEditor = "SET_PREFERRED_EDITOR";
|
|
19956
|
-
type SetPreferredEditorActionInput = {
|
|
19957
|
-
preferredEditor: Scalars["String"]["input"] | null;
|
|
19958
|
-
};
|
|
19959
|
-
type SchemaSetPreferredEditorAction = {
|
|
19960
|
-
id: Scalars["String"]["output"];
|
|
19961
|
-
timestampUtcMs: Scalars["DateTime"]["output"];
|
|
19962
|
-
input: SetPreferredEditorActionInput;
|
|
19963
|
-
type: Set_PreferredEditor;
|
|
19964
|
-
scope: "header";
|
|
19965
|
-
};
|
|
19966
|
-
type SetPreferredEditorOperation = IOperation & {
|
|
19967
|
-
__typename?: "SetPreferredEditorOperation";
|
|
19968
|
-
hash: Scalars["String"]["output"];
|
|
19969
|
-
index: Scalars["Int"]["output"];
|
|
19970
|
-
input: SetPreferredEditorActionInput;
|
|
19971
|
-
timestamp: Scalars["DateTime"]["output"];
|
|
19972
|
-
type: Scalars["String"]["output"];
|
|
19973
|
-
};
|
|
19974
|
-
type Undo = "UNDO";
|
|
19975
|
-
type UndoActionInput = {
|
|
19976
|
-
count: Scalars["Int"]["input"];
|
|
19977
|
-
};
|
|
19978
|
-
type SchemaUndoAction = {
|
|
19979
|
-
id: Scalars["String"]["output"];
|
|
19980
|
-
timestampUtcMs: Scalars["DateTime"]["output"];
|
|
19981
|
-
input: UndoActionInput;
|
|
19982
|
-
type: Undo;
|
|
19983
|
-
scope: string;
|
|
19984
|
-
};
|
|
19985
|
-
type SchemaNOOPAction = {
|
|
19986
|
-
id: Scalars["String"]["output"];
|
|
19987
|
-
input: Scalars["Unknown"]["input"];
|
|
19988
|
-
scope: string;
|
|
19989
|
-
timestampUtcMs: Scalars["DateTime"]["output"];
|
|
19990
|
-
type: "NOOP";
|
|
19991
|
-
};
|
|
19992
|
-
type LoadStateAction = Action & {
|
|
19993
|
-
type: "LOAD_STATE";
|
|
19994
|
-
input: LoadStateActionInput;
|
|
19995
|
-
};
|
|
19996
|
-
type PruneAction = Action & {
|
|
19997
|
-
type: "PRUNE";
|
|
19998
|
-
input: PruneActionInput;
|
|
19999
|
-
};
|
|
20000
|
-
type RedoAction = Action & {
|
|
20001
|
-
type: "REDO";
|
|
20002
|
-
input: SchemaRedoAction["input"];
|
|
20003
|
-
};
|
|
20004
|
-
type SetNameAction = Action & {
|
|
20005
|
-
type: "SET_NAME";
|
|
20006
|
-
input: SchemaSetNameAction["input"];
|
|
20007
|
-
};
|
|
20008
|
-
type SetPreferredEditorAction = Action & {
|
|
20009
|
-
type: "SET_PREFERRED_EDITOR";
|
|
20010
|
-
input: SchemaSetPreferredEditorAction["input"];
|
|
20011
|
-
};
|
|
20012
|
-
type UndoAction = Action & {
|
|
20013
|
-
type: "UNDO";
|
|
20014
|
-
input: SchemaUndoAction["input"];
|
|
20015
|
-
};
|
|
20016
|
-
type NOOPAction = Action & {
|
|
20017
|
-
type: "NOOP";
|
|
20018
|
-
input: SchemaNOOPAction["input"];
|
|
20019
|
-
};
|
|
20020
|
-
type CreateDocumentActionInput = {
|
|
20021
|
-
model: string;
|
|
20022
|
-
version: 0;
|
|
20023
|
-
documentId: string;
|
|
20024
|
-
signing?: {
|
|
20025
|
-
signature: string;
|
|
20026
|
-
publicKey: JsonWebKey;
|
|
20027
|
-
nonce: string;
|
|
20028
|
-
createdAtUtcIso: string;
|
|
20029
|
-
documentType: string;
|
|
20030
|
-
};
|
|
20031
|
-
slug?: string;
|
|
20032
|
-
name?: string;
|
|
20033
|
-
branch?: string;
|
|
20034
|
-
meta?: Record<string, unknown>;
|
|
20035
|
-
protocolVersions?: {
|
|
20036
|
-
[key: string]: number;
|
|
20037
|
-
};
|
|
20038
|
-
};
|
|
20039
|
-
type UpgradeDocumentActionInput = {
|
|
20040
|
-
model: string;
|
|
20041
|
-
fromVersion: number;
|
|
20042
|
-
toVersion: number;
|
|
20043
|
-
documentId: string;
|
|
20044
|
-
initialState?: object;
|
|
20045
|
-
};
|
|
20046
|
-
type DeleteDocumentActionInput = {
|
|
20047
|
-
documentId: string;
|
|
20048
|
-
propagate?: "none" | "cascade";
|
|
20049
|
-
};
|
|
20050
|
-
type AddRelationshipActionInput = {
|
|
20051
|
-
sourceId: string;
|
|
20052
|
-
targetId: string;
|
|
20053
|
-
relationshipType: string;
|
|
20054
|
-
metadata?: Record<string, unknown>;
|
|
20055
|
-
};
|
|
20056
|
-
type RemoveRelationshipActionInput = {
|
|
20057
|
-
sourceId: string;
|
|
20058
|
-
targetId: string;
|
|
20059
|
-
relationshipType: string;
|
|
20060
|
-
};
|
|
20061
|
-
type UpdateRelationshipActionInput = {
|
|
20062
|
-
sourceId: string;
|
|
20063
|
-
targetId: string;
|
|
20064
|
-
relationshipType: string;
|
|
20065
|
-
metadata: Record<string, unknown> | null;
|
|
20066
|
-
};
|
|
20067
|
-
type CreateDocumentAction = Action & {
|
|
20068
|
-
type: "CREATE_DOCUMENT";
|
|
20069
|
-
input: CreateDocumentActionInput;
|
|
20070
|
-
};
|
|
20071
|
-
type UpgradeDocumentAction = Action & {
|
|
20072
|
-
type: "UPGRADE_DOCUMENT";
|
|
20073
|
-
input: UpgradeDocumentActionInput;
|
|
20074
|
-
};
|
|
20075
|
-
type DeleteDocumentAction = Action & {
|
|
20076
|
-
type: "DELETE_DOCUMENT";
|
|
20077
|
-
input: DeleteDocumentActionInput;
|
|
20078
|
-
};
|
|
20079
|
-
type AddRelationshipAction = Action & {
|
|
20080
|
-
type: "ADD_RELATIONSHIP";
|
|
20081
|
-
input: AddRelationshipActionInput;
|
|
20082
|
-
};
|
|
20083
|
-
type RemoveRelationshipAction = Action & {
|
|
20084
|
-
type: "REMOVE_RELATIONSHIP";
|
|
20085
|
-
input: RemoveRelationshipActionInput;
|
|
20086
|
-
};
|
|
20087
|
-
type UpdateRelationshipAction = Action & {
|
|
20088
|
-
type: "UPDATE_RELATIONSHIP";
|
|
20089
|
-
input: UpdateRelationshipActionInput;
|
|
20090
|
-
};
|
|
20091
|
-
type DocumentAction = LoadStateAction | PruneAction | RedoAction | SetNameAction | SetPreferredEditorAction | UndoAction | NOOPAction;
|
|
20092
|
-
interface ISignal<TType extends string, TInput> {
|
|
20093
|
-
type: TType;
|
|
20094
|
-
input: TInput;
|
|
20095
|
-
}
|
|
20096
|
-
type ISignalResult<TTYpe, TInput, TResult> = {
|
|
20097
|
-
signal: {
|
|
20098
|
-
type: TTYpe;
|
|
20099
|
-
input: TInput;
|
|
20100
|
-
};
|
|
20101
|
-
result: TResult;
|
|
20618
|
+
data?: InputMaybe<Scalars["Unknown"]["input"]>;
|
|
20619
|
+
name: Scalars["String"]["input"];
|
|
20102
20620
|
};
|
|
20103
|
-
type
|
|
20104
|
-
|
|
20105
|
-
documentType: string;
|
|
20621
|
+
type MutationLoadStateArgs = {
|
|
20622
|
+
input: SchemaLoadStateAction;
|
|
20106
20623
|
};
|
|
20107
|
-
type
|
|
20108
|
-
|
|
20109
|
-
id: string;
|
|
20624
|
+
type MutationPruneArgs = {
|
|
20625
|
+
input: SchemaPruneAction;
|
|
20110
20626
|
};
|
|
20111
|
-
type
|
|
20112
|
-
|
|
20113
|
-
id: string;
|
|
20114
|
-
newId: string;
|
|
20627
|
+
type MutationRedoArgs = {
|
|
20628
|
+
input: SchemaRedoAction;
|
|
20115
20629
|
};
|
|
20116
|
-
type
|
|
20117
|
-
|
|
20118
|
-
type SignalDispatch = (signal: Signal) => void;
|
|
20119
|
-
type SignalResult = ISignalResult<CreateChildDocumentSignal["type"], CreateChildDocumentSignal["input"], PHDocument> | ISignalResult<CopyChildDocumentSignal["type"], CopyChildDocumentSignal["input"], boolean> | ISignalResult<DeleteChildDocumentSignal["type"], DeleteChildDocumentSignal["input"], PHDocument>;
|
|
20120
|
-
type SignalResults = {
|
|
20121
|
-
CREATE_CHILD_DOCUMENT: PHDocument;
|
|
20122
|
-
COPY_CHILD_DOCUMENT: PHDocument;
|
|
20123
|
-
DELETE_CHILD_DOCUMENT: boolean;
|
|
20630
|
+
type MutationSetNameArgs = {
|
|
20631
|
+
input: SchemaSetNameAction;
|
|
20124
20632
|
};
|
|
20125
|
-
type
|
|
20126
|
-
|
|
20127
|
-
type ReducerOptions = {
|
|
20128
|
-
/** The number of operations to skip before this new action is applied. This overrides the skip count in the operation. */skip?: number; /** When true the skip count is ignored and the action is applied regardless of the skip count */
|
|
20129
|
-
ignoreSkipOperations?: boolean; /** if true reuses the provided action resulting state instead of replaying it */
|
|
20130
|
-
reuseOperationResultingState?: boolean; /** if true checks the hashes of the operations */
|
|
20131
|
-
checkHashes?: boolean; /** Options for performing a replay. */
|
|
20132
|
-
replayOptions?: {
|
|
20133
|
-
/** The previously created operation to verify against. */operation: Operation;
|
|
20134
|
-
}; /** Optional parser for the operation resulting state, uses JSON.parse by default */
|
|
20135
|
-
operationResultingStateParser?: <TState>(state: string | null | undefined) => TState;
|
|
20136
|
-
/**
|
|
20137
|
-
* When true (default), the reducer will prune operations (garbage collect) when processing a skip.
|
|
20138
|
-
* When false, it will recompute state for the skip but preserve the existing operations history.
|
|
20139
|
-
*/
|
|
20140
|
-
pruneOnSkip?: boolean; /** The branch being operated on. Defaults to "main". */
|
|
20141
|
-
branch?: string;
|
|
20142
|
-
/**
|
|
20143
|
-
* Protocol version controlling undo/redo behavior.
|
|
20144
|
-
* - Version 1 (default): Legacy behavior with index reuse
|
|
20145
|
-
* - Version 2: Reactor behavior with monotonic indices
|
|
20146
|
-
*/
|
|
20147
|
-
protocolVersion?: number;
|
|
20148
|
-
/**
|
|
20149
|
-
* When true, skip index contiguity validation during replay.
|
|
20150
|
-
* Used for V2 state rebuild where gapped indices are expected.
|
|
20151
|
-
*/
|
|
20152
|
-
skipIndexValidation?: boolean;
|
|
20633
|
+
type MutationUndoArgs = {
|
|
20634
|
+
input: SchemaUndoAction;
|
|
20153
20635
|
};
|
|
20154
|
-
|
|
20155
|
-
|
|
20156
|
-
|
|
20157
|
-
|
|
20158
|
-
|
|
20159
|
-
type
|
|
20160
|
-
|
|
20161
|
-
* Object that indexes attachments of a Document.
|
|
20162
|
-
*
|
|
20163
|
-
* @remarks
|
|
20164
|
-
* This is used to reduce memory usage to avoid
|
|
20165
|
-
* multiple instances of the binary data of the attachments.
|
|
20166
|
-
*
|
|
20167
|
-
*/
|
|
20168
|
-
type FileRegistry = Record<AttachmentRef, Attachment>;
|
|
20169
|
-
type MappedOperation = {
|
|
20170
|
-
ignore: boolean;
|
|
20171
|
-
operation: Operation;
|
|
20636
|
+
type Prune = "PRUNE";
|
|
20637
|
+
type SchemaPruneAction = {
|
|
20638
|
+
id: Scalars["String"]["output"];
|
|
20639
|
+
timestampUtcMs: Scalars["DateTime"]["output"];
|
|
20640
|
+
input: PruneActionInput;
|
|
20641
|
+
type: Prune;
|
|
20642
|
+
scope: string;
|
|
20172
20643
|
};
|
|
20173
|
-
type
|
|
20174
|
-
|
|
20175
|
-
|
|
20176
|
-
signer: ActionSigner;
|
|
20177
|
-
action: Action;
|
|
20178
|
-
previousStateHash: string;
|
|
20644
|
+
type PruneActionInput = {
|
|
20645
|
+
end?: InputMaybe<Scalars["Int"]["input"]>;
|
|
20646
|
+
start?: InputMaybe<Scalars["Int"]["input"]>;
|
|
20179
20647
|
};
|
|
20180
|
-
type
|
|
20181
|
-
|
|
20182
|
-
|
|
20183
|
-
* Handler for verifying operation signatures.
|
|
20184
|
-
*
|
|
20185
|
-
* @param operation - The operation to verify
|
|
20186
|
-
* @param publicKey - The public key to verify against (from signer.app.key)
|
|
20187
|
-
* @returns Promise that resolves to true if signature is valid, false otherwise
|
|
20188
|
-
*/
|
|
20189
|
-
type SignatureVerificationHandler = (operation: Operation, publicKey: string) => Promise<boolean>;
|
|
20190
|
-
type ENSInfo = {
|
|
20191
|
-
name?: string;
|
|
20192
|
-
avatarUrl?: string;
|
|
20648
|
+
type Query = {
|
|
20649
|
+
__typename?: "Query";
|
|
20650
|
+
document: Maybe<IDocument>;
|
|
20193
20651
|
};
|
|
20194
|
-
type
|
|
20195
|
-
|
|
20196
|
-
|
|
20197
|
-
chainId: number;
|
|
20198
|
-
ens?: ENSInfo;
|
|
20652
|
+
type Redo = "REDO";
|
|
20653
|
+
type RedoActionInput = {
|
|
20654
|
+
count: Scalars["Int"]["input"];
|
|
20199
20655
|
};
|
|
20200
|
-
type
|
|
20201
|
-
|
|
20202
|
-
|
|
20203
|
-
|
|
20204
|
-
|
|
20656
|
+
type SchemaRedoAction = {
|
|
20657
|
+
id: Scalars["String"]["output"];
|
|
20658
|
+
timestampUtcMs: Scalars["DateTime"]["output"];
|
|
20659
|
+
input: RedoActionInput;
|
|
20660
|
+
type: Redo;
|
|
20661
|
+
scope: string;
|
|
20205
20662
|
};
|
|
20206
|
-
type
|
|
20207
|
-
type
|
|
20208
|
-
|
|
20209
|
-
children?: ReactNode;
|
|
20210
|
-
className?: string;
|
|
20211
|
-
document?: PHDocument;
|
|
20663
|
+
type Set_Name = "SET_NAME";
|
|
20664
|
+
type SetNameActionInput = {
|
|
20665
|
+
name: Scalars["String"]["input"];
|
|
20212
20666
|
};
|
|
20213
|
-
type
|
|
20214
|
-
id:
|
|
20215
|
-
|
|
20216
|
-
|
|
20217
|
-
|
|
20667
|
+
type SchemaSetNameAction = {
|
|
20668
|
+
id: Scalars["String"]["output"];
|
|
20669
|
+
timestampUtcMs: Scalars["DateTime"]["output"];
|
|
20670
|
+
input: SetNameActionInput;
|
|
20671
|
+
type: Set_Name;
|
|
20672
|
+
scope: "global";
|
|
20218
20673
|
};
|
|
20219
|
-
type
|
|
20220
|
-
|
|
20221
|
-
|
|
20222
|
-
|
|
20223
|
-
|
|
20224
|
-
|
|
20225
|
-
|
|
20674
|
+
type SetNameOperation = IOperation & {
|
|
20675
|
+
__typename?: "SetNameOperation";
|
|
20676
|
+
hash: Scalars["String"]["output"];
|
|
20677
|
+
index: Scalars["Int"]["output"];
|
|
20678
|
+
input: Scalars["String"]["output"];
|
|
20679
|
+
timestamp: Scalars["DateTime"]["output"];
|
|
20680
|
+
type: Scalars["String"]["output"];
|
|
20226
20681
|
};
|
|
20227
|
-
type
|
|
20228
|
-
|
|
20229
|
-
|
|
20682
|
+
type Set_PreferredEditor = "SET_PREFERRED_EDITOR";
|
|
20683
|
+
type SetPreferredEditorActionInput = {
|
|
20684
|
+
preferredEditor: Scalars["String"]["input"] | null;
|
|
20230
20685
|
};
|
|
20231
|
-
type
|
|
20232
|
-
|
|
20233
|
-
|
|
20234
|
-
|
|
20235
|
-
|
|
20236
|
-
|
|
20686
|
+
type SchemaSetPreferredEditorAction = {
|
|
20687
|
+
id: Scalars["String"]["output"];
|
|
20688
|
+
timestampUtcMs: Scalars["DateTime"]["output"];
|
|
20689
|
+
input: SetPreferredEditorActionInput;
|
|
20690
|
+
type: Set_PreferredEditor;
|
|
20691
|
+
scope: "header";
|
|
20237
20692
|
};
|
|
20238
|
-
type
|
|
20239
|
-
|
|
20240
|
-
|
|
20241
|
-
|
|
20242
|
-
|
|
20693
|
+
type SetPreferredEditorOperation = IOperation & {
|
|
20694
|
+
__typename?: "SetPreferredEditorOperation";
|
|
20695
|
+
hash: Scalars["String"]["output"];
|
|
20696
|
+
index: Scalars["Int"]["output"];
|
|
20697
|
+
input: SetPreferredEditorActionInput;
|
|
20698
|
+
timestamp: Scalars["DateTime"]["output"];
|
|
20699
|
+
type: Scalars["String"]["output"];
|
|
20243
20700
|
};
|
|
20244
|
-
|
|
20245
|
-
|
|
20246
|
-
|
|
20247
|
-
type SigningParameters = {
|
|
20248
|
-
documentType: string;
|
|
20249
|
-
createdAtUtcIso: string;
|
|
20250
|
-
/**
|
|
20251
|
-
* The nonce can act as both a salt and a typical nonce.
|
|
20252
|
-
*/
|
|
20253
|
-
nonce: string;
|
|
20701
|
+
type Undo = "UNDO";
|
|
20702
|
+
type UndoActionInput = {
|
|
20703
|
+
count: Scalars["Int"]["input"];
|
|
20254
20704
|
};
|
|
20255
|
-
|
|
20256
|
-
|
|
20257
|
-
|
|
20258
|
-
|
|
20259
|
-
|
|
20260
|
-
|
|
20261
|
-
/** The app associated with the signer */
|
|
20262
|
-
app?: AppActionSigner;
|
|
20263
|
-
/** The corresponding public key */
|
|
20264
|
-
publicKey: CryptoKey;
|
|
20265
|
-
/**
|
|
20266
|
-
* Signs raw data (used for document header signing).
|
|
20267
|
-
*
|
|
20268
|
-
* @param data - The data to sign.
|
|
20269
|
-
* @returns The signature of the data.
|
|
20270
|
-
*/
|
|
20271
|
-
sign: (data: Uint8Array) => Promise<Uint8Array>;
|
|
20272
|
-
/**
|
|
20273
|
-
* Verifies a signature.
|
|
20274
|
-
*
|
|
20275
|
-
* @param data - The data to verify.
|
|
20276
|
-
* @param signature - The signature to verify.
|
|
20277
|
-
*/
|
|
20278
|
-
verify: (data: Uint8Array, signature: Uint8Array) => Promise<void>;
|
|
20279
|
-
/**
|
|
20280
|
-
* Signs an action (used for operation signing).
|
|
20281
|
-
*
|
|
20282
|
-
* @param action - The action to sign.
|
|
20283
|
-
* @param abortSignal - Optional abort signal to cancel the signing.
|
|
20284
|
-
* @returns The signature tuple.
|
|
20285
|
-
*/
|
|
20286
|
-
signAction: (action: Action, abortSignal?: AbortSignal) => Promise<Signature>;
|
|
20287
|
-
}
|
|
20288
|
-
type IsStateOfType<TState> = (state: unknown) => state is TState;
|
|
20289
|
-
type AssertIsStateOfType<TState> = (state: unknown) => asserts state is TState;
|
|
20290
|
-
type IsDocumentOfType<TState extends PHBaseState> = (document: unknown) => document is PHDocument<TState>;
|
|
20291
|
-
type AssertIsDocumentOfType<TState extends PHBaseState> = (document: unknown) => asserts document is PHDocument<TState>;
|
|
20292
|
-
type PartialState<TState> = TState | Partial<TState>;
|
|
20293
|
-
type CreateState<TState extends PHBaseState = PHBaseState> = (state?: PartialState<TState>) => TState;
|
|
20294
|
-
type SaveToFileHandle = (document: PHDocument, input: FileSystemFileHandle) => void | Promise<void>;
|
|
20295
|
-
type SaveToFile = (document: PHDocument, path: string, name?: string) => string | Promise<string>;
|
|
20296
|
-
type LoadFromInput<TState extends PHBaseState = PHBaseState> = (input: FileInput) => PHDocument<TState> | Promise<PHDocument<TState>>;
|
|
20297
|
-
type LoadFromFile<TState extends PHBaseState = PHBaseState> = (path: string) => PHDocument<TState> | Promise<PHDocument<TState>>;
|
|
20298
|
-
type CreateDocument<TState extends PHBaseState = PHBaseState> = (initialState?: Partial<TState>, createState?: CreateState<TState>) => PHDocument<TState>;
|
|
20299
|
-
type MinimalBackupData = {
|
|
20300
|
-
documentId: string;
|
|
20301
|
-
documentType: string;
|
|
20302
|
-
branch: string;
|
|
20303
|
-
state: PHBaseState;
|
|
20304
|
-
name: string;
|
|
20705
|
+
type SchemaUndoAction = {
|
|
20706
|
+
id: Scalars["String"]["output"];
|
|
20707
|
+
timestampUtcMs: Scalars["DateTime"]["output"];
|
|
20708
|
+
input: UndoActionInput;
|
|
20709
|
+
type: Undo;
|
|
20710
|
+
scope: string;
|
|
20305
20711
|
};
|
|
20306
|
-
type
|
|
20307
|
-
|
|
20308
|
-
|
|
20309
|
-
|
|
20310
|
-
|
|
20311
|
-
|
|
20312
|
-
isStateOfType: IsStateOfType<TState>;
|
|
20313
|
-
assertIsStateOfType: AssertIsStateOfType<TState>;
|
|
20314
|
-
isDocumentOfType: IsDocumentOfType<TState>;
|
|
20315
|
-
assertIsDocumentOfType: AssertIsDocumentOfType<TState>;
|
|
20712
|
+
type SchemaNOOPAction = {
|
|
20713
|
+
id: Scalars["String"]["output"];
|
|
20714
|
+
input: Scalars["Unknown"]["input"];
|
|
20715
|
+
scope: string;
|
|
20716
|
+
timestampUtcMs: Scalars["DateTime"]["output"];
|
|
20717
|
+
type: "NOOP";
|
|
20316
20718
|
};
|
|
20317
|
-
type
|
|
20318
|
-
type
|
|
20319
|
-
|
|
20320
|
-
reducer: Reducer<TState>;
|
|
20321
|
-
actions: Actions;
|
|
20322
|
-
utils: DocumentModelUtils<TState>;
|
|
20323
|
-
documentModel: DocumentModelPHState;
|
|
20719
|
+
type LoadStateAction = Action & {
|
|
20720
|
+
type: "LOAD_STATE";
|
|
20721
|
+
input: LoadStateActionInput;
|
|
20324
20722
|
};
|
|
20325
|
-
type
|
|
20326
|
-
|
|
20327
|
-
|
|
20328
|
-
editors: readonly EditorModule[];
|
|
20329
|
-
subgraphs?: readonly SubgraphModule[];
|
|
20330
|
-
upgradeManifests?: readonly UpgradeManifest<readonly number[]>[] | undefined;
|
|
20331
|
-
processorFactory?: ProcessorFactoryBuilder;
|
|
20723
|
+
type PruneAction = Action & {
|
|
20724
|
+
type: "PRUNE";
|
|
20725
|
+
input: PruneActionInput;
|
|
20332
20726
|
};
|
|
20333
|
-
type
|
|
20334
|
-
type
|
|
20335
|
-
|
|
20336
|
-
type PowerhouseModule = z.infer<typeof PowerhouseModuleSchema>;
|
|
20337
|
-
type Publisher = z.infer<typeof PublisherSchema>;
|
|
20338
|
-
type Manifest = z.infer<typeof ManifestSchema>;
|
|
20339
|
-
//#endregion
|
|
20340
|
-
//#region document-model/state.d.ts
|
|
20341
|
-
/**
|
|
20342
|
-
* Creates a default PHAuthState
|
|
20343
|
-
*/
|
|
20344
|
-
declare function defaultAuthState(): PHAuthState;
|
|
20345
|
-
/**
|
|
20346
|
-
* Creates a default PHDocumentState
|
|
20347
|
-
*/
|
|
20348
|
-
declare function defaultDocumentState(): PHDocumentState;
|
|
20349
|
-
/**
|
|
20350
|
-
* Creates a default PHBaseState with auth and document properties
|
|
20351
|
-
*/
|
|
20352
|
-
declare function defaultBaseState(): PHBaseState;
|
|
20353
|
-
/**
|
|
20354
|
-
* Creates a PHAuthState with the given properties
|
|
20355
|
-
*/
|
|
20356
|
-
declare function createAuthState(auth?: Partial<PHAuthState>): PHAuthState;
|
|
20357
|
-
/**
|
|
20358
|
-
* Creates a PHDocumentState with the given properties
|
|
20359
|
-
*/
|
|
20360
|
-
declare function createDocumentState(document?: Partial<PHDocumentState>): PHDocumentState;
|
|
20361
|
-
/**
|
|
20362
|
-
* Creates a PHBaseState with the given auth and document properties
|
|
20363
|
-
*/
|
|
20364
|
-
declare function createBaseState(auth?: Partial<PHAuthState>, document?: Partial<PHDocumentState>): PHBaseState;
|
|
20365
|
-
/**
|
|
20366
|
-
* The document state of the document.
|
|
20367
|
-
*/
|
|
20368
|
-
type PHDocumentState = {
|
|
20369
|
-
/**
|
|
20370
|
-
* The current document model schema version of the document. This is used
|
|
20371
|
-
* with the UPGRADE_DOCUMENT operation to specify the DocumentModelModule
|
|
20372
|
-
* version to use for reducer execution.
|
|
20373
|
-
*/
|
|
20374
|
-
version: number; /** Hash configuration for operation state verification */
|
|
20375
|
-
hash: HashConfig; /** True if and only if the document has been deleted */
|
|
20376
|
-
isDeleted?: boolean; /** The timestamp when the document was deleted, in UTC ISO format */
|
|
20377
|
-
deletedAtUtcIso?: string; /** Optional: who deleted the document */
|
|
20378
|
-
deletedBy?: string; /** Optional: reason for deletion */
|
|
20379
|
-
deletionReason?: string;
|
|
20727
|
+
type RedoAction = Action & {
|
|
20728
|
+
type: "REDO";
|
|
20729
|
+
input: SchemaRedoAction["input"];
|
|
20380
20730
|
};
|
|
20381
|
-
|
|
20382
|
-
|
|
20383
|
-
|
|
20384
|
-
* This has yet to be implemented.
|
|
20385
|
-
*/
|
|
20386
|
-
type PHAuthState = {};
|
|
20387
|
-
/**
|
|
20388
|
-
* The base state of the document.
|
|
20389
|
-
*/
|
|
20390
|
-
type PHBaseState = {
|
|
20391
|
-
/** Carries authentication information. */auth: PHAuthState; /** Carries information about the document. */
|
|
20392
|
-
document: PHDocumentState;
|
|
20731
|
+
type SetNameAction = Action & {
|
|
20732
|
+
type: "SET_NAME";
|
|
20733
|
+
input: SchemaSetNameAction["input"];
|
|
20393
20734
|
};
|
|
20394
|
-
|
|
20395
|
-
|
|
20396
|
-
|
|
20397
|
-
|
|
20398
|
-
|
|
20399
|
-
|
|
20400
|
-
|
|
20401
|
-
|
|
20402
|
-
|
|
20403
|
-
|
|
20404
|
-
|
|
20405
|
-
|
|
20406
|
-
|
|
20407
|
-
|
|
20408
|
-
|
|
20409
|
-
|
|
20735
|
+
type SetPreferredEditorAction = Action & {
|
|
20736
|
+
type: "SET_PREFERRED_EDITOR";
|
|
20737
|
+
input: SchemaSetPreferredEditorAction["input"];
|
|
20738
|
+
};
|
|
20739
|
+
type UndoAction = Action & {
|
|
20740
|
+
type: "UNDO";
|
|
20741
|
+
input: SchemaUndoAction["input"];
|
|
20742
|
+
};
|
|
20743
|
+
type NOOPAction = Action & {
|
|
20744
|
+
type: "NOOP";
|
|
20745
|
+
input: SchemaNOOPAction["input"];
|
|
20746
|
+
};
|
|
20747
|
+
type CreateDocumentActionInput = {
|
|
20748
|
+
model: string;
|
|
20749
|
+
version: 0;
|
|
20750
|
+
documentId: string;
|
|
20751
|
+
signing?: {
|
|
20752
|
+
signature: string;
|
|
20753
|
+
publicKey: JsonWebKey;
|
|
20754
|
+
nonce: string;
|
|
20410
20755
|
createdAtUtcIso: string;
|
|
20411
|
-
|
|
20412
|
-
|
|
20413
|
-
|
|
20414
|
-
|
|
20415
|
-
|
|
20416
|
-
|
|
20417
|
-
|
|
20418
|
-
|
|
20419
|
-
};
|
|
20420
|
-
meta?: PHDocumentMeta;
|
|
20756
|
+
documentType: string;
|
|
20757
|
+
};
|
|
20758
|
+
slug?: string;
|
|
20759
|
+
name?: string;
|
|
20760
|
+
branch?: string;
|
|
20761
|
+
meta?: Record<string, unknown>;
|
|
20762
|
+
protocolVersions?: {
|
|
20763
|
+
[key: string]: number;
|
|
20421
20764
|
};
|
|
20422
20765
|
};
|
|
20423
|
-
|
|
20424
|
-
|
|
20425
|
-
|
|
20426
|
-
|
|
20427
|
-
|
|
20428
|
-
|
|
20429
|
-
skip: number;
|
|
20430
|
-
reuseLastOperationIndex: boolean;
|
|
20766
|
+
type UpgradeDocumentActionInput = {
|
|
20767
|
+
model: string;
|
|
20768
|
+
fromVersion: number;
|
|
20769
|
+
toVersion: number;
|
|
20770
|
+
documentId: string;
|
|
20771
|
+
initialState?: object;
|
|
20431
20772
|
};
|
|
20432
|
-
|
|
20433
|
-
|
|
20434
|
-
|
|
20435
|
-
* - Never reuses operation index (always increments)
|
|
20436
|
-
* - Always sets skip=1 (consecutive NOOPs are handled during rebuild/GC)
|
|
20437
|
-
* - No complex skip calculation - simpler model where each UNDO is independent
|
|
20438
|
-
*/
|
|
20439
|
-
declare function undoOperationV2<TDocument extends PHDocument>(document: TDocument, action: Action, skip: number): {
|
|
20440
|
-
document: TDocument;
|
|
20441
|
-
action: Action;
|
|
20442
|
-
skip: number;
|
|
20443
|
-
reuseLastOperationIndex: false;
|
|
20773
|
+
type DeleteDocumentActionInput = {
|
|
20774
|
+
documentId: string;
|
|
20775
|
+
propagate?: "none" | "cascade";
|
|
20444
20776
|
};
|
|
20445
|
-
|
|
20446
|
-
|
|
20447
|
-
|
|
20448
|
-
|
|
20449
|
-
|
|
20777
|
+
type AddRelationshipActionInput = {
|
|
20778
|
+
sourceId: string;
|
|
20779
|
+
targetId: string;
|
|
20780
|
+
relationshipType: string;
|
|
20781
|
+
metadata?: Record<string, unknown>;
|
|
20450
20782
|
};
|
|
20451
|
-
|
|
20452
|
-
|
|
20453
|
-
|
|
20454
|
-
|
|
20455
|
-
|
|
20456
|
-
|
|
20457
|
-
|
|
20458
|
-
|
|
20459
|
-
|
|
20460
|
-
|
|
20461
|
-
|
|
20462
|
-
|
|
20463
|
-
|
|
20464
|
-
|
|
20465
|
-
* B gets A's Operations Scenario:
|
|
20466
|
-
* B' - [(0, 0, 0, "B0"), (1, 0, 3, "B1"), (2, 1, 1, "A0"), (3, 0, 2, "A1"), (4, 0, 3, "B1")]
|
|
20467
|
-
* Then A needs to end up with:
|
|
20468
|
-
* A' - [(0, 0, 1, "A0"), (1, 0, 2, "A1"), (2, 2, 0, "B0"), (3, 0, 1, "A0"), (4, 0, 2, "A1"), (5, 0, 3, "B1")]
|
|
20469
|
-
* So that both A and B end up with the stream of actions (action):
|
|
20470
|
-
* [("B0"), ("A0"), ("A1"), ("B1")]
|
|
20471
|
-
*
|
|
20472
|
-
* @typeParam A - The type of the action.
|
|
20473
|
-
*/
|
|
20474
|
-
type Operation = {
|
|
20475
|
-
/**
|
|
20476
|
-
* This is a stable id, derived from various document and action properties
|
|
20477
|
-
* in deriveOperationId().
|
|
20478
|
-
*
|
|
20479
|
-
* It _cannot_ be an arbitrary string.
|
|
20480
|
-
*
|
|
20481
|
-
* It it also not unique per operation, as reshuffled operations will keep'
|
|
20482
|
-
* the same id they had before they were reshuffled. This means that the
|
|
20483
|
-
* IOperationStore may have multiple operations with the same operation id.
|
|
20484
|
-
**/
|
|
20485
|
-
id: string; /** Position of the operation in the history. This is relative to a specific reactor -- they may not all agree on this value. */
|
|
20486
|
-
index: number; /** The number of operations skipped with this Operation. This is relative to a specific reactor -- they may not all agree on this value. */
|
|
20487
|
-
skip: number; /** Timestamp of when the operation was added */
|
|
20488
|
-
timestampUtcMs: string; /** Hash of the resulting document data after the operation */
|
|
20489
|
-
hash: string; /** Error message for a failed action */
|
|
20490
|
-
error?: string; /** The resulting state after the operation */
|
|
20491
|
-
resultingState?: string;
|
|
20492
|
-
/**
|
|
20493
|
-
* The action that was applied to the document to produce this operation.
|
|
20494
|
-
*/
|
|
20495
|
-
action: Action;
|
|
20783
|
+
type RemoveRelationshipActionInput = {
|
|
20784
|
+
sourceId: string;
|
|
20785
|
+
targetId: string;
|
|
20786
|
+
relationshipType: string;
|
|
20787
|
+
};
|
|
20788
|
+
type UpdateRelationshipActionInput = {
|
|
20789
|
+
sourceId: string;
|
|
20790
|
+
targetId: string;
|
|
20791
|
+
relationshipType: string;
|
|
20792
|
+
metadata: Record<string, unknown> | null;
|
|
20793
|
+
};
|
|
20794
|
+
type CreateDocumentAction = Action & {
|
|
20795
|
+
type: "CREATE_DOCUMENT";
|
|
20796
|
+
input: CreateDocumentActionInput;
|
|
20496
20797
|
};
|
|
20497
|
-
|
|
20498
|
-
|
|
20499
|
-
|
|
20500
|
-
* This will be removed in a future release.
|
|
20501
|
-
*
|
|
20502
|
-
* TODO: Type should be Partial<Record<string, Operation[]>>,
|
|
20503
|
-
* but that is a breaking change for codegen + external doc models.
|
|
20504
|
-
*/
|
|
20505
|
-
type DocumentOperations = Record<string, Operation[]>;
|
|
20506
|
-
type OperationContext = {
|
|
20507
|
-
documentId: string;
|
|
20508
|
-
documentType: string;
|
|
20509
|
-
scope: string;
|
|
20510
|
-
branch: string;
|
|
20511
|
-
resultingState?: string;
|
|
20512
|
-
ordinal: number;
|
|
20798
|
+
type UpgradeDocumentAction = Action & {
|
|
20799
|
+
type: "UPGRADE_DOCUMENT";
|
|
20800
|
+
input: UpgradeDocumentActionInput;
|
|
20513
20801
|
};
|
|
20514
|
-
type
|
|
20515
|
-
|
|
20516
|
-
|
|
20802
|
+
type DeleteDocumentAction = Action & {
|
|
20803
|
+
type: "DELETE_DOCUMENT";
|
|
20804
|
+
input: DeleteDocumentActionInput;
|
|
20517
20805
|
};
|
|
20518
|
-
|
|
20519
|
-
|
|
20520
|
-
|
|
20521
|
-
type PHDocumentMeta = {
|
|
20522
|
-
/** The preferred editor for the document. */preferredEditor?: string;
|
|
20806
|
+
type AddRelationshipAction = Action & {
|
|
20807
|
+
type: "ADD_RELATIONSHIP";
|
|
20808
|
+
input: AddRelationshipActionInput;
|
|
20523
20809
|
};
|
|
20524
|
-
|
|
20525
|
-
|
|
20526
|
-
|
|
20527
|
-
type PHDocumentHeader = {
|
|
20528
|
-
/**
|
|
20529
|
-
* The id of the document.
|
|
20530
|
-
*
|
|
20531
|
-
* This is a Ed25519 signature and is immutable.
|
|
20532
|
-
**/
|
|
20533
|
-
id: string;
|
|
20534
|
-
/**
|
|
20535
|
-
* Information to verify the document creator.
|
|
20536
|
-
*
|
|
20537
|
-
* This is immutable.
|
|
20538
|
-
**/
|
|
20539
|
-
sig: PHDocumentSignatureInfo;
|
|
20540
|
-
/**
|
|
20541
|
-
* The type of the document.
|
|
20542
|
-
*
|
|
20543
|
-
* This is used as part of the signature payload and thus, cannot be changed
|
|
20544
|
-
* after the document header has been created.
|
|
20545
|
-
**/
|
|
20546
|
-
documentType: string;
|
|
20547
|
-
/**
|
|
20548
|
-
* The timestamp of the creation date of the document, in UTC ISO format.
|
|
20549
|
-
*
|
|
20550
|
-
* This is used as part of the signature payload and thus, cannot be changed
|
|
20551
|
-
* after the document header has been created.
|
|
20552
|
-
**/
|
|
20553
|
-
createdAtUtcIso: string; /** The slug of the document. */
|
|
20554
|
-
slug: string; /** The name of the document. */
|
|
20555
|
-
name: string; /** The branch of this document. */
|
|
20556
|
-
branch: string;
|
|
20557
|
-
/**
|
|
20558
|
-
* The revision of each scope of the document. This object is updated every
|
|
20559
|
-
* time any _other_ scope is updated.
|
|
20560
|
-
*/
|
|
20561
|
-
revision: {
|
|
20562
|
-
[scope: string]: number;
|
|
20563
|
-
};
|
|
20564
|
-
/**
|
|
20565
|
-
* The timestamp of the last change in the document, in UTC ISO format.
|
|
20566
|
-
**/
|
|
20567
|
-
lastModifiedAtUtcIso: string;
|
|
20568
|
-
/**
|
|
20569
|
-
* This is a map from protocol name to version. A protocol can be any set of
|
|
20570
|
-
* rules that are applied to the document.
|
|
20571
|
-
*
|
|
20572
|
-
* Examples of protocols include:
|
|
20573
|
-
*
|
|
20574
|
-
* - "base-reducer"
|
|
20575
|
-
*/
|
|
20576
|
-
protocolVersions?: {
|
|
20577
|
-
[key: string]: number;
|
|
20578
|
-
}; /** Meta information about the document. */
|
|
20579
|
-
meta?: PHDocumentMeta;
|
|
20810
|
+
type RemoveRelationshipAction = Action & {
|
|
20811
|
+
type: "REMOVE_RELATIONSHIP";
|
|
20812
|
+
input: RemoveRelationshipActionInput;
|
|
20580
20813
|
};
|
|
20581
|
-
|
|
20582
|
-
|
|
20583
|
-
|
|
20584
|
-
* @remarks
|
|
20585
|
-
* This type is extended by all Document models.
|
|
20586
|
-
*
|
|
20587
|
-
* @typeParam TState - The type of the document state.
|
|
20588
|
-
*/
|
|
20589
|
-
type PHDocument<TState extends PHBaseState = PHBaseState> = {
|
|
20590
|
-
/** The header of the document. */header: PHDocumentHeader; /** The document model specific state. */
|
|
20591
|
-
state: TState;
|
|
20592
|
-
/**
|
|
20593
|
-
* The initial state of the document, enabling replaying operations.
|
|
20594
|
-
*
|
|
20595
|
-
* This will be removed in a future release.
|
|
20596
|
-
*/
|
|
20597
|
-
initialState: TState;
|
|
20598
|
-
/**
|
|
20599
|
-
* The operations history of the document.
|
|
20600
|
-
*
|
|
20601
|
-
* This will be removed in a future release.
|
|
20602
|
-
*/
|
|
20603
|
-
operations: DocumentOperations;
|
|
20604
|
-
/**
|
|
20605
|
-
* A list of undone operations
|
|
20606
|
-
*
|
|
20607
|
-
* This will be removed in a future release.
|
|
20608
|
-
*/
|
|
20609
|
-
clipboard: Operation[];
|
|
20814
|
+
type UpdateRelationshipAction = Action & {
|
|
20815
|
+
type: "UPDATE_RELATIONSHIP";
|
|
20816
|
+
input: UpdateRelationshipActionInput;
|
|
20610
20817
|
};
|
|
20611
|
-
|
|
20612
|
-
|
|
20613
|
-
|
|
20614
|
-
|
|
20615
|
-
}>(op: Partial<TOp>): boolean;
|
|
20616
|
-
declare function isUndoRedo(action: Action): action is UndoRedoAction;
|
|
20617
|
-
declare function isUndo(action: Action): action is UndoAction;
|
|
20618
|
-
declare function isDocumentAction(action: Action): action is DocumentAction;
|
|
20619
|
-
/**
|
|
20620
|
-
* Creates a new document. When `documentType` is given the header is stamped
|
|
20621
|
-
* with it and the document-scope operations are seeded.
|
|
20622
|
-
*/
|
|
20623
|
-
declare function baseCreateDocument<TState extends PHBaseState = PHBaseState>(createState: CreateState<TState>, initialState?: Partial<TState>, documentType?: string): PHDocument<TState>;
|
|
20624
|
-
declare function hashDocumentStateForScope(document: {
|
|
20625
|
-
state: {
|
|
20626
|
-
[key: string]: unknown;
|
|
20627
|
-
};
|
|
20628
|
-
}, scope?: string): string;
|
|
20629
|
-
declare function readOnly<T>(value: T): Readonly<T>;
|
|
20630
|
-
/**
|
|
20631
|
-
* Maps skipped operations in an array of operations.
|
|
20632
|
-
* Skipped operations are operations that are ignored during processing.
|
|
20633
|
-
* @param operations - The array of operations to map.
|
|
20634
|
-
* @param skippedHeadOperations - The number of operations to skip at the head of the array of operations.
|
|
20635
|
-
* @returns An array of mapped operations with ignore flag indicating if the operation is skipped.
|
|
20636
|
-
* @throws Error if the operation index is invalid and there are missing operations.
|
|
20637
|
-
*/
|
|
20638
|
-
declare function mapSkippedOperations(operations: Operation[], skippedHeadOperations?: number): MappedOperation[];
|
|
20639
|
-
/**
|
|
20640
|
-
* V2 version of mapSkippedOperations for protocol version 2+.
|
|
20641
|
-
* In V2, all NOOPs have skip=1 and consecutive NOOPs form chains.
|
|
20642
|
-
* N consecutive NOOPs at any point skip N preceding content operations.
|
|
20643
|
-
*
|
|
20644
|
-
* Algorithm: Process from end to start
|
|
20645
|
-
* - When hitting a NOOP: increment chain length, mark as ignored
|
|
20646
|
-
* - When hitting a non-NOOP:
|
|
20647
|
-
* - If chain > 0: decrement chain, mark as ignored (this op was undone)
|
|
20648
|
-
* - If chain == 0: mark as not ignored (apply this op)
|
|
20649
|
-
*/
|
|
20650
|
-
declare function mapSkippedOperationsV2(operations: Operation[]): MappedOperation[];
|
|
20651
|
-
/**
|
|
20652
|
-
* V2 garbage collect that returns only operations that should be applied for state.
|
|
20653
|
-
* Uses the V2 model where consecutive NOOPs form chains.
|
|
20654
|
-
* Unlike V1 garbageCollect, this preserves ALL operations but marks which to apply.
|
|
20655
|
-
*/
|
|
20656
|
-
declare function garbageCollectV2<TOpIndex extends OperationIndex>(sortedOperations: TOpIndex[]): TOpIndex[];
|
|
20657
|
-
declare function sortMappedOperations(operations: DocumentOperationsIgnoreMap): MappedOperation[];
|
|
20658
|
-
declare function replayDocument<TState extends PHBaseState = PHBaseState>(initialState: TState, operations: DocumentOperations, reducer: Reducer<TState>, header: PHDocumentHeader, dispatch?: SignalDispatch, skipHeaderOperations?: SkipHeaderOperations, options?: ReplayDocumentOptions): PHDocument<TState>;
|
|
20659
|
-
declare function parseResultingState<TState>(state: string | null | undefined): TState;
|
|
20660
|
-
declare enum IntegrityIssueType {
|
|
20661
|
-
UNEXPECTED_INDEX = "UNEXPECTED_INDEX"
|
|
20662
|
-
}
|
|
20663
|
-
declare enum IntegrityIssueSubType {
|
|
20664
|
-
DUPLICATED_INDEX = "DUPLICATED_INDEX",
|
|
20665
|
-
MISSING_INDEX = "MISSING_INDEX"
|
|
20818
|
+
type DocumentAction = LoadStateAction | PruneAction | RedoAction | SetNameAction | SetPreferredEditorAction | UndoAction | NOOPAction;
|
|
20819
|
+
interface ISignal<TType extends string, TInput> {
|
|
20820
|
+
type: TType;
|
|
20821
|
+
input: TInput;
|
|
20666
20822
|
}
|
|
20667
|
-
type
|
|
20668
|
-
|
|
20669
|
-
|
|
20670
|
-
|
|
20671
|
-
|
|
20672
|
-
|
|
20673
|
-
type Reshuffle = (startIndex: OperationIndex, opsA: Operation[], opsB: Operation[]) => Operation[];
|
|
20674
|
-
declare function checkCleanedOperationsIntegrity(sortedOperations: OperationIndex[]): IntegrityIssue[];
|
|
20675
|
-
declare function garbageCollect<TOpIndex extends OperationIndex>(sortedOperations: TOpIndex[]): TOpIndex[];
|
|
20676
|
-
declare function addUndo(sortedOperations: Operation[]): Operation[];
|
|
20677
|
-
declare function sortOperations<TOpIndex extends OperationIndex>(operations: TOpIndex[]): TOpIndex[];
|
|
20678
|
-
declare function reshuffleByTimestamp<TOp extends OperationIndex>(startIndex: OperationIndex, opsA: TOp[], opsB: TOp[]): TOp[];
|
|
20679
|
-
declare function reshuffleByTimestampAndIndex<TOp extends OperationIndex>(startIndex: OperationIndex, opsA: TOp[], opsB: TOp[]): TOp[];
|
|
20680
|
-
declare function operationsAreEqual<TOp extends {
|
|
20681
|
-
index: number;
|
|
20682
|
-
skip: number;
|
|
20683
|
-
type?: string;
|
|
20684
|
-
scope?: string;
|
|
20685
|
-
input?: unknown;
|
|
20686
|
-
}>(op1: TOp, op2: TOp): boolean;
|
|
20687
|
-
declare function attachBranch(trunk: Operation[], newBranch: Operation[]): [Operation[], Operation[]];
|
|
20688
|
-
declare function precedes(op1: OperationIndex, op2: OperationIndex): boolean;
|
|
20689
|
-
declare function split(sortedTargetOperations: Operation[], sortedMergeOperations: Operation[]): [Operation[], Operation[], Operation[]];
|
|
20690
|
-
declare function merge(sortedTargetOperations: Operation[], sortedMergeOperations: Operation[], reshuffle: Reshuffle): Operation[];
|
|
20691
|
-
declare function nextSkipNumber(sortedOperations: OperationIndex[]): number;
|
|
20692
|
-
declare function checkOperationsIntegrity(operations: Operation[]): IntegrityIssue[];
|
|
20693
|
-
declare function groupOperationsByScope(operations: Operation[]): Partial<Record<string, Operation[]>>;
|
|
20694
|
-
type PrepareOperationsResult = {
|
|
20695
|
-
validOperations: Operation[];
|
|
20696
|
-
invalidOperations: Operation[];
|
|
20697
|
-
duplicatedOperations: Operation[];
|
|
20698
|
-
integrityIssues: IntegrityIssue[];
|
|
20823
|
+
type ISignalResult<TTYpe, TInput, TResult> = {
|
|
20824
|
+
signal: {
|
|
20825
|
+
type: TTYpe;
|
|
20826
|
+
input: TInput;
|
|
20827
|
+
};
|
|
20828
|
+
result: TResult;
|
|
20699
20829
|
};
|
|
20700
|
-
|
|
20701
|
-
|
|
20702
|
-
|
|
20703
|
-
|
|
20704
|
-
|
|
20705
|
-
|
|
20706
|
-
|
|
20707
|
-
|
|
20708
|
-
|
|
20709
|
-
|
|
20710
|
-
|
|
20711
|
-
|
|
20712
|
-
|
|
20713
|
-
|
|
20714
|
-
|
|
20715
|
-
|
|
20716
|
-
|
|
20717
|
-
|
|
20718
|
-
|
|
20719
|
-
|
|
20720
|
-
|
|
20721
|
-
}
|
|
20722
|
-
|
|
20723
|
-
|
|
20724
|
-
|
|
20725
|
-
|
|
20726
|
-
|
|
20727
|
-
|
|
20728
|
-
|
|
20729
|
-
|
|
20730
|
-
|
|
20731
|
-
}
|
|
20830
|
+
type CreateChildDocumentInput = {
|
|
20831
|
+
id: string;
|
|
20832
|
+
documentType: string;
|
|
20833
|
+
};
|
|
20834
|
+
type CreateChildDocumentSignal = ISignal<"CREATE_CHILD_DOCUMENT", CreateChildDocumentInput>;
|
|
20835
|
+
type DeleteChildDocumentInput = {
|
|
20836
|
+
id: string;
|
|
20837
|
+
};
|
|
20838
|
+
type DeleteChildDocumentSignal = ISignal<"DELETE_CHILD_DOCUMENT", DeleteChildDocumentInput>;
|
|
20839
|
+
type CopyChildDocumentInput = {
|
|
20840
|
+
id: string;
|
|
20841
|
+
newId: string;
|
|
20842
|
+
};
|
|
20843
|
+
type CopyChildDocumentSignal = ISignal<"COPY_CHILD_DOCUMENT", CopyChildDocumentInput>;
|
|
20844
|
+
type Signal = CreateChildDocumentSignal | CopyChildDocumentSignal | DeleteChildDocumentSignal;
|
|
20845
|
+
type SignalDispatch = (signal: Signal) => void;
|
|
20846
|
+
type SignalResult = ISignalResult<CreateChildDocumentSignal["type"], CreateChildDocumentSignal["input"], PHDocument> | ISignalResult<CopyChildDocumentSignal["type"], CopyChildDocumentSignal["input"], boolean> | ISignalResult<DeleteChildDocumentSignal["type"], DeleteChildDocumentSignal["input"], PHDocument>;
|
|
20847
|
+
type SignalResults = {
|
|
20848
|
+
CREATE_CHILD_DOCUMENT: PHDocument;
|
|
20849
|
+
COPY_CHILD_DOCUMENT: PHDocument;
|
|
20850
|
+
DELETE_CHILD_DOCUMENT: boolean;
|
|
20851
|
+
};
|
|
20852
|
+
type SignalType<T extends Signal> = T["type"];
|
|
20853
|
+
type FileInput = string | number[] | Uint8Array | ArrayBuffer | Blob;
|
|
20854
|
+
type ReducerOptions = {
|
|
20855
|
+
/** The number of operations to skip before this new action is applied. This overrides the skip count in the operation. */skip?: number; /** When true the skip count is ignored and the action is applied regardless of the skip count */
|
|
20856
|
+
ignoreSkipOperations?: boolean; /** if true reuses the provided action resulting state instead of replaying it */
|
|
20857
|
+
reuseOperationResultingState?: boolean; /** if true checks the hashes of the operations */
|
|
20858
|
+
checkHashes?: boolean; /** Options for performing a replay. */
|
|
20859
|
+
replayOptions?: {
|
|
20860
|
+
/** The previously created operation to verify against. */operation: Operation;
|
|
20861
|
+
}; /** Optional parser for the operation resulting state, uses JSON.parse by default */
|
|
20862
|
+
operationResultingStateParser?: <TState>(state: string | null | undefined) => TState;
|
|
20863
|
+
/**
|
|
20864
|
+
* When true (default), the reducer will prune operations (garbage collect) when processing a skip.
|
|
20865
|
+
* When false, it will recompute state for the skip but preserve the existing operations history.
|
|
20866
|
+
*/
|
|
20867
|
+
pruneOnSkip?: boolean; /** The branch being operated on. Defaults to "main". */
|
|
20868
|
+
branch?: string;
|
|
20869
|
+
/**
|
|
20870
|
+
* Protocol version controlling undo/redo behavior.
|
|
20871
|
+
* - Version 1 (default): Legacy behavior with index reuse
|
|
20872
|
+
* - Version 2: Reactor behavior with monotonic indices
|
|
20873
|
+
*/
|
|
20874
|
+
protocolVersion?: number;
|
|
20875
|
+
/**
|
|
20876
|
+
* When true, skip index contiguity validation during replay.
|
|
20877
|
+
* Used for V2 state rebuild where gapped indices are expected.
|
|
20878
|
+
*/
|
|
20879
|
+
skipIndexValidation?: boolean;
|
|
20732
20880
|
};
|
|
20733
20881
|
/**
|
|
20734
|
-
*
|
|
20735
|
-
*
|
|
20736
|
-
*
|
|
20737
|
-
* @template TOp - The type of the operations.
|
|
20738
|
-
* @param {TOp[]} clearedOperationsA - The first array of operations.
|
|
20739
|
-
* @param {TOp[]} clearedOperationsB - The second array of operations.
|
|
20740
|
-
* @returns {TOp[]} - The difference between the two arrays of operations.
|
|
20741
|
-
*/
|
|
20742
|
-
declare function diffOperations<TOp extends OperationIndex>(clearedOperationsA: TOp[], clearedOperationsB: TOp[]): TOp[];
|
|
20743
|
-
declare function getDocumentLastModified(document: PHDocument): string;
|
|
20744
|
-
/**
|
|
20745
|
-
* Updates the document header with the latest revision number and
|
|
20746
|
-
* date of last modification.
|
|
20747
|
-
*
|
|
20748
|
-
* @param document The current state of the document.
|
|
20749
|
-
* @param scope The scope of the operation.
|
|
20750
|
-
* @param lastModifiedTimestamp Optional timestamp to use directly, avoiding a scan of all operations.
|
|
20751
|
-
* @returns The updated document state.
|
|
20752
|
-
*/
|
|
20753
|
-
declare function updateHeaderRevision(document: PHDocument, scope: string, lastModifiedTimestamp?: string): PHDocument;
|
|
20754
|
-
//#endregion
|
|
20755
|
-
//#region document-model/actions.d.ts
|
|
20756
|
-
/**
|
|
20757
|
-
* Cancels the last `count` operations.
|
|
20758
|
-
*
|
|
20759
|
-
* @param count - Number of operations to cancel
|
|
20760
|
-
* @category Actions
|
|
20761
|
-
*/
|
|
20762
|
-
declare const undo: (count?: number, scope?: string) => UndoAction;
|
|
20763
|
-
/**
|
|
20764
|
-
* Cancels the last `count` {@link undo | UNDO} operations.
|
|
20765
|
-
*
|
|
20766
|
-
* @param count - Number of UNDO operations to cancel
|
|
20767
|
-
* @category Actions
|
|
20768
|
-
*/
|
|
20769
|
-
declare const redo: (count?: number, scope?: string) => RedoAction;
|
|
20770
|
-
/**
|
|
20771
|
-
* Joins multiple operations into a single {@link loadState | LOAD_STATE} operation.
|
|
20772
|
-
*
|
|
20773
|
-
* @remarks
|
|
20774
|
-
* Useful to keep operations history smaller. Operations to prune are selected by index,
|
|
20775
|
-
* similar to the {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice | slice} method in Arrays.
|
|
20776
|
-
*
|
|
20777
|
-
* @param start - Index of the first operation to prune
|
|
20778
|
-
* @param end - Index of the last operation to prune
|
|
20779
|
-
* @category Actions
|
|
20780
|
-
*/
|
|
20781
|
-
declare const prune: (start?: number, end?: number, scope?: string) => SchemaPruneAction;
|
|
20782
|
-
/**
|
|
20783
|
-
* Replaces the state of the document.
|
|
20784
|
-
*
|
|
20785
|
-
* @remarks
|
|
20786
|
-
* This action shouldn't be used directly. It is dispatched by the {@link prune} action.
|
|
20787
|
-
*
|
|
20788
|
-
* @param state - State to be set in the document.
|
|
20789
|
-
* @param operations - Number of operations that were removed from the previous state.
|
|
20790
|
-
* @category Actions
|
|
20882
|
+
* A pure function that takes an action and the previous state
|
|
20883
|
+
* of the document and returns the new state.
|
|
20791
20884
|
*/
|
|
20792
|
-
|
|
20793
|
-
|
|
20794
|
-
}, operations: number) => LoadStateAction;
|
|
20795
|
-
declare const noop: (scope?: string) => NOOPAction;
|
|
20885
|
+
type Reducer<TState extends PHBaseState = PHBaseState> = (document: PHDocument<TState>, action: Action, dispatch?: SignalDispatch, options?: ReducerOptions) => PHDocument<TState>;
|
|
20886
|
+
type StateReducer<TState extends PHBaseState = PHBaseState> = (state: Draft<TState>, action: Action, dispatch?: SignalDispatch) => TState | undefined;
|
|
20796
20887
|
/**
|
|
20797
|
-
*
|
|
20888
|
+
* Object that indexes attachments of a Document.
|
|
20798
20889
|
*
|
|
20799
20890
|
* @remarks
|
|
20800
|
-
*
|
|
20801
|
-
*
|
|
20802
|
-
*
|
|
20803
|
-
* @typeParam A - Type of the action to be returned.
|
|
20804
|
-
*
|
|
20805
|
-
* @param type - The type of the action.
|
|
20806
|
-
* @param input - The input properties of the action.
|
|
20807
|
-
* @param attachments - The attachments included in the action.
|
|
20808
|
-
* @param validator - The validator to use for the input properties.
|
|
20809
|
-
* @param scope - The scope of the action, can either be 'global' or 'local'.
|
|
20810
|
-
* @param skip - The number of operations to skip before this new action is applied.
|
|
20811
|
-
*
|
|
20812
|
-
* @throws Error if the type is empty or not a string.
|
|
20813
|
-
*
|
|
20814
|
-
* @returns The new action.
|
|
20815
|
-
*/
|
|
20816
|
-
declare function createAction<TAction extends Action>(type: TAction["type"], input?: TAction["input"], attachments?: TAction["attachments"], validator?: () => {
|
|
20817
|
-
parse(v: unknown): TAction["input"];
|
|
20818
|
-
}, scope?: Action["scope"]): TAction;
|
|
20819
|
-
/**
|
|
20820
|
-
* This function should be used instead of { ...action } to ensure
|
|
20821
|
-
* that extra properties are not included in the action.
|
|
20822
|
-
*/
|
|
20823
|
-
declare const actionFromAction: (action: Action) => Action;
|
|
20824
|
-
declare const operationFromAction: (action: Action, index: number, skip: number, context: OperationContext) => Operation;
|
|
20825
|
-
declare const operationFromOperation: (operation: Operation, index: number, skip: number, context: OperationContext) => Operation;
|
|
20826
|
-
declare const operationWithContext: (operation: Operation, context: ActionContext) => Operation;
|
|
20827
|
-
declare const actionContext: () => ActionContext;
|
|
20828
|
-
declare const actionSigner: (user: UserActionSigner, app: AppActionSigner, signatures?: Signature[]) => ActionSigner;
|
|
20829
|
-
declare function buildOperationSignature(context: ActionSignatureContext, signMethod: ActionSigningHandler): Promise<Signature>;
|
|
20830
|
-
declare function buildSignedAction<TState extends PHBaseState = PHBaseState>(action: Action, reducer: Reducer<TState>, document: PHDocument<TState>, signer: ActionSigner, signHandler: ActionSigningHandler): Promise<Operation>;
|
|
20831
|
-
declare function verifyOperationSignature(signature: Signature, signer: Omit<ActionSigner, "signatures">, verifyHandler: ActionVerificationHandler): Promise<boolean>;
|
|
20832
|
-
/**
|
|
20833
|
-
* Changes the name of the document.
|
|
20891
|
+
* This is used to reduce memory usage to avoid
|
|
20892
|
+
* multiple instances of the binary data of the attachments.
|
|
20834
20893
|
*
|
|
20835
|
-
* @param name - The name to be set in the document.
|
|
20836
|
-
* @category Actions
|
|
20837
20894
|
*/
|
|
20838
|
-
|
|
20839
|
-
|
|
20840
|
-
|
|
20895
|
+
type FileRegistry = Record<AttachmentRef, Attachment>;
|
|
20896
|
+
type MappedOperation = {
|
|
20897
|
+
ignore: boolean;
|
|
20898
|
+
operation: Operation;
|
|
20899
|
+
};
|
|
20900
|
+
type DocumentOperationsIgnoreMap = Record<string, MappedOperation[]>;
|
|
20901
|
+
type ActionSignatureContext = {
|
|
20902
|
+
documentId: string;
|
|
20903
|
+
signer: ActionSigner;
|
|
20904
|
+
action: Action;
|
|
20905
|
+
previousStateHash: string;
|
|
20906
|
+
};
|
|
20907
|
+
type ActionSigningHandler = (message: Uint8Array) => Promise<Uint8Array>;
|
|
20908
|
+
type ActionVerificationHandler = (publicKey: string, signature: Uint8Array, data: Uint8Array) => Promise<boolean>;
|
|
20841
20909
|
/**
|
|
20842
|
-
*
|
|
20843
|
-
*
|
|
20844
|
-
* Passing `null` clears the preferred editor.
|
|
20910
|
+
* Handler for verifying operation signatures.
|
|
20845
20911
|
*
|
|
20846
|
-
* @
|
|
20912
|
+
* @param operation - The operation to verify
|
|
20913
|
+
* @param publicKey - The public key to verify against (from signer.app.key)
|
|
20914
|
+
* @returns Promise that resolves to true if signature is valid, false otherwise
|
|
20847
20915
|
*/
|
|
20848
|
-
|
|
20849
|
-
|
|
20850
|
-
|
|
20851
|
-
|
|
20852
|
-
declare const setModelId: (input: SetModelIdInput) => SetModelIdAction;
|
|
20853
|
-
declare const setModelExtension: (input: SetModelExtensionInput) => SetModelExtensionAction;
|
|
20854
|
-
declare const setModelDescription: (input: SetModelDescriptionInput) => SetModelDescriptionAction;
|
|
20855
|
-
declare const setAuthorName: (input: SetAuthorNameInput) => SetAuthorNameAction;
|
|
20856
|
-
declare const setAuthorWebsite: (input: SetAuthorWebsiteInput) => SetAuthorWebsiteAction;
|
|
20857
|
-
declare const addModule: (input: AddModuleInput) => AddModuleAction;
|
|
20858
|
-
declare const setModuleName: (input: SetModuleNameInput) => SetModuleNameAction;
|
|
20859
|
-
declare const setModuleDescription: (input: SetModuleDescriptionInput) => SetModuleDescriptionAction;
|
|
20860
|
-
declare const deleteModule: (input: DeleteModuleInput) => DeleteModuleAction;
|
|
20861
|
-
declare const reorderModules: (input: ReorderModulesInput) => ReorderModulesAction;
|
|
20862
|
-
declare const addOperation: (input: AddOperationInput) => AddOperationAction;
|
|
20863
|
-
declare const setOperationName: (input: SetOperationNameInput) => SetOperationNameAction;
|
|
20864
|
-
declare const setOperationScope: (input: SetOperationScopeInput) => SetOperationScopeAction;
|
|
20865
|
-
declare const setOperationSchema: (input: SetOperationSchemaInput) => SetOperationSchemaAction;
|
|
20866
|
-
declare const setOperationDescription: (input: SetOperationDescriptionInput) => SetOperationDescriptionAction;
|
|
20867
|
-
declare const setOperationTemplate: (input: SetOperationTemplateInput) => SetOperationTemplateAction;
|
|
20868
|
-
declare const setOperationReducer: (input: SetOperationReducerInput) => SetOperationReducerAction;
|
|
20869
|
-
declare const moveOperation: (input: MoveOperationInput) => MoveOperationAction;
|
|
20870
|
-
declare const deleteOperation: (input: DeleteOperationInput) => DeleteOperationAction;
|
|
20871
|
-
declare const reorderModuleOperations: (input: ReorderModuleOperationsInput) => ReorderModuleOperationsAction;
|
|
20872
|
-
declare const addOperationError: (input: AddOperationErrorInput) => AddOperationErrorAction;
|
|
20873
|
-
declare const setOperationErrorCode: (input: SetOperationErrorCodeInput) => SetOperationErrorCodeAction;
|
|
20874
|
-
declare const setOperationErrorName: (input: SetOperationErrorNameInput) => SetOperationErrorNameAction;
|
|
20875
|
-
declare const setOperationErrorDescription: (input: SetOperationErrorDescriptionInput) => SetOperationErrorDescriptionAction;
|
|
20876
|
-
declare const setOperationErrorTemplate: (input: SetOperationErrorTemplateInput) => SetOperationErrorTemplateAction;
|
|
20877
|
-
declare const deleteOperationError: (input: DeleteOperationErrorInput) => DeleteOperationErrorAction;
|
|
20878
|
-
declare const reorderOperationErrors: (input: ReorderOperationErrorsInput) => ReorderOperationErrorsAction;
|
|
20879
|
-
declare const addOperationExample: (input: AddOperationExampleInput) => AddOperationExampleAction;
|
|
20880
|
-
declare const updateOperationExample: (input: UpdateOperationExampleInput) => UpdateOperationExampleAction;
|
|
20881
|
-
declare const deleteOperationExample: (input: DeleteOperationExampleInput) => DeleteOperationExampleAction;
|
|
20882
|
-
declare const reorderOperationExamples: (input: ReorderOperationExamplesInput) => ReorderOperationExamplesAction;
|
|
20883
|
-
declare const operationExampleCreators: {
|
|
20884
|
-
addOperationExample: (input: AddOperationExampleInput) => AddOperationExampleAction;
|
|
20885
|
-
updateOperationExample: (input: UpdateOperationExampleInput) => UpdateOperationExampleAction;
|
|
20886
|
-
deleteOperationExample: (input: DeleteOperationExampleInput) => DeleteOperationExampleAction;
|
|
20887
|
-
reorderOperationExamples: (input: ReorderOperationExamplesInput) => ReorderOperationExamplesAction;
|
|
20916
|
+
type SignatureVerificationHandler = (operation: Operation, publicKey: string) => Promise<boolean>;
|
|
20917
|
+
type ENSInfo = {
|
|
20918
|
+
name?: string;
|
|
20919
|
+
avatarUrl?: string;
|
|
20888
20920
|
};
|
|
20889
|
-
|
|
20890
|
-
|
|
20891
|
-
|
|
20892
|
-
|
|
20893
|
-
|
|
20894
|
-
|
|
20895
|
-
|
|
20896
|
-
|
|
20897
|
-
|
|
20898
|
-
|
|
20899
|
-
|
|
20900
|
-
declare const baseActions: {
|
|
20901
|
-
setName: (name: string | {
|
|
20902
|
-
name: string;
|
|
20903
|
-
}) => SetNameAction;
|
|
20904
|
-
setPreferredEditor: (input: string | null | {
|
|
20905
|
-
preferredEditor: string | null;
|
|
20906
|
-
}) => SetPreferredEditorAction;
|
|
20907
|
-
undo: (count?: number, scope?: string) => UndoAction;
|
|
20908
|
-
redo: (count?: number, scope?: string) => RedoAction;
|
|
20909
|
-
prune: (start?: number, end?: number, scope?: string) => SchemaPruneAction;
|
|
20910
|
-
loadState: <TState extends PHBaseState = PHBaseState>(state: TState & {
|
|
20911
|
-
name: string;
|
|
20912
|
-
}, operations: number) => LoadStateAction;
|
|
20913
|
-
noop: (scope?: string) => NOOPAction;
|
|
20921
|
+
type User = {
|
|
20922
|
+
address: `0x${string}`;
|
|
20923
|
+
networkId: string;
|
|
20924
|
+
chainId: number;
|
|
20925
|
+
ens?: ENSInfo;
|
|
20926
|
+
};
|
|
20927
|
+
type PartialRecord<K extends keyof any, T> = { [P in K]?: T };
|
|
20928
|
+
type RevisionsFilter = PartialRecord<string, number>;
|
|
20929
|
+
type GetDocumentOptions = ReducerOptions & {
|
|
20930
|
+
revisions?: RevisionsFilter;
|
|
20931
|
+
checkHashes?: boolean;
|
|
20914
20932
|
};
|
|
20915
|
-
|
|
20916
|
-
|
|
20917
|
-
|
|
20918
|
-
|
|
20919
|
-
|
|
20920
|
-
|
|
20921
|
-
setAuthorWebsite: (input: SetAuthorWebsiteInput) => SetAuthorWebsiteAction;
|
|
20922
|
-
addModule: (input: AddModuleInput) => AddModuleAction;
|
|
20923
|
-
setModuleName: (input: SetModuleNameInput) => SetModuleNameAction;
|
|
20924
|
-
setModuleDescription: (input: SetModuleDescriptionInput) => SetModuleDescriptionAction;
|
|
20925
|
-
deleteModule: (input: DeleteModuleInput) => DeleteModuleAction;
|
|
20926
|
-
reorderModules: (input: ReorderModulesInput) => ReorderModulesAction;
|
|
20927
|
-
addOperation: (input: AddOperationInput) => AddOperationAction;
|
|
20928
|
-
setOperationName: (input: SetOperationNameInput) => SetOperationNameAction;
|
|
20929
|
-
setOperationScope: (input: SetOperationScopeInput) => SetOperationScopeAction;
|
|
20930
|
-
setOperationSchema: (input: SetOperationSchemaInput) => SetOperationSchemaAction;
|
|
20931
|
-
setOperationDescription: (input: SetOperationDescriptionInput) => SetOperationDescriptionAction;
|
|
20932
|
-
setOperationTemplate: (input: SetOperationTemplateInput) => SetOperationTemplateAction;
|
|
20933
|
-
setOperationReducer: (input: SetOperationReducerInput) => SetOperationReducerAction;
|
|
20934
|
-
moveOperation: (input: MoveOperationInput) => MoveOperationAction;
|
|
20935
|
-
deleteOperation: (input: DeleteOperationInput) => DeleteOperationAction;
|
|
20936
|
-
reorderModuleOperations: (input: ReorderModuleOperationsInput) => ReorderModuleOperationsAction;
|
|
20937
|
-
addOperationError: (input: AddOperationErrorInput) => AddOperationErrorAction;
|
|
20938
|
-
setOperationErrorCode: (input: SetOperationErrorCodeInput) => SetOperationErrorCodeAction;
|
|
20939
|
-
setOperationErrorName: (input: SetOperationErrorNameInput) => SetOperationErrorNameAction;
|
|
20940
|
-
setOperationErrorDescription: (input: SetOperationErrorDescriptionInput) => SetOperationErrorDescriptionAction;
|
|
20941
|
-
setOperationErrorTemplate: (input: SetOperationErrorTemplateInput) => SetOperationErrorTemplateAction;
|
|
20942
|
-
deleteOperationError: (input: DeleteOperationErrorInput) => DeleteOperationErrorAction;
|
|
20943
|
-
reorderOperationErrors: (input: ReorderOperationErrorsInput) => ReorderOperationErrorsAction;
|
|
20944
|
-
addOperationExample: (input: AddOperationExampleInput) => AddOperationExampleAction;
|
|
20945
|
-
updateOperationExample: (input: UpdateOperationExampleInput) => UpdateOperationExampleAction;
|
|
20946
|
-
deleteOperationExample: (input: DeleteOperationExampleInput) => DeleteOperationExampleAction;
|
|
20947
|
-
reorderOperationExamples: (input: ReorderOperationExamplesInput) => ReorderOperationExamplesAction;
|
|
20948
|
-
setStateSchema: (input: SetStateSchemaInput) => SetStateSchemaAction;
|
|
20949
|
-
setInitialState: (input: SetInitialStateInput) => SetInitialStateAction;
|
|
20950
|
-
addStateExample: (input: AddStateExampleInput) => AddStateExampleAction;
|
|
20951
|
-
updateStateExample: (input: UpdateStateExampleInput) => UpdateStateExampleAction;
|
|
20952
|
-
deleteStateExample: (input: DeleteStateExampleInput) => DeleteStateExampleAction;
|
|
20953
|
-
reorderStateExamples: (input: ReorderStateExamplesInput) => ReorderStateExamplesAction;
|
|
20954
|
-
addChangeLogItem: (input: AddChangeLogItemInput) => AddChangeLogItemAction;
|
|
20955
|
-
updateChangeLogItem: (input: UpdateChangeLogItemInput) => UpdateChangeLogItemAction;
|
|
20956
|
-
deleteChangeLogItem: (input: DeleteChangeLogItemInput) => DeleteChangeLogItemAction;
|
|
20957
|
-
reorderChangeLogItems: (input: ReorderChangeLogItemsInput) => ReorderChangeLogItemsAction;
|
|
20958
|
-
releaseNewVersion: () => ReleaseNewVersionAction;
|
|
20933
|
+
type ActionErrorCallback = (error: unknown) => void;
|
|
20934
|
+
type EditorDispatch = (action: Action, onErrorCallback?: ActionErrorCallback) => void;
|
|
20935
|
+
type EditorProps = {
|
|
20936
|
+
children?: ReactNode;
|
|
20937
|
+
className?: string;
|
|
20938
|
+
document?: PHDocument;
|
|
20959
20939
|
};
|
|
20960
|
-
|
|
20961
|
-
|
|
20962
|
-
|
|
20963
|
-
|
|
20964
|
-
|
|
20965
|
-
|
|
20966
|
-
|
|
20967
|
-
|
|
20968
|
-
|
|
20969
|
-
|
|
20970
|
-
|
|
20971
|
-
reorderModules: (input: ReorderModulesInput) => ReorderModulesAction;
|
|
20972
|
-
addOperation: (input: AddOperationInput) => AddOperationAction;
|
|
20973
|
-
setOperationName: (input: SetOperationNameInput) => SetOperationNameAction;
|
|
20974
|
-
setOperationScope: (input: SetOperationScopeInput) => SetOperationScopeAction;
|
|
20975
|
-
setOperationSchema: (input: SetOperationSchemaInput) => SetOperationSchemaAction;
|
|
20976
|
-
setOperationDescription: (input: SetOperationDescriptionInput) => SetOperationDescriptionAction;
|
|
20977
|
-
setOperationTemplate: (input: SetOperationTemplateInput) => SetOperationTemplateAction;
|
|
20978
|
-
setOperationReducer: (input: SetOperationReducerInput) => SetOperationReducerAction;
|
|
20979
|
-
moveOperation: (input: MoveOperationInput) => MoveOperationAction;
|
|
20980
|
-
deleteOperation: (input: DeleteOperationInput) => DeleteOperationAction;
|
|
20981
|
-
reorderModuleOperations: (input: ReorderModuleOperationsInput) => ReorderModuleOperationsAction;
|
|
20982
|
-
addOperationError: (input: AddOperationErrorInput) => AddOperationErrorAction;
|
|
20983
|
-
setOperationErrorCode: (input: SetOperationErrorCodeInput) => SetOperationErrorCodeAction;
|
|
20984
|
-
setOperationErrorName: (input: SetOperationErrorNameInput) => SetOperationErrorNameAction;
|
|
20985
|
-
setOperationErrorDescription: (input: SetOperationErrorDescriptionInput) => SetOperationErrorDescriptionAction;
|
|
20986
|
-
setOperationErrorTemplate: (input: SetOperationErrorTemplateInput) => SetOperationErrorTemplateAction;
|
|
20987
|
-
deleteOperationError: (input: DeleteOperationErrorInput) => DeleteOperationErrorAction;
|
|
20988
|
-
reorderOperationErrors: (input: ReorderOperationErrorsInput) => ReorderOperationErrorsAction;
|
|
20989
|
-
addOperationExample: (input: AddOperationExampleInput) => AddOperationExampleAction;
|
|
20990
|
-
updateOperationExample: (input: UpdateOperationExampleInput) => UpdateOperationExampleAction;
|
|
20991
|
-
deleteOperationExample: (input: DeleteOperationExampleInput) => DeleteOperationExampleAction;
|
|
20992
|
-
reorderOperationExamples: (input: ReorderOperationExamplesInput) => ReorderOperationExamplesAction;
|
|
20993
|
-
setStateSchema: (input: SetStateSchemaInput) => SetStateSchemaAction;
|
|
20994
|
-
setInitialState: (input: SetInitialStateInput) => SetInitialStateAction;
|
|
20995
|
-
addStateExample: (input: AddStateExampleInput) => AddStateExampleAction;
|
|
20996
|
-
updateStateExample: (input: UpdateStateExampleInput) => UpdateStateExampleAction;
|
|
20997
|
-
deleteStateExample: (input: DeleteStateExampleInput) => DeleteStateExampleAction;
|
|
20998
|
-
reorderStateExamples: (input: ReorderStateExamplesInput) => ReorderStateExamplesAction;
|
|
20999
|
-
addChangeLogItem: (input: AddChangeLogItemInput) => AddChangeLogItemAction;
|
|
21000
|
-
updateChangeLogItem: (input: UpdateChangeLogItemInput) => UpdateChangeLogItemAction;
|
|
21001
|
-
deleteChangeLogItem: (input: DeleteChangeLogItemInput) => DeleteChangeLogItemAction;
|
|
21002
|
-
reorderChangeLogItems: (input: ReorderChangeLogItemsInput) => ReorderChangeLogItemsAction;
|
|
21003
|
-
releaseNewVersion: () => ReleaseNewVersionAction;
|
|
21004
|
-
setName: (name: string | {
|
|
21005
|
-
name: string;
|
|
21006
|
-
}) => SetNameAction;
|
|
21007
|
-
setPreferredEditor: (input: string | null | {
|
|
21008
|
-
preferredEditor: string | null;
|
|
21009
|
-
}) => SetPreferredEditorAction;
|
|
21010
|
-
undo: (count?: number, scope?: string) => UndoAction;
|
|
21011
|
-
redo: (count?: number, scope?: string) => RedoAction;
|
|
21012
|
-
prune: (start?: number, end?: number, scope?: string) => SchemaPruneAction;
|
|
21013
|
-
loadState: <TState extends PHBaseState = PHBaseState>(state: TState & {
|
|
20940
|
+
type SubgraphModule = {
|
|
20941
|
+
id: string;
|
|
20942
|
+
name: string;
|
|
20943
|
+
gql: string;
|
|
20944
|
+
endpoint: string;
|
|
20945
|
+
};
|
|
20946
|
+
type EditorModule<TProps = any> = {
|
|
20947
|
+
Component: FC<EditorProps & TProps>;
|
|
20948
|
+
documentTypes: string[];
|
|
20949
|
+
config: {
|
|
20950
|
+
id: string;
|
|
21014
20951
|
name: string;
|
|
21015
|
-
}
|
|
21016
|
-
|
|
20952
|
+
};
|
|
20953
|
+
};
|
|
20954
|
+
type ValidationError = {
|
|
20955
|
+
message: string;
|
|
20956
|
+
details: object;
|
|
20957
|
+
};
|
|
20958
|
+
type SkipHeaderOperations = Partial<Record<string, number>>;
|
|
20959
|
+
type ReplayDocumentOptions = {
|
|
20960
|
+
checkHashes?: boolean;
|
|
20961
|
+
reuseOperationResultingState?: boolean;
|
|
20962
|
+
operationResultingStateParser?: <TState>(state: string) => TState;
|
|
20963
|
+
skipIndexValidation?: boolean;
|
|
20964
|
+
};
|
|
20965
|
+
type OperationIndex = {
|
|
20966
|
+
index: number;
|
|
20967
|
+
skip: number;
|
|
20968
|
+
id?: string;
|
|
20969
|
+
timestampUtcMs?: string;
|
|
21017
20970
|
};
|
|
21018
20971
|
/**
|
|
21019
|
-
*
|
|
20972
|
+
* Parameters used in a document signature.
|
|
21020
20973
|
*/
|
|
21021
|
-
type
|
|
21022
|
-
|
|
21023
|
-
|
|
21024
|
-
|
|
21025
|
-
|
|
20974
|
+
type SigningParameters = {
|
|
20975
|
+
documentType: string;
|
|
20976
|
+
createdAtUtcIso: string;
|
|
20977
|
+
/**
|
|
20978
|
+
* The nonce can act as both a salt and a typical nonce.
|
|
20979
|
+
*/
|
|
20980
|
+
nonce: string;
|
|
21026
20981
|
};
|
|
21027
20982
|
/**
|
|
21028
|
-
*
|
|
20983
|
+
* Describes a signer that can sign both document headers and actions.
|
|
21029
20984
|
*/
|
|
21030
|
-
|
|
21031
|
-
/** The
|
|
21032
|
-
|
|
21033
|
-
|
|
21034
|
-
|
|
21035
|
-
|
|
20985
|
+
interface ISigner {
|
|
20986
|
+
/** The user associated with the signer */
|
|
20987
|
+
user?: UserActionSigner;
|
|
20988
|
+
/** The app associated with the signer */
|
|
20989
|
+
app?: AppActionSigner;
|
|
20990
|
+
/** The corresponding public key */
|
|
20991
|
+
publicKey: CryptoKey;
|
|
21036
20992
|
/**
|
|
21037
|
-
*
|
|
20993
|
+
* Signs raw data (used for document header signing).
|
|
21038
20994
|
*
|
|
21039
|
-
*
|
|
20995
|
+
* @param data - The data to sign.
|
|
20996
|
+
* @returns The signature of the data.
|
|
21040
20997
|
*/
|
|
21041
|
-
|
|
21042
|
-
|
|
20998
|
+
sign: (data: Uint8Array) => Promise<Uint8Array>;
|
|
20999
|
+
/**
|
|
21000
|
+
* Verifies a signature.
|
|
21001
|
+
*
|
|
21002
|
+
* @param data - The data to verify.
|
|
21003
|
+
* @param signature - The signature to verify.
|
|
21004
|
+
*/
|
|
21005
|
+
verify: (data: Uint8Array, signature: Uint8Array) => Promise<void>;
|
|
21006
|
+
/**
|
|
21007
|
+
* Signs an action (used for operation signing).
|
|
21008
|
+
*
|
|
21009
|
+
* @param action - The action to sign.
|
|
21010
|
+
* @param abortSignal - Optional abort signal to cancel the signing.
|
|
21011
|
+
* @returns The signature tuple.
|
|
21012
|
+
*/
|
|
21013
|
+
signAction: (action: Action, abortSignal?: AbortSignal) => Promise<Signature>;
|
|
21014
|
+
}
|
|
21015
|
+
type IsStateOfType<TState> = (state: unknown) => state is TState;
|
|
21016
|
+
type AssertIsStateOfType<TState> = (state: unknown) => asserts state is TState;
|
|
21017
|
+
type IsDocumentOfType<TState extends PHBaseState> = (document: unknown) => document is PHDocument<TState>;
|
|
21018
|
+
type AssertIsDocumentOfType<TState extends PHBaseState> = (document: unknown) => asserts document is PHDocument<TState>;
|
|
21019
|
+
type PartialState<TState> = TState | Partial<TState>;
|
|
21020
|
+
type CreateState<TState extends PHBaseState = PHBaseState> = (state?: PartialState<TState>) => TState;
|
|
21021
|
+
type SaveToFileHandle = (document: PHDocument, input: FileSystemFileHandle) => void | Promise<void>;
|
|
21022
|
+
type SaveToFile = (document: PHDocument, path: string, name?: string) => string | Promise<string>;
|
|
21023
|
+
type LoadFromInput<TState extends PHBaseState = PHBaseState> = (input: FileInput) => PHDocument<TState> | Promise<PHDocument<TState>>;
|
|
21024
|
+
type LoadFromFile<TState extends PHBaseState = PHBaseState> = (path: string) => PHDocument<TState> | Promise<PHDocument<TState>>;
|
|
21025
|
+
type CreateDocument<TState extends PHBaseState = PHBaseState> = (initialState?: Partial<TState>, createState?: CreateState<TState>) => PHDocument<TState>;
|
|
21026
|
+
type MinimalBackupData = {
|
|
21027
|
+
documentId: string;
|
|
21028
|
+
documentType: string;
|
|
21029
|
+
branch: string;
|
|
21030
|
+
state: PHBaseState;
|
|
21031
|
+
name: string;
|
|
21043
21032
|
};
|
|
21044
|
-
|
|
21045
|
-
|
|
21046
|
-
|
|
21047
|
-
|
|
21048
|
-
|
|
21049
|
-
|
|
21050
|
-
|
|
21051
|
-
|
|
21033
|
+
type DocumentModelUtils<TState extends PHBaseState = PHBaseState> = {
|
|
21034
|
+
fileExtension: string;
|
|
21035
|
+
createState: CreateState<TState>;
|
|
21036
|
+
createDocument: CreateDocument<TState>;
|
|
21037
|
+
loadFromInput: LoadFromInput<TState>;
|
|
21038
|
+
saveToFileHandle: SaveToFileHandle;
|
|
21039
|
+
isStateOfType: IsStateOfType<TState>;
|
|
21040
|
+
assertIsStateOfType: AssertIsStateOfType<TState>;
|
|
21041
|
+
isDocumentOfType: IsDocumentOfType<TState>;
|
|
21042
|
+
assertIsDocumentOfType: AssertIsDocumentOfType<TState>;
|
|
21052
21043
|
};
|
|
21053
|
-
type
|
|
21054
|
-
|
|
21044
|
+
type Actions = Record<string, (...args: any[]) => Action>;
|
|
21045
|
+
type DocumentModelModule<TState extends PHBaseState = PHBaseState> = {
|
|
21046
|
+
/** optional version field, should be made required */version?: number;
|
|
21047
|
+
reducer: Reducer<TState>;
|
|
21048
|
+
actions: Actions;
|
|
21049
|
+
utils: DocumentModelUtils<TState>;
|
|
21050
|
+
documentModel: DocumentModelPHState;
|
|
21055
21051
|
};
|
|
21056
|
-
type
|
|
21057
|
-
|
|
21052
|
+
type DocumentModelLib<TState extends PHBaseState = PHBaseState> = {
|
|
21053
|
+
manifest: Manifest;
|
|
21054
|
+
documentModels: readonly DocumentModelModule<TState>[];
|
|
21055
|
+
editors: readonly EditorModule[];
|
|
21056
|
+
subgraphs?: readonly SubgraphModule[];
|
|
21057
|
+
upgradeManifests?: readonly UpgradeManifest<readonly number[]>[] | undefined;
|
|
21058
|
+
processorFactory?: ProcessorFactoryBuilder;
|
|
21058
21059
|
};
|
|
21059
|
-
|
|
21060
|
-
|
|
21061
|
-
|
|
21062
|
-
|
|
21063
|
-
|
|
21064
|
-
|
|
21065
|
-
type AttachmentRef = string;
|
|
21060
|
+
type DocumentModelDocumentModelModule = DocumentModelModule<DocumentModelPHState>;
|
|
21061
|
+
type ConfigEntryType = z.infer<typeof ConfigEntryTypeSchema>;
|
|
21062
|
+
type ConfigEntry = z.infer<typeof ConfigEntrySchema>;
|
|
21063
|
+
type PowerhouseModule = z.infer<typeof PowerhouseModuleSchema>;
|
|
21064
|
+
type Publisher = z.infer<typeof PublisherSchema>;
|
|
21065
|
+
type Manifest = z.infer<typeof ManifestSchema>;
|
|
21066
21066
|
//#endregion
|
|
21067
|
-
export { setName as $, ReorderOperationErrorsAction as $a, SetOperationReducerInputSchema as $c, MutationReorderOperationErrorsArgs as $i, ConfigEntryType as $n, SetOperationSchemaAction as $o, EditorDispatch as $r, DeleteChangeLogItemInputSchema as $s, skipHeaderOperations as $t, noop as A, OperationsByScope as Aa, ReorderModuleOperationsInputSchema as Ac, ModuleSpecification as Ai, RelationalDbProcessorClass as Al, ActionSignatureContext as An, SetModelNameAction as Ao, DocumentModelHeaderAction as Ar, UpdateOperationExampleAction as As, garbageCollect as At, reorderModules as B, RedoAction as Ba, SetModelExtensionInputSchema as Bc, MutationDeleteChangeLogItemInputArgs as Bi, ProcessorFilter as Bl, AddOperationErrorInput as Bn, SetOperationDescriptionInput as Bo, DocumentModelOperationErrorOperations as Br, UpgradeManifest as Bs, mapSkippedOperations as Bt, deleteOperation as C, MutationUpdateChangeLogItemInputArgs as Ca, PruneActionSchema as Cc, MakeEmpty as Ci, HashAlgorithms as Cl, defaultAuthState as Cn, SetInitialStateInput as Co, DeleteStateExampleInput as Cr, SubgraphModule as Cs, attachBranch as Ct, documentModelActions as D, OperationErrorSpecification as Da, RedoActionSchema as Dc, MappedOperation as Di, IRelationalQueryBuilder as Dl, defaultLocalState as Dn, SetModelExtensionInput as Do, DocumentModelDocument as Dr, UndoRedoAction as Ds, diffOperations as Dt, deleteStateExample as E, NOOPAction as Ea, RedoActionInputSchema as Ec, Manifest as Ei, IRelationalDbProcessor as El, defaultGlobalState as En, SetModelExtensionAction as Eo, DocumentModelAction as Er, UndoActionInput as Es, checkOperationsIntegrity as Et, prune as F, PruneAction as Fa, ScopeStateSchema as Fc, MutationAddModuleArgs as Fi, ProcessorApp as Fl, AddChangeLogItemInput as Fn, SetModuleNameInput as Fo, DocumentModelModule as Fr, UpdateStateExampleInput as Fs, hashDocumentStateForScope as Ft, setAuthorWebsite as G, RemoveRelationshipAction as Ga, SetNameActionInputSchema as Gc, MutationDeleteStateExampleArgs as Gi, DEFAULT_RELATIONAL_PROCESSOR_DB_NAME as Gl, AddRelationshipActionInput as Gn, SetOperationErrorNameAction as Go, DocumentModelStateAction as Gr, AddOperationErrorInputSchema as Gs, parseResultingState as Gt, reorderOperationExamples as H, Reducer as Ha, SetModelNameInputSchema as Hc, MutationDeleteOperationArgs as Hi, ProcessorStatus as Hl, AddOperationExampleInput as Hn, SetOperationErrorCodeInput as Ho, DocumentModelOperationExampleOperations as Hr, UpgradeTransition as Hs, merge as Ht, redo as I, PruneActionInput as Ia, SetAuthorNameInputSchema as Ic, MutationAddOperationArgs as Ii, ProcessorApps as Il, AddModuleAction as In, SetNameAction as Io, DocumentModelModuleAction as Ir, UpgradeDocumentAction as Is, isDocumentAction as It, setModelExtension as J, ReorderChangeLogItemsInput as Ja, SetOperationErrorCodeInputSchema as Jc, MutationPruneArgs as Ji, AppActionSigner as Jl, AssertIsDocumentOfType as Jn, SetOperationErrorTemplateInput as Jo, DocumentModelVersioningAction as Jr, AddStateExampleInputSchema as Js, readOnly as Jt, setInitialState as K, RemoveRelationshipActionInput as Ka, SetNameActionSchema as Kc, MutationLoadStateArgs as Ki, PROCESSOR_APPS as Kl, AddStateExampleAction as Kn, SetOperationErrorNameInput as Ko, DocumentModelStateOperations as Kr, AddOperationExampleInputSchema as Ks, precedes as Kt, releaseNewVersion as L, Publisher as La, SetAuthorWebsiteInputSchema as Lc, MutationAddOperationErrorArgs as Li, ProcessorDispatchResult as Ll, AddModuleInput as Ln, SetNameActionInput as Lo, DocumentModelModuleOperations as Lr, UpgradeDocumentActionInput as Ls, isNoopOperation as Lt, operationFromAction as M, PartialState as Ma, ReorderOperationErrorsInputSchema as Mc, MoveOperationInput as Mi, IProcessorDispatch as Ml, ActionVerificationHandler as Mn, SetModuleDescriptionAction as Mo, DocumentModelInput as Mr, UpdateRelationshipAction as Ms, garbageCollectV2 as Mt, operationFromOperation as N, PowerhouseModule as Na, ReorderOperationExamplesInputSchema as Nc, Mutation as Ni, IProcessorHostModule as Nl, Actions as Nn, SetModuleDescriptionInput as No, DocumentModelLib as Nr, UpdateRelationshipActionInput as Ns, getDocumentLastModified as Nt, loadState as O, OperationIndex as Oa, RedoSchema as Oc, Maybe as Oi, IRelationalQueryMethods as Ol, defaultPHState as On, SetModelIdAction as Oo, DocumentModelDocumentModelModule as Or, UpdateChangeLogItemAction as Os, filterDocumentOperationsResultingState as Ot, operationWithContext as P, Prune as Pa, ReorderStateExamplesInputSchema as Pc, MutationAddChangeLogItemInputArgs as Pi, IProcessorManager as Pl, AddChangeLogItemAction as Pn, SetModuleNameAction as Po, DocumentModelLocalState as Pr, UpdateStateExampleAction as Ps, groupOperationsByScope as Pt, setModuleName as Q, ReorderModulesInput as Qa, SetOperationNameInputSchema as Qc, MutationReorderModulesArgs as Qi, UserActionSigner as Ql, ConfigEntry as Qn, SetOperationReducerInput as Qo, ENSInfo as Qr, ConfigEntryTypeSchema as Qs, reshuffleByTimestampAndIndex as Qt, reorderChangeLogItems as R, Query as Ra, SetInitialStateInputSchema as Rc, MutationAddOperationExampleArgs as Ri, ProcessorFactory as Rl, AddOperationAction as Rn, SetNameOperation as Ro, DocumentModelOperationAction as Rr, User as Rs, isUndo as Rt, deleteModule as S, MutationUndoArgs as Sa, PruneActionInputSchema as Sc, Load_State as Si, ExtractProcessorSchemaOrSelf as Sl, createState as Sn, SetInitialStateAction as So, DeleteStateExampleAction as Sr, StateReducer as Ss, addUndo as St, deleteOperationExample as T, MutationUpdateStateExampleArgs as Ta, PublisherSchema as Tc, MakeOptional as Ti, IRelationalDb as Tl, defaultDocumentState as Tn, SetModelDescriptionInput as To, DocumentFile as Tr, UndoAction as Ts, checkCleanedOperationsIntegrity as Tt, reorderStateExamples as U, ReducerOptions as Ua, SetModuleDescriptionInputSchema as Uc, MutationDeleteOperationErrorArgs as Ui, TrackedProcessor as Ul, AddOperationInput as Un, SetOperationErrorDescriptionAction as Uo, DocumentModelOperationOperations as Ur, AddChangeLogItemInputSchema as Us, nextSkipNumber as Ut, reorderOperationErrors as V, RedoActionInput as Va, SetModelIdInputSchema as Vc, MutationDeleteModuleArgs as Vi, ProcessorRecord as Vl, AddOperationExampleAction as Vn, SetOperationErrorCodeAction as Vo, DocumentModelOperationExampleAction as Vr, UpgradeReducer as Vs, mapSkippedOperationsV2 as Vt, setAuthorName as W, ReleaseNewVersionAction as Wa, SetModuleNameInputSchema as Wc, MutationDeleteOperationExampleArgs as Wi, DEFAULT_ANALYTICS_PROCESSOR_DB_NAME as Wl, AddRelationshipAction as Wn, SetOperationErrorDescriptionInput as Wo, DocumentModelPHState as Wr, AddModuleInputSchema as Ws, operationsAreEqual as Wt, setModelName as X, ReorderModuleOperationsInput as Xa, SetOperationErrorNameInputSchema as Xc, MutationReorderChangeLogItemsInputArgs as Xi, PHDocumentSignatureInfo as Xl, Author as Xn, SetOperationNameInput as Xo, DocumentOperationsIgnoreMap as Xr, CodeExampleSchema as Xs, replayDocument as Xt, setModelId as Y, ReorderModuleOperationsAction as Ya, SetOperationErrorDescriptionInputSchema as Yc, MutationRedoArgs as Yi, HashConfig as Yl, AssertIsStateOfType as Yn, SetOperationNameAction as Yo, DocumentModelVersioningOperations as Yr, AuthorSchema as Ys, removeExistingOperations as Yt, setModuleDescription as Z, ReorderModulesAction as Za, SetOperationErrorTemplateInputSchema as Zc, MutationReorderModuleOperationsArgs as Zi, Signature as Zl, CodeExample as Zn, SetOperationReducerAction as Zo, DocumentSpecification as Zr, ConfigEntrySchema as Zs, reshuffleByTimestamp as Zt, baseActions as _, MutationSetOperationNameArgs as _a, OperationErrorSchema as _c, LoadFromFile as _i, createNamespacedDb as _l, createAuthState as _n, ScopeState as _o, DeleteOperationErrorAction as _r, SignatureVerificationHandler as _s, IntegrityIssueSubType as _t, AttachmentInput as a, MutationSetModelDescriptionArgs as aa, DocumentActionSchema as ac, GetDocumentOptions as ai, SetStateSchemaInputSchema as al, Operation as an, ReplayDocumentOptions as ao, CreateDocumentAction as ar, SetPreferredEditorAction as as, setOperationName as at, createAction as b, MutationSetOperationTemplateArgs as ba, PowerhouseModuleSchema as bc, LoadStateActionInput as bi, hashNamespace as bl, createGlobalState as bn, SetAuthorWebsiteAction as bo, DeleteOperationExampleInput as br, SkipHeaderOperations as bs, PHDocumentHeader as bt, actionFromAction as c, MutationSetModelNameArgs as ca, DocumentModelInputSchema as cc, IDocument as ci, StateSchema as cl, loadStateOperation as cn, SaveToFileHandle as co, DeleteChangeLogItemAction as cr, SetStateSchemaAction as cs, setOperationScope as ct, addChangeLogItem as d, MutationSetNameArgs as da, LoadStateActionSchema as dc, ISignalResult as di, UndoSchema as dl, setPreferredEditorOperation as dn, SchemaNOOPAction as do, DeleteChildDocumentSignal as dr, Set_PreferredEditor as ds, setStateSchema as dt, MutationReorderOperationExamplesArgs as ea, DeleteModuleInputSchema as ec, EditorModule as ei, SetOperationSchemaInputSchema as el, sortMappedOperations as en, ReorderOperationErrorsInput as eo, CopyChildDocumentInput as er, SetOperationSchemaInput as es, setOperationDescription as et, addModule as f, MutationSetOperationDescriptionArgs as fa, LoadStateActionStateInputSchema as fc, ISigner as fi, UpdateChangeLogItemInputSchema as fl, undoOperation as fn, SchemaPruneAction as fo, DeleteDocumentAction as fr, Signal as fs, undo as ft, addStateExample as g, MutationSetOperationErrorTemplateArgs as ga, MoveOperationInputSchema as gc, IsStateOfType as gi, isDefinedNonNullAny as gl, PHDocumentState as gn, SchemaUndoAction as go, DeleteOperationAction as gr, SignalType as gs, verifyOperationSignature as gt, addOperationExample as h, MutationSetOperationErrorNameArgs as ha, ModuleSchema as hc, IsDocumentOfType as hi, definedNonNullAnySchema as hl, PHBaseState as hn, SchemaSetPreferredEditorAction as ho, DeleteModuleInput as hr, SignalResults as hs, updateStateExample as ht, Attachment as i, MutationSetInitialStateArgs as ia, DeleteStateExampleInputSchema as ic, FileRegistry as ii, SetPreferredEditorActionSchema as il, DocumentOperations as in, ReorderStateExamplesInput as io, CreateDocument as ir, SetOperationTemplateInput as is, setOperationErrorTemplate as it, operationExampleCreators as j, PartialRecord as ja, ReorderModulesInputSchema as jc, MoveOperationAction as ji, IProcessor as jl, ActionSigningHandler as jn, SetModelNameInput as jo, DocumentModelHeaderOperations as jr, UpdateOperationExampleInput as js, garbageCollectDocumentOperations as jt, moveOperation as k, OperationSpecification as ka, ReorderChangeLogItemsInputSchema as kc, MinimalBackupData as ki, RelationalDbProcessor as kl, ActionErrorCallback as kn, SetModelIdInput as ko, DocumentModelGlobalState as kr, UpdateChangeLogItemInput as ks, filterDuplicatedOperations as kt, actionSigner as l, MutationSetModuleDescriptionArgs as la, DocumentSpecificationSchema as lc, IOperation as li, UndoActionInputSchema as ll, redoOperation as ln, Scalars as lo, DeleteChangeLogItemInput as lr, SetStateSchemaInput as ls, setOperationTemplate as lt, addOperationError as m, MutationSetOperationErrorDescriptionArgs as ma, ManifestSchema as mc, InputMaybe as mi, UpdateStateExampleInputSchema as ml, PHAuthState as mn, SchemaSetNameAction as mo, DeleteModuleAction as mr, SignalResult as ms, updateOperationExample as mt, ActionContext as n, MutationSetAuthorNameArgs as na, DeleteOperationExampleInputSchema as nc, Exact as ni, SetOperationTemplateInputSchema as nl, split as nn, ReorderOperationExamplesInput as no, CreateChildDocumentInput as nr, SetOperationScopeInput as ns, setOperationErrorDescription as nt, AttachmentRef as o, MutationSetModelExtensionArgs as oa, DocumentFileSchema as oc, IAction as oi, Set_NameSchema as ol, OperationContext as on, RevisionsFilter as oo, CreateDocumentActionInput as or, SetPreferredEditorActionInput as os, setOperationReducer as ot, addOperation as p, MutationSetOperationErrorCodeArgs as pa, Load_StateSchema as pc, Incremental as pi, UpdateOperationExampleInputSchema as pl, undoOperationV2 as pn, SchemaRedoAction as po, DeleteDocumentActionInput as pr, SignalDispatch as ps, updateChangeLogItem as pt, setModelDescription as q, ReorderChangeLogItemsAction as qa, SetOperationDescriptionInputSchema as qc, MutationMoveOperationArgs as qi, ActionSigner as ql, AddStateExampleInput as qn, SetOperationErrorTemplateAction as qo, DocumentModelUtils as qr, AddOperationInputSchema as qs, prepareOperations as qt, ActionWithAttachment as r, MutationSetAuthorWebsiteArgs as ra, DeleteOperationInputSchema as rc, FileInput as ri, SetPreferredEditorActionInputSchema as rl, updateHeaderRevision as rn, ReorderStateExamplesAction as ro, CreateChildDocumentSignal as rr, SetOperationTemplateAction as rs, setOperationErrorName as rt, actionContext as s, MutationSetModelIdArgs as sa, DocumentModelGlobalStateSchema as sc, ID as si, Set_PreferredEditorSchema as sl, OperationWithContext$1 as sn, SaveToFile as so, CreateState as sr, SetPreferredEditorOperation as ss, setOperationSchema as st, Action as t, MutationReorderStateExamplesArgs as ta, DeleteOperationErrorInputSchema as tc, EditorProps as ti, SetOperationScopeInputSchema as tl, sortOperations as tn, ReorderOperationExamplesAction as to, CopyChildDocumentSignal as tr, SetOperationScopeAction as ts, setOperationErrorCode as tt, actions as u, MutationSetModuleNameArgs as ua, LoadStateActionInputSchema as uc, ISignal as ui, UndoActionSchema as ul, setNameOperation as un, SchemaLoadStateAction as uo, DeleteChildDocumentInput as ur, Set_Name as us, setPreferredEditor as ut, buildOperationSignature as v, MutationSetOperationReducerArgs as va, OperationScopeSchema as vc, LoadFromInput as vi, createNamespacedQueryBuilder as vl, createBaseState as vn, SetAuthorNameAction as vo, DeleteOperationErrorInput as vr, SigningParameters as vs, IntegrityIssueType as vt, deleteOperationError as w, MutationUpdateOperationExampleArgs as wa, PruneSchema as wc, MakeMaybe as wi, IBaseRelationalDb as wl, defaultBaseState as wn, SetModelDescriptionAction as wo, DocumentAction as wr, Undo as ws, baseCreateDocument as wt, deleteChangeLogItem as x, MutationSetStateSchemaArgs as xa, PowerhouseModulesSchema as xc, LoadStateActionStateInput as xi, relationalDbToQueryBuilder as xl, createLocalState as xn, SetAuthorWebsiteInput as xo, DeleteOperationInput as xr, State as xs, PHDocumentMeta as xt, buildSignedAction as y, MutationSetOperationSchemaArgs as ya, OperationSpecificationSchema as yc, LoadStateAction as yi, createRelationalDb as yl, createDocumentState as yn, SetAuthorNameInput as yo, DeleteOperationExampleAction as yr, SkipHeaderOperationIndex as ys, PHDocument as yt, reorderModuleOperations as z, Redo as za, SetModelDescriptionInputSchema as zc, MutationAddStateExampleArgs as zi, ProcessorFactoryBuilder as zl, AddOperationErrorAction as zn, SetOperationDescriptionAction as zo, DocumentModelOperationErrorAction as zr, ValidationError as zs, isUndoRedo as zt };
|
|
21068
|
-
//# sourceMappingURL=
|
|
21067
|
+
export { DocumentModelDocument as $, RedoActionSchema as $a, isUndo as $c, UndoRedoAction as $i, OperationErrorSpecification as $n, IRelationalQueryBuilder as $o, SetModelExtensionInput as $r, reorderChangeLogItems as $s, MappedOperation as $t, CreateDocument as A, DeleteStateExampleInputSchema as Aa, updateStateExample as Ac, SetOperationTemplateInput as Ai, PHBaseState as Al, MutationSetInitialStateArgs as An, SetPreferredEditorActionSchema as Ao, ReorderStateExamplesInput as Ar, addOperationExample as As, FileRegistry as At, DeleteModuleAction as B, ManifestSchema as Ba, checkCleanedOperationsIntegrity as Bc, SignalResult as Bi, defaultDocumentState as Bl, MutationSetOperationErrorDescriptionArgs as Bn, UpdateStateExampleInputSchema as Bo, SchemaSetNameAction as Br, deleteOperationExample as Bs, InputMaybe as Bt, CodeExample as C, ConfigEntrySchema as Ca, setOperationScope as Cc, SetOperationReducerAction as Ci, loadStateOperation as Cl, MutationReorderModuleOperationsArgs as Cn, SetOperationErrorTemplateInputSchema as Co, ReorderModulesAction as Cr, actionFromAction as Cs, DocumentSpecification as Ct, CopyChildDocumentSignal as D, DeleteOperationErrorInputSchema as Da, undo as Dc, SetOperationScopeAction as Di, undoOperation as Dl, MutationReorderStateExamplesArgs as Dn, SetOperationScopeInputSchema as Do, ReorderOperationExamplesAction as Dr, addModule as Ds, EditorProps as Dt, CopyChildDocumentInput as E, DeleteModuleInputSchema as Ea, setStateSchema as Ec, SetOperationSchemaInput as Ei, setPreferredEditorOperation as El, MutationReorderOperationExamplesArgs as En, SetOperationSchemaInputSchema as Eo, ReorderOperationErrorsInput as Er, addChangeLogItem as Es, EditorModule as Et, DeleteChangeLogItemInput as F, DocumentSpecificationSchema as Fa, PHDocumentHeader as Fc, SetStateSchemaInput as Fi, createGlobalState as Fl, MutationSetModuleDescriptionArgs as Fn, UndoActionInputSchema as Fo, Scalars as Fr, createAction as Fs, IOperation as Ft, DeleteOperationExampleAction as G, OperationSpecificationSchema as Ga, garbageCollect as Gc, SkipHeaderOperationIndex as Gi, AppActionSigner as Gl, MutationSetOperationSchemaArgs as Gn, createRelationalDb as Go, SetAuthorNameInput as Gr, noop as Gs, LoadStateAction as Gt, DeleteOperationAction as H, MoveOperationInputSchema as Ha, diffOperations as Hc, SignalType as Hi, defaultLocalState as Hl, MutationSetOperationErrorTemplateArgs as Hn, isDefinedNonNullAny as Ho, SchemaUndoAction as Hr, documentModelActions as Hs, IsStateOfType as Ht, DeleteChildDocumentInput as I, LoadStateActionInputSchema as Ia, PHDocumentMeta as Ic, Set_Name as Ii, createLocalState as Il, MutationSetModuleNameArgs as In, UndoActionSchema as Io, SchemaLoadStateAction as Ir, deleteChangeLogItem as Is, ISignal as It, DeleteStateExampleAction as J, PruneActionInputSchema as Ja, getDocumentLastModified as Jc, StateReducer as Ji, Signature as Jl, MutationUndoArgs as Jn, ExtractProcessorSchemaOrSelf as Jo, SetInitialStateAction as Jr, operationFromOperation as Js, Load_State as Jt, DeleteOperationExampleInput as K, PowerhouseModuleSchema as Ka, garbageCollectDocumentOperations as Kc, SkipHeaderOperations as Ki, HashConfig as Kl, MutationSetOperationTemplateArgs as Kn, hashNamespace as Ko, SetAuthorWebsiteAction as Kr, operationExampleCreators as Ks, LoadStateActionInput as Kt, DeleteChildDocumentSignal as L, LoadStateActionSchema as La, addUndo as Lc, Set_PreferredEditor as Li, createState as Ll, MutationSetNameArgs as Ln, UndoSchema as Lo, SchemaNOOPAction as Lr, deleteModule as Ls, ISignalResult as Lt, CreateDocumentActionInput as M, DocumentFileSchema as Ma, IntegrityIssueSubType as Mc, SetPreferredEditorActionInput as Mi, createAuthState as Ml, MutationSetModelExtensionArgs as Mn, Set_NameSchema as Mo, RevisionsFilter as Mr, baseActions as Ms, IAction as Mt, CreateState as N, DocumentModelGlobalStateSchema as Na, IntegrityIssueType as Nc, SetPreferredEditorOperation as Ni, createBaseState as Nl, MutationSetModelIdArgs as Nn, Set_PreferredEditorSchema as No, SaveToFile as Nr, buildOperationSignature as Ns, ID as Nt, CreateChildDocumentInput as O, DeleteOperationExampleInputSchema as Oa, updateChangeLogItem as Oc, SetOperationScopeInput as Oi, undoOperationV2 as Ol, MutationSetAuthorNameArgs as On, SetOperationTemplateInputSchema as Oo, ReorderOperationExamplesInput as Or, addOperation as Os, Exact as Ot, DeleteChangeLogItemAction as P, DocumentModelInputSchema as Pa, PHDocument as Pc, SetStateSchemaAction as Pi, createDocumentState as Pl, MutationSetModelNameArgs as Pn, StateSchema as Po, SaveToFileHandle as Pr, buildSignedAction as Ps, IDocument as Pt, DocumentModelAction as Q, RedoActionInputSchema as Qa, isNoopOperation as Qc, UndoActionInput as Qi, PROCESSOR_APPS as Ql, NOOPAction as Qn, IRelationalDbProcessor as Qo, SetModelExtensionAction as Qr, releaseNewVersion as Qs, Manifest as Qt, DeleteDocumentAction as R, LoadStateActionStateInputSchema as Ra, attachBranch as Rc, Signal as Ri, defaultAuthState as Rl, MutationSetOperationDescriptionArgs as Rn, UpdateChangeLogItemInputSchema as Ro, SchemaPruneAction as Rr, deleteOperation as Rs, ISigner as Rt, Author as S, CodeExampleSchema as Sa, setOperationSchema as Sc, SetOperationNameInput as Si, OperationWithContext$1 as Sl, MutationReorderChangeLogItemsInputArgs as Sn, SetOperationErrorNameInputSchema as So, ReorderModuleOperationsInput as Sr, actionContext as Ss, DocumentOperationsIgnoreMap as St, ConfigEntryType as T, DeleteChangeLogItemInputSchema as Ta, setPreferredEditor as Tc, SetOperationSchemaAction as Ti, setNameOperation as Tl, MutationReorderOperationErrorsArgs as Tn, SetOperationReducerInputSchema as To, ReorderOperationErrorsAction as Tr, actions as Ts, EditorDispatch as Tt, DeleteOperationErrorAction as U, OperationErrorSchema as Ua, filterDocumentOperationsResultingState as Uc, SignatureVerificationHandler as Ui, defaultPHState as Ul, MutationSetOperationNameArgs as Un, createNamespacedDb as Uo, ScopeState as Ur, loadState as Us, LoadFromFile as Ut, DeleteModuleInput as V, ModuleSchema as Va, checkOperationsIntegrity as Vc, SignalResults as Vi, defaultGlobalState as Vl, MutationSetOperationErrorNameArgs as Vn, definedNonNullAnySchema as Vo, SchemaSetPreferredEditorAction as Vr, deleteStateExample as Vs, IsDocumentOfType as Vt, DeleteOperationErrorInput as W, OperationScopeSchema as Wa, filterDuplicatedOperations as Wc, SigningParameters as Wi, ActionSigner as Wl, MutationSetOperationReducerArgs as Wn, createNamespacedQueryBuilder as Wo, SetAuthorNameAction as Wr, moveOperation as Ws, LoadFromInput as Wt, DocumentAction as X, PruneSchema as Xa, hashDocumentStateForScope as Xc, Undo as Xi, DEFAULT_ANALYTICS_PROCESSOR_DB_NAME as Xl, MutationUpdateOperationExampleArgs as Xn, IBaseRelationalDb as Xo, SetModelDescriptionAction as Xr, prune as Xs, MakeMaybe as Xt, DeleteStateExampleInput as Y, PruneActionSchema as Ya, groupOperationsByScope as Yc, SubgraphModule as Yi, UserActionSigner as Yl, MutationUpdateChangeLogItemInputArgs as Yn, HashAlgorithms as Yo, SetInitialStateInput as Yr, operationWithContext as Ys, MakeEmpty as Yt, DocumentFile as Z, PublisherSchema as Za, isDocumentAction as Zc, UndoAction as Zi, DEFAULT_RELATIONAL_PROCESSOR_DB_NAME as Zl, MutationUpdateStateExampleArgs as Zn, IRelationalDb as Zo, SetModelDescriptionInput as Zr, redo as Zs, MakeOptional as Zt, AddRelationshipActionInput as _, AddOperationErrorInputSchema as _a, setOperationErrorDescription as _c, SetOperationErrorNameAction as _i, split as _l, MutationDeleteStateExampleArgs as _n, SetNameActionInputSchema as _o, RemoveRelationshipAction as _r, ActionContext as _s, DocumentModelStateAction as _t, Actions as a, UpdateRelationshipActionInput as aa, setAuthorName as ac, SetModuleDescriptionInput as ai, operationsAreEqual as al, Mutation as an, ReorderOperationExamplesInputSchema as ao, PowerhouseModule as ar, IProcessorHostModule as as, DocumentModelLib as at, AssertIsDocumentOfType as b, AddStateExampleInputSchema as ba, setOperationName as bc, SetOperationErrorTemplateInput as bi, Operation as bl, MutationPruneArgs as bn, SetOperationErrorCodeInputSchema as bo, ReorderChangeLogItemsInput as br, AttachmentInput as bs, DocumentModelVersioningAction as bt, AddModuleAction as c, UpgradeDocumentAction as ca, setModelDescription as cc, SetNameAction as ci, prepareOperations as cl, MutationAddOperationArgs as cn, SetAuthorNameInputSchema as co, PruneActionInput as cr, ProcessorApps as cs, DocumentModelModuleAction as ct, AddOperationErrorAction as d, ValidationError as da, setModelName as dc, SetOperationDescriptionAction as di, replayDocument as dl, MutationAddStateExampleArgs as dn, SetModelDescriptionInputSchema as do, Redo as dr, ProcessorFactoryBuilder as ds, DocumentModelOperationErrorAction as dt, UpdateChangeLogItemAction as ea, reorderModuleOperations as ec, SetModelIdAction as ei, isUndoRedo as el, Maybe as en, RedoSchema as eo, OperationIndex as er, IRelationalQueryMethods as es, DocumentModelDocumentModelModule as et, AddOperationErrorInput as f, UpgradeManifest as fa, setModuleDescription as fc, SetOperationDescriptionInput as fi, reshuffleByTimestamp as fl, MutationDeleteChangeLogItemInputArgs as fn, SetModelExtensionInputSchema as fo, RedoAction as fr, ProcessorFilter as fs, DocumentModelOperationErrorOperations as ft, AddRelationshipAction as g, AddModuleInputSchema as ga, setOperationErrorCode as gc, SetOperationErrorDescriptionInput as gi, sortOperations as gl, MutationDeleteOperationExampleArgs as gn, SetModuleNameInputSchema as go, ReleaseNewVersionAction as gr, Action as gs, DocumentModelPHState as gt, AddOperationInput as h, AddChangeLogItemInputSchema as ha, setOperationDescription as hc, SetOperationErrorDescriptionAction as hi, sortMappedOperations as hl, MutationDeleteOperationErrorArgs as hn, SetModuleDescriptionInputSchema as ho, ReducerOptions as hr, TrackedProcessor as hs, DocumentModelOperationOperations as ht, ActionVerificationHandler as i, UpdateRelationshipAction as ia, reorderStateExamples as ic, SetModuleDescriptionAction as ii, nextSkipNumber as il, MoveOperationInput as in, ReorderOperationErrorsInputSchema as io, PartialState as ir, IProcessorDispatch as is, DocumentModelInput as it, CreateDocumentAction as j, DocumentActionSchema as ja, verifyOperationSignature as jc, SetPreferredEditorAction as ji, PHDocumentState as jl, MutationSetModelDescriptionArgs as jn, SetStateSchemaInputSchema as jo, ReplayDocumentOptions as jr, addStateExample as js, GetDocumentOptions as jt, CreateChildDocumentSignal as k, DeleteOperationInputSchema as ka, updateOperationExample as kc, SetOperationTemplateAction as ki, PHAuthState as kl, MutationSetAuthorWebsiteArgs as kn, SetPreferredEditorActionInputSchema as ko, ReorderStateExamplesAction as kr, addOperationError as ks, FileInput as kt, AddModuleInput as l, UpgradeDocumentActionInput as la, setModelExtension as lc, SetNameActionInput as li, readOnly as ll, MutationAddOperationErrorArgs as ln, SetAuthorWebsiteInputSchema as lo, Publisher as lr, ProcessorDispatchResult as ls, DocumentModelModuleOperations as lt, AddOperationExampleInput as m, UpgradeTransition as ma, setName as mc, SetOperationErrorCodeInput as mi, skipHeaderOperations as ml, MutationDeleteOperationArgs as mn, SetModelNameInputSchema as mo, Reducer as mr, ProcessorStatus as ms, DocumentModelOperationExampleOperations as mt, ActionSignatureContext as n, UpdateOperationExampleAction as na, reorderOperationErrors as nc, SetModelNameAction as ni, mapSkippedOperationsV2 as nl, ModuleSpecification as nn, ReorderModuleOperationsInputSchema as no, OperationsByScope as nr, RelationalDbProcessorClass as ns, DocumentModelHeaderAction as nt, AddChangeLogItemAction as o, UpdateStateExampleAction as oa, setAuthorWebsite as oc, SetModuleNameAction as oi, parseResultingState as ol, MutationAddChangeLogItemInputArgs as on, ReorderStateExamplesInputSchema as oo, Prune as or, IProcessorManager as os, DocumentModelLocalState as ot, AddOperationExampleAction as p, UpgradeReducer as pa, setModuleName as pc, SetOperationErrorCodeAction as pi, reshuffleByTimestampAndIndex as pl, MutationDeleteModuleArgs as pn, SetModelIdInputSchema as po, RedoActionInput as pr, ProcessorRecord as ps, DocumentModelOperationExampleAction as pt, DeleteOperationInput as q, PowerhouseModulesSchema as qa, garbageCollectV2 as qc, State as qi, PHDocumentSignatureInfo as ql, MutationSetStateSchemaArgs as qn, relationalDbToQueryBuilder as qo, SetAuthorWebsiteInput as qr, operationFromAction as qs, LoadStateActionStateInput as qt, ActionSigningHandler as r, UpdateOperationExampleInput as ra, reorderOperationExamples as rc, SetModelNameInput as ri, merge as rl, MoveOperationAction as rn, ReorderModulesInputSchema as ro, PartialRecord as rr, IProcessor as rs, DocumentModelHeaderOperations as rt, AddChangeLogItemInput as s, UpdateStateExampleInput as sa, setInitialState as sc, SetModuleNameInput as si, precedes as sl, MutationAddModuleArgs as sn, ScopeStateSchema as so, PruneAction as sr, ProcessorApp as ss, DocumentModelModule as st, ActionErrorCallback as t, UpdateChangeLogItemInput as ta, reorderModules as tc, SetModelIdInput as ti, mapSkippedOperations as tl, MinimalBackupData as tn, ReorderChangeLogItemsInputSchema as to, OperationSpecification as tr, RelationalDbProcessor as ts, DocumentModelGlobalState as tt, AddOperationAction as u, User as ua, setModelId as uc, SetNameOperation as ui, removeExistingOperations as ul, MutationAddOperationExampleArgs as un, SetInitialStateInputSchema as uo, Query as ur, ProcessorFactory as us, DocumentModelOperationAction as ut, AddStateExampleAction as v, AddOperationExampleInputSchema as va, setOperationErrorName as vc, SetOperationErrorNameInput as vi, updateHeaderRevision as vl, MutationLoadStateArgs as vn, SetNameActionSchema as vo, RemoveRelationshipActionInput as vr, ActionWithAttachment as vs, DocumentModelStateOperations as vt, ConfigEntry as w, ConfigEntryTypeSchema as wa, setOperationTemplate as wc, SetOperationReducerInput as wi, redoOperation as wl, MutationReorderModulesArgs as wn, SetOperationNameInputSchema as wo, ReorderModulesInput as wr, actionSigner as ws, ENSInfo as wt, AssertIsStateOfType as x, AuthorSchema as xa, setOperationReducer as xc, SetOperationNameAction as xi, OperationContext as xl, MutationRedoArgs as xn, SetOperationErrorDescriptionInputSchema as xo, ReorderModuleOperationsAction as xr, AttachmentRef as xs, DocumentModelVersioningOperations as xt, AddStateExampleInput as y, AddOperationInputSchema as ya, setOperationErrorTemplate as yc, SetOperationErrorTemplateAction as yi, DocumentOperations as yl, MutationMoveOperationArgs as yn, SetOperationDescriptionInputSchema as yo, ReorderChangeLogItemsAction as yr, Attachment as ys, DocumentModelUtils as yt, DeleteDocumentActionInput as z, Load_StateSchema as za, baseCreateDocument as zc, SignalDispatch as zi, defaultBaseState as zl, MutationSetOperationErrorCodeArgs as zn, UpdateOperationExampleInputSchema as zo, SchemaRedoAction as zr, deleteOperationError as zs, Incremental as zt };
|
|
21068
|
+
//# sourceMappingURL=types-CC6ib3_2.d.ts.map
|