@fluid-internal/presence-definitions 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.
Files changed (141) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +12 -0
  3. package/dist/baseTypes.d.ts +24 -0
  4. package/dist/baseTypes.d.ts.map +1 -0
  5. package/dist/baseTypes.js +7 -0
  6. package/dist/baseTypes.js.map +1 -0
  7. package/dist/broadcastControlsTypes.d.ts +38 -0
  8. package/dist/broadcastControlsTypes.d.ts.map +1 -0
  9. package/dist/broadcastControlsTypes.js +7 -0
  10. package/dist/broadcastControlsTypes.js.map +1 -0
  11. package/dist/exposedInternalTypes.d.ts +137 -0
  12. package/dist/exposedInternalTypes.d.ts.map +1 -0
  13. package/dist/exposedInternalTypes.js +19 -0
  14. package/dist/exposedInternalTypes.js.map +1 -0
  15. package/dist/exposedUtilityTypes.d.ts +108 -0
  16. package/dist/exposedUtilityTypes.d.ts.map +1 -0
  17. package/dist/exposedUtilityTypes.js +7 -0
  18. package/dist/exposedUtilityTypes.js.map +1 -0
  19. package/dist/index.d.ts +16 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +10 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/internal.d.ts +9 -0
  24. package/dist/internal.d.ts.map +1 -0
  25. package/dist/internal.js +7 -0
  26. package/dist/internal.js.map +1 -0
  27. package/dist/latestMapTypes.d.ts +343 -0
  28. package/dist/latestMapTypes.d.ts.map +1 -0
  29. package/dist/latestMapTypes.js +7 -0
  30. package/dist/latestMapTypes.js.map +1 -0
  31. package/dist/latestTypes.d.ts +183 -0
  32. package/dist/latestTypes.d.ts.map +1 -0
  33. package/dist/latestTypes.js +7 -0
  34. package/dist/latestTypes.js.map +1 -0
  35. package/dist/latestValueTypes.d.ts +108 -0
  36. package/dist/latestValueTypes.d.ts.map +1 -0
  37. package/dist/latestValueTypes.js +7 -0
  38. package/dist/latestValueTypes.js.map +1 -0
  39. package/dist/notificationsManagerTypes.d.ts +144 -0
  40. package/dist/notificationsManagerTypes.d.ts.map +1 -0
  41. package/dist/notificationsManagerTypes.js +7 -0
  42. package/dist/notificationsManagerTypes.js.map +1 -0
  43. package/dist/package.json +11 -0
  44. package/dist/presence.d.ts +224 -0
  45. package/dist/presence.d.ts.map +1 -0
  46. package/dist/presence.js +23 -0
  47. package/dist/presence.js.map +1 -0
  48. package/dist/statesManagerTypes.d.ts +31 -0
  49. package/dist/statesManagerTypes.d.ts.map +1 -0
  50. package/dist/statesManagerTypes.js +7 -0
  51. package/dist/statesManagerTypes.js.map +1 -0
  52. package/dist/types.d.ts +134 -0
  53. package/dist/types.d.ts.map +1 -0
  54. package/dist/types.js +7 -0
  55. package/dist/types.js.map +1 -0
  56. package/dist/validatableTypes.d.ts +79 -0
  57. package/dist/validatableTypes.d.ts.map +1 -0
  58. package/dist/validatableTypes.js +7 -0
  59. package/dist/validatableTypes.js.map +1 -0
  60. package/dist/workspace/workspaceTypes.d.ts +18 -0
  61. package/dist/workspace/workspaceTypes.d.ts.map +1 -0
  62. package/dist/workspace/workspaceTypes.js +7 -0
  63. package/dist/workspace/workspaceTypes.js.map +1 -0
  64. package/dist/workspace-runtime/presenceStatesTypes.d.ts +72 -0
  65. package/dist/workspace-runtime/presenceStatesTypes.d.ts.map +1 -0
  66. package/dist/workspace-runtime/presenceStatesTypes.js +7 -0
  67. package/dist/workspace-runtime/presenceStatesTypes.js.map +1 -0
  68. package/dist/workspace-states/stateDatastoreTypes.d.ts +42 -0
  69. package/dist/workspace-states/stateDatastoreTypes.d.ts.map +1 -0
  70. package/dist/workspace-states/stateDatastoreTypes.js +7 -0
  71. package/dist/workspace-states/stateDatastoreTypes.js.map +1 -0
  72. package/lib/baseTypes.d.ts +24 -0
  73. package/lib/baseTypes.d.ts.map +1 -0
  74. package/lib/baseTypes.js +6 -0
  75. package/lib/baseTypes.js.map +1 -0
  76. package/lib/broadcastControlsTypes.d.ts +38 -0
  77. package/lib/broadcastControlsTypes.d.ts.map +1 -0
  78. package/lib/broadcastControlsTypes.js +6 -0
  79. package/lib/broadcastControlsTypes.js.map +1 -0
  80. package/lib/exposedInternalTypes.d.ts +137 -0
  81. package/lib/exposedInternalTypes.d.ts.map +1 -0
  82. package/lib/exposedInternalTypes.js +16 -0
  83. package/lib/exposedInternalTypes.js.map +1 -0
  84. package/lib/exposedUtilityTypes.d.ts +108 -0
  85. package/lib/exposedUtilityTypes.d.ts.map +1 -0
  86. package/lib/exposedUtilityTypes.js +6 -0
  87. package/lib/exposedUtilityTypes.js.map +1 -0
  88. package/lib/index.d.ts +16 -0
  89. package/lib/index.d.ts.map +1 -0
  90. package/lib/index.js +6 -0
  91. package/lib/index.js.map +1 -0
  92. package/lib/internal.d.ts +9 -0
  93. package/lib/internal.d.ts.map +1 -0
  94. package/lib/internal.js +6 -0
  95. package/lib/internal.js.map +1 -0
  96. package/lib/latestMapTypes.d.ts +343 -0
  97. package/lib/latestMapTypes.d.ts.map +1 -0
  98. package/lib/latestMapTypes.js +6 -0
  99. package/lib/latestMapTypes.js.map +1 -0
  100. package/lib/latestTypes.d.ts +183 -0
  101. package/lib/latestTypes.d.ts.map +1 -0
  102. package/lib/latestTypes.js +6 -0
  103. package/lib/latestTypes.js.map +1 -0
  104. package/lib/latestValueTypes.d.ts +108 -0
  105. package/lib/latestValueTypes.d.ts.map +1 -0
  106. package/lib/latestValueTypes.js +6 -0
  107. package/lib/latestValueTypes.js.map +1 -0
  108. package/lib/notificationsManagerTypes.d.ts +144 -0
  109. package/lib/notificationsManagerTypes.d.ts.map +1 -0
  110. package/lib/notificationsManagerTypes.js +6 -0
  111. package/lib/notificationsManagerTypes.js.map +1 -0
  112. package/lib/presence.d.ts +224 -0
  113. package/lib/presence.d.ts.map +1 -0
  114. package/lib/presence.js +20 -0
  115. package/lib/presence.js.map +1 -0
  116. package/lib/statesManagerTypes.d.ts +31 -0
  117. package/lib/statesManagerTypes.d.ts.map +1 -0
  118. package/lib/statesManagerTypes.js +6 -0
  119. package/lib/statesManagerTypes.js.map +1 -0
  120. package/lib/tsdoc-metadata.json +11 -0
  121. package/lib/types.d.ts +134 -0
  122. package/lib/types.d.ts.map +1 -0
  123. package/lib/types.js +6 -0
  124. package/lib/types.js.map +1 -0
  125. package/lib/validatableTypes.d.ts +79 -0
  126. package/lib/validatableTypes.d.ts.map +1 -0
  127. package/lib/validatableTypes.js +6 -0
  128. package/lib/validatableTypes.js.map +1 -0
  129. package/lib/workspace/workspaceTypes.d.ts +18 -0
  130. package/lib/workspace/workspaceTypes.d.ts.map +1 -0
  131. package/lib/workspace/workspaceTypes.js +6 -0
  132. package/lib/workspace/workspaceTypes.js.map +1 -0
  133. package/lib/workspace-runtime/presenceStatesTypes.d.ts +72 -0
  134. package/lib/workspace-runtime/presenceStatesTypes.d.ts.map +1 -0
  135. package/lib/workspace-runtime/presenceStatesTypes.js +6 -0
  136. package/lib/workspace-runtime/presenceStatesTypes.js.map +1 -0
  137. package/lib/workspace-states/stateDatastoreTypes.d.ts +42 -0
  138. package/lib/workspace-states/stateDatastoreTypes.d.ts.map +1 -0
  139. package/lib/workspace-states/stateDatastoreTypes.js +6 -0
  140. package/lib/workspace-states/stateDatastoreTypes.js.map +1 -0
  141. package/package.json +117 -0
