@fluidframework/presence 2.74.0-370705 → 2.80.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 (69) hide show
  1. package/dist/alpha.d.ts +1 -0
  2. package/dist/beta.d.ts +1 -0
  3. package/dist/exposedInternalTypes.d.ts +1 -1
  4. package/dist/exposedInternalTypes.d.ts.map +1 -1
  5. package/dist/exposedInternalTypes.js.map +1 -1
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/internalTypes.d.ts +6 -0
  10. package/dist/internalTypes.d.ts.map +1 -1
  11. package/dist/internalTypes.js.map +1 -1
  12. package/dist/latestMapValueManager.d.ts +33 -14
  13. package/dist/latestMapValueManager.d.ts.map +1 -1
  14. package/dist/latestMapValueManager.js +33 -16
  15. package/dist/latestMapValueManager.js.map +1 -1
  16. package/dist/legacy.alpha.d.ts +1 -0
  17. package/dist/packageVersion.d.ts +1 -1
  18. package/dist/packageVersion.d.ts.map +1 -1
  19. package/dist/packageVersion.js +1 -1
  20. package/dist/packageVersion.js.map +1 -1
  21. package/dist/presenceDatastoreManager.d.ts +7 -11
  22. package/dist/presenceDatastoreManager.d.ts.map +1 -1
  23. package/dist/presenceDatastoreManager.js +11 -62
  24. package/dist/presenceDatastoreManager.js.map +1 -1
  25. package/dist/presenceManager.d.ts.map +1 -1
  26. package/dist/presenceManager.js +68 -23
  27. package/dist/presenceManager.js.map +1 -1
  28. package/dist/stateDatastore.d.ts +2 -2
  29. package/dist/stateDatastore.d.ts.map +1 -1
  30. package/dist/stateDatastore.js.map +1 -1
  31. package/dist/systemWorkspace.d.ts +2 -1
  32. package/dist/systemWorkspace.d.ts.map +1 -1
  33. package/dist/systemWorkspace.js +95 -42
  34. package/dist/systemWorkspace.js.map +1 -1
  35. package/lib/alpha.d.ts +1 -0
  36. package/lib/beta.d.ts +1 -0
  37. package/lib/exposedInternalTypes.d.ts +1 -1
  38. package/lib/exposedInternalTypes.d.ts.map +1 -1
  39. package/lib/exposedInternalTypes.js.map +1 -1
  40. package/lib/index.d.ts +1 -1
  41. package/lib/index.d.ts.map +1 -1
  42. package/lib/index.js.map +1 -1
  43. package/lib/internalTypes.d.ts +6 -0
  44. package/lib/internalTypes.d.ts.map +1 -1
  45. package/lib/internalTypes.js.map +1 -1
  46. package/lib/latestMapValueManager.d.ts +33 -14
  47. package/lib/latestMapValueManager.d.ts.map +1 -1
  48. package/lib/latestMapValueManager.js +33 -16
  49. package/lib/latestMapValueManager.js.map +1 -1
  50. package/lib/legacy.alpha.d.ts +1 -0
  51. package/lib/packageVersion.d.ts +1 -1
  52. package/lib/packageVersion.d.ts.map +1 -1
  53. package/lib/packageVersion.js +1 -1
  54. package/lib/packageVersion.js.map +1 -1
  55. package/lib/presenceDatastoreManager.d.ts +7 -11
  56. package/lib/presenceDatastoreManager.d.ts.map +1 -1
  57. package/lib/presenceDatastoreManager.js +11 -62
  58. package/lib/presenceDatastoreManager.js.map +1 -1
  59. package/lib/presenceManager.d.ts.map +1 -1
  60. package/lib/presenceManager.js +64 -19
  61. package/lib/presenceManager.js.map +1 -1
  62. package/lib/stateDatastore.d.ts +2 -2
  63. package/lib/stateDatastore.d.ts.map +1 -1
  64. package/lib/stateDatastore.js.map +1 -1
  65. package/lib/systemWorkspace.d.ts +2 -1
  66. package/lib/systemWorkspace.d.ts.map +1 -1
  67. package/lib/systemWorkspace.js +95 -42
  68. package/lib/systemWorkspace.js.map +1 -1
  69. package/package.json +25 -24
package/dist/alpha.d.ts CHANGED
@@ -27,6 +27,7 @@ export {
27
27
  BroadcastControls,
28
28
  ClientConnectionId,
29
29
  InternalTypes,
30
+ KeySchemaValidator,
30
31
  Latest,
31
32
  LatestArguments,
32
33
  LatestArgumentsRaw,
package/dist/beta.d.ts CHANGED
@@ -27,6 +27,7 @@ export {
27
27
  BroadcastControls,
28
28
  ClientConnectionId,
29
29
  InternalTypes,
30
+ KeySchemaValidator,
30
31
  Latest,
31
32
  LatestArguments,
32
33
  LatestArgumentsRaw,
@@ -72,7 +72,7 @@ export declare namespace InternalTypes {
72
72
  *
73
73
  * @system
74
74
  */
75
- interface MapValueState<T, Keys extends string | number> {
75
+ interface MapValueState<T, Keys extends string> {
76
76
  rev: number;
77
77
  items: {
78
78
  [name in Keys]: ValueOptionalState<T>;
@@ -1 +1 @@
1
- {"version":3,"file":"exposedInternalTypes.d.ts","sourceRoot":"","sources":["../src/exposedInternalTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8DAA8D,CAAC;AAE3G;;;;;;GAMG;AAEH,yBAAiB,aAAa,CAAC;IAC9B;;;;OAIG;IACH,UAAiB,kBAAkB;QAClC,GAAG,EAAE,MAAM,CAAC;QACZ,SAAS,EAAE,MAAM,CAAC;KAClB;IAED;;;;;;;;OAQG;IACH,UAAiB,kBAAkB,CAAC,MAAM,CAAE,SAAQ,kBAAkB;QACrE,KAAK,CAAC,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;KAMvC;IAED;;;;;;;;;;;;;;OAcG;IACH,UAAiB,kBAAkB,CAAC,MAAM,CAAE,SAAQ,kBAAkB;QACrE,KAAK,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;KAMtC;IAED;;;;OAIG;IACH,UAAiB,cAAc,CAAC,CAAC;QAChC,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE;YAIN,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,kBAAkB,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;SACnE,CAAC;KACF;IAED;;;;OAIG;IACH,KAAY,qBAAqB,CAAC,CAAC,IAAI,kBAAkB,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;IAEjF;;;;OAIG;IACH,UAAiB,aAAa,CAAC,CAAC,EAAE,IAAI,SAAS,MAAM,GA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IAAI,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;IAEnD;;;;OAIG;IACH,KAAY,cAAc,CACzB,IAAI,SAAS,MAAM,EACnB,MAAM,SAAS,qBAAqB,CAAC,GAAG,CAAC,EACzC,QAAQ,IACL;QAAE,YAAY,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;KAAE,GAAG,CAAC,CACpD,GAAG,EAAE,IAAI,EACT,eAAe,EAAE,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,KAC/C;QACJ,WAAW,CAAC,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,wBAAwB,EAAE,MAAM,GAAG,SAAS,CAAA;SAAE,CAAC;QAC9E,OAAO,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;KAC9B,CAAC,CAAC;IAEH;;;;OAIG;IACH,UAAiB,gBAAgB;QAChC,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,OAAO,EAAE,CAAC;KAChB;CACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"exposedInternalTypes.js","sourceRoot":"","sources":["../src/exposedInternalTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;;;;;GAMG;AACH,2DAA2D;AAC3D,IAAiB,aAAa,CAmJ7B;AAnJD,WAAiB,aAAa;AAmJ9B,CAAC,EAnJgB,aAAa,6BAAb,aAAa,QAmJ7B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { OpaqueJsonDeserialized } from \"@fluidframework/core-interfaces/internal/exposedUtilityTypes\";\n\n/**\n * Collection of value types that are not intended to be used/imported\n * directly outside of this package.\n *\n * @beta\n * @system\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace InternalTypes {\n\t/**\n\t * Metadata for a value state.\n\t *\n\t * @system\n\t */\n\texport interface ValueStateMetadata {\n\t\trev: number;\n\t\ttimestamp: number;\n\t}\n\n\t/**\n\t * Represents a state that may have a value.\n\t * And it includes standard metadata.\n\t *\n\t * @remarks\n\t * See {@link InternalTypes.ValueRequiredState}.\n\t *\n\t * @system\n\t */\n\texport interface ValueOptionalState<TValue> extends ValueStateMetadata {\n\t\tvalue?: OpaqueJsonDeserialized<TValue>;\n\n\t\t// Uncomment this property and rebuild to check more thoroughly\n\t\t// for incompatibilities between this non-validatable state\n\t\t// and ValidatableOptionalState.\n\t\t// validatedValue?: never;\n\t}\n\n\t/**\n\t * Represents a state that must have a value.\n\t * And it includes standard metadata.\n\t *\n\t * @remarks\n\t * The value is wrapped in `OpaqueJsonDeserialized` as uses are expected\n\t * to involve generic or unknown types that will be filtered. It is here\n\t * mostly as a convenience to the many such uses that would otherwise\n\t * need to specify some wrapper themselves.\n\t *\n\t * For known cases, construct a custom interface that extends\n\t * {@link InternalTypes.ValueStateMetadata}.\n\t *\n\t * @system\n\t */\n\texport interface ValueRequiredState<TValue> extends ValueStateMetadata {\n\t\tvalue: OpaqueJsonDeserialized<TValue>;\n\n\t\t// Uncomment this property and rebuild to check more thoroughly\n\t\t// for incompatibilities between this non-validatable state\n\t\t// and ValidatableOptionalState.\n\t\t// validatedValue?: never;\n\t}\n\n\t/**\n\t * A directory of values, where each value may be an optional state or another directory.\n\t *\n\t * @system\n\t */\n\texport interface ValueDirectory<T> {\n\t\trev: number;\n\t\titems: {\n\t\t\t// Caution: any particular item may or may not exist\n\t\t\t// Typescript does not support absent keys without forcing type to also be undefined.\n\t\t\t// See https://github.com/microsoft/TypeScript/issues/42810.\n\t\t\t[name: string | number]: ValueOptionalState<T> | ValueDirectory<T>;\n\t\t};\n\t}\n\n\t/**\n\t * Convenience type for a required state or a directory of values.\n\t *\n\t * @system\n\t */\n\texport type ValueDirectoryOrState<T> = ValueRequiredState<T> | ValueDirectory<T>;\n\n\t/**\n\t * Collection of optional values in a \"map\" structure.\n\t *\n\t * @system\n\t */\n\texport interface MapValueState<T, Keys extends string | number> {\n\t\trev: number;\n\t\titems: {\n\t\t\t// Caution: any particular item may or may not exist\n\t\t\t// Typescript does not support absent keys without forcing type to also be undefined.\n\t\t\t// See https://github.com/microsoft/TypeScript/issues/42810.\n\t\t\t[name in Keys]: ValueOptionalState<T>;\n\t\t};\n\t}\n\n\t/**\n\t * Opaque type representing internal state datastore.\n\t *\n\t * @system\n\t */\n\texport declare class StateDatastoreHandle<TKey, TValue extends ValueDirectoryOrState<any>> {\n\t\tprivate readonly StateDatastoreHandle: StateDatastoreHandle<TKey, TValue>;\n\t}\n\n\t/**\n\t * Brand to ensure state values internal type safety without revealing\n\t * internals that are subject to change.\n\t *\n\t * @system\n\t */\n\texport declare class StateValueBrand<T> {\n\t\tprivate readonly StateValue: StateValue<T>;\n\t}\n\n\t/**\n\t * This type provides no additional functionality over the type it wraps.\n\t * It is used to ensure type safety within package.\n\t * Users may find it convenient to just use the type it wraps directly.\n\t *\n\t * @privateRemarks\n\t * Checkout filtering omitting unknown from T (`Omit<T,unknown> &`).\n\t *\n\t * @system\n\t */\n\texport type StateValue<T> = T & StateValueBrand<T>;\n\n\t/**\n\t * Package internal function declaration for state and notification instantiation.\n\t *\n\t * @system\n\t */\n\texport type ManagerFactory<\n\t\tTKey extends string,\n\t\tTValue extends ValueDirectoryOrState<any>,\n\t\tTManager,\n\t> = { instanceBase: new (...args: any[]) => any } & ((\n\t\tkey: TKey,\n\t\tdatastoreHandle: StateDatastoreHandle<TKey, TValue>,\n\t) => {\n\t\tinitialData?: { value: TValue; allowableUpdateLatencyMs: number | undefined };\n\t\tmanager: StateValue<TManager>;\n\t});\n\n\t/**\n\t * Structure of a generic notification \"value\".\n\t *\n\t * @system\n\t */\n\texport interface NotificationType {\n\t\tname: string;\n\t\targs: unknown[];\n\t}\n}\n"]}
1
+ {"version":3,"file":"exposedInternalTypes.js","sourceRoot":"","sources":["../src/exposedInternalTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;;;;;GAMG;AACH,2DAA2D;AAC3D,IAAiB,aAAa,CAmJ7B;AAnJD,WAAiB,aAAa;AAmJ9B,CAAC,EAnJgB,aAAa,6BAAb,aAAa,QAmJ7B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { OpaqueJsonDeserialized } from \"@fluidframework/core-interfaces/internal/exposedUtilityTypes\";\n\n/**\n * Collection of value types that are not intended to be used/imported\n * directly outside of this package.\n *\n * @beta\n * @system\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace InternalTypes {\n\t/**\n\t * Metadata for a value state.\n\t *\n\t * @system\n\t */\n\texport interface ValueStateMetadata {\n\t\trev: number;\n\t\ttimestamp: number;\n\t}\n\n\t/**\n\t * Represents a state that may have a value.\n\t * And it includes standard metadata.\n\t *\n\t * @remarks\n\t * See {@link InternalTypes.ValueRequiredState}.\n\t *\n\t * @system\n\t */\n\texport interface ValueOptionalState<TValue> extends ValueStateMetadata {\n\t\tvalue?: OpaqueJsonDeserialized<TValue>;\n\n\t\t// Uncomment this property and rebuild to check more thoroughly\n\t\t// for incompatibilities between this non-validatable state\n\t\t// and ValidatableOptionalState.\n\t\t// validatedValue?: never;\n\t}\n\n\t/**\n\t * Represents a state that must have a value.\n\t * And it includes standard metadata.\n\t *\n\t * @remarks\n\t * The value is wrapped in `OpaqueJsonDeserialized` as uses are expected\n\t * to involve generic or unknown types that will be filtered. It is here\n\t * mostly as a convenience to the many such uses that would otherwise\n\t * need to specify some wrapper themselves.\n\t *\n\t * For known cases, construct a custom interface that extends\n\t * {@link InternalTypes.ValueStateMetadata}.\n\t *\n\t * @system\n\t */\n\texport interface ValueRequiredState<TValue> extends ValueStateMetadata {\n\t\tvalue: OpaqueJsonDeserialized<TValue>;\n\n\t\t// Uncomment this property and rebuild to check more thoroughly\n\t\t// for incompatibilities between this non-validatable state\n\t\t// and ValidatableOptionalState.\n\t\t// validatedValue?: never;\n\t}\n\n\t/**\n\t * A directory of values, where each value may be an optional state or another directory.\n\t *\n\t * @system\n\t */\n\texport interface ValueDirectory<T> {\n\t\trev: number;\n\t\titems: {\n\t\t\t// Caution: any particular item may or may not exist\n\t\t\t// Typescript does not support absent keys without forcing type to also be undefined.\n\t\t\t// See https://github.com/microsoft/TypeScript/issues/42810.\n\t\t\t[name: string | number]: ValueOptionalState<T> | ValueDirectory<T>;\n\t\t};\n\t}\n\n\t/**\n\t * Convenience type for a required state or a directory of values.\n\t *\n\t * @system\n\t */\n\texport type ValueDirectoryOrState<T> = ValueRequiredState<T> | ValueDirectory<T>;\n\n\t/**\n\t * Collection of optional values in a \"map\" structure.\n\t *\n\t * @system\n\t */\n\texport interface MapValueState<T, Keys extends string> {\n\t\trev: number;\n\t\titems: {\n\t\t\t// Caution: any particular item may or may not exist\n\t\t\t// Typescript does not support absent keys without forcing type to also be undefined.\n\t\t\t// See https://github.com/microsoft/TypeScript/issues/42810.\n\t\t\t[name in Keys]: ValueOptionalState<T>;\n\t\t};\n\t}\n\n\t/**\n\t * Opaque type representing internal state datastore.\n\t *\n\t * @system\n\t */\n\texport declare class StateDatastoreHandle<TKey, TValue extends ValueDirectoryOrState<any>> {\n\t\tprivate readonly StateDatastoreHandle: StateDatastoreHandle<TKey, TValue>;\n\t}\n\n\t/**\n\t * Brand to ensure state values internal type safety without revealing\n\t * internals that are subject to change.\n\t *\n\t * @system\n\t */\n\texport declare class StateValueBrand<T> {\n\t\tprivate readonly StateValue: StateValue<T>;\n\t}\n\n\t/**\n\t * This type provides no additional functionality over the type it wraps.\n\t * It is used to ensure type safety within package.\n\t * Users may find it convenient to just use the type it wraps directly.\n\t *\n\t * @privateRemarks\n\t * Checkout filtering omitting unknown from T (`Omit<T,unknown> &`).\n\t *\n\t * @system\n\t */\n\texport type StateValue<T> = T & StateValueBrand<T>;\n\n\t/**\n\t * Package internal function declaration for state and notification instantiation.\n\t *\n\t * @system\n\t */\n\texport type ManagerFactory<\n\t\tTKey extends string,\n\t\tTValue extends ValueDirectoryOrState<any>,\n\t\tTManager,\n\t> = { instanceBase: new (...args: any[]) => any } & ((\n\t\tkey: TKey,\n\t\tdatastoreHandle: StateDatastoreHandle<TKey, TValue>,\n\t) => {\n\t\tinitialData?: { value: TValue; allowableUpdateLatencyMs: number | undefined };\n\t\tmanager: StateValue<TManager>;\n\t});\n\n\t/**\n\t * Structure of a generic notification \"value\".\n\t *\n\t * @system\n\t */\n\texport interface NotificationType {\n\t\tname: string;\n\t\targs: unknown[];\n\t}\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -14,7 +14,7 @@ export type { NotificationsWorkspace, NotificationsWorkspaceSchema, StatesWorksp
14
14
  export { type Attendee, type AttendeesEvents, type AttendeeId, AttendeeStatus, type Presence, type PresenceEvents, type PresenceWithNotifications, } from "./presence.js";
15
15
  export type { BroadcastControls, BroadcastControlSettings, } from "./broadcastControls.js";
16
16
  export { getPresence, getPresenceAlpha, getPresenceFromDataStoreContext, } from "./getPresence.js";
17
- export type { LatestMap, LatestMapArguments, LatestMapArgumentsRaw, LatestMapClientData, LatestMapEvents, LatestMapFactory, LatestMapItemRemovedClientData, LatestMapItemUpdatedClientData, LatestMapRaw, LatestMapRawEvents, StateMap, } from "./latestMapValueManager.js";
17
+ export type { KeySchemaValidator, LatestMap, LatestMapArguments, LatestMapArgumentsRaw, LatestMapClientData, LatestMapEvents, LatestMapFactory, LatestMapItemRemovedClientData, LatestMapItemUpdatedClientData, LatestMapRaw, LatestMapRawEvents, StateMap, } from "./latestMapValueManager.js";
18
18
  export type { Latest, LatestArguments, LatestArgumentsRaw, LatestEvents, LatestFactory, LatestRaw, LatestRawEvents, } from "./latestValueManager.js";
19
19
  export type { Accessor, LatestClientData, LatestData, LatestMetadata, ProxiedValueAccessor, RawValueAccessor, StateSchemaValidator, ValueAccessor, } from "./latestValueTypes.js";
20
20
  export { type NotificationEmitter, type NotificationListenable, type NotificationSubscriptions, Notifications, type NotificationsManager, type NotificationsManagerEvents, } from "./notificationsManager.js";
@@ -1 +1 @@
1
- {"version":3,"file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B,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,GAC/B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,YAAY,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAsBH,6CAQuB;AAJtB,6GAAA,cAAc,OAAA;AAWf,mDAI0B;AAHzB,6GAAA,WAAW,OAAA;AACX,kHAAA,gBAAgB,OAAA;AAChB,iIAAA,+BAA+B,OAAA;AAoChC,qEAOmC;AAHlC,wHAAA,aAAa,OAAA;AAKd,qDAAiD;AAAxC,+GAAA,YAAY,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Package for client presence within a connected session.\n *\n * See {@link https://github.com/microsoft/FluidFramework/tree/main/packages/framework/presence#readme | README.md } for an overview of the package.\n *\n * @packageDocumentation\n */\n\nexport type { ClientConnectionId } from \"./baseTypes.js\";\n\nexport type {\n\tNotificationsWorkspace,\n\tNotificationsWorkspaceSchema,\n\tStatesWorkspace,\n\tStatesWorkspaceEntries,\n\tStatesWorkspaceSchema,\n\tStatesWorkspaceEntry,\n\tWorkspaceAddress,\n} from \"./types.js\";\n\nexport {\n\ttype Attendee,\n\ttype AttendeesEvents,\n\ttype AttendeeId,\n\tAttendeeStatus,\n\ttype Presence,\n\ttype PresenceEvents,\n\ttype PresenceWithNotifications,\n} from \"./presence.js\";\n\nexport type {\n\tBroadcastControls,\n\tBroadcastControlSettings,\n} from \"./broadcastControls.js\";\n\nexport {\n\tgetPresence,\n\tgetPresenceAlpha,\n\tgetPresenceFromDataStoreContext,\n} from \"./getPresence.js\";\n\nexport type {\n\tLatestMap,\n\tLatestMapArguments,\n\tLatestMapArgumentsRaw,\n\tLatestMapClientData,\n\tLatestMapEvents,\n\tLatestMapFactory,\n\tLatestMapItemRemovedClientData,\n\tLatestMapItemUpdatedClientData,\n\tLatestMapRaw,\n\tLatestMapRawEvents,\n\tStateMap,\n} from \"./latestMapValueManager.js\";\nexport type {\n\tLatest,\n\tLatestArguments,\n\tLatestArgumentsRaw,\n\tLatestEvents,\n\tLatestFactory,\n\tLatestRaw,\n\tLatestRawEvents,\n} from \"./latestValueManager.js\";\nexport type {\n\tAccessor,\n\tLatestClientData,\n\tLatestData,\n\tLatestMetadata,\n\tProxiedValueAccessor,\n\tRawValueAccessor,\n\tStateSchemaValidator,\n\tValueAccessor,\n} from \"./latestValueTypes.js\";\n\nexport {\n\ttype NotificationEmitter,\n\ttype NotificationListenable,\n\ttype NotificationSubscriptions,\n\tNotifications,\n\ttype NotificationsManager,\n\ttype NotificationsManagerEvents,\n} from \"./notificationsManager.js\";\n\nexport { StateFactory } from \"./stateFactory.js\";\n\nexport type { InternalTypes } from \"./exposedInternalTypes.js\";\nexport type { InternalUtilityTypes } from \"./exposedUtilityTypes.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAsBH,6CAQuB;AAJtB,6GAAA,cAAc,OAAA;AAWf,mDAI0B;AAHzB,6GAAA,WAAW,OAAA;AACX,kHAAA,gBAAgB,OAAA;AAChB,iIAAA,+BAA+B,OAAA;AAqChC,qEAOmC;AAHlC,wHAAA,aAAa,OAAA;AAKd,qDAAiD;AAAxC,+GAAA,YAAY,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Package for client presence within a connected session.\n *\n * See {@link https://github.com/microsoft/FluidFramework/tree/main/packages/framework/presence#readme | README.md } for an overview of the package.\n *\n * @packageDocumentation\n */\n\nexport type { ClientConnectionId } from \"./baseTypes.js\";\n\nexport type {\n\tNotificationsWorkspace,\n\tNotificationsWorkspaceSchema,\n\tStatesWorkspace,\n\tStatesWorkspaceEntries,\n\tStatesWorkspaceSchema,\n\tStatesWorkspaceEntry,\n\tWorkspaceAddress,\n} from \"./types.js\";\n\nexport {\n\ttype Attendee,\n\ttype AttendeesEvents,\n\ttype AttendeeId,\n\tAttendeeStatus,\n\ttype Presence,\n\ttype PresenceEvents,\n\ttype PresenceWithNotifications,\n} from \"./presence.js\";\n\nexport type {\n\tBroadcastControls,\n\tBroadcastControlSettings,\n} from \"./broadcastControls.js\";\n\nexport {\n\tgetPresence,\n\tgetPresenceAlpha,\n\tgetPresenceFromDataStoreContext,\n} from \"./getPresence.js\";\n\nexport type {\n\tKeySchemaValidator,\n\tLatestMap,\n\tLatestMapArguments,\n\tLatestMapArgumentsRaw,\n\tLatestMapClientData,\n\tLatestMapEvents,\n\tLatestMapFactory,\n\tLatestMapItemRemovedClientData,\n\tLatestMapItemUpdatedClientData,\n\tLatestMapRaw,\n\tLatestMapRawEvents,\n\tStateMap,\n} from \"./latestMapValueManager.js\";\nexport type {\n\tLatest,\n\tLatestArguments,\n\tLatestArgumentsRaw,\n\tLatestEvents,\n\tLatestFactory,\n\tLatestRaw,\n\tLatestRawEvents,\n} from \"./latestValueManager.js\";\nexport type {\n\tAccessor,\n\tLatestClientData,\n\tLatestData,\n\tLatestMetadata,\n\tProxiedValueAccessor,\n\tRawValueAccessor,\n\tStateSchemaValidator,\n\tValueAccessor,\n} from \"./latestValueTypes.js\";\n\nexport {\n\ttype NotificationEmitter,\n\ttype NotificationListenable,\n\ttype NotificationSubscriptions,\n\tNotifications,\n\ttype NotificationsManager,\n\ttype NotificationsManagerEvents,\n} from \"./notificationsManager.js\";\n\nexport { StateFactory } from \"./stateFactory.js\";\n\nexport type { InternalTypes } from \"./exposedInternalTypes.js\";\nexport type { InternalUtilityTypes } from \"./exposedUtilityTypes.js\";\n"]}
@@ -50,6 +50,12 @@ export type IEphemeralRuntime = Omit<ExtensionHost, "logger" | "submitAddressedS
50
50
  */
51
51
  export interface ValueManager<TValue, TValueState extends InternalTypes.ValueDirectoryOrState<TValue> = InternalTypes.ValueDirectoryOrState<TValue>> {
52
52
  readonly value?: TValueState;
53
+ /**
54
+ * Process an update of `value` for remote attendee.
55
+ * @param attendee - The attendee whose `value` is being updated
56
+ * @param received - The revision number received
57
+ * @param value - The new `value` state
58
+ */
53
59
  update(attendee: Attendee, received: number, value: TValueState): PostUpdateAction[];
54
60
  }
55
61
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"internalTypes.d.ts","sourceRoot":"","sources":["../src/internalTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,IAAI,sBAAsB,EAAE,MAAM,wDAAwD,CAAC;AACtH,OAAO,KAAK,EACX,oBAAoB,EACpB,sBAAsB,EACtB,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,EACX,8BAA8B,EAC9B,yBAAyB,EACzB,8BAA8B,EAC9B,cAAc,EACd,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C,cAAc,EAAE,cAAc,CAAC;CAC/B;AACD;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,sBAAsB,CAAC,0BAA0B,CAAC,CAAC;AAE/E;;;;;GAKG;AACH,MAAM,WAAW,YAAY,CAAC,MAAM,SAAS,gCAAgC,CAAC,OAAO,CAAC;IAIrF,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAAC;CACjC;AAED;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,aAAa,EAAE,QAAQ,GAAG,uBAAuB,CAAC,GAEtF,OAAO,CAAC,IAAI,CA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UAAU,CAC/B,CAAC,EACD,aAAa,CAAC,cAAc,CAAC,CAAC,CAAC,EAE/B,yBAAyB,CAAC,MAAM,CAAC,EAEjC,oBAAoB,CAAC,mBAAmB,CACvC,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG;IAClB,KAAK,EAAE;SACL,MAAM,IAAI,MAAM,CAAC,CAAC,OAAO,CAAC,GAAG,yBAAyB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;KAC3E,CAAC;CACF,CACD,CACD,GACA,CAAC,SACE,aAAa,CAAC,kBAAkB,CAAC,MAAM,MAAM,CAAC,GAC9C,aAAa,CAAC,kBAAkB,CAAC,MAAM,MAAM,CAAC,GAChD,oBAAoB,CAAC,mBAAmB,CACxC,IAAI,CAAC,CAAC,EAAE,MAAM,mBAAmB,CAAC,MAAM,CAAC,CAAC,GAAG,mBAAmB,CAAC,MAAM,CAAC,CACxE,GACA,KAAK,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"internalTypes.js","sourceRoot":"","sources":["../src/internalTypes.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 { ExtensionHost as ContainerExtensionHost } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type {\n\tInternalUtilityTypes,\n\tOpaqueJsonDeserialized,\n} from \"@fluidframework/core-interfaces/internal\";\n\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\nimport type { AttendeeId, Attendee } from \"./presence.js\";\nimport type {\n\tOutboundAcknowledgementMessage,\n\tOutboundClientJoinMessage,\n\tOutboundDatastoreUpdateMessage,\n\tSignalMessages,\n} from \"./protocol.js\";\n\n/**\n * Presence {@link ContainerExtension} version of {@link @fluidframework/container-runtime-definitions#ExtensionRuntimeProperties}\n */\nexport interface ExtensionRuntimeProperties {\n\tSignalMessages: SignalMessages;\n}\n/**\n * Presence specific ExtensionHost\n */\nexport type ExtensionHost = ContainerExtensionHost<ExtensionRuntimeProperties>;\n\n/**\n * Basic structure of set of {@link Attendee} records within Presence datastore\n *\n * @remarks\n * This is commonly exists per named state in State Managers.\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\n/**\n * This interface is a subset of ExtensionHost (and mostly of\n * FluidDataStoreRuntime) that is needed by the Presence States.\n *\n * @privateRemarks\n * Replace with non-DataStore based interface.\n */\nexport type IEphemeralRuntime = Omit<ExtensionHost, \"logger\" | \"submitAddressedSignal\"> &\n\t// Apart from tests, there is always a logger. So this could be promoted to required.\n\tPartial<Pick<ExtensionHost, \"logger\">> & {\n\t\t/**\n\t\t * Submits the signal to be sent to other clients.\n\t\t * @param type - Type of the signal.\n\t\t * @param content - Content of the signal. Should be a JSON serializable object or primitive.\n\t\t * @param targetClientId - When specified, the signal is only sent to the provided client id.\n\t\t */\n\t\tsubmitSignal: (\n\t\t\tmessage:\n\t\t\t\t| OutboundAcknowledgementMessage\n\t\t\t\t| OutboundClientJoinMessage\n\t\t\t\t| OutboundDatastoreUpdateMessage,\n\t\t) => void;\n\t};\n\n/**\n * Contract for State Managers as used by a States Workspace (`PresenceStatesImpl`)\n *\n * @remarks\n * See uses of `unbrandIVM`.\n */\nexport interface ValueManager<\n\tTValue,\n\tTValueState extends\n\t\tInternalTypes.ValueDirectoryOrState<TValue> = InternalTypes.ValueDirectoryOrState<TValue>,\n> {\n\t// State objects should provide value - implement Required<ValueManager<...>>\n\treadonly value?: TValueState;\n\tupdate(attendee: Attendee, received: number, value: TValueState): PostUpdateAction[];\n}\n\n/**\n * A function to be called at the end of an update frame\n */\nexport type PostUpdateAction = () => void;\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> = T extends InternalTypes.ValueDirectory<infer TValue>\n\t? InternalUtilityTypes.IfSameType<\n\t\t\tT,\n\t\t\tInternalTypes.ValueDirectory<T>,\n\t\t\t// Use canonical type for exact match\n\t\t\tValidatableValueDirectory<TValue>,\n\t\t\t// Inexact match => recurse\n\t\t\tInternalUtilityTypes.FlattenIntersection<\n\t\t\t\tOmit<T, \"items\"> & {\n\t\t\t\t\titems: {\n\t\t\t\t\t\t[KItems in keyof T[\"items\"]]: ValidatableValueStructure<T[\"items\"][KItems]>;\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t>\n\t\t>\n\t: T extends\n\t\t\t\t| InternalTypes.ValueRequiredState<infer TValue>\n\t\t\t\t| InternalTypes.ValueOptionalState<infer TValue>\n\t\t? InternalUtilityTypes.FlattenIntersection<\n\t\t\t\tOmit<T, keyof ValidatableMetadata<TValue>> & ValidatableMetadata<TValue>\n\t\t\t>\n\t\t: never;\n"]}
1
+ {"version":3,"file":"internalTypes.js","sourceRoot":"","sources":["../src/internalTypes.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 { ExtensionHost as ContainerExtensionHost } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type {\n\tInternalUtilityTypes,\n\tOpaqueJsonDeserialized,\n} from \"@fluidframework/core-interfaces/internal\";\n\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\nimport type { AttendeeId, Attendee } from \"./presence.js\";\nimport type {\n\tOutboundAcknowledgementMessage,\n\tOutboundClientJoinMessage,\n\tOutboundDatastoreUpdateMessage,\n\tSignalMessages,\n} from \"./protocol.js\";\n\n/**\n * Presence {@link ContainerExtension} version of {@link @fluidframework/container-runtime-definitions#ExtensionRuntimeProperties}\n */\nexport interface ExtensionRuntimeProperties {\n\tSignalMessages: SignalMessages;\n}\n/**\n * Presence specific ExtensionHost\n */\nexport type ExtensionHost = ContainerExtensionHost<ExtensionRuntimeProperties>;\n\n/**\n * Basic structure of set of {@link Attendee} records within Presence datastore\n *\n * @remarks\n * This is commonly exists per named state in State Managers.\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\n/**\n * This interface is a subset of ExtensionHost (and mostly of\n * FluidDataStoreRuntime) that is needed by the Presence States.\n *\n * @privateRemarks\n * Replace with non-DataStore based interface.\n */\nexport type IEphemeralRuntime = Omit<ExtensionHost, \"logger\" | \"submitAddressedSignal\"> &\n\t// Apart from tests, there is always a logger. So this could be promoted to required.\n\tPartial<Pick<ExtensionHost, \"logger\">> & {\n\t\t/**\n\t\t * Submits the signal to be sent to other clients.\n\t\t * @param type - Type of the signal.\n\t\t * @param content - Content of the signal. Should be a JSON serializable object or primitive.\n\t\t * @param targetClientId - When specified, the signal is only sent to the provided client id.\n\t\t */\n\t\tsubmitSignal: (\n\t\t\tmessage:\n\t\t\t\t| OutboundAcknowledgementMessage\n\t\t\t\t| OutboundClientJoinMessage\n\t\t\t\t| OutboundDatastoreUpdateMessage,\n\t\t) => void;\n\t};\n\n/**\n * Contract for State Managers as used by a States Workspace (`PresenceStatesImpl`)\n *\n * @remarks\n * See uses of `unbrandIVM`.\n */\nexport interface ValueManager<\n\tTValue,\n\tTValueState extends\n\t\tInternalTypes.ValueDirectoryOrState<TValue> = InternalTypes.ValueDirectoryOrState<TValue>,\n> {\n\t// State objects should provide value - implement Required<ValueManager<...>>\n\treadonly value?: TValueState;\n\n\t/**\n\t * Process an update of `value` for remote attendee.\n\t * @param attendee - The attendee whose `value` is being updated\n\t * @param received - The revision number received\n\t * @param value - The new `value` state\n\t */\n\tupdate(attendee: Attendee, received: number, value: TValueState): PostUpdateAction[];\n}\n\n/**\n * A function to be called at the end of an update frame\n */\nexport type PostUpdateAction = () => void;\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> = T extends InternalTypes.ValueDirectory<infer TValue>\n\t? InternalUtilityTypes.IfSameType<\n\t\t\tT,\n\t\t\tInternalTypes.ValueDirectory<T>,\n\t\t\t// Use canonical type for exact match\n\t\t\tValidatableValueDirectory<TValue>,\n\t\t\t// Inexact match => recurse\n\t\t\tInternalUtilityTypes.FlattenIntersection<\n\t\t\t\tOmit<T, \"items\"> & {\n\t\t\t\t\titems: {\n\t\t\t\t\t\t[KItems in keyof T[\"items\"]]: ValidatableValueStructure<T[\"items\"][KItems]>;\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t>\n\t\t>\n\t: T extends\n\t\t\t\t| InternalTypes.ValueRequiredState<infer TValue>\n\t\t\t\t| InternalTypes.ValueOptionalState<infer TValue>\n\t\t? InternalUtilityTypes.FlattenIntersection<\n\t\t\t\tOmit<T, keyof ValidatableMetadata<TValue>> & ValidatableMetadata<TValue>\n\t\t\t>\n\t\t: never;\n"]}
@@ -8,13 +8,24 @@ import type { BroadcastControls, BroadcastControlSettings } from "./broadcastCon
8
8
  import type { InternalTypes } from "./exposedInternalTypes.js";
9
9
  import type { LatestClientData, LatestData, LatestMetadata, ProxiedValueAccessor, RawValueAccessor, StateSchemaValidator, ValueAccessor } from "./latestValueTypes.js";
10
10
  import type { AttendeeId, Attendee, Presence } from "./presence.js";
11
+ /**
12
+ * A validator function that can optionally be provided to do runtime validation
13
+ * of the custom key listed in a {@link LatestMap}.
14
+ *
15
+ * @param unvalidatedKey - The unknown key that should be validated.
16
+ *
17
+ * @returns True if the key is valid.
18
+ *
19
+ * @beta
20
+ */
21
+ export type KeySchemaValidator<Keys extends string> = (unvalidatedKey: string) => unvalidatedKey is Keys;
11
22
  /**
12
23
  * Collection of latest known values for a specific {@link Attendee}.
13
24
  *
14
25
  * @sealed
15
26
  * @beta
16
27
  */
17
- export interface LatestMapClientData<T, Keys extends string | number, TValueAccessor extends ValueAccessor<T>, SpecificAttendeeId extends AttendeeId = AttendeeId> {
28
+ export interface LatestMapClientData<T, Keys extends string, TValueAccessor extends ValueAccessor<T>, SpecificAttendeeId extends AttendeeId = AttendeeId> {
18
29
  /**
19
30
  * Associated {@link Attendee}.
20
31
  */
@@ -33,7 +44,7 @@ export interface LatestMapClientData<T, Keys extends string | number, TValueAcce
33
44
  * @sealed
34
45
  * @beta
35
46
  */
36
- export interface LatestMapItemUpdatedClientData<T, K extends string | number, TValueAccessor extends ValueAccessor<T>> extends LatestClientData<T, TValueAccessor> {
47
+ export interface LatestMapItemUpdatedClientData<T, K extends string, TValueAccessor extends ValueAccessor<T>> extends LatestClientData<T, TValueAccessor> {
37
48
  /**
38
49
  * Key of the updated item.
39
50
  */
@@ -45,7 +56,7 @@ export interface LatestMapItemUpdatedClientData<T, K extends string | number, TV
45
56
  * @sealed
46
57
  * @beta
47
58
  */
48
- export interface LatestMapItemRemovedClientData<K extends string | number> {
59
+ export interface LatestMapItemRemovedClientData<K extends string> {
49
60
  /**
50
61
  * Associated {@link Attendee}.
51
62
  */
@@ -65,7 +76,7 @@ export interface LatestMapItemRemovedClientData<K extends string | number> {
65
76
  * @sealed
66
77
  * @beta
67
78
  */
68
- export interface LatestMapEvents<T, K extends string | number, TRemoteValueAccessor extends ValueAccessor<T> = ProxiedValueAccessor<T>> {
79
+ export interface LatestMapEvents<T, K extends string, TRemoteValueAccessor extends ValueAccessor<T> = ProxiedValueAccessor<T>> {
69
80
  /**
70
81
  * Raised when any item's value for remote client is updated.
71
82
  * @param updates - Map of one or more values updated.
@@ -115,14 +126,14 @@ export interface LatestMapEvents<T, K extends string | number, TRemoteValueAcces
115
126
  * @sealed
116
127
  * @beta
117
128
  */
118
- export type LatestMapRawEvents<T, K extends string | number> = LatestMapEvents<T, K, RawValueAccessor<T>>;
129
+ export type LatestMapRawEvents<T, K extends string> = LatestMapEvents<T, K, RawValueAccessor<T>>;
119
130
  /**
120
131
  * Map of local client's values. Modifications are transmitted to all other connected clients.
121
132
  *
122
133
  * @sealed
123
134
  * @beta
124
135
  */
125
- export interface StateMap<K extends string | number, V> {
136
+ export interface StateMap<K extends string, V> {
126
137
  /**
127
138
  * ${@link StateMap.delete}s all elements in the StateMap.
128
139
  * @remarks This is not yet implemented.
@@ -190,7 +201,7 @@ export interface StateMap<K extends string | number, V> {
190
201
  * @sealed
191
202
  * @beta
192
203
  */
193
- export interface LatestMap<T, Keys extends string | number = string | number, TRemoteAccessor extends ValueAccessor<T> = ProxiedValueAccessor<T>> {
204
+ export interface LatestMap<T, Keys extends string = string, TRemoteAccessor extends ValueAccessor<T> = ProxiedValueAccessor<T>> {
194
205
  /**
195
206
  * Containing {@link Presence}
196
207
  */
@@ -231,14 +242,14 @@ export interface LatestMap<T, Keys extends string | number = string | number, TR
231
242
  * @sealed
232
243
  * @beta
233
244
  */
234
- export type LatestMapRaw<T, Keys extends string | number = string | number> = LatestMap<T, Keys, RawValueAccessor<T>>;
245
+ export type LatestMapRaw<T, Keys extends string = string> = LatestMap<T, Keys, RawValueAccessor<T>>;
235
246
  /**
236
247
  * Arguments that are passed to the {@link StateFactory.latestMap} function.
237
248
  *
238
249
  * @input
239
250
  * @beta
240
251
  */
241
- export interface LatestMapArgumentsRaw<T, Keys extends string | number = string | number> {
252
+ export interface LatestMapArgumentsRaw<T, Keys extends string = string> {
242
253
  /**
243
254
  * The initial value of the local state.
244
255
  */
@@ -256,12 +267,20 @@ export interface LatestMapArgumentsRaw<T, Keys extends string | number = string
256
267
  * @input
257
268
  * @beta
258
269
  */
259
- export interface LatestMapArguments<T, Keys extends string | number = string | number> extends LatestMapArgumentsRaw<T, Keys> {
270
+ export interface LatestMapArguments<T, Keys extends string = string> extends LatestMapArgumentsRaw<T, Keys> {
260
271
  /**
261
- * An optional function that will be called at runtime to validate the presence data. A runtime validator is strongly
262
- * recommended. See {@link StateSchemaValidator}.
272
+ * An optional function that will be called at runtime to validate data value
273
+ * under a key. A runtime validator is strongly recommended.
274
+ * @see {@link StateSchemaValidator}.
263
275
  */
264
276
  validator: StateSchemaValidator<T>;
277
+ /**
278
+ * An optional function that will be called at runtime to validate the presence
279
+ * data key. A runtime validator is strongly recommended when key type is not
280
+ * simply `string`.
281
+ * @see {@link KeySchemaValidator}.
282
+ */
283
+ keyValidator?: KeySchemaValidator<Keys>;
265
284
  }
266
285
  /**
267
286
  * Factory for creating a {@link LatestMap} or {@link LatestMapRaw} State object.
@@ -277,7 +296,7 @@ export interface LatestMapFactory {
277
296
  * This overload is used when called with {@link LatestMapArguments}.
278
297
  * That is, if a validator function is provided.
279
298
  */
280
- <T, Keys extends string | number = string | number, RegistrationKey extends string = string>(args: LatestMapArguments<T, Keys>): InternalTypes.ManagerFactory<RegistrationKey, InternalTypes.MapValueState<T, Keys>, LatestMap<T, Keys>>;
299
+ <T, Keys extends string = string, RegistrationKey extends string = string>(args: LatestMapArguments<T, Keys>): InternalTypes.ManagerFactory<RegistrationKey, InternalTypes.MapValueState<T, Keys>, LatestMap<T, Keys>>;
281
300
  /**
282
301
  * Factory for creating a {@link LatestMapRaw} State object.
283
302
  *
@@ -285,7 +304,7 @@ export interface LatestMapFactory {
285
304
  * This overload is used when called with {@link LatestMapArgumentsRaw}.
286
305
  * That is, if a validator function is _not_ provided.
287
306
  */
288
- <T, Keys extends string | number = string | number, RegistrationKey extends string = string>(args?: LatestMapArgumentsRaw<T, Keys>): InternalTypes.ManagerFactory<RegistrationKey, InternalTypes.MapValueState<T, Keys>, LatestMapRaw<T, Keys>>;
307
+ <T, Keys extends string = string, RegistrationKey extends string = string>(args?: LatestMapArgumentsRaw<T, Keys>): InternalTypes.ManagerFactory<RegistrationKey, InternalTypes.MapValueState<T, Keys>, LatestMapRaw<T, Keys>>;
289
308
  }
290
309
  /**
291
310
  * Factory for creating a {@link LatestMap} or {@link LatestMapRaw} State object.
@@ -1 +1 @@
1
- {"version":3,"file":"latestMapValueManager.d.ts","sourceRoot":"","sources":["../src/latestMapValueManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,KAAK,EACX,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,8DAA8D,CAAC;AAEtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAE1F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAe/D,OAAO,KAAK,EACX,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAoB,MAAM,eAAe,CAAC;AAoBtF;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB,CACnC,CAAC,EACD,IAAI,SAAS,MAAM,GAAG,MAAM,EAC5B,cAAc,SAAS,aAAa,CAAC,CAAC,CAAC,EACvC,kBAAkB,SAAS,UAAU,GAAG,UAAU;IAElD;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IAEvC;;;;;OAKG;IACH,KAAK,EAAE,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC;CACxD;AAED;;;;;GAKG;AACH,MAAM,WAAW,8BAA8B,CAC9C,CAAC,EACD,CAAC,SAAS,MAAM,GAAG,MAAM,EACzB,cAAc,SAAS,aAAa,CAAC,CAAC,CAAC,CACtC,SAAQ,gBAAgB,CAAC,CAAC,EAAE,cAAc,CAAC;IAC5C;;OAEG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,CAAC,EACpC,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,CACrB,CAAC;CACF;AAID;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,gBA6DvB,CAAC"}
@@ -54,6 +54,7 @@ class ValueMapImpl {
54
54
  forEach(callbackfn, thisArg) {
55
55
  for (const [key, item] of (0, internalUtils_js_1.objectEntries)(this.value.items)) {
56
56
  if (item.value !== undefined) {
57
+ // TODO: AB#55932: try fixing typing of objectEntries to avoid this cast
57
58
  callbackfn((0, internalUtils_js_1.asDeeplyReadonlyDeserializedJson)(item.value), key, this);
58
59
  }
59
60
  }
@@ -81,18 +82,26 @@ class ValueMapImpl {
81
82
  const keys = [];
82
83
  for (const [key, item] of (0, internalUtils_js_1.objectEntries)(this.value.items)) {
83
84
  if (item.value !== undefined) {
85
+ // TODO: AB#55932: try fixing typing of objectEntries to avoid this cast
84
86
  keys.push(key);
85
87
  }
86
88
  }
87
89
  return keys[Symbol.iterator]();
88
90
  }
89
91
  }
92
+ /**
93
+ * Simply returns true for all given string keys.
94
+ */
95
+ function anyKeyIsValid(unvalidatedKey) {
96
+ return true;
97
+ }
90
98
  class LatestMapValueManagerImpl {
91
- constructor(key, datastore, value, controlSettings, validator) {
99
+ constructor(key, datastore, value, controlSettings, validator, isValidKey) {
92
100
  this.key = key;
93
101
  this.datastore = datastore;
94
102
  this.value = value;
95
103
  this.validator = validator;
104
+ this.isValidKey = isValidKey;
96
105
  this.events = (0, client_utils_1.createEmitter)();
97
106
  this.controls = new broadcastControls_js_1.OptionalBroadcastControl(controlSettings);
98
107
  this.local = new ValueMapImpl(value, this.events, (updates) => {
@@ -130,7 +139,7 @@ class LatestMapValueManagerImpl {
130
139
  }
131
140
  const items = new Map();
132
141
  for (const [key, item] of (0, internalUtils_js_1.objectEntries)(clientStateMap.items)) {
133
- if ((0, internalUtils_js_1.isValueRequiredState)(item)) {
142
+ if (this.isValidKey(key) && (0, internalUtils_js_1.isValueRequiredState)(item)) {
134
143
  items.set(key, {
135
144
  value: (0, latestValueTypes_js_1.createValidatedGetter)(item, validator),
136
145
  metadata: { revision: item.rev, timestamp: item.timestamp },
@@ -146,19 +155,17 @@ class LatestMapValueManagerImpl {
146
155
  // New attendee - prepare new attendee state directory
147
156
  {
148
157
  rev: value.rev,
149
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- items entries can't be optional per https://github.com/microsoft/TypeScript/issues/42810; so forced cast
150
158
  items: {},
151
159
  });
152
160
  // Accumulate individual update keys
153
- const updatedItemKeys = [];
161
+ const updatedKeyItemPairs = [];
154
162
  for (const [key, item] of (0, internalUtils_js_1.objectEntries)(value.items)) {
155
- // TODO: Key validation needs to be added here.
156
- const validKey = key;
157
- if (!(key in currentState.items) || currentState.items[validKey].rev < item.rev) {
158
- updatedItemKeys.push(validKey);
163
+ const currentItem = currentState.items[key];
164
+ if (currentItem === undefined || currentItem.rev < item.rev) {
165
+ updatedKeyItemPairs.push([key, item]);
159
166
  }
160
167
  }
161
- if (updatedItemKeys.length === 0) {
168
+ if (updatedKeyItemPairs.length === 0) {
162
169
  return [];
163
170
  }
164
171
  // Store updates
@@ -170,10 +177,13 @@ class LatestMapValueManagerImpl {
170
177
  items: new Map(),
171
178
  };
172
179
  const postUpdateActions = [];
173
- for (const key of updatedItemKeys) {
174
- const item = value.items[key];
180
+ for (const [key, item] of updatedKeyItemPairs) {
175
181
  const hadPriorValue = currentState.items[key]?.value;
176
182
  currentState.items[key] = item;
183
+ // Prepare update events, but only for valid keys.
184
+ if (!this.isValidKey(key)) {
185
+ continue;
186
+ }
177
187
  const metadata = {
178
188
  revision: item.rev,
179
189
  timestamp: item.timestamp,
@@ -200,7 +210,11 @@ class LatestMapValueManagerImpl {
200
210
  }
201
211
  }
202
212
  this.datastore.update(this.key, attendeeId, currentState);
203
- postUpdateActions.push(() => this.events.emit("remoteUpdated", allUpdates));
213
+ // Only emit remoteUpdated if there are any individual updates, which
214
+ // accounts for the case where all updates were for invalid keys.
215
+ if (postUpdateActions.length > 0) {
216
+ postUpdateActions.push(() => this.events.emit("remoteUpdated", allUpdates));
217
+ }
204
218
  return postUpdateActions;
205
219
  }
206
220
  }
@@ -212,21 +226,24 @@ const latestMap = (args) => {
212
226
  const settings = args?.settings;
213
227
  const initialValues = args?.local;
214
228
  const validator = args?.validator;
229
+ const isKeyValid = args?.keyValidator ?? anyKeyIsValid;
215
230
  const timestamp = Date.now();
216
231
  const value = { rev: 0, items: {} };
217
232
  // LatestMapRaw takes ownership of values within initialValues.
218
233
  if (initialValues !== undefined) {
219
- for (const key of (0, internalUtils_js_1.objectKeys)(initialValues)) {
220
- value.items[key] = {
234
+ for (const [key, item] of (0, internalUtils_js_1.objectEntries)(initialValues)) {
235
+ // TODO: AB#55932: try fixing typing of objectEntries to avoid this cast
236
+ const assumedValidKey = key;
237
+ value.items[assumedValidKey] = {
221
238
  rev: 0,
222
239
  timestamp,
223
- value: (0, internalUtils_js_1.toOpaqueJson)(initialValues[key]),
240
+ value: (0, internalUtils_js_1.toOpaqueJson)(item),
224
241
  };
225
242
  }
226
243
  }
227
244
  const factory = (key, datastoreHandle) => ({
228
245
  initialData: { value, allowableUpdateLatencyMs: settings?.allowableUpdateLatencyMs },
229
- manager: (0, valueManager_js_1.brandIVM)(new LatestMapValueManagerImpl(key, (0, stateDatastore_js_1.datastoreFromHandle)(datastoreHandle), value, settings, validator)),
246
+ manager: (0, valueManager_js_1.brandIVM)(new LatestMapValueManagerImpl(key, (0, stateDatastore_js_1.datastoreFromHandle)(datastoreHandle), value, settings, validator, isKeyValid)),
230
247
  });
231
248
  return Object.assign(factory, { instanceBase: LatestMapValueManagerImpl });
232
249
  };