@fluidframework/presence 2.91.0 → 2.93.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/alpha.d.ts +7 -5
- package/dist/beta.d.ts +6 -3
- package/dist/getPresence.d.ts +4 -9
- package/dist/getPresence.d.ts.map +1 -1
- package/dist/getPresence.js +6 -86
- package/dist/getPresence.js.map +1 -1
- package/dist/index.d.ts +4 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/legacy.alpha.d.ts +7 -5
- package/dist/package.json +1 -15
- package/dist/public.d.ts +69 -0
- package/lib/alpha.d.ts +7 -5
- package/lib/beta.d.ts +6 -3
- package/lib/getPresence.d.ts +4 -9
- package/lib/getPresence.d.ts.map +1 -1
- package/lib/getPresence.js +6 -85
- package/lib/getPresence.js.map +1 -1
- package/lib/index.d.ts +4 -13
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -4
- package/lib/index.js.map +1 -1
- package/lib/legacy.alpha.d.ts +7 -5
- package/lib/public.d.ts +69 -0
- package/package.json +31 -80
- package/dist/baseTypes.d.ts +0 -24
- package/dist/baseTypes.d.ts.map +0 -1
- package/dist/baseTypes.js +0 -7
- package/dist/baseTypes.js.map +0 -1
- package/dist/broadcastControls.d.ts +0 -37
- package/dist/broadcastControls.d.ts.map +0 -1
- package/dist/broadcastControls.js +0 -60
- package/dist/broadcastControls.js.map +0 -1
- package/dist/broadcastControlsTypes.d.ts +0 -38
- package/dist/broadcastControlsTypes.d.ts.map +0 -1
- package/dist/broadcastControlsTypes.js +0 -7
- package/dist/broadcastControlsTypes.js.map +0 -1
- package/dist/exposedInternalTypes.d.ts +0 -138
- package/dist/exposedInternalTypes.d.ts.map +0 -1
- package/dist/exposedInternalTypes.js +0 -19
- package/dist/exposedInternalTypes.js.map +0 -1
- package/dist/exposedUtilityTypes.d.ts +0 -108
- package/dist/exposedUtilityTypes.d.ts.map +0 -1
- package/dist/exposedUtilityTypes.js +0 -7
- package/dist/exposedUtilityTypes.js.map +0 -1
- package/dist/internalUtils.d.ts +0 -125
- package/dist/internalUtils.d.ts.map +0 -1
- package/dist/internalUtils.js +0 -99
- package/dist/internalUtils.js.map +0 -1
- package/dist/latestMapTypes.d.ts +0 -343
- package/dist/latestMapTypes.d.ts.map +0 -1
- package/dist/latestMapTypes.js +0 -7
- package/dist/latestMapTypes.js.map +0 -1
- package/dist/latestMapValueManager.d.ts +0 -52
- package/dist/latestMapValueManager.d.ts.map +0 -1
- package/dist/latestMapValueManager.js +0 -250
- package/dist/latestMapValueManager.js.map +0 -1
- package/dist/latestTypes.d.ts +0 -183
- package/dist/latestTypes.d.ts.map +0 -1
- package/dist/latestTypes.js +0 -7
- package/dist/latestTypes.js.map +0 -1
- package/dist/latestValueManager.d.ts +0 -10
- package/dist/latestValueManager.d.ts.map +0 -1
- package/dist/latestValueManager.js +0 -117
- package/dist/latestValueManager.js.map +0 -1
- package/dist/latestValueTypes.d.ts +0 -108
- package/dist/latestValueTypes.d.ts.map +0 -1
- package/dist/latestValueTypes.js +0 -7
- package/dist/latestValueTypes.js.map +0 -1
- package/dist/notificationsManager.d.ts +0 -27
- package/dist/notificationsManager.d.ts.map +0 -1
- package/dist/notificationsManager.js +0 -98
- package/dist/notificationsManager.js.map +0 -1
- package/dist/notificationsManagerTypes.d.ts +0 -144
- package/dist/notificationsManagerTypes.d.ts.map +0 -1
- package/dist/notificationsManagerTypes.js +0 -7
- package/dist/notificationsManagerTypes.js.map +0 -1
- package/dist/packageVersion.d.ts +0 -9
- package/dist/packageVersion.d.ts.map +0 -1
- package/dist/packageVersion.js +0 -12
- package/dist/packageVersion.js.map +0 -1
- package/dist/presence.d.ts +0 -229
- package/dist/presence.d.ts.map +0 -1
- package/dist/presence.js +0 -23
- package/dist/presence.js.map +0 -1
- package/dist/presenceDatastoreManager.d.ts +0 -149
- package/dist/presenceDatastoreManager.d.ts.map +0 -1
- package/dist/presenceDatastoreManager.js +0 -667
- package/dist/presenceDatastoreManager.js.map +0 -1
- package/dist/presenceManager.d.ts +0 -16
- package/dist/presenceManager.d.ts.map +0 -1
- package/dist/presenceManager.js +0 -140
- package/dist/presenceManager.js.map +0 -1
- package/dist/presenceStates.d.ts +0 -102
- package/dist/presenceStates.d.ts.map +0 -1
- package/dist/presenceStates.js +0 -231
- package/dist/presenceStates.js.map +0 -1
- package/dist/protocol.d.ts +0 -111
- package/dist/protocol.d.ts.map +0 -1
- package/dist/protocol.js +0 -20
- package/dist/protocol.js.map +0 -1
- package/dist/runtimeTypes.d.ts +0 -26
- package/dist/runtimeTypes.d.ts.map +0 -1
- package/dist/runtimeTypes.js +0 -7
- package/dist/runtimeTypes.js.map +0 -1
- package/dist/stateDatastore.d.ts +0 -56
- package/dist/stateDatastore.d.ts.map +0 -1
- package/dist/stateDatastore.js +0 -22
- package/dist/stateDatastore.js.map +0 -1
- package/dist/stateFactory.d.ts +0 -18
- package/dist/stateFactory.d.ts.map +0 -1
- package/dist/stateFactory.js +0 -23
- package/dist/stateFactory.js.map +0 -1
- package/dist/statesManagerTypes.d.ts +0 -27
- package/dist/statesManagerTypes.d.ts.map +0 -1
- package/dist/statesManagerTypes.js +0 -7
- package/dist/statesManagerTypes.js.map +0 -1
- package/dist/systemWorkspace.d.ts +0 -58
- package/dist/systemWorkspace.d.ts.map +0 -1
- package/dist/systemWorkspace.js +0 -265
- package/dist/systemWorkspace.js.map +0 -1
- package/dist/timerManager.d.ts +0 -37
- package/dist/timerManager.d.ts.map +0 -1
- package/dist/timerManager.js +0 -65
- package/dist/timerManager.js.map +0 -1
- package/dist/types.d.ts +0 -132
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -7
- package/dist/types.js.map +0 -1
- package/dist/validatableTypes.d.ts +0 -69
- package/dist/validatableTypes.d.ts.map +0 -1
- package/dist/validatableTypes.js +0 -7
- package/dist/validatableTypes.js.map +0 -1
- package/dist/validatedGetter.d.ts +0 -18
- package/dist/validatedGetter.d.ts.map +0 -1
- package/dist/validatedGetter.js +0 -43
- package/dist/validatedGetter.js.map +0 -1
- package/dist/valueManager.d.ts +0 -15
- package/dist/valueManager.d.ts.map +0 -1
- package/dist/valueManager.js +0 -22
- package/dist/valueManager.js.map +0 -1
- package/lib/baseTypes.d.ts +0 -24
- package/lib/baseTypes.d.ts.map +0 -1
- package/lib/baseTypes.js +0 -6
- package/lib/baseTypes.js.map +0 -1
- package/lib/broadcastControls.d.ts +0 -37
- package/lib/broadcastControls.d.ts.map +0 -1
- package/lib/broadcastControls.js +0 -55
- package/lib/broadcastControls.js.map +0 -1
- package/lib/broadcastControlsTypes.d.ts +0 -38
- package/lib/broadcastControlsTypes.d.ts.map +0 -1
- package/lib/broadcastControlsTypes.js +0 -6
- package/lib/broadcastControlsTypes.js.map +0 -1
- package/lib/exposedInternalTypes.d.ts +0 -138
- package/lib/exposedInternalTypes.d.ts.map +0 -1
- package/lib/exposedInternalTypes.js +0 -16
- package/lib/exposedInternalTypes.js.map +0 -1
- package/lib/exposedUtilityTypes.d.ts +0 -108
- package/lib/exposedUtilityTypes.d.ts.map +0 -1
- package/lib/exposedUtilityTypes.js +0 -6
- package/lib/exposedUtilityTypes.js.map +0 -1
- package/lib/internalUtils.d.ts +0 -125
- package/lib/internalUtils.d.ts.map +0 -1
- package/lib/internalUtils.js +0 -90
- package/lib/internalUtils.js.map +0 -1
- package/lib/latestMapTypes.d.ts +0 -343
- package/lib/latestMapTypes.d.ts.map +0 -1
- package/lib/latestMapTypes.js +0 -6
- package/lib/latestMapTypes.js.map +0 -1
- package/lib/latestMapValueManager.d.ts +0 -52
- package/lib/latestMapValueManager.d.ts.map +0 -1
- package/lib/latestMapValueManager.js +0 -246
- package/lib/latestMapValueManager.js.map +0 -1
- package/lib/latestTypes.d.ts +0 -183
- package/lib/latestTypes.d.ts.map +0 -1
- package/lib/latestTypes.js +0 -6
- package/lib/latestTypes.js.map +0 -1
- package/lib/latestValueManager.d.ts +0 -10
- package/lib/latestValueManager.d.ts.map +0 -1
- package/lib/latestValueManager.js +0 -113
- package/lib/latestValueManager.js.map +0 -1
- package/lib/latestValueTypes.d.ts +0 -108
- package/lib/latestValueTypes.d.ts.map +0 -1
- package/lib/latestValueTypes.js +0 -6
- package/lib/latestValueTypes.js.map +0 -1
- package/lib/notificationsManager.d.ts +0 -27
- package/lib/notificationsManager.d.ts.map +0 -1
- package/lib/notificationsManager.js +0 -94
- package/lib/notificationsManager.js.map +0 -1
- package/lib/notificationsManagerTypes.d.ts +0 -144
- package/lib/notificationsManagerTypes.d.ts.map +0 -1
- package/lib/notificationsManagerTypes.js +0 -6
- package/lib/notificationsManagerTypes.js.map +0 -1
- package/lib/packageVersion.d.ts +0 -9
- package/lib/packageVersion.d.ts.map +0 -1
- package/lib/packageVersion.js +0 -9
- package/lib/packageVersion.js.map +0 -1
- package/lib/presence.d.ts +0 -229
- package/lib/presence.d.ts.map +0 -1
- package/lib/presence.js +0 -20
- package/lib/presence.js.map +0 -1
- package/lib/presenceDatastoreManager.d.ts +0 -149
- package/lib/presenceDatastoreManager.d.ts.map +0 -1
- package/lib/presenceDatastoreManager.js +0 -663
- package/lib/presenceDatastoreManager.js.map +0 -1
- package/lib/presenceManager.d.ts +0 -16
- package/lib/presenceManager.d.ts.map +0 -1
- package/lib/presenceManager.js +0 -136
- package/lib/presenceManager.js.map +0 -1
- package/lib/presenceStates.d.ts +0 -102
- package/lib/presenceStates.d.ts.map +0 -1
- package/lib/presenceStates.js +0 -225
- package/lib/presenceStates.js.map +0 -1
- package/lib/protocol.d.ts +0 -111
- package/lib/protocol.d.ts.map +0 -1
- package/lib/protocol.js +0 -17
- package/lib/protocol.js.map +0 -1
- package/lib/runtimeTypes.d.ts +0 -26
- package/lib/runtimeTypes.d.ts.map +0 -1
- package/lib/runtimeTypes.js +0 -6
- package/lib/runtimeTypes.js.map +0 -1
- package/lib/stateDatastore.d.ts +0 -56
- package/lib/stateDatastore.d.ts.map +0 -1
- package/lib/stateDatastore.js +0 -17
- package/lib/stateDatastore.js.map +0 -1
- package/lib/stateFactory.d.ts +0 -18
- package/lib/stateFactory.d.ts.map +0 -1
- package/lib/stateFactory.js +0 -20
- package/lib/stateFactory.js.map +0 -1
- package/lib/statesManagerTypes.d.ts +0 -27
- package/lib/statesManagerTypes.d.ts.map +0 -1
- package/lib/statesManagerTypes.js +0 -6
- package/lib/statesManagerTypes.js.map +0 -1
- package/lib/systemWorkspace.d.ts +0 -58
- package/lib/systemWorkspace.d.ts.map +0 -1
- package/lib/systemWorkspace.js +0 -261
- package/lib/systemWorkspace.js.map +0 -1
- package/lib/timerManager.d.ts +0 -37
- package/lib/timerManager.d.ts.map +0 -1
- package/lib/timerManager.js +0 -61
- package/lib/timerManager.js.map +0 -1
- package/lib/types.d.ts +0 -132
- package/lib/types.d.ts.map +0 -1
- package/lib/types.js +0 -6
- package/lib/types.js.map +0 -1
- package/lib/validatableTypes.d.ts +0 -69
- package/lib/validatableTypes.d.ts.map +0 -1
- package/lib/validatableTypes.js +0 -6
- package/lib/validatableTypes.js.map +0 -1
- package/lib/validatedGetter.d.ts +0 -18
- package/lib/validatedGetter.d.ts.map +0 -1
- package/lib/validatedGetter.js +0 -39
- package/lib/validatedGetter.js.map +0 -1
- package/lib/valueManager.d.ts +0 -15
- package/lib/valueManager.d.ts.map +0 -1
- package/lib/valueManager.js +0 -17
- package/lib/valueManager.js.map +0 -1
package/lib/types.d.ts
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import type { BroadcastControls } from "./broadcastControlsTypes.js";
|
|
6
|
-
import type { InternalTypes } from "./exposedInternalTypes.js";
|
|
7
|
-
import type { InternalUtilityTypes } from "./exposedUtilityTypes.js";
|
|
8
|
-
import type { NotificationsManager } from "./notificationsManagerTypes.js";
|
|
9
|
-
import type { Presence, PresenceWithNotifications } from "./presence.js";
|
|
10
|
-
/**
|
|
11
|
-
* Unique address within a session.
|
|
12
|
-
*
|
|
13
|
-
* @remarks
|
|
14
|
-
* A string known to all clients working with a certain Workspace and unique
|
|
15
|
-
* among Workspaces. Recommend using specifying concatenation of: type of
|
|
16
|
-
* unique identifier, `:` (required), and unique identifier.
|
|
17
|
-
*
|
|
18
|
-
* @example Examples
|
|
19
|
-
* ```typescript
|
|
20
|
-
* "guid:g0fl001d-1415-5000-c00l-g0fa54g0b1g1"
|
|
21
|
-
* "address:object0/sub-object2:pointers"
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @beta
|
|
25
|
-
*/
|
|
26
|
-
export type WorkspaceAddress = `${string}:${string}`;
|
|
27
|
-
/**
|
|
28
|
-
* Single entry in {@link StatesWorkspaceSchema} or {@link NotificationsWorkspaceSchema}.
|
|
29
|
-
*
|
|
30
|
-
* @beta
|
|
31
|
-
*/
|
|
32
|
-
export type StatesWorkspaceEntry<TKey extends string, TValue extends InternalTypes.ValueDirectoryOrState<unknown>, TManager = unknown> = InternalTypes.ManagerFactory<TKey, TValue, TManager>;
|
|
33
|
-
/**
|
|
34
|
-
* Schema for a {@link StatesWorkspace} workspace.
|
|
35
|
-
*
|
|
36
|
-
* Keys of schema are the keys of the {@link StatesWorkspace} providing access to State objects.
|
|
37
|
-
*
|
|
38
|
-
* @beta
|
|
39
|
-
*/
|
|
40
|
-
export type StatesWorkspaceSchema<Keys extends string = string> = {
|
|
41
|
-
[Key in Keys]: StatesWorkspaceEntry<Key, InternalTypes.ValueDirectoryOrState<unknown>>;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Map of State objects registered with {@link StatesWorkspace}.
|
|
45
|
-
*
|
|
46
|
-
* @sealed
|
|
47
|
-
* @beta
|
|
48
|
-
*/
|
|
49
|
-
export type StatesWorkspaceEntries<TSchema extends Partial<StatesWorkspaceSchema<TSchemaKeys>>, TSchemaKeys extends string & keyof TSchema = string & keyof TSchema> = {
|
|
50
|
-
/**
|
|
51
|
-
* Registered State objects.
|
|
52
|
-
*/
|
|
53
|
-
readonly [Key in keyof TSchema]: ReturnType<Exclude<TSchema[Key], undefined>>["manager"] extends InternalTypes.StateValue<infer TManager> ? TManager : never;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* `StatesWorkspace` maintains a registry of State objects that all share and provide access to
|
|
57
|
-
* presence state values across client members in a session.
|
|
58
|
-
*
|
|
59
|
-
* State objects offer variations on how to manage states, but all share same principle that
|
|
60
|
-
* each client's state is independent and may only be updated by originating client.
|
|
61
|
-
*
|
|
62
|
-
* @sealed
|
|
63
|
-
* @beta
|
|
64
|
-
*/
|
|
65
|
-
export interface StatesWorkspace<TSchema extends Partial<StatesWorkspaceSchema<TSchemaKeys>>, TManagerConstraints = unknown, TSchemaKeys extends string & keyof TSchema = string & keyof TSchema> {
|
|
66
|
-
/**
|
|
67
|
-
* Registers a new State object with the {@link StatesWorkspace}.
|
|
68
|
-
* @param key - new unique key for the State object within the workspace
|
|
69
|
-
* @param configuration - factory/settings for creating a State object. Use
|
|
70
|
-
* {@link StateFactory} to create.
|
|
71
|
-
*/
|
|
72
|
-
add<TKey extends string, TValue extends InternalTypes.ValueDirectoryOrState<unknown>, TManager extends TManagerConstraints>(key: TKey, configuration: InternalTypes.ManagerFactory<TKey, TValue, TManager>): asserts this is StatesWorkspace<TSchema & Record<TKey, InternalTypes.ManagerFactory<TKey, TValue, TManager>>, TManagerConstraints>;
|
|
73
|
-
/**
|
|
74
|
-
* Registry of State objects.
|
|
75
|
-
*/
|
|
76
|
-
readonly states: StatesWorkspaceEntries<TSchema, TSchemaKeys>;
|
|
77
|
-
/**
|
|
78
|
-
* Default controls for management of broadcast updates.
|
|
79
|
-
*/
|
|
80
|
-
readonly controls: BroadcastControls;
|
|
81
|
-
/**
|
|
82
|
-
* Containing {@link Presence}
|
|
83
|
-
*/
|
|
84
|
-
readonly presence: Presence;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Schema for a {@link NotificationsWorkspace} workspace.
|
|
88
|
-
*
|
|
89
|
-
* Keys of schema are the keys of the {@link NotificationsWorkspace} providing access to {@link NotificationsManager}s.
|
|
90
|
-
*
|
|
91
|
-
* @alpha
|
|
92
|
-
*/
|
|
93
|
-
export type NotificationsWorkspaceSchema<Keys extends string = string> = {
|
|
94
|
-
[Key in Keys]: InternalTypes.ManagerFactory<Key, InternalTypes.ValueRequiredState<InternalTypes.NotificationType>, NotificationsManager<InternalUtilityTypes.NotificationListeners<unknown>>>;
|
|
95
|
-
};
|
|
96
|
-
/**
|
|
97
|
-
* `NotificationsWorkspace` maintains a registry of {@link NotificationsManager}s
|
|
98
|
-
* that facilitate messages across client members in a session.
|
|
99
|
-
*
|
|
100
|
-
* @privateRemarks
|
|
101
|
-
* This should be kept mostly in sync with {@link StatesWorkspace}. Notably the
|
|
102
|
-
* return type of `add` is limited here and the `controls` property is omitted.
|
|
103
|
-
* The `PresenceStatesImpl` class implements `AnyWorkspace` and therefore
|
|
104
|
-
* `NotificationsWorkspace`, so long as this is proper subset.
|
|
105
|
-
*
|
|
106
|
-
* @sealed
|
|
107
|
-
* @alpha
|
|
108
|
-
*/
|
|
109
|
-
export interface NotificationsWorkspace<TSchema extends Partial<NotificationsWorkspaceSchema<TSchemaKeys>>, TSchemaKeys extends string & keyof TSchema = string & keyof TSchema> {
|
|
110
|
-
/**
|
|
111
|
-
* Registers a new `NotificationsManager` with the {@link NotificationsWorkspace}.
|
|
112
|
-
* @param key - new unique key for the `NotificationsManager` within the workspace
|
|
113
|
-
* @param manager - factory for creating a `NotificationsManager`
|
|
114
|
-
*/
|
|
115
|
-
add<TKey extends string, TValue extends InternalTypes.ValueDirectoryOrState<unknown>, TManager extends NotificationsManager<InternalUtilityTypes.NotificationListeners<unknown>>>(key: TKey, manager: InternalTypes.ManagerFactory<TKey, TValue, TManager>): asserts this is NotificationsWorkspace<TSchema & Record<TKey, InternalTypes.ManagerFactory<TKey, TValue, TManager>>>;
|
|
116
|
-
/**
|
|
117
|
-
* Registry of `NotificationsManager`s.
|
|
118
|
-
*/
|
|
119
|
-
readonly notifications: StatesWorkspaceEntries<TSchema, TSchemaKeys>;
|
|
120
|
-
/**
|
|
121
|
-
* Containing {@link PresenceWithNotifications}
|
|
122
|
-
*/
|
|
123
|
-
readonly presence: PresenceWithNotifications;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* `AnyWorkspace` is a superset of {@link StatesWorkspace} and {@link NotificationsWorkspace}.
|
|
127
|
-
*/
|
|
128
|
-
export interface AnyWorkspace<TSchema extends StatesWorkspaceSchema, TManagerConstraints = unknown> extends StatesWorkspace<TSchema, TManagerConstraints> {
|
|
129
|
-
readonly notifications: StatesWorkspaceEntries<TSchema>;
|
|
130
|
-
readonly presence: PresenceWithNotifications;
|
|
131
|
-
}
|
|
132
|
-
//# sourceMappingURL=types.d.ts.map
|
package/lib/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,KAAK,EAAE,QAAQ,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAEzE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,gBAAgB,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAErD;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,CAC/B,IAAI,SAAS,MAAM,EACnB,MAAM,SAAS,aAAa,CAAC,qBAAqB,CAAC,OAAO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,CAAC,CAAC,CAC5E,CAAC;IAEF;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAE,sBAAsB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAErE;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,CAAC;CAC7C;AAID;;GAEG;AACH,MAAM,WAAW,YAAY,CAC5B,OAAO,SAAS,qBAAqB,EACrC,mBAAmB,GAAG,OAAO,CAC5B,SAAQ,eAAe,CAAC,OAAO,EAAE,mBAAmB,CAAC;IACtD,QAAQ,CAAC,aAAa,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAExD,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,CAAC;CAC7C"}
|
package/lib/types.js
DELETED
package/lib/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { BroadcastControls } from \"./broadcastControlsTypes.js\";\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\nimport type { InternalUtilityTypes } from \"./exposedUtilityTypes.js\";\nimport type { NotificationsManager } from \"./notificationsManagerTypes.js\";\nimport type { Presence, PresenceWithNotifications } from \"./presence.js\";\n\n/**\n * Unique address within a session.\n *\n * @remarks\n * A string known to all clients working with a certain Workspace and unique\n * among Workspaces. Recommend using specifying concatenation of: type of\n * unique identifier, `:` (required), and unique identifier.\n *\n * @example Examples\n * ```typescript\n * \"guid:g0fl001d-1415-5000-c00l-g0fa54g0b1g1\"\n * \"address:object0/sub-object2:pointers\"\n * ```\n *\n * @beta\n */\nexport type WorkspaceAddress = `${string}:${string}`;\n\n/**\n * Single entry in {@link StatesWorkspaceSchema} or {@link NotificationsWorkspaceSchema}.\n *\n * @beta\n */\nexport type StatesWorkspaceEntry<\n\tTKey extends string,\n\tTValue extends InternalTypes.ValueDirectoryOrState<unknown>,\n\tTManager = unknown,\n> = InternalTypes.ManagerFactory<TKey, TValue, TManager>;\n\n// #region StatesWorkspace\n\n/**\n * Schema for a {@link StatesWorkspace} workspace.\n *\n * Keys of schema are the keys of the {@link StatesWorkspace} providing access to State objects.\n *\n * @beta\n */\nexport type StatesWorkspaceSchema<Keys extends string = string> = {\n\t/**\n\t * Key-value pairs of State objects registered with the {@link StatesWorkspace}.\n\t */\n\t[Key in Keys]: StatesWorkspaceEntry<Key, InternalTypes.ValueDirectoryOrState<unknown>>;\n};\n\n/**\n * Map of State objects registered with {@link StatesWorkspace}.\n *\n * @sealed\n * @beta\n */\nexport type StatesWorkspaceEntries<\n\tTSchema extends Partial<StatesWorkspaceSchema<TSchemaKeys>>,\n\tTSchemaKeys extends string & keyof TSchema = string & keyof TSchema,\n> = {\n\t/**\n\t * Registered State objects.\n\t */\n\treadonly [Key in keyof TSchema]: ReturnType<\n\t\tExclude<TSchema[Key], undefined>\n\t>[\"manager\"] extends InternalTypes.StateValue<infer TManager>\n\t\t? TManager\n\t\t: never;\n};\n\n/**\n * `StatesWorkspace` maintains a registry of State objects that all share and provide access to\n * presence state values across client members in a session.\n *\n * State objects offer variations on how to manage states, but all share same principle that\n * each client's state is independent and may only be updated by originating client.\n *\n * @sealed\n * @beta\n */\nexport interface StatesWorkspace<\n\tTSchema extends Partial<StatesWorkspaceSchema<TSchemaKeys>>,\n\tTManagerConstraints = unknown,\n\tTSchemaKeys extends string & keyof TSchema = string & keyof TSchema,\n> {\n\t/**\n\t * Registers a new State object with the {@link StatesWorkspace}.\n\t * @param key - new unique key for the State object within the workspace\n\t * @param configuration - factory/settings for creating a State object. Use\n\t * {@link StateFactory} to create.\n\t */\n\tadd<\n\t\tTKey extends string,\n\t\tTValue extends InternalTypes.ValueDirectoryOrState<unknown>,\n\t\tTManager extends TManagerConstraints,\n\t>(\n\t\tkey: TKey,\n\t\tconfiguration: InternalTypes.ManagerFactory<TKey, TValue, TManager>,\n\t): asserts this is StatesWorkspace<\n\t\tTSchema & Record<TKey, InternalTypes.ManagerFactory<TKey, TValue, TManager>>,\n\t\tTManagerConstraints\n\t>;\n\n\t/**\n\t * Registry of State objects.\n\t */\n\treadonly states: StatesWorkspaceEntries<TSchema, TSchemaKeys>;\n\n\t/**\n\t * Default controls for management of broadcast updates.\n\t */\n\treadonly controls: BroadcastControls;\n\n\t/**\n\t * Containing {@link Presence}\n\t */\n\treadonly presence: Presence;\n}\n\n// #endregion StatesWorkspace\n\n// #region NotificationsWorkspace\n\n/**\n * Schema for a {@link NotificationsWorkspace} workspace.\n *\n * Keys of schema are the keys of the {@link NotificationsWorkspace} providing access to {@link NotificationsManager}s.\n *\n * @alpha\n */\nexport type NotificationsWorkspaceSchema<Keys extends string = string> = {\n\t[Key in Keys]: InternalTypes.ManagerFactory<\n\t\tKey,\n\t\tInternalTypes.ValueRequiredState<InternalTypes.NotificationType>,\n\t\tNotificationsManager<InternalUtilityTypes.NotificationListeners<unknown>>\n\t>;\n};\n\n/**\n * `NotificationsWorkspace` maintains a registry of {@link NotificationsManager}s\n * that facilitate messages across client members in a session.\n *\n * @privateRemarks\n * This should be kept mostly in sync with {@link StatesWorkspace}. Notably the\n * return type of `add` is limited here and the `controls` property is omitted.\n * The `PresenceStatesImpl` class implements `AnyWorkspace` and therefore\n * `NotificationsWorkspace`, so long as this is proper subset.\n *\n * @sealed\n * @alpha\n */\nexport interface NotificationsWorkspace<\n\tTSchema extends Partial<NotificationsWorkspaceSchema<TSchemaKeys>>,\n\tTSchemaKeys extends string & keyof TSchema = string & keyof TSchema,\n> {\n\t/**\n\t * Registers a new `NotificationsManager` with the {@link NotificationsWorkspace}.\n\t * @param key - new unique key for the `NotificationsManager` within the workspace\n\t * @param manager - factory for creating a `NotificationsManager`\n\t */\n\tadd<\n\t\tTKey extends string,\n\t\tTValue extends InternalTypes.ValueDirectoryOrState<unknown>,\n\t\tTManager extends NotificationsManager<InternalUtilityTypes.NotificationListeners<unknown>>,\n\t>(\n\t\tkey: TKey,\n\t\tmanager: InternalTypes.ManagerFactory<TKey, TValue, TManager>,\n\t): asserts this is NotificationsWorkspace<\n\t\tTSchema & Record<TKey, InternalTypes.ManagerFactory<TKey, TValue, TManager>>\n\t>;\n\n\t/**\n\t * Registry of `NotificationsManager`s.\n\t */\n\treadonly notifications: StatesWorkspaceEntries<TSchema, TSchemaKeys>;\n\n\t/**\n\t * Containing {@link PresenceWithNotifications}\n\t */\n\treadonly presence: PresenceWithNotifications;\n}\n\n// #endregion NotificationsWorkspace\n\n/**\n * `AnyWorkspace` is a superset of {@link StatesWorkspace} and {@link NotificationsWorkspace}.\n */\nexport interface AnyWorkspace<\n\tTSchema extends StatesWorkspaceSchema,\n\tTManagerConstraints = unknown,\n> extends StatesWorkspace<TSchema, TManagerConstraints> {\n\treadonly notifications: StatesWorkspaceEntries<TSchema>;\n\t// TO be removed if/when notifications are fully supported\n\treadonly presence: PresenceWithNotifications;\n}\n"]}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import type { InternalCoreInterfacesUtilityTypes, OpaqueJsonDeserialized } from "@fluidframework/core-interfaces/internal";
|
|
6
|
-
import type { InternalTypes } from "./exposedInternalTypes.js";
|
|
7
|
-
/**
|
|
8
|
-
* Metadata for a value that may have been validated by a {@link StateSchemaValidator} function.
|
|
9
|
-
*/
|
|
10
|
-
interface ValidatableMetadata<TValue> {
|
|
11
|
-
/**
|
|
12
|
-
* Contains a validated value or undefined if `value` is invalid.
|
|
13
|
-
*
|
|
14
|
-
* This property will not be present if the data has not been validated.
|
|
15
|
-
* If it is present and `undefined`, the value has been checked and found to be invalid.
|
|
16
|
-
* Otherwise it will be the validated value.
|
|
17
|
-
*/
|
|
18
|
-
validatedValue?: OpaqueJsonDeserialized<TValue> | undefined;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Represents data with optional value that may have been validated by a
|
|
22
|
-
* {@link StateSchemaValidator} function.
|
|
23
|
-
*/
|
|
24
|
-
export interface ValidatableOptionalState<TValue> extends Omit<InternalTypes.ValueOptionalState<TValue>, keyof ValidatableMetadata<TValue>>, ValidatableMetadata<TValue> {
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Represents data with required value that may have been validated by a
|
|
28
|
-
* {@link StateSchemaValidator} function.
|
|
29
|
-
*/
|
|
30
|
-
export interface ValidatableRequiredState<TValue> extends Omit<InternalTypes.ValueRequiredState<TValue>, keyof ValidatableMetadata<TValue>>, ValidatableMetadata<TValue> {
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* A directory of validatable values, where each value may be an optional
|
|
34
|
-
* state or another directory.
|
|
35
|
-
*
|
|
36
|
-
* @remarks
|
|
37
|
-
* The is the validatable version of {@link InternalTypes.ValueDirectory}.
|
|
38
|
-
*/
|
|
39
|
-
export interface ValidatableValueDirectory<T> {
|
|
40
|
-
rev: number;
|
|
41
|
-
items: {
|
|
42
|
-
[name: string | number]: ValidatableOptionalState<T> | ValidatableValueDirectory<T>;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Convenience type for a validatable required state or a directory of values.
|
|
47
|
-
*
|
|
48
|
-
* @remarks
|
|
49
|
-
* This is the validatable version of {@link InternalTypes.ValueDirectoryOrState}.
|
|
50
|
-
*/
|
|
51
|
-
export type ValidatableValueDirectoryOrState<T> = ValidatableRequiredState<T> | ValidatableValueDirectory<T>;
|
|
52
|
-
/**
|
|
53
|
-
* Transforms basic value datastore / protocol type into equivalent type
|
|
54
|
-
* with validation support.
|
|
55
|
-
*
|
|
56
|
-
* @remarks
|
|
57
|
-
* Use when some more specific or parameterized type equivalent of
|
|
58
|
-
* `InternalTypes.Value(Directory|RequiredState|OptionalState)` is needed.
|
|
59
|
-
*
|
|
60
|
-
* Basically, wherever a `*ValueState` appears it is extended with
|
|
61
|
-
* {@link ValidatableMetadata} to support validation.
|
|
62
|
-
*/
|
|
63
|
-
export type ValidatableValueStructure<T extends InternalTypes.ValueDirectory<unknown> | InternalTypes.ValueRequiredState<unknown> | InternalTypes.ValueOptionalState<unknown>> = T extends InternalTypes.ValueDirectory<infer TValue> ? InternalCoreInterfacesUtilityTypes.IfSameType<T, InternalTypes.ValueDirectory<T>, ValidatableValueDirectory<TValue>, InternalCoreInterfacesUtilityTypes.FlattenIntersection<Omit<T, "items"> & {
|
|
64
|
-
items: {
|
|
65
|
-
[KItems in keyof T["items"]]: ValidatableValueStructure<T["items"][KItems]>;
|
|
66
|
-
};
|
|
67
|
-
}>> : T extends InternalTypes.ValueRequiredState<infer TValue> | InternalTypes.ValueOptionalState<infer TValue> ? InternalCoreInterfacesUtilityTypes.FlattenIntersection<Omit<T, keyof ValidatableMetadata<TValue>> & ValidatableMetadata<TValue>> : never;
|
|
68
|
-
export {};
|
|
69
|
-
//# sourceMappingURL=validatableTypes.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validatableTypes.d.ts","sourceRoot":"","sources":["../src/validatableTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,kCAAkC,EAClC,sBAAsB,EACtB,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D;;GAEG;AACH,UAAU,mBAAmB,CAAC,MAAM;IACnC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,sBAAsB,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;CAE5D;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAwB,CAAC,MAAM,CAC/C,SAAQ,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,mBAAmB,CAAC,MAAM,CAAC,CAAC,EACxF,mBAAmB,CAAC,MAAM,CAAC;CAAG;A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9C,aAAa,CAAC,kBAAkB,CAAC,MAAM,MAAM,CAAC,GAChD,kCAAkC,CAAC,mBAAmB,CACtD,IAAI,CAAC,CAAC,EAAE,MAAM,mBAAmB,CAAC,MAAM,CAAC,CAAC,GAAG,mBAAmB,CAAC,MAAM,CAAC,CACxE,GACA,KAAK,CAAC"}
|
package/lib/validatableTypes.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validatableTypes.js","sourceRoot":"","sources":["../src/validatableTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tInternalCoreInterfacesUtilityTypes,\n\tOpaqueJsonDeserialized,\n} from \"@fluidframework/core-interfaces/internal\";\n\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\n\n/**\n * Metadata for a value that may have been validated by a {@link StateSchemaValidator} function.\n */\ninterface ValidatableMetadata<TValue> {\n\t/**\n\t * Contains a validated value or undefined if `value` is invalid.\n\t *\n\t * This property will not be present if the data has not been validated.\n\t * If it is present and `undefined`, the value has been checked and found to be invalid.\n\t * Otherwise it will be the validated value.\n\t */\n\tvalidatedValue?: OpaqueJsonDeserialized<TValue> | undefined;\n\t// typeCheck: \"do you have me?\";\n}\n\n/**\n * Represents data with optional value that may have been validated by a\n * {@link StateSchemaValidator} function.\n */\nexport interface ValidatableOptionalState<TValue>\n\textends Omit<InternalTypes.ValueOptionalState<TValue>, keyof ValidatableMetadata<TValue>>,\n\t\tValidatableMetadata<TValue> {}\n\n/**\n * Represents data with required value that may have been validated by a\n * {@link StateSchemaValidator} function.\n */\nexport interface ValidatableRequiredState<TValue>\n\textends Omit<InternalTypes.ValueRequiredState<TValue>, keyof ValidatableMetadata<TValue>>,\n\t\tValidatableMetadata<TValue> {}\n\n/**\n * A directory of validatable values, where each value may be an optional\n * state or another directory.\n *\n * @remarks\n * The is the validatable version of {@link InternalTypes.ValueDirectory}.\n */\nexport interface ValidatableValueDirectory<T> {\n\trev: number;\n\titems: {\n\t\t// Caution: any particular item may or may not exist\n\t\t// Typescript does not support absent keys without forcing type to also be undefined.\n\t\t// See https://github.com/microsoft/TypeScript/issues/42810.\n\t\t[name: string | number]: ValidatableOptionalState<T> | ValidatableValueDirectory<T>;\n\t};\n}\n\n/**\n * Convenience type for a validatable required state or a directory of values.\n *\n * @remarks\n * This is the validatable version of {@link InternalTypes.ValueDirectoryOrState}.\n */\nexport type ValidatableValueDirectoryOrState<T> =\n\t| ValidatableRequiredState<T>\n\t| ValidatableValueDirectory<T>;\n\n/**\n * Transforms basic value datastore / protocol type into equivalent type\n * with validation support.\n *\n * @remarks\n * Use when some more specific or parameterized type equivalent of\n * `InternalTypes.Value(Directory|RequiredState|OptionalState)` is needed.\n *\n * Basically, wherever a `*ValueState` appears it is extended with\n * {@link ValidatableMetadata} to support validation.\n */\nexport type ValidatableValueStructure<\n\tT extends\n\t\t| InternalTypes.ValueDirectory<unknown>\n\t\t| InternalTypes.ValueRequiredState<unknown>\n\t\t| InternalTypes.ValueOptionalState<unknown>,\n> =\n\tT extends InternalTypes.ValueDirectory<infer TValue>\n\t\t? InternalCoreInterfacesUtilityTypes.IfSameType<\n\t\t\t\tT,\n\t\t\t\tInternalTypes.ValueDirectory<T>,\n\t\t\t\t// Use canonical type for exact match\n\t\t\t\tValidatableValueDirectory<TValue>,\n\t\t\t\t// Inexact match => recurse\n\t\t\t\tInternalCoreInterfacesUtilityTypes.FlattenIntersection<\n\t\t\t\t\tOmit<T, \"items\"> & {\n\t\t\t\t\t\titems: {\n\t\t\t\t\t\t\t[KItems in keyof T[\"items\"]]: ValidatableValueStructure<T[\"items\"][KItems]>;\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t>\n\t\t: T extends\n\t\t\t\t\t| InternalTypes.ValueRequiredState<infer TValue>\n\t\t\t\t\t| InternalTypes.ValueOptionalState<infer TValue>\n\t\t\t? InternalCoreInterfacesUtilityTypes.FlattenIntersection<\n\t\t\t\t\tOmit<T, keyof ValidatableMetadata<TValue>> & ValidatableMetadata<TValue>\n\t\t\t\t>\n\t\t\t: never;\n"]}
|
package/lib/validatedGetter.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import type { DeepReadonly, JsonDeserialized } from "@fluidframework/core-interfaces/internal/exposedUtilityTypes";
|
|
6
|
-
import type { StateSchemaValidator } from "./latestValueTypes.js";
|
|
7
|
-
import type { ValidatableRequiredState } from "./validatableTypes.js";
|
|
8
|
-
/**
|
|
9
|
-
* Creates a getter for a state value that validates the data with a validator if one is provided. Otherwise the value
|
|
10
|
-
* is returned directly.
|
|
11
|
-
*
|
|
12
|
-
* @param clientState - The client state to be validated.
|
|
13
|
-
* @param validator - The validator function to run.
|
|
14
|
-
* @returns Either returns the value directly if a validator is not provided, or a function that will return the
|
|
15
|
-
* validated data.
|
|
16
|
-
*/
|
|
17
|
-
export declare function createValidatedGetter<T>(clientState: ValidatableRequiredState<T>, validator: StateSchemaValidator<T> | undefined): (() => DeepReadonly<JsonDeserialized<T>> | undefined) | DeepReadonly<JsonDeserialized<T>>;
|
|
18
|
-
//# sourceMappingURL=validatedGetter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validatedGetter.d.ts","sourceRoot":"","sources":["../src/validatedGetter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,YAAY,EACZ,gBAAgB,EAEhB,MAAM,8DAA8D,CAAC;AAGtE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAmBtE;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EACtC,WAAW,EAAE,wBAAwB,CAAC,CAAC,CAAC,EACxC,SAAS,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,SAAS,GAC5C,CAAC,MAAM,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,GAAG,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAgB3F"}
|
package/lib/validatedGetter.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { asDeeplyReadonlyDeserializedJson } from "./internalUtils.js";
|
|
6
|
-
function createGetterFunction(clientState, validator) {
|
|
7
|
-
return () => {
|
|
8
|
-
if (!("validatedValue" in clientState)) {
|
|
9
|
-
// Stored `value` has not been validated yet, so validate it and save the result.
|
|
10
|
-
clientState.validatedValue = validator(clientState.value);
|
|
11
|
-
}
|
|
12
|
-
return asDeeplyReadonlyDeserializedJson(clientState.validatedValue);
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Creates a getter for a state value that validates the data with a validator if one is provided. Otherwise the value
|
|
17
|
-
* is returned directly.
|
|
18
|
-
*
|
|
19
|
-
* @param clientState - The client state to be validated.
|
|
20
|
-
* @param validator - The validator function to run.
|
|
21
|
-
* @returns Either returns the value directly if a validator is not provided, or a function that will return the
|
|
22
|
-
* validated data.
|
|
23
|
-
*/
|
|
24
|
-
export function createValidatedGetter(clientState, validator) {
|
|
25
|
-
// No validator
|
|
26
|
-
if (validator === undefined) {
|
|
27
|
-
return asDeeplyReadonlyDeserializedJson(clientState.value);
|
|
28
|
-
}
|
|
29
|
-
// Avoid creating another function since one already exists on the item
|
|
30
|
-
if (typeof clientState.value === "function") {
|
|
31
|
-
return clientState.value;
|
|
32
|
-
}
|
|
33
|
-
// OpaqueJsonDeserialized<T> is just a branded alias of JsonDeserialized<T>. At runtime the functions are still passed
|
|
34
|
-
// JSON data, regardless of their type representation. Passing that data to a function that expects `unknown`, like
|
|
35
|
-
// the user-provided validator function, is always valid, so StateSchemaValidator and StateSchemaValidatorToOpaque are
|
|
36
|
-
// functionally equivalent.
|
|
37
|
-
return createGetterFunction(clientState, validator);
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=validatedGetter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validatedGetter.js","sourceRoot":"","sources":["../src/validatedGetter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAE,gCAAgC,EAAE,MAAM,oBAAoB,CAAC;AAQtE,SAAS,oBAAoB,CAC5B,WAAwC,EACxC,SAA0C;IAE1C,OAAO,GAAkD,EAAE;QAC1D,IAAI,CAAC,CAAC,gBAAgB,IAAI,WAAW,CAAC,EAAE,CAAC;YACxC,iFAAiF;YACjF,WAAW,CAAC,cAAc,GAAG,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,gCAAgC,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IACrE,CAAC,CAAC;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CACpC,WAAwC,EACxC,SAA8C;IAE9C,eAAe;IACf,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,gCAAgC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC5D,CAAC;IAED,uEAAuE;IACvE,IAAI,OAAO,WAAW,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;QAC7C,OAAO,WAAW,CAAC,KAAK,CAAC;IAC1B,CAAC;IAED,sHAAsH;IACtH,mHAAmH;IACnH,sHAAsH;IACtH,2BAA2B;IAC3B,OAAO,oBAAoB,CAAC,WAAW,EAAE,SAA4C,CAAC,CAAC;AACxF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tDeepReadonly,\n\tJsonDeserialized,\n\tOpaqueJsonDeserialized,\n} from \"@fluidframework/core-interfaces/internal/exposedUtilityTypes\";\n\nimport { asDeeplyReadonlyDeserializedJson } from \"./internalUtils.js\";\nimport type { StateSchemaValidator } from \"./latestValueTypes.js\";\nimport type { ValidatableRequiredState } from \"./validatableTypes.js\";\n\ntype StateSchemaValidatorToOpaque<T> = (\n\trawData: OpaqueJsonDeserialized<T>,\n) => OpaqueJsonDeserialized<T> | undefined;\n\nfunction createGetterFunction<T>(\n\tclientState: ValidatableRequiredState<T>,\n\tvalidator: StateSchemaValidatorToOpaque<T>,\n): () => DeepReadonly<JsonDeserialized<T>> | undefined {\n\treturn (): DeepReadonly<JsonDeserialized<T>> | undefined => {\n\t\tif (!(\"validatedValue\" in clientState)) {\n\t\t\t// Stored `value` has not been validated yet, so validate it and save the result.\n\t\t\tclientState.validatedValue = validator(clientState.value);\n\t\t}\n\t\treturn asDeeplyReadonlyDeserializedJson(clientState.validatedValue);\n\t};\n}\n\n/**\n * Creates a getter for a state value that validates the data with a validator if one is provided. Otherwise the value\n * is returned directly.\n *\n * @param clientState - The client state to be validated.\n * @param validator - The validator function to run.\n * @returns Either returns the value directly if a validator is not provided, or a function that will return the\n * validated data.\n */\nexport function createValidatedGetter<T>(\n\tclientState: ValidatableRequiredState<T>,\n\tvalidator: StateSchemaValidator<T> | undefined,\n): (() => DeepReadonly<JsonDeserialized<T>> | undefined) | DeepReadonly<JsonDeserialized<T>> {\n\t// No validator\n\tif (validator === undefined) {\n\t\treturn asDeeplyReadonlyDeserializedJson(clientState.value);\n\t}\n\n\t// Avoid creating another function since one already exists on the item\n\tif (typeof clientState.value === \"function\") {\n\t\treturn clientState.value;\n\t}\n\n\t// OpaqueJsonDeserialized<T> is just a branded alias of JsonDeserialized<T>. At runtime the functions are still passed\n\t// JSON data, regardless of their type representation. Passing that data to a function that expects `unknown`, like\n\t// the user-provided validator function, is always valid, so StateSchemaValidator and StateSchemaValidatorToOpaque are\n\t// functionally equivalent.\n\treturn createGetterFunction(clientState, validator as StateSchemaValidatorToOpaque<T>);\n}\n"]}
|
package/lib/valueManager.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import type { InternalTypes } from "./exposedInternalTypes.js";
|
|
6
|
-
import type { ValueManager } from "./statesManagerTypes.js";
|
|
7
|
-
/**
|
|
8
|
-
* Given a value manager, return opaque InternalTypes.StateValue.
|
|
9
|
-
*/
|
|
10
|
-
export declare function brandIVM<TManagerInterface, TValue, TValueState extends InternalTypes.ValueDirectoryOrState<TValue>>(manager: TManagerInterface & ValueManager<TValue, TValueState>): InternalTypes.StateValue<TManagerInterface>;
|
|
11
|
-
/**
|
|
12
|
-
* Extract the value manager from an opaque InternalTypes.StateValue.
|
|
13
|
-
*/
|
|
14
|
-
export declare function unbrandIVM<TManagerInterface, TValue, TValueState extends InternalTypes.ValueDirectoryOrState<TValue>>(branded: InternalTypes.StateValue<TManagerInterface>): ValueManager<TValue, TValueState>;
|
|
15
|
-
//# sourceMappingURL=valueManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"valueManager.d.ts","sourceRoot":"","sources":["../src/valueManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D;;GAEG;AACH,wBAAgB,QAAQ,CACvB,iBAAiB,EACjB,MAAM,EACN,WAAW,SAAS,aAAa,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAE/D,OAAO,EAAE,iBAAiB,GAAG,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,GAC5D,aAAa,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAE7C;AAED;;GAEG;AACH,wBAAgB,UAAU,CACzB,iBAAiB,EACjB,MAAM,EACN,WAAW,SAAS,aAAa,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAC9D,OAAO,EAAE,aAAa,CAAC,UAAU,CAAC,iBAAiB,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,CAEzF"}
|
package/lib/valueManager.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Given a value manager, return opaque InternalTypes.StateValue.
|
|
7
|
-
*/
|
|
8
|
-
export function brandIVM(manager) {
|
|
9
|
-
return manager;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Extract the value manager from an opaque InternalTypes.StateValue.
|
|
13
|
-
*/
|
|
14
|
-
export function unbrandIVM(branded) {
|
|
15
|
-
return branded;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=valueManager.js.map
|
package/lib/valueManager.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"valueManager.js","sourceRoot":"","sources":["../src/valueManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;GAEG;AACH,MAAM,UAAU,QAAQ,CAKvB,OAA8D;IAE9D,OAAO,OAA2E,CAAC;AACpF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAIxB,OAAoD;IACrD,OAAO,OAAuD,CAAC;AAChE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\nimport type { ValueManager } from \"./statesManagerTypes.js\";\n\n/**\n * Given a value manager, return opaque InternalTypes.StateValue.\n */\nexport function brandIVM<\n\tTManagerInterface,\n\tTValue,\n\tTValueState extends InternalTypes.ValueDirectoryOrState<TValue>,\n>(\n\tmanager: TManagerInterface & ValueManager<TValue, TValueState>,\n): InternalTypes.StateValue<TManagerInterface> {\n\treturn manager as TManagerInterface as InternalTypes.StateValue<TManagerInterface>;\n}\n\n/**\n * Extract the value manager from an opaque InternalTypes.StateValue.\n */\nexport function unbrandIVM<\n\tTManagerInterface,\n\tTValue,\n\tTValueState extends InternalTypes.ValueDirectoryOrState<TValue>,\n>(branded: InternalTypes.StateValue<TManagerInterface>): ValueManager<TValue, TValueState> {\n\treturn branded as unknown as ValueManager<TValue, TValueState>;\n}\n"]}
|