package/lib/types.d.ts ADDED
@@ -0,0 +1,134 @@
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
+ * @public
25
+ */
26
+ export type WorkspaceAddress = `${string}:${string}`;
27
+ /**
28
+ * Single entry in {@link StatesWorkspaceSchema} or {@link NotificationsWorkspaceSchema}.
29
+ *
30
+ * @public
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
+ * @public
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
+ * @public
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
+ * @public
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 @fluidframework/presence#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
+ * @internal
129
+ */
130
+ export interface AnyWorkspace<TSchema extends StatesWorkspaceSchema, TManagerConstraints = unknown> extends StatesWorkspace<TSchema, TManagerConstraints> {
131
+ readonly notifications: StatesWorkspaceEntries<TSchema>;
132
+ readonly presence: PresenceWithNotifications;
133
+ }
134
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
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,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AAC,GAC3D,OAAO,CAAC,IAAI,IAAI,sBAAsB,CACxC,OAAO,GAAG,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,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;;;;GAIG;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 ADDED
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
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 * @public\n */\nexport type WorkspaceAddress = `${string}:${string}`;\n\n/**\n * Single entry in {@link StatesWorkspaceSchema} or {@link NotificationsWorkspaceSchema}.\n *\n * @public\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 * @public\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 * @public\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 * @public\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 @fluidframework/presence#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 *\n * @internal\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"]}
@@ -0,0 +1,79 @@
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 @fluidframework/presence#StateSchemaValidator} function.
23
+ *
24
+ * @internal
25
+ */
26
+ export interface ValidatableOptionalState<TValue> extends Omit<InternalTypes.ValueOptionalState<TValue>, keyof ValidatableMetadata<TValue>>, ValidatableMetadata<TValue> {
27
+ }
28
+ /**
29
+ * Represents data with required value that may have been validated by a
30
+ * {@link @fluidframework/presence#StateSchemaValidator} function.
31
+ *
32
+ * @internal
33
+ */
34
+ export interface ValidatableRequiredState<TValue> extends Omit<InternalTypes.ValueRequiredState<TValue>, keyof ValidatableMetadata<TValue>>, ValidatableMetadata<TValue> {
35
+ }
36
+ /**
37
+ * A directory of validatable values, where each value may be an optional
38
+ * state or another directory.
39
+ *
40
+ * @remarks
41
+ * The is the validatable version of {@link InternalTypes.ValueDirectory}.
42
+ *
43
+ * @internal
44
+ */
45
+ export interface ValidatableValueDirectory<T> {
46
+ rev: number;
47
+ items: {
48
+ [name: string | number]: ValidatableOptionalState<T> | ValidatableValueDirectory<T>;
49
+ };
50
+ }
51
+ /**
52
+ * Convenience type for a validatable required state or a directory of values.
53
+ *
54
+ * @remarks
55
+ * This is the validatable version of {@link InternalTypes.ValueDirectoryOrState}.
56
+ *
57
+ * @internal
58
+ */
59
+ export type ValidatableValueDirectoryOrState<T> = ValidatableRequiredState<T> | ValidatableValueDirectory<T>;
60
+ /**
61
+ * Transforms basic value datastore / protocol type into equivalent type
62
+ * with validation support.
63
+ *
64
+ * @remarks
65
+ * Use when some more specific or parameterized type equivalent of
66
+ * `InternalTypes.Value(Directory|RequiredState|OptionalState)` is needed.
67
+ *
68
+ * Basically, wherever a `*ValueState` appears it is extended with
69
+ * {@link ValidatableMetadata} to support validation.
70
+ *
71
+ * @internal
72
+ */
73
+ 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"> & {
74
+ items: {
75
+ [KItems in keyof T["items"]]: ValidatableValueStructure<T["items"][KItems]>;
76
+ };
77
+ }>> : T extends InternalTypes.ValueRequiredState<infer TValue> | InternalTypes.ValueOptionalState<infer TValue> ? InternalCoreInterfacesUtilityTypes.FlattenIntersection<Omit<T, keyof ValidatableMetadata<TValue>> & ValidatableMetadata<TValue>> : never;
78
+ export {};
79
+ //# sourceMappingURL=validatableTypes.d.ts.map
@@ -0,0 +1 @@
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;;;;;GAKG;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;AAEhC;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB,CAAC,MAAM,CAC/C,SAAQ,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,mBAAmB,CAAC,MAAM,CAAC,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AG,mBAAmB,CAAC,MAAM,CAAC,CACxE,GACA,KAAK,CAAC"}
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=validatableTypes.js.map
@@ -0,0 +1 @@
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 @fluidframework/presence#StateSchemaValidator} function.\n *\n * @internal\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 @fluidframework/presence#StateSchemaValidator} function.\n *\n * @internal\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 *\n * @internal\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 *\n * @internal\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 *\n * @internal\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"]}
@@ -0,0 +1,18 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import type { AttendeeId } from "@fluid-internal/presence-definitions";
6
+ import type { ValidatableValueDirectoryOrState } from "@fluid-internal/presence-definitions/internal";
7
+ /**
8
+ * Basic structure of set of {@link Attendee} records within Presence datastore
9
+ *
10
+ * @remarks
11
+ * This exists per named state in State Managers.
12
+ *
13
+ * @internal
14
+ */
15
+ export interface ClientRecord<TValue extends ValidatableValueDirectoryOrState<unknown>> {
16
+ [AttendeeId: AttendeeId]: TValue;
17
+ }
18
+ //# sourceMappingURL=workspaceTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspaceTypes.d.ts","sourceRoot":"","sources":["../../src/workspace/workspaceTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,+CAA+C,CAAC;AAEtG;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY,CAAC,MAAM,SAAS,gCAAgC,CAAC,OAAO,CAAC;IAIrF,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAAC;CACjC"}
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=workspaceTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspaceTypes.js","sourceRoot":"","sources":["../../src/workspace/workspaceTypes.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 { AttendeeId } from \"@fluid-internal/presence-definitions\";\nimport type { ValidatableValueDirectoryOrState } from \"@fluid-internal/presence-definitions/internal\";\n\n/**\n * Basic structure of set of {@link Attendee} records within Presence datastore\n *\n * @remarks\n * This exists per named state in State Managers.\n *\n * @internal\n */\nexport interface ClientRecord<TValue extends ValidatableValueDirectoryOrState<unknown>> {\n\t// Caution: any particular item may or may not exist\n\t// Typescript does not support absent keys without forcing type to also be undefined.\n\t// See https://github.com/microsoft/TypeScript/issues/42810.\n\t[AttendeeId: AttendeeId]: TValue;\n}\n"]}
@@ -0,0 +1,72 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import type { AttendeeId, BroadcastControlSettings, ClientConnectionId, StatesWorkspaceSchema } from "@fluid-internal/presence-definitions";
6
+ import type { AnyWorkspace, InternalTypes, PostUpdateAction, ValidatableValueDirectoryOrState } from "@fluid-internal/presence-definitions/internal";
7
+ import type { ClientRecord } from "@fluid-internal/presence-definitions/internal/workspace";
8
+ /**
9
+ * Miscellaneous options for local state updates
10
+ *
11
+ * @internal
12
+ */
13
+ export interface RuntimeLocalUpdateOptions {
14
+ /**
15
+ * The maximum time in milliseconds that this update is allowed to be
16
+ * delayed before it must be sent to the service.
17
+ */
18
+ allowableUpdateLatencyMs: number;
19
+ /**
20
+ * Special option allowed for unicast notifications.
21
+ */
22
+ targetClientId?: ClientConnectionId;
23
+ }
24
+ /**
25
+ * ValueElementMap is a map of key to a map of attendeeId to ValueState.
26
+ *
27
+ * @remarks
28
+ * It is not restricted to the schema of the map as it may receive updates from other clients
29
+ * with managers that have not been registered locally. Each map node is responsible for keeping
30
+ * all session's state to be able to pick an arbitrary client to rebroadcast to others.
31
+ *
32
+ * This generic aspect makes some typing difficult. The loose typing is not broadcast to the
33
+ * consumers. They are expected to maintain their schema over multiple versions of clients.
34
+ *
35
+ * @internal
36
+ */
37
+ export interface ValueElementMap<_TSchema extends StatesWorkspaceSchema> {
38
+ [key: string]: ClientRecord<ValidatableValueDirectoryOrState<unknown>>;
39
+ }
40
+ /**
41
+ * Data content of a datastore entry in update messages
42
+ *
43
+ * @internal
44
+ */
45
+ export type ClientUpdateEntry = InternalTypes.ValueDirectoryOrState<unknown> & {
46
+ ignoreUnmonitored?: true;
47
+ };
48
+ /**
49
+ * Record of client update entries keyed by attendee ID
50
+ */
51
+ interface ClientUpdateRecord {
52
+ [AttendeeId: AttendeeId]: ClientUpdateEntry;
53
+ }
54
+ /**
55
+ * Record of value updates keyed by value key
56
+ *
57
+ * @internal
58
+ */
59
+ export interface ValueUpdateRecord {
60
+ [valueKey: string]: ClientUpdateRecord;
61
+ }
62
+ /**
63
+ * Contract for Workspaces as required by `PresenceDatastoreManager`
64
+ *
65
+ * @internal
66
+ */
67
+ export interface PresenceStatesInternal {
68
+ ensureContent<TSchemaAdditional extends StatesWorkspaceSchema>(content: TSchemaAdditional, controls: BroadcastControlSettings | undefined): AnyWorkspace<TSchemaAdditional>;
69
+ processUpdate(received: number, timeModifier: number, remoteDatastore: ValueUpdateRecord, senderConnectionId: ClientConnectionId): PostUpdateAction[];
70
+ }
71
+ export {};
72
+ //# sourceMappingURL=presenceStatesTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presenceStatesTypes.d.ts","sourceRoot":"","sources":["../../src/workspace-runtime/presenceStatesTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,UAAU,EACV,wBAAwB,EACxB,kBAAkB,EAClB,qBAAqB,EACrB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EACX,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,gCAAgC,EAChC,MAAM,+CAA+C,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yDAAyD,CAAC;AAE5F;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACzC;;;OAGG;IACH,wBAAwB,EAAE,MAAM,CAAC;IAEjC;;OAEG;IACH,cAAc,CAAC,EAAE,kBAAkB,CAAC;CACpC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,eAAe,CAAC,QAAQ,SAAS,qBAAqB;IACtE,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAC,gCAAgC,CAAC,OAAO,CAAC,CAAC,CAAC;CACvE;AAuBD;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC,qBAAqB,CAAC,OAAO,CAAC,GAAG;IAC9E,iBAAiB,CAAC,EAAE,IAAI,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,UAAU,kBAAkB;IAC3B,CAAC,UAAU,EAAE,UAAU,GAAG,iBAAiB,CAAC;CAC5C;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IACjC,CAAC,QAAQ,EAAE,MAAM,GAAG,kBAAkB,CAAC;CACvC;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACtC,aAAa,CAAC,iBAAiB,SAAS,qBAAqB,EAC5D,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE,wBAAwB,GAAG,SAAS,GAC5C,YAAY,CAAC,iBAAiB,CAAC,CAAC;IACnC,aAAa,CACZ,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,iBAAiB,EAClC,kBAAkB,EAAE,kBAAkB,GACpC,gBAAgB,EAAE,CAAC;CACtB"}
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=presenceStatesTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presenceStatesTypes.js","sourceRoot":"","sources":["../../src/workspace-runtime/presenceStatesTypes.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\tAttendeeId,\n\tBroadcastControlSettings,\n\tClientConnectionId,\n\tStatesWorkspaceSchema,\n} from \"@fluid-internal/presence-definitions\";\nimport type {\n\tAnyWorkspace,\n\tInternalTypes,\n\tPostUpdateAction,\n\tValidatableValueDirectoryOrState,\n} from \"@fluid-internal/presence-definitions/internal\";\nimport type { ClientRecord } from \"@fluid-internal/presence-definitions/internal/workspace\";\n\n/**\n * Miscellaneous options for local state updates\n *\n * @internal\n */\nexport interface RuntimeLocalUpdateOptions {\n\t/**\n\t * The maximum time in milliseconds that this update is allowed to be\n\t * delayed before it must be sent to the service.\n\t */\n\tallowableUpdateLatencyMs: number;\n\n\t/**\n\t * Special option allowed for unicast notifications.\n\t */\n\ttargetClientId?: ClientConnectionId;\n}\n\n/**\n * ValueElementMap is a map of key to a map of attendeeId to ValueState.\n *\n * @remarks\n * It is not restricted to the schema of the map as it may receive updates from other clients\n * with managers that have not been registered locally. Each map node is responsible for keeping\n * all session's state to be able to pick an arbitrary client to rebroadcast to others.\n *\n * This generic aspect makes some typing difficult. The loose typing is not broadcast to the\n * consumers. They are expected to maintain their schema over multiple versions of clients.\n *\n * @internal\n */\nexport interface ValueElementMap<_TSchema extends StatesWorkspaceSchema> {\n\t[key: string]: ClientRecord<ValidatableValueDirectoryOrState<unknown>>;\n}\n\n// An attempt to make the type more precise, but it is not working.\n// If the casting in support code is too much we could keep two references to the same\n// complete datastore, but with the respective types desired.\n// type ValueElementMap<TSchema extends PresenceStatesNodeSchema> =\n// \t| {\n// \t\t\t[Key in keyof TSchema & string]?: {\n// \t\t\t\t[AttendeeId: AttendeeId]: InternalTypes.ValueDirectoryOrState<MapSchemaElement<TSchema,\"value\",Key>>;\n// \t\t\t};\n// \t }\n// \t| {\n// \t\t\t[key: string]: ClientRecord<InternalTypes.ValueDirectoryOrState<unknown>>;\n// \t };\n// interface ValueElementMap<TValue> {\n// \t[Id: string]: ClientRecord<InternalTypes.ValueDirectoryOrState<TValue>>;\n// \t// Version with local packed in is convenient for map, but not for join broadcast to serialize simply.\n// \t// [Id: string]: {\n// \t// \tlocal: InternalTypes.ValueDirectoryOrState<TValue>;\n// \t// \tall: ClientRecord<InternalTypes.ValueDirectoryOrState<TValue>>;\n// \t// };\n// }\n\n/**\n * Data content of a datastore entry in update messages\n *\n * @internal\n */\nexport type ClientUpdateEntry = InternalTypes.ValueDirectoryOrState<unknown> & {\n\tignoreUnmonitored?: true;\n};\n\n/**\n * Record of client update entries keyed by attendee ID\n */\ninterface ClientUpdateRecord {\n\t[AttendeeId: AttendeeId]: ClientUpdateEntry;\n}\n\n/**\n * Record of value updates keyed by value key\n *\n * @internal\n */\nexport interface ValueUpdateRecord {\n\t[valueKey: string]: ClientUpdateRecord;\n}\n\n/**\n * Contract for Workspaces as required by `PresenceDatastoreManager`\n *\n * @internal\n */\nexport interface PresenceStatesInternal {\n\tensureContent<TSchemaAdditional extends StatesWorkspaceSchema>(\n\t\tcontent: TSchemaAdditional,\n\t\tcontrols: BroadcastControlSettings | undefined,\n\t): AnyWorkspace<TSchemaAdditional>;\n\tprocessUpdate(\n\t\treceived: number,\n\t\ttimeModifier: number,\n\t\tremoteDatastore: ValueUpdateRecord,\n\t\tsenderConnectionId: ClientConnectionId,\n\t): PostUpdateAction[];\n}\n"]}
@@ -0,0 +1,42 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import type { AttendeeId, ClientConnectionId, PresenceWithNotifications as Presence } from "@fluid-internal/presence-definitions";
6
+ import type { InternalTypes, ValidatableValueDirectoryOrState, ValidatableValueStructure } from "@fluid-internal/presence-definitions/internal";
7
+ import type { ClientRecord } from "@fluid-internal/presence-definitions/internal/workspace";
8
+ /**
9
+ * Miscellaneous options for local state updates
10
+ *
11
+ * @internal
12
+ */
13
+ export interface LocalStateUpdateOptions {
14
+ /**
15
+ * When defined, this is the maximum time in milliseconds that this
16
+ * update is allowed to be delayed before it must be sent to service.
17
+ * When `undefined`, the callee may determine maximum delay.
18
+ */
19
+ allowableUpdateLatencyMs: number | undefined;
20
+ /**
21
+ * Special option allowed for unicast notifications.
22
+ */
23
+ targetClientId?: ClientConnectionId;
24
+ }
25
+ /**
26
+ * Contract for States Workspace to support State Manager access to
27
+ * datastore and general internal presence knowledge.
28
+ *
29
+ * @internal
30
+ */
31
+ export interface StateDatastore<TKey extends string, TLocalUpdateValue extends InternalTypes.ValueDirectoryOrState<unknown>, TStoredValue extends ValidatableValueDirectoryOrState<unknown> = ValidatableValueStructure<TLocalUpdateValue>> {
32
+ readonly presence: Presence;
33
+ localUpdate(key: TKey, value: TLocalUpdateValue & {
34
+ ignoreUnmonitored?: true;
35
+ }, options: LocalStateUpdateOptions): void;
36
+ update(key: TKey, attendeeId: AttendeeId, value: TStoredValue): void;
37
+ knownValues(key: TKey): {
38
+ self: AttendeeId | undefined;
39
+ states: ClientRecord<TStoredValue>;
40
+ };
41
+ }
42
+ //# sourceMappingURL=stateDatastoreTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stateDatastoreTypes.d.ts","sourceRoot":"","sources":["../../src/workspace-states/stateDatastoreTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,UAAU,EACV,kBAAkB,EAClB,yBAAyB,IAAI,QAAQ,EACrC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EACX,aAAa,EACb,gCAAgC,EAChC,yBAAyB,EACzB,MAAM,+CAA+C,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yDAAyD,CAAC;AAE5F;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACvC;;;;OAIG;IACH,wBAAwB,EAAE,MAAM,GAAG,SAAS,CAAC;IAE7C;;OAEG;IACH,cAAc,CAAC,EAAE,kBAAkB,CAAC;CACpC;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAc,CAC9B,IAAI,SAAS,MAAM,EACnB,iBAAiB,SAAS,aAAa,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtE,YAAY,SACX,gCAAgC,CAAC,OAAO,CAAC,GAAG,yBAAyB,CAAC,iBAAiB,CAAC;IAEzF,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,WAAW,CACV,GAAG,EAAE,IAAI,EACT,KAAK,EAAE,iBAAiB,GAAG;QAC1B,iBAAiB,CAAC,EAAE,IAAI,CAAC;KACzB,EACD,OAAO,EAAE,uBAAuB,GAC9B,IAAI,CAAC;IACR,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IACrE,WAAW,CAAC,GAAG,EAAE,IAAI,GAAG;QACvB,IAAI,EAAE,UAAU,GAAG,SAAS,CAAC;QAC7B,MAAM,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;KACnC,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=stateDatastoreTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stateDatastoreTypes.js","sourceRoot":"","sources":["../../src/workspace-states/stateDatastoreTypes.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\tAttendeeId,\n\tClientConnectionId,\n\tPresenceWithNotifications as Presence,\n} from \"@fluid-internal/presence-definitions\";\nimport type {\n\tInternalTypes,\n\tValidatableValueDirectoryOrState,\n\tValidatableValueStructure,\n} from \"@fluid-internal/presence-definitions/internal\";\nimport type { ClientRecord } from \"@fluid-internal/presence-definitions/internal/workspace\";\n\n/**\n * Miscellaneous options for local state updates\n *\n * @internal\n */\nexport interface LocalStateUpdateOptions {\n\t/**\n\t * When defined, this is the maximum time in milliseconds that this\n\t * update is allowed to be delayed before it must be sent to service.\n\t * When `undefined`, the callee may determine maximum delay.\n\t */\n\tallowableUpdateLatencyMs: number | undefined;\n\n\t/**\n\t * Special option allowed for unicast notifications.\n\t */\n\ttargetClientId?: ClientConnectionId;\n}\n\n/**\n * Contract for States Workspace to support State Manager access to\n * datastore and general internal presence knowledge.\n *\n * @internal\n */\nexport interface StateDatastore<\n\tTKey extends string,\n\tTLocalUpdateValue extends InternalTypes.ValueDirectoryOrState<unknown>,\n\tTStoredValue extends\n\t\tValidatableValueDirectoryOrState<unknown> = ValidatableValueStructure<TLocalUpdateValue>,\n> {\n\treadonly presence: Presence;\n\tlocalUpdate(\n\t\tkey: TKey,\n\t\tvalue: TLocalUpdateValue & {\n\t\t\tignoreUnmonitored?: true;\n\t\t},\n\t\toptions: LocalStateUpdateOptions,\n\t): void;\n\tupdate(key: TKey, attendeeId: AttendeeId, value: TStoredValue): void;\n\tknownValues(key: TKey): {\n\t\tself: AttendeeId | undefined;\n\t\tstates: ClientRecord<TStoredValue>;\n\t};\n}\n"]}
package/package.json ADDED
@@ -0,0 +1,117 @@
1
+ {
2
+ "name": "@fluid-internal/presence-definitions",
3
+ "version": "2.93.0",
4
+ "description": "Core type definitions and interfaces for Fluid Framework presence",
5
+ "homepage": "https://fluidframework.com",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/microsoft/FluidFramework.git",
9
+ "directory": "packages/framework/presence-definitions"
10
+ },
11
+ "license": "MIT",
12
+ "author": "Microsoft and contributors",
13
+ "sideEffects": false,
14
+ "type": "module",
15
+ "exports": {
16
+ ".": {
17
+ "import": {
18
+ "types": "./lib/index.d.ts",
19
+ "default": "./lib/index.js"
20
+ },
21
+ "require": {
22
+ "types": "./dist/index.d.ts",
23
+ "default": "./dist/index.js"
24
+ }
25
+ },
26
+ "./internal": {
27
+ "import": "./lib/internal.js",
28
+ "require": "./dist/internal.js"
29
+ },
30
+ "./internal/workspace": {
31
+ "import": "./lib/workspace/workspaceTypes.js",
32
+ "require": "./dist/workspace/workspaceTypes.js"
33
+ },
34
+ "./internal/workspace-runtime": {
35
+ "import": "./lib/workspace-runtime/presenceStatesTypes.js",
36
+ "require": "./dist/workspace-runtime/presenceStatesTypes.js"
37
+ },
38
+ "./internal/workspace-states": {
39
+ "import": "./lib/workspace-states/stateDatastoreTypes.js",
40
+ "require": "./dist/workspace-states/stateDatastoreTypes.js"
41
+ }
42
+ },
43
+ "files": [
44
+ "dist/**/*",
45
+ "lib/**/*",
46
+ "!**/test/**"
47
+ ],
48
+ "dependencies": {
49
+ "@fluidframework/core-interfaces": "~2.93.0",
50
+ "@fluidframework/id-compressor": "~2.93.0"
51
+ },
52
+ "devDependencies": {
53
+ "@arethetypeswrong/cli": "^0.18.2",
54
+ "@biomejs/biome": "~2.4.5",
55
+ "@fluid-internal/presence-definitions-previous": "npm:@fluidframework/presence@2.92.0",
56
+ "@fluid-tools/build-cli": "^0.64.0",
57
+ "@fluidframework/build-common": "^2.0.3",
58
+ "@fluidframework/build-tools": "^0.64.0",
59
+ "@fluidframework/eslint-config-fluid": "^9.0.0",
60
+ "@microsoft/api-extractor": "7.58.1",
61
+ "concurrently": "^9.2.1",
62
+ "copyfiles": "^2.4.1",
63
+ "cross-env": "^10.1.0",
64
+ "eslint": "~9.39.1",
65
+ "jiti": "^2.6.1",
66
+ "rimraf": "^6.1.3",
67
+ "typescript": "~5.4.5"
68
+ },
69
+ "fluidBuild": {
70
+ "tasks": {
71
+ "check:exports:cjs:index": [
72
+ "tsc"
73
+ ],
74
+ "check:exports:esm:index": [
75
+ "build:esnext"
76
+ ]
77
+ }
78
+ },
79
+ "typeValidation": {
80
+ "entrypoint": "beta",
81
+ "broken": {
82
+ "Variable_getPresence": {
83
+ "backCompat": false
84
+ },
85
+ "Variable_StateFactory": {
86
+ "backCompat": false
87
+ }
88
+ }
89
+ },
90
+ "scripts": {
91
+ "build": "fluid-build . --task build",
92
+ "build:commonjs": "fluid-build . --task commonjs",
93
+ "build:compile": "fluid-build . --task compile",
94
+ "build:docs": "api-extractor run --local",
95
+ "build:esnext": "tsc --project ./tsconfig.json",
96
+ "build:test": "npm run build:test:esm && npm run build:test:cjs",
97
+ "build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
98
+ "build:test:esm": "tsc --project ./src/test/tsconfig.json",
99
+ "check:are-the-types-wrong": "attw --pack . --profile node16",
100
+ "check:biome": "biome check .",
101
+ "check:exports": "concurrently \"npm:check:exports:*\"",
102
+ "check:exports:bundle-release-tags": "api-extractor run --config api-extractor/api-extractor-lint-bundle.json",
103
+ "check:exports:cjs:index": "api-extractor run --config api-extractor/api-extractor-lint-index.cjs.json",
104
+ "check:exports:esm:index": "api-extractor run --config api-extractor/api-extractor-lint-index.esm.json",
105
+ "check:format": "npm run check:biome",
106
+ "ci:build:docs": "api-extractor run",
107
+ "clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
108
+ "eslint": "eslint --quiet --format stylish src",
109
+ "eslint:fix": "eslint --quiet --format stylish src --fix --fix-type problem,suggestion,layout",
110
+ "format": "npm run format:biome",
111
+ "format:biome": "biome check . --write",
112
+ "lint": "fluid-build . --task lint",
113
+ "lint:fix": "fluid-build . --task eslint:fix --task format",
114
+ "tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ./src/cjs/package.json ./dist",
115
+ "typetests:gen-disabled": "flub generate typetests --dir . -v"
116
+ }
117
+ }