cojson 0.4.1 → 0.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/coValue.js +0 -9
- package/dist/coValue.js.map +1 -1
- package/dist/coValueCore.js +4 -34
- package/dist/coValueCore.js.map +1 -1
- package/dist/coValues/coList.js +2 -2
- package/dist/coValues/coList.js.map +1 -1
- package/dist/coValues/coMap.js +2 -2
- package/dist/coValues/coMap.js.map +1 -1
- package/dist/coValues/coStream.js +2 -2
- package/dist/coValues/coStream.js.map +1 -1
- package/dist/coValues/group.js.map +1 -1
- package/dist/coreToCoValue.js +37 -0
- package/dist/coreToCoValue.js.map +1 -0
- package/dist/index.js +2 -4
- package/dist/index.js.map +1 -1
- package/dist/isCoValue.js +10 -0
- package/dist/isCoValue.js.map +1 -0
- package/dist/localNode.js +1 -14
- package/dist/localNode.js.map +1 -1
- package/package.json +4 -4
- package/src/coValue.ts +11 -19
- package/src/coValueCore.ts +2 -25
- package/src/coValues/coList.ts +3 -2
- package/src/coValues/coMap.ts +3 -2
- package/src/coValues/coStream.ts +3 -4
- package/src/coValues/group.ts +4 -4
- package/src/coreToCoValue.ts +37 -0
- package/src/index.ts +16 -16
- package/src/isCoValue.ts +16 -0
- package/src/localNode.ts +6 -47
- package/src/tests/coValue.test.ts +5 -5
- package/src/tests/group.test.ts +1 -1
- package/dist/base64url.d.ts +0 -2
- package/dist/coValue.d.ts +0 -38
- package/dist/coValueCore.d.ts +0 -103
- package/dist/coValues/account.d.ts +0 -62
- package/dist/coValues/coList.d.ts +0 -179
- package/dist/coValues/coMap.d.ts +0 -149
- package/dist/coValues/coStream.d.ts +0 -123
- package/dist/coValues/group.d.ts +0 -111
- package/dist/crypto.d.ts +0 -120
- package/dist/ids.d.ts +0 -11
- package/dist/index.d.ts +0 -67
- package/dist/jsonStringify.d.ts +0 -6
- package/dist/jsonValue.d.ts +0 -7
- package/dist/localNode.d.ts +0 -101
- package/dist/media.d.ts +0 -7
- package/dist/permissions.d.ts +0 -20
- package/dist/queriedCoValues/queriedAccount.d.ts +0 -13
- package/dist/queriedCoValues/queriedAccount.js +0 -24
- package/dist/queriedCoValues/queriedAccount.js.map +0 -1
- package/dist/queriedCoValues/queriedCoList.d.ts +0 -66
- package/dist/queriedCoValues/queriedCoList.js +0 -116
- package/dist/queriedCoValues/queriedCoList.js.map +0 -1
- package/dist/queriedCoValues/queriedCoMap.d.ts +0 -40
- package/dist/queriedCoValues/queriedCoMap.js +0 -82
- package/dist/queriedCoValues/queriedCoMap.js.map +0 -1
- package/dist/queriedCoValues/queriedCoStream.d.ts +0 -36
- package/dist/queriedCoValues/queriedCoStream.js +0 -97
- package/dist/queriedCoValues/queriedCoStream.js.map +0 -1
- package/dist/queriedCoValues/queriedGroup.d.ts +0 -29
- package/dist/queriedCoValues/queriedGroup.js +0 -54
- package/dist/queriedCoValues/queriedGroup.js.map +0 -1
- package/dist/queries.d.ts +0 -62
- package/dist/queries.js +0 -142
- package/dist/queries.js.map +0 -1
- package/dist/streamUtils.d.ts +0 -8
- package/dist/sync.d.ts +0 -80
- package/dist/tests/testUtils.d.ts +0 -37
- package/src/queriedCoValues/queriedAccount.ts +0 -40
- package/src/queriedCoValues/queriedCoList.ts +0 -240
- package/src/queriedCoValues/queriedCoMap.ts +0 -168
- package/src/queriedCoValues/queriedCoStream.ts +0 -151
- package/src/queriedCoValues/queriedGroup.ts +0 -90
- package/src/queries.ts +0 -263
- package/src/tests/queries.test.ts +0 -398
package/dist/crypto.d.ts
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { JsonValue } from "./jsonValue.js";
|
|
2
|
-
import { AgentID, RawCoID, TransactionID } from "./ids.js";
|
|
3
|
-
import { Stringified } from "./jsonStringify.js";
|
|
4
|
-
export declare const cryptoReady: Promise<void>;
|
|
5
|
-
export type SignerSecret = `signerSecret_z${string}`;
|
|
6
|
-
export type SignerID = `signer_z${string}`;
|
|
7
|
-
export type Signature = `signature_z${string}`;
|
|
8
|
-
export type SealerSecret = `sealerSecret_z${string}`;
|
|
9
|
-
export type SealerID = `sealer_z${string}`;
|
|
10
|
-
export type Sealed<T> = `sealed_U${string}` & {
|
|
11
|
-
__type: T;
|
|
12
|
-
};
|
|
13
|
-
export type AgentSecret = `${SealerSecret}/${SignerSecret}`;
|
|
14
|
-
export declare function newRandomSigner(): SignerSecret;
|
|
15
|
-
export declare function signerSecretToBytes(secret: SignerSecret): Uint8Array;
|
|
16
|
-
export declare function signerSecretFromBytes(bytes: Uint8Array): SignerSecret;
|
|
17
|
-
export declare function getSignerID(secret: SignerSecret): SignerID;
|
|
18
|
-
export declare function sign(secret: SignerSecret, message: JsonValue): Signature;
|
|
19
|
-
export declare function verify(signature: Signature, message: JsonValue, id: SignerID): boolean;
|
|
20
|
-
export declare function newRandomSealer(): SealerSecret;
|
|
21
|
-
export declare function sealerSecretToBytes(secret: SealerSecret): Uint8Array;
|
|
22
|
-
export declare function sealerSecretFromBytes(bytes: Uint8Array): SealerSecret;
|
|
23
|
-
export declare function getSealerID(secret: SealerSecret): SealerID;
|
|
24
|
-
export declare function newRandomAgentSecret(): AgentSecret;
|
|
25
|
-
export declare function agentSecretToBytes(secret: AgentSecret): Uint8Array;
|
|
26
|
-
export declare function agentSecretFromBytes(bytes: Uint8Array): AgentSecret;
|
|
27
|
-
export declare function getAgentID(secret: AgentSecret): AgentID;
|
|
28
|
-
export declare function getAgentSignerID(agentId: AgentID): SignerID;
|
|
29
|
-
export declare function getAgentSignerSecret(agentSecret: AgentSecret): SignerSecret;
|
|
30
|
-
export declare function getAgentSealerID(agentId: AgentID): SealerID;
|
|
31
|
-
export declare function getAgentSealerSecret(agentSecret: AgentSecret): SealerSecret;
|
|
32
|
-
export declare function seal<T extends JsonValue>({ message, from, to, nOnceMaterial, }: {
|
|
33
|
-
message: T;
|
|
34
|
-
from: SealerSecret;
|
|
35
|
-
to: SealerID;
|
|
36
|
-
nOnceMaterial: {
|
|
37
|
-
in: RawCoID;
|
|
38
|
-
tx: TransactionID;
|
|
39
|
-
};
|
|
40
|
-
}): Sealed<T>;
|
|
41
|
-
export declare function unseal<T extends JsonValue>(sealed: Sealed<T>, sealer: SealerSecret, from: SealerID, nOnceMaterial: {
|
|
42
|
-
in: RawCoID;
|
|
43
|
-
tx: TransactionID;
|
|
44
|
-
}): T | undefined;
|
|
45
|
-
export type Hash = `hash_z${string}`;
|
|
46
|
-
export declare function secureHash(value: JsonValue): Hash;
|
|
47
|
-
export declare class StreamingHash {
|
|
48
|
-
state: Uint8Array;
|
|
49
|
-
constructor(fromClone?: Uint8Array);
|
|
50
|
-
update(value: JsonValue): void;
|
|
51
|
-
digest(): Hash;
|
|
52
|
-
clone(): StreamingHash;
|
|
53
|
-
}
|
|
54
|
-
export type ShortHash = `shortHash_z${string}`;
|
|
55
|
-
export declare const shortHashLength = 19;
|
|
56
|
-
export declare function shortHash(value: JsonValue): ShortHash;
|
|
57
|
-
export type Encrypted<T extends JsonValue, N extends JsonValue> = `encrypted_U${string}` & {
|
|
58
|
-
__type: T;
|
|
59
|
-
__nOnceMaterial: N;
|
|
60
|
-
};
|
|
61
|
-
export type KeySecret = `keySecret_z${string}`;
|
|
62
|
-
export type KeyID = `key_z${string}`;
|
|
63
|
-
export declare function newRandomKeySecret(): {
|
|
64
|
-
secret: KeySecret;
|
|
65
|
-
id: KeyID;
|
|
66
|
-
};
|
|
67
|
-
export declare function encryptForTransaction<T extends JsonValue>(value: T, keySecret: KeySecret, nOnceMaterial: {
|
|
68
|
-
in: RawCoID;
|
|
69
|
-
tx: TransactionID;
|
|
70
|
-
}): Encrypted<T, {
|
|
71
|
-
in: RawCoID;
|
|
72
|
-
tx: TransactionID;
|
|
73
|
-
}>;
|
|
74
|
-
export declare function encryptKeySecret(keys: {
|
|
75
|
-
toEncrypt: {
|
|
76
|
-
id: KeyID;
|
|
77
|
-
secret: KeySecret;
|
|
78
|
-
};
|
|
79
|
-
encrypting: {
|
|
80
|
-
id: KeyID;
|
|
81
|
-
secret: KeySecret;
|
|
82
|
-
};
|
|
83
|
-
}): {
|
|
84
|
-
encryptedID: KeyID;
|
|
85
|
-
encryptingID: KeyID;
|
|
86
|
-
encrypted: Encrypted<KeySecret, {
|
|
87
|
-
encryptedID: KeyID;
|
|
88
|
-
encryptingID: KeyID;
|
|
89
|
-
}>;
|
|
90
|
-
};
|
|
91
|
-
export declare function decryptRawForTransaction<T extends JsonValue>(encrypted: Encrypted<T, {
|
|
92
|
-
in: RawCoID;
|
|
93
|
-
tx: TransactionID;
|
|
94
|
-
}>, keySecret: KeySecret, nOnceMaterial: {
|
|
95
|
-
in: RawCoID;
|
|
96
|
-
tx: TransactionID;
|
|
97
|
-
}): Stringified<T> | undefined;
|
|
98
|
-
export declare function decryptForTransaction<T extends JsonValue>(encrypted: Encrypted<T, {
|
|
99
|
-
in: RawCoID;
|
|
100
|
-
tx: TransactionID;
|
|
101
|
-
}>, keySecret: KeySecret, nOnceMaterial: {
|
|
102
|
-
in: RawCoID;
|
|
103
|
-
tx: TransactionID;
|
|
104
|
-
}): T | undefined;
|
|
105
|
-
export declare function decryptKeySecret(encryptedInfo: {
|
|
106
|
-
encryptedID: KeyID;
|
|
107
|
-
encryptingID: KeyID;
|
|
108
|
-
encrypted: Encrypted<KeySecret, {
|
|
109
|
-
encryptedID: KeyID;
|
|
110
|
-
encryptingID: KeyID;
|
|
111
|
-
}>;
|
|
112
|
-
}, sealingSecret: KeySecret): KeySecret | undefined;
|
|
113
|
-
export declare function uniquenessForHeader(): `z${string}`;
|
|
114
|
-
export declare function createdNowUnique(): {
|
|
115
|
-
createdAt: `2${string}`;
|
|
116
|
-
uniqueness: `z${string}`;
|
|
117
|
-
};
|
|
118
|
-
export declare const secretSeedLength = 32;
|
|
119
|
-
export declare function newRandomSecretSeed(): Uint8Array;
|
|
120
|
-
export declare function agentSecretFromSecretSeed(secretSeed: Uint8Array): AgentSecret;
|
package/dist/ids.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { AccountID } from './coValues/account.js';
|
|
2
|
-
export type RawCoID = `co_z${string}`;
|
|
3
|
-
export declare function rawCoIDtoBytes(id: RawCoID): Uint8Array;
|
|
4
|
-
export declare function rawCoIDfromBytes(bytes: Uint8Array): RawCoID;
|
|
5
|
-
export type TransactionID = {
|
|
6
|
-
sessionID: SessionID;
|
|
7
|
-
txIndex: number;
|
|
8
|
-
};
|
|
9
|
-
export type AgentID = `sealer_z${string}/signer_z${string}`;
|
|
10
|
-
export declare function isAgentID(id: string): id is AgentID;
|
|
11
|
-
export type SessionID = `${AccountID | AgentID}_session_z${string}`;
|
package/dist/index.d.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { CoValueCore, newRandomSessionID, MAX_RECOMMENDED_TX_SIZE, accountOrAgentIDfromSessionID } from "./coValueCore.js";
|
|
2
|
-
import { LocalNode } from "./localNode.js";
|
|
3
|
-
import type { CoValue } from "./coValue.js";
|
|
4
|
-
import { CoMap, MutableCoMap } from "./coValues/coMap.js";
|
|
5
|
-
import { CoList, MutableCoList } from "./coValues/coList.js";
|
|
6
|
-
import { CoStream, MutableCoStream, BinaryCoStream, MutableBinaryCoStream } from "./coValues/coStream.js";
|
|
7
|
-
import { agentSecretFromBytes, agentSecretToBytes, getAgentID, newRandomAgentSecret, newRandomSecretSeed, agentSecretFromSecretSeed, cryptoReady } from "./crypto.js";
|
|
8
|
-
import { connectedPeers } from "./streamUtils.js";
|
|
9
|
-
import { AnonymousControlledAccount, ControlledAccount } from "./coValues/account.js";
|
|
10
|
-
import { rawCoIDtoBytes, rawCoIDfromBytes } from "./ids.js";
|
|
11
|
-
import { Group, expectGroup, EVERYONE } from "./coValues/group.js";
|
|
12
|
-
import { base64URLtoBytes, bytesToBase64url } from "./base64url.js";
|
|
13
|
-
import { parseJSON } from "./jsonStringify.js";
|
|
14
|
-
import { Account, Profile, isAccountID } from "./coValues/account.js";
|
|
15
|
-
import type { SessionID, AgentID } from "./ids.js";
|
|
16
|
-
import type { CoID, AnyCoValue } from "./coValue.js";
|
|
17
|
-
import type { Queried, QueryExtension } from "./queries.js";
|
|
18
|
-
import type { QueriedCoStream } from "./queriedCoValues/queriedCoStream.js";
|
|
19
|
-
import type { QueriedCoList } from "./queriedCoValues/queriedCoList.js";
|
|
20
|
-
import type { QueriedCoMap } from "./queriedCoValues/queriedCoMap.js";
|
|
21
|
-
import { QueriedAccount } from "./queriedCoValues/queriedAccount.js";
|
|
22
|
-
import { QueriedGroup } from "./queriedCoValues/queriedGroup.js";
|
|
23
|
-
import type { BinaryStreamInfo, BinaryCoStreamMeta } from "./coValues/coStream.js";
|
|
24
|
-
import type { JsonValue } from "./jsonValue.js";
|
|
25
|
-
import type { SyncMessage, Peer } from "./sync.js";
|
|
26
|
-
import type { AgentSecret } from "./crypto.js";
|
|
27
|
-
import type { AccountID, AccountMeta, AccountMigration, ProfileMeta } from "./coValues/account.js";
|
|
28
|
-
import type { InviteSecret } from "./coValues/group.js";
|
|
29
|
-
import type * as Media from "./media.js";
|
|
30
|
-
type Value = JsonValue | AnyCoValue;
|
|
31
|
-
/** @hidden */
|
|
32
|
-
export declare const cojsonInternals: {
|
|
33
|
-
agentSecretFromBytes: typeof agentSecretFromBytes;
|
|
34
|
-
agentSecretToBytes: typeof agentSecretToBytes;
|
|
35
|
-
newRandomSessionID: typeof newRandomSessionID;
|
|
36
|
-
newRandomAgentSecret: typeof newRandomAgentSecret;
|
|
37
|
-
connectedPeers: typeof connectedPeers;
|
|
38
|
-
getAgentID: typeof getAgentID;
|
|
39
|
-
rawCoIDtoBytes: typeof rawCoIDtoBytes;
|
|
40
|
-
rawCoIDfromBytes: typeof rawCoIDfromBytes;
|
|
41
|
-
newRandomSecretSeed: typeof newRandomSecretSeed;
|
|
42
|
-
agentSecretFromSecretSeed: typeof agentSecretFromSecretSeed;
|
|
43
|
-
secretSeedLength: number;
|
|
44
|
-
shortHashLength: number;
|
|
45
|
-
expectGroup: typeof expectGroup;
|
|
46
|
-
base64URLtoBytes: typeof base64URLtoBytes;
|
|
47
|
-
bytesToBase64url: typeof bytesToBase64url;
|
|
48
|
-
parseJSON: typeof parseJSON;
|
|
49
|
-
accountOrAgentIDfromSessionID: typeof accountOrAgentIDfromSessionID;
|
|
50
|
-
isAccountID: typeof isAccountID;
|
|
51
|
-
};
|
|
52
|
-
export { LocalNode, Group, EVERYONE, CoMap, MutableCoMap, CoList, MutableCoList, CoStream, MutableCoStream, BinaryCoStream, MutableBinaryCoStream, CoValue, CoID, AnyCoValue, Queried, QueriedCoMap, QueriedCoList, QueriedCoStream, QueriedGroup, QueriedAccount, Account, AccountID, AccountMeta, AccountMigration, Profile, ProfileMeta, SessionID, Media, CoValueCore, AnonymousControlledAccount, ControlledAccount, cryptoReady as cojsonReady, MAX_RECOMMENDED_TX_SIZE, Value, JsonValue, Peer, BinaryStreamInfo, BinaryCoStreamMeta, AgentID, AgentSecret, InviteSecret, SyncMessage, QueryExtension, };
|
|
53
|
-
export declare namespace CojsonInternalTypes {
|
|
54
|
-
type CoValueKnownState = import("./sync.js").CoValueKnownState;
|
|
55
|
-
type DoneMessage = import("./sync.js").DoneMessage;
|
|
56
|
-
type KnownStateMessage = import("./sync.js").KnownStateMessage;
|
|
57
|
-
type LoadMessage = import("./sync.js").LoadMessage;
|
|
58
|
-
type NewContentMessage = import("./sync.js").NewContentMessage;
|
|
59
|
-
type CoValueHeader = import("./coValueCore.js").CoValueHeader;
|
|
60
|
-
type Transaction = import("./coValueCore.js").Transaction;
|
|
61
|
-
type Signature = import("./crypto.js").Signature;
|
|
62
|
-
type RawCoID = import("./ids.js").RawCoID;
|
|
63
|
-
type ProfileShape = import("./coValues/account.js").ProfileShape;
|
|
64
|
-
type ProfileMeta = import("./coValues/account.js").ProfileMeta;
|
|
65
|
-
type SealerSecret = import("./crypto.js").SealerSecret;
|
|
66
|
-
type SignerSecret = import("./crypto.js").SignerSecret;
|
|
67
|
-
}
|
package/dist/jsonStringify.d.ts
DELETED
package/dist/jsonValue.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { RawCoID } from './ids.js';
|
|
2
|
-
export type JsonAtom = string | number | boolean | null;
|
|
3
|
-
export type JsonValue = JsonAtom | JsonArray | JsonObject | RawCoID;
|
|
4
|
-
export type JsonArray = JsonValue[];
|
|
5
|
-
export type JsonObject = {
|
|
6
|
-
[key: string]: JsonValue | undefined;
|
|
7
|
-
};
|
package/dist/localNode.d.ts
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { AgentSecret } from "./crypto.js";
|
|
2
|
-
import { CoValueCore, CoValueHeader } from "./coValueCore.js";
|
|
3
|
-
import { InviteSecret, Group } from "./coValues/group.js";
|
|
4
|
-
import { Peer, SyncManager } from "./sync.js";
|
|
5
|
-
import { AgentID, RawCoID, SessionID } from "./ids.js";
|
|
6
|
-
import { CoID } from "./coValue.js";
|
|
7
|
-
import { Queried } from "./queries.js";
|
|
8
|
-
import { Account, AccountMeta, GeneralizedControlledAccount, ControlledAccount, AccountID, Profile, AccountMigration } from "./coValues/account.js";
|
|
9
|
-
import { CoMap } from "./coValues/coMap.js";
|
|
10
|
-
import { CoValue } from "./index.js";
|
|
11
|
-
import { QueriedAccount } from "./queriedCoValues/queriedAccount.js";
|
|
12
|
-
/** A `LocalNode` represents a local view of a set of loaded `CoValue`s, from the perspective of a particular account (or primitive cryptographic agent).
|
|
13
|
-
|
|
14
|
-
A `LocalNode` can have peers that it syncs to, for example some form of local persistence, or a sync server, such as `sync.jazz.tools` (Jazz Global Mesh).
|
|
15
|
-
|
|
16
|
-
@example
|
|
17
|
-
You typically get hold of a `LocalNode` using `jazz-react`'s `useJazz()`:
|
|
18
|
-
|
|
19
|
-
```typescript
|
|
20
|
-
const { localNode } = useJazz();
|
|
21
|
-
```
|
|
22
|
-
*/
|
|
23
|
-
export declare class LocalNode {
|
|
24
|
-
/** @internal */
|
|
25
|
-
coValues: {
|
|
26
|
-
[key: RawCoID]: CoValueState;
|
|
27
|
-
};
|
|
28
|
-
/** @category 3. Low-level */
|
|
29
|
-
account: GeneralizedControlledAccount;
|
|
30
|
-
/** @category 3. Low-level */
|
|
31
|
-
currentSessionID: SessionID;
|
|
32
|
-
/** @category 3. Low-level */
|
|
33
|
-
syncManager: SyncManager;
|
|
34
|
-
/** @category 3. Low-level */
|
|
35
|
-
constructor(account: GeneralizedControlledAccount, currentSessionID: SessionID);
|
|
36
|
-
/** @category 2. Node Creation */
|
|
37
|
-
static withNewlyCreatedAccount<P extends Profile = Profile, R extends CoMap = CoMap, Meta extends AccountMeta = AccountMeta>({ name, migration, initialAgentSecret, }: {
|
|
38
|
-
name: string;
|
|
39
|
-
migration?: AccountMigration<P, R, Meta>;
|
|
40
|
-
initialAgentSecret?: AgentSecret;
|
|
41
|
-
}): {
|
|
42
|
-
node: LocalNode;
|
|
43
|
-
accountID: AccountID;
|
|
44
|
-
accountSecret: AgentSecret;
|
|
45
|
-
sessionID: SessionID;
|
|
46
|
-
};
|
|
47
|
-
/** @category 2. Node Creation */
|
|
48
|
-
static withLoadedAccount<P extends Profile = Profile, R extends CoMap = CoMap, Meta extends AccountMeta = AccountMeta>({ accountID, accountSecret, sessionID, peersToLoadFrom, migration, }: {
|
|
49
|
-
accountID: AccountID;
|
|
50
|
-
accountSecret: AgentSecret;
|
|
51
|
-
sessionID: SessionID;
|
|
52
|
-
peersToLoadFrom: Peer[];
|
|
53
|
-
migration?: AccountMigration<P, R, Meta>;
|
|
54
|
-
}): Promise<LocalNode>;
|
|
55
|
-
/** @internal */
|
|
56
|
-
createCoValue(header: CoValueHeader): CoValueCore;
|
|
57
|
-
/** @internal */
|
|
58
|
-
loadCoValue(id: RawCoID): Promise<CoValueCore>;
|
|
59
|
-
/**
|
|
60
|
-
* Loads a CoValue's content, syncing from peers as necessary and resolving the returned
|
|
61
|
-
* promise once a first version has been loaded. See `coValue.subscribe()` and `node.useTelepathicData()`
|
|
62
|
-
* for listening to subsequent updates to the CoValue.
|
|
63
|
-
*
|
|
64
|
-
* @category 3. Low-level
|
|
65
|
-
*/
|
|
66
|
-
load<T extends CoValue>(id: CoID<T>): Promise<T>;
|
|
67
|
-
/** @category 3. Low-level */
|
|
68
|
-
subscribe<T extends CoValue>(id: CoID<T>, callback: (update: T) => void): () => void;
|
|
69
|
-
/** @category 1. High-level */
|
|
70
|
-
query<T extends CoValue>(id: CoID<T>, callback: (update: Queried<T> | undefined) => void): () => void;
|
|
71
|
-
query<P extends Profile = Profile, R extends CoMap = CoMap, Meta extends AccountMeta = AccountMeta>(id: "me", callback: (update: QueriedAccount<Account<P, R, Meta>> | undefined) => void): () => void;
|
|
72
|
-
query(id: CoID<CoValue> | "me", callback: (update: Queried<CoValue> | QueriedAccount | undefined) => void): () => void;
|
|
73
|
-
/** @deprecated Use Account.acceptInvite instead */
|
|
74
|
-
acceptInvite<T extends CoValue>(groupOrOwnedValueID: CoID<T>, inviteSecret: InviteSecret): Promise<void>;
|
|
75
|
-
/** @internal */
|
|
76
|
-
expectCoValueLoaded(id: RawCoID, expectation?: string): CoValueCore;
|
|
77
|
-
/** @internal */
|
|
78
|
-
expectProfileLoaded(id: AccountID, expectation?: string): Profile;
|
|
79
|
-
/** @internal */
|
|
80
|
-
createAccount(name: string, agentSecret?: `sealerSecret_z${string}/signerSecret_z${string}`): ControlledAccount;
|
|
81
|
-
/** @internal */
|
|
82
|
-
resolveAccountAgent(id: AccountID | AgentID, expectation?: string): AgentID;
|
|
83
|
-
/**
|
|
84
|
-
* @deprecated use Account.createGroup() instead
|
|
85
|
-
*/
|
|
86
|
-
createGroup(): Group;
|
|
87
|
-
/** @internal */
|
|
88
|
-
testWithDifferentAccount(account: GeneralizedControlledAccount, currentSessionID: SessionID): LocalNode;
|
|
89
|
-
}
|
|
90
|
-
/** @internal */
|
|
91
|
-
type CoValueState = {
|
|
92
|
-
state: "loading";
|
|
93
|
-
done: Promise<CoValueCore>;
|
|
94
|
-
resolve: (coValue: CoValueCore) => void;
|
|
95
|
-
} | {
|
|
96
|
-
state: "loaded";
|
|
97
|
-
coValue: CoValueCore;
|
|
98
|
-
};
|
|
99
|
-
/** @internal */
|
|
100
|
-
export declare function newLoadingState(): CoValueState;
|
|
101
|
-
export {};
|
package/dist/media.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { CoMap } from './coValues/coMap.js';
|
|
2
|
-
import { BinaryCoStream } from './coValues/coStream.js';
|
|
3
|
-
export type ImageDefinition = CoMap<{
|
|
4
|
-
originalSize: [number, number];
|
|
5
|
-
placeholderDataURL?: string;
|
|
6
|
-
[res: `${number}x${number}`]: BinaryCoStream["id"];
|
|
7
|
-
}>;
|
package/dist/permissions.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { KeyID } from "./crypto.js";
|
|
2
|
-
import { CoValueCore, Transaction } from "./coValueCore.js";
|
|
3
|
-
import { AgentID, RawCoID, TransactionID } from "./ids.js";
|
|
4
|
-
import { AccountID } from "./coValues/account.js";
|
|
5
|
-
export type PermissionsDef = {
|
|
6
|
-
type: "group";
|
|
7
|
-
initialAdmin: AccountID | AgentID;
|
|
8
|
-
} | {
|
|
9
|
-
type: "ownedByGroup";
|
|
10
|
-
group: RawCoID;
|
|
11
|
-
} | {
|
|
12
|
-
type: "unsafeAllowAll";
|
|
13
|
-
};
|
|
14
|
-
export type Role = "reader" | "writer" | "admin" | "revoked" | "adminInvite" | "writerInvite" | "readerInvite";
|
|
15
|
-
export declare function determineValidTransactions(coValue: CoValueCore): {
|
|
16
|
-
txID: TransactionID;
|
|
17
|
-
tx: Transaction;
|
|
18
|
-
}[];
|
|
19
|
-
export declare function isKeyForKeyField(field: string): field is `${KeyID}_for_${KeyID}`;
|
|
20
|
-
export declare function isKeyForAccountField(field: string): field is `${KeyID}_for_${AccountID | AgentID}`;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Account } from "../coValues/account.js";
|
|
2
|
-
import { CoID, CoValue, InviteSecret } from "../index.js";
|
|
3
|
-
import { QueryContext } from "../queries.js";
|
|
4
|
-
import { QueriedGroup } from "./queriedGroup.js";
|
|
5
|
-
export declare class QueriedAccount<A extends Account = Account> extends QueriedGroup<A> {
|
|
6
|
-
id: CoID<A>;
|
|
7
|
-
isMe: boolean;
|
|
8
|
-
constructor(account: A, queryContext: QueryContext);
|
|
9
|
-
createGroup(): import("../index.js").Group<import("../index.js").Profile<import("../coValues/account.js").ProfileShape, import("../index.js").ProfileMeta>, import("../index.js").CoMap<{
|
|
10
|
-
[key: string]: import("../jsonValue.js").JsonValue | undefined;
|
|
11
|
-
}, import("../jsonValue.js").JsonObject | null>, import("../jsonValue.js").JsonObject | null>;
|
|
12
|
-
acceptInvite<T extends CoValue>(groupOrOwnedValueID: CoID<T>, inviteSecret: InviteSecret): Promise<void>;
|
|
13
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { QueriedGroup } from "./queriedGroup.js";
|
|
2
|
-
export class QueriedAccount extends QueriedGroup {
|
|
3
|
-
constructor(account, queryContext) {
|
|
4
|
-
super(account, queryContext);
|
|
5
|
-
Object.defineProperties(this, {
|
|
6
|
-
id: { value: account.id, enumerable: false },
|
|
7
|
-
isMe: {
|
|
8
|
-
value: account.core.node.account.id === account.id,
|
|
9
|
-
enumerable: false,
|
|
10
|
-
},
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
createGroup() {
|
|
14
|
-
if (!this.isMe)
|
|
15
|
-
throw new Error("Only the current user can create a group");
|
|
16
|
-
return this.group.core.node.account.createGroup();
|
|
17
|
-
}
|
|
18
|
-
acceptInvite(groupOrOwnedValueID, inviteSecret) {
|
|
19
|
-
if (!this.isMe)
|
|
20
|
-
throw new Error("Only the current user can accept an invite");
|
|
21
|
-
return this.group.core.node.account.acceptInvite(groupOrOwnedValueID, inviteSecret);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=queriedAccount.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queriedAccount.js","sourceRoot":"","sources":["../../src/queriedCoValues/queriedAccount.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,OAAO,cAA4C,SAAQ,YAAe;IAI5E,YAAY,OAAU,EAAE,YAA0B;QAC9C,KAAK,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QAC7B,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE;YAC1B,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;YAC5C,IAAI,EAAE;gBACF,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,KAAK,OAAO,CAAC,EAAE;gBAClD,UAAU,EAAE,KAAK;aACpB;SACJ,CAAC,CAAC;IACP,CAAC;IAED,WAAW;QACP,IAAI,CAAC,IAAI,CAAC,IAAI;YACV,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAChE,OACI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OACxB,CAAC,WAAW,EAAE,CAAC;IACpB,CAAC;IAED,YAAY,CACR,mBAA4B,EAC5B,YAA0B;QAE1B,IAAI,CAAC,IAAI,CAAC,IAAI;YACV,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAClE,OAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAA6B,CAAC,YAAY,CACnE,mBAAmB,EACnB,YAAY,CACf,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { CoList, MutableCoList } from "../coValues/coList.js";
|
|
2
|
-
import { CoValueCore } from "../coValueCore.js";
|
|
3
|
-
import { Group } from "../coValues/group.js";
|
|
4
|
-
import { CoID, CoValue } from "../coValue.js";
|
|
5
|
-
import { TransactionID } from "../ids.js";
|
|
6
|
-
import { ValueOrSubQueried, QueryContext } from "../queries.js";
|
|
7
|
-
import { QueriedAccount } from "./queriedAccount.js";
|
|
8
|
-
export declare class QueriedCoList<L extends CoList> extends Array<ValueOrSubQueried<L["_item"]>> {
|
|
9
|
-
coList: L;
|
|
10
|
-
id: CoID<L>;
|
|
11
|
-
type: "colist";
|
|
12
|
-
/** @internal */
|
|
13
|
-
constructor(coList: L, queryContext: QueryContext);
|
|
14
|
-
get meta(): L["meta"];
|
|
15
|
-
get group(): Group;
|
|
16
|
-
get core(): CoValueCore;
|
|
17
|
-
append(item: L["_item"], after?: number, privacy?: "private" | "trusting"): L;
|
|
18
|
-
prepend(item: L["_item"], before?: number, privacy?: "private" | "trusting"): L;
|
|
19
|
-
delete(at: number, privacy?: "private" | "trusting"): L;
|
|
20
|
-
mutate(mutator: (mutable: MutableCoList<L["_item"], L["meta"]>) => void): L;
|
|
21
|
-
edits: {
|
|
22
|
-
by?: QueriedAccount;
|
|
23
|
-
tx: TransactionID;
|
|
24
|
-
at: Date;
|
|
25
|
-
value: L["_item"] extends CoValue ? CoID<L["_item"]> : Exclude<L["_item"], CoValue>;
|
|
26
|
-
}[];
|
|
27
|
-
deletions: {
|
|
28
|
-
by?: QueriedAccount;
|
|
29
|
-
tx: TransactionID;
|
|
30
|
-
at: Date;
|
|
31
|
-
}[];
|
|
32
|
-
/** @internal */
|
|
33
|
-
static isArray(arg: any): arg is any[];
|
|
34
|
-
/** @internal */
|
|
35
|
-
static from<T>(arrayLike: ArrayLike<T>): T[];
|
|
36
|
-
/** @internal */
|
|
37
|
-
static from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
38
|
-
/** @internal */
|
|
39
|
-
static from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
|
|
40
|
-
/** @internal */
|
|
41
|
-
static from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
42
|
-
/** @internal */
|
|
43
|
-
static of<T>(..._items: T[]): T[];
|
|
44
|
-
/** @internal */
|
|
45
|
-
pop(): ValueOrSubQueried<L["_item"]> | undefined;
|
|
46
|
-
/** @internal */
|
|
47
|
-
push(..._items: ValueOrSubQueried<L["_item"]>[]): number;
|
|
48
|
-
/** @internal */
|
|
49
|
-
concat(..._items: ConcatArray<ValueOrSubQueried<L["_item"]>>[]): ValueOrSubQueried<L["_item"]>[];
|
|
50
|
-
/** @internal */
|
|
51
|
-
concat(..._items: (ValueOrSubQueried<L["_item"]> | ConcatArray<ValueOrSubQueried<L["_item"]>>)[]): ValueOrSubQueried<L["_item"]>[];
|
|
52
|
-
/** @internal */
|
|
53
|
-
reverse(): ValueOrSubQueried<L["_item"]>[];
|
|
54
|
-
/** @internal */
|
|
55
|
-
shift(): ValueOrSubQueried<L["_item"]> | undefined;
|
|
56
|
-
/** @internal */
|
|
57
|
-
sort(_compareFn?: ((a: ValueOrSubQueried<L["_item"]>, b: ValueOrSubQueried<L["_item"]>) => number) | undefined): this;
|
|
58
|
-
/** @internal */
|
|
59
|
-
splice(_start: number, _deleteCount?: number | undefined): ValueOrSubQueried<L["_item"]>[];
|
|
60
|
-
/** @internal */
|
|
61
|
-
unshift(..._items: ValueOrSubQueried<L["_item"]>[]): number;
|
|
62
|
-
/** @internal */
|
|
63
|
-
fill(_value: ValueOrSubQueried<L["_item"]>, _start?: number | undefined, _end?: number | undefined): this;
|
|
64
|
-
/** @internal */
|
|
65
|
-
copyWithin(_target: number, _start: number, _end?: number | undefined): this;
|
|
66
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { CoList } from "../coValues/coList.js";
|
|
2
|
-
export class QueriedCoList extends Array {
|
|
3
|
-
/** @internal */
|
|
4
|
-
constructor(coList, queryContext) {
|
|
5
|
-
if (!(coList instanceof CoList)) {
|
|
6
|
-
// this might be called from an intrinsic, like map, trying to create an empty array
|
|
7
|
-
// passing `0` as the only parameter
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
-
return new Array(coList);
|
|
10
|
-
}
|
|
11
|
-
super(...coList
|
|
12
|
-
.asArray()
|
|
13
|
-
.map((item) => queryContext.queryIfCoID(item, [coList.id])));
|
|
14
|
-
Object.defineProperties(this, {
|
|
15
|
-
coList: { get() { return coList; } },
|
|
16
|
-
id: { value: coList.id },
|
|
17
|
-
type: { value: "colist" },
|
|
18
|
-
edits: {
|
|
19
|
-
value: [...this.keys()].map((i) => {
|
|
20
|
-
const edit = coList.editAt(i);
|
|
21
|
-
return queryContext.defineSubqueryPropertiesIn({
|
|
22
|
-
tx: edit.tx,
|
|
23
|
-
at: new Date(edit.at),
|
|
24
|
-
}, {
|
|
25
|
-
by: { value: edit.by, enumerable: true },
|
|
26
|
-
value: { value: edit.value, enumerable: true },
|
|
27
|
-
}, [coList.id]);
|
|
28
|
-
}),
|
|
29
|
-
},
|
|
30
|
-
deletions: {
|
|
31
|
-
value: coList.deletionEdits().map((deletion) => queryContext.defineSubqueryPropertiesIn({
|
|
32
|
-
tx: deletion.tx,
|
|
33
|
-
at: new Date(deletion.at),
|
|
34
|
-
}, {
|
|
35
|
-
by: { value: deletion.by, enumerable: true },
|
|
36
|
-
}, [coList.id])),
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
get meta() {
|
|
41
|
-
return this.coList.meta;
|
|
42
|
-
}
|
|
43
|
-
get group() {
|
|
44
|
-
return this.coList.group;
|
|
45
|
-
}
|
|
46
|
-
get core() {
|
|
47
|
-
return this.coList.core;
|
|
48
|
-
}
|
|
49
|
-
append(item, after, privacy) {
|
|
50
|
-
return this.coList.append(item, after, privacy);
|
|
51
|
-
}
|
|
52
|
-
prepend(item, before, privacy) {
|
|
53
|
-
return this.coList.prepend(item, before, privacy);
|
|
54
|
-
}
|
|
55
|
-
delete(at, privacy) {
|
|
56
|
-
return this.coList.delete(at, privacy);
|
|
57
|
-
}
|
|
58
|
-
mutate(mutator) {
|
|
59
|
-
return this.coList.mutate(mutator);
|
|
60
|
-
}
|
|
61
|
-
/** @internal */
|
|
62
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
63
|
-
static isArray(arg) {
|
|
64
|
-
return Array.isArray(arg);
|
|
65
|
-
}
|
|
66
|
-
/** @internal */
|
|
67
|
-
static from(_iterable, _mapfn, _thisArg) {
|
|
68
|
-
throw new Error("Array method 'from' not supported on QueriedCoList");
|
|
69
|
-
}
|
|
70
|
-
/** @internal */
|
|
71
|
-
static of(..._items) {
|
|
72
|
-
throw new Error("Array method 'of' not supported on QueriedCoList");
|
|
73
|
-
}
|
|
74
|
-
/** @internal */
|
|
75
|
-
pop() {
|
|
76
|
-
throw new Error("Array method 'pop' not supported on QueriedCoList");
|
|
77
|
-
}
|
|
78
|
-
/** @internal */
|
|
79
|
-
push(..._items) {
|
|
80
|
-
throw new Error("Array method 'push' not supported on QueriedCoList");
|
|
81
|
-
}
|
|
82
|
-
/** @internal */
|
|
83
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
84
|
-
concat(..._items) {
|
|
85
|
-
throw new Error("Array method 'concat' not supported on QueriedCoList");
|
|
86
|
-
}
|
|
87
|
-
/** @internal */
|
|
88
|
-
reverse() {
|
|
89
|
-
throw new Error("Array method 'reverse' not supported on QueriedCoList");
|
|
90
|
-
}
|
|
91
|
-
/** @internal */
|
|
92
|
-
shift() {
|
|
93
|
-
throw new Error("Array method 'shift' not supported on QueriedCoList");
|
|
94
|
-
}
|
|
95
|
-
/** @internal */
|
|
96
|
-
sort(_compareFn) {
|
|
97
|
-
throw new Error("Array method 'sort' not supported on QueriedCoList");
|
|
98
|
-
}
|
|
99
|
-
/** @internal */
|
|
100
|
-
splice(_start, _deleteCount) {
|
|
101
|
-
throw new Error("Array method 'splice' not supported on QueriedCoList");
|
|
102
|
-
}
|
|
103
|
-
/** @internal */
|
|
104
|
-
unshift(..._items) {
|
|
105
|
-
throw new Error("Array method 'unshift' not supported on QueriedCoList");
|
|
106
|
-
}
|
|
107
|
-
/** @internal */
|
|
108
|
-
fill(_value, _start, _end) {
|
|
109
|
-
throw new Error("Array method 'fill' not supported on QueriedCoList");
|
|
110
|
-
}
|
|
111
|
-
/** @internal */
|
|
112
|
-
copyWithin(_target, _start, _end) {
|
|
113
|
-
throw new Error("Array method 'copyWithin' not supported on QueriedCoList");
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
//# sourceMappingURL=queriedCoList.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queriedCoList.js","sourceRoot":"","sources":["../../src/queriedCoValues/queriedCoList.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { CoMap, MutableCoMap } from "../coValues/coMap.js";
|
|
2
|
-
import { CoValueCore } from "../coValueCore.js";
|
|
3
|
-
import { Group } from "../coValues/group.js";
|
|
4
|
-
import { CoID } from "../coValue.js";
|
|
5
|
-
import { TransactionID } from "../ids.js";
|
|
6
|
-
import { ValueOrSubQueried, QueryContext, QueryExtension } from "../queries.js";
|
|
7
|
-
import { QueriedAccount } from "./queriedAccount.js";
|
|
8
|
-
export type QueriedCoMap<M extends CoMap> = {
|
|
9
|
-
[K in keyof M["_shape"] & string]: ValueOrSubQueried<M["_shape"][K]>;
|
|
10
|
-
} & QueriedCoMapBase<M>;
|
|
11
|
-
export type QueriedCoMapEdit<M extends CoMap, K extends keyof M["_shape"]> = {
|
|
12
|
-
by?: QueriedAccount;
|
|
13
|
-
tx: TransactionID;
|
|
14
|
-
at: Date;
|
|
15
|
-
value: M["_shape"][K];
|
|
16
|
-
};
|
|
17
|
-
export declare class QueriedCoMapBase<M extends CoMap> {
|
|
18
|
-
coMap: M;
|
|
19
|
-
id: CoID<M>;
|
|
20
|
-
type: "comap";
|
|
21
|
-
/** @internal */
|
|
22
|
-
static newWithKVPairs<M extends CoMap>(coMap: M, queryContext: QueryContext): QueriedCoMap<M>;
|
|
23
|
-
/** @internal */
|
|
24
|
-
constructor(coMap: M, queryContext: QueryContext);
|
|
25
|
-
edits: {
|
|
26
|
-
[K in keyof M["_shape"] & string]: (QueriedCoMapEdit<M, K> & {
|
|
27
|
-
all: QueriedCoMapEdit<M, K>[];
|
|
28
|
-
}) | undefined;
|
|
29
|
-
};
|
|
30
|
-
get meta(): M["meta"];
|
|
31
|
-
get group(): Group;
|
|
32
|
-
get core(): CoValueCore;
|
|
33
|
-
set<K extends keyof M["_shape"] & string>(key: K, value: M["_shape"][K], privacy?: "private" | "trusting"): M;
|
|
34
|
-
set(kv: {
|
|
35
|
-
[K in keyof M["_shape"] & string]?: M["_shape"][K];
|
|
36
|
-
}, privacy?: "private" | "trusting"): M;
|
|
37
|
-
delete(key: keyof M["_shape"] & string, privacy?: "private" | "trusting"): M;
|
|
38
|
-
mutate(mutator: (mutable: MutableCoMap<M["_shape"], M["meta"]>) => void): M;
|
|
39
|
-
as: <O>(extension: QueryExtension<M, O>) => O | undefined;
|
|
40
|
-
}
|