@fluidframework/presence 2.81.1 → 2.82.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/alpha.d.ts +1 -1
- package/dist/exposedUtilityTypes.d.ts +57 -5
- package/dist/exposedUtilityTypes.d.ts.map +1 -1
- package/dist/exposedUtilityTypes.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internalUtils.d.ts.map +1 -1
- package/dist/internalUtils.js.map +1 -1
- package/dist/latestMapTypes.d.ts +309 -0
- package/dist/latestMapTypes.d.ts.map +1 -0
- package/dist/latestMapTypes.js +8 -0
- package/dist/latestMapTypes.js.map +1 -0
- package/dist/latestMapValueManager.d.ts +4 -265
- package/dist/latestMapValueManager.d.ts.map +1 -1
- package/dist/latestMapValueManager.js +3 -4
- package/dist/latestMapValueManager.js.map +1 -1
- package/dist/latestTypes.d.ts +149 -0
- package/dist/latestTypes.d.ts.map +1 -0
- package/dist/latestTypes.js +7 -0
- package/dist/latestTypes.js.map +1 -0
- package/dist/latestValueManager.d.ts +1 -144
- package/dist/latestValueManager.d.ts.map +1 -1
- package/dist/latestValueManager.js +4 -5
- package/dist/latestValueManager.js.map +1 -1
- package/dist/latestValueTypes.d.ts +0 -11
- package/dist/latestValueTypes.d.ts.map +1 -1
- package/dist/latestValueTypes.js +0 -36
- package/dist/latestValueTypes.js.map +1 -1
- package/dist/legacy.alpha.d.ts +1 -1
- package/dist/notificationsManager.d.ts +15 -5
- package/dist/notificationsManager.d.ts.map +1 -1
- package/dist/notificationsManager.js +0 -4
- package/dist/notificationsManager.js.map +1 -1
- package/dist/notificationsManagerTypes.d.ts +7 -4
- package/dist/notificationsManagerTypes.d.ts.map +1 -1
- package/dist/notificationsManagerTypes.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/stateFactory.d.ts +2 -2
- package/dist/stateFactory.d.ts.map +1 -1
- package/dist/stateFactory.js.map +1 -1
- package/dist/validatableTypes.d.ts.map +1 -1
- package/dist/validatableTypes.js.map +1 -1
- package/dist/validatedGetter.d.ts +18 -0
- package/dist/validatedGetter.d.ts.map +1 -0
- package/dist/validatedGetter.js +43 -0
- package/dist/validatedGetter.js.map +1 -0
- package/lib/alpha.d.ts +1 -1
- package/lib/exposedUtilityTypes.d.ts +57 -5
- package/lib/exposedUtilityTypes.d.ts.map +1 -1
- package/lib/exposedUtilityTypes.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/internalUtils.d.ts.map +1 -1
- package/lib/internalUtils.js.map +1 -1
- package/lib/latestMapTypes.d.ts +309 -0
- package/lib/latestMapTypes.d.ts.map +1 -0
- package/lib/latestMapTypes.js +7 -0
- package/lib/latestMapTypes.js.map +1 -0
- package/lib/latestMapValueManager.d.ts +4 -265
- package/lib/latestMapValueManager.d.ts.map +1 -1
- package/lib/latestMapValueManager.js +1 -2
- package/lib/latestMapValueManager.js.map +1 -1
- package/lib/latestTypes.d.ts +149 -0
- package/lib/latestTypes.d.ts.map +1 -0
- package/lib/latestTypes.js +6 -0
- package/lib/latestTypes.js.map +1 -0
- package/lib/latestValueManager.d.ts +1 -144
- package/lib/latestValueManager.d.ts.map +1 -1
- package/lib/latestValueManager.js +1 -2
- package/lib/latestValueManager.js.map +1 -1
- package/lib/latestValueTypes.d.ts +0 -11
- package/lib/latestValueTypes.d.ts.map +1 -1
- package/lib/latestValueTypes.js +1 -34
- package/lib/latestValueTypes.js.map +1 -1
- package/lib/legacy.alpha.d.ts +1 -1
- package/lib/notificationsManager.d.ts +15 -5
- package/lib/notificationsManager.d.ts.map +1 -1
- package/lib/notificationsManager.js +0 -4
- package/lib/notificationsManager.js.map +1 -1
- package/lib/notificationsManagerTypes.d.ts +7 -4
- package/lib/notificationsManagerTypes.d.ts.map +1 -1
- package/lib/notificationsManagerTypes.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/stateFactory.d.ts +2 -2
- package/lib/stateFactory.d.ts.map +1 -1
- package/lib/stateFactory.js.map +1 -1
- package/lib/validatableTypes.d.ts.map +1 -1
- package/lib/validatableTypes.js.map +1 -1
- package/lib/validatedGetter.d.ts +18 -0
- package/lib/validatedGetter.d.ts.map +1 -0
- package/lib/validatedGetter.js +39 -0
- package/lib/validatedGetter.js.map +1 -0
- package/package.json +16 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validatableTypes.d.ts","sourceRoot":"","sources":["../src/validatableTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,oBAAoB,EACpB,sBAAsB,EACtB,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D;;GAEG;AACH,UAAU,mBAAmB,CAAC,MAAM;IACnC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,sBAAsB,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;CAE5D;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAwB,CAAC,MAAM,CAC/C,SAAQ,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,mBAAmB,CAAC,MAAM,CAAC,CAAC,EACxF,mBAAmB,CAAC,MAAM,CAAC;CAAG;AAEhC;;;GAGG;AACH,MAAM,WAAW,wBAAwB,CAAC,MAAM,CAC/C,SAAQ,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,mBAAmB,CAAC,MAAM,CAAC,CAAC,EACxF,mBAAmB,CAAC,MAAM,CAAC;CAAG;AAEhC;;;;;;GAMG;AACH,MAAM,WAAW,yBAAyB,CAAC,CAAC;IAC3C,GAAG,EAAE,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,KAAK,CAAC"}
|
|
@@ -1 +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\tInternalUtilityTypes,\n\tOpaqueJsonDeserialized,\n} from \"@fluidframework/core-interfaces/internal\";\n\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\n\n/**\n * Metadata for a value that may have been validated by a {@link StateSchemaValidator} function.\n */\ninterface ValidatableMetadata<TValue> {\n\t/**\n\t * Contains a validated value or undefined if `value` is invalid.\n\t *\n\t * This property will not be present if the data has not been validated.\n\t * If it is present and `undefined`, the value has been checked and found to be invalid.\n\t * Otherwise it will be the validated value.\n\t */\n\tvalidatedValue?: OpaqueJsonDeserialized<TValue> | undefined;\n\t// typeCheck: \"do you have me?\";\n}\n\n/**\n * Represents data with optional value that may have been validated by a\n * {@link StateSchemaValidator} function.\n */\nexport interface ValidatableOptionalState<TValue>\n\textends Omit<InternalTypes.ValueOptionalState<TValue>, keyof ValidatableMetadata<TValue>>,\n\t\tValidatableMetadata<TValue> {}\n\n/**\n * Represents data with required value that may have been validated by a\n * {@link StateSchemaValidator} function.\n */\nexport interface ValidatableRequiredState<TValue>\n\textends Omit<InternalTypes.ValueRequiredState<TValue>, keyof ValidatableMetadata<TValue>>,\n\t\tValidatableMetadata<TValue> {}\n\n/**\n * A directory of validatable values, where each value may be an optional\n * state or another directory.\n *\n * @remarks\n * The is the validatable version of {@link InternalTypes.ValueDirectory}.\n */\nexport interface ValidatableValueDirectory<T> {\n\trev: number;\n\titems: {\n\t\t// Caution: any particular item may or may not exist\n\t\t// Typescript does not support absent keys without forcing type to also be undefined.\n\t\t// See https://github.com/microsoft/TypeScript/issues/42810.\n\t\t[name: string | number]: ValidatableOptionalState<T> | ValidatableValueDirectory<T>;\n\t};\n}\n\n/**\n * Convenience type for a validatable required state or a directory of values.\n *\n * @remarks\n * This is the validatable version of {@link InternalTypes.ValueDirectoryOrState}.\n */\nexport type ValidatableValueDirectoryOrState<T> =\n\t| ValidatableRequiredState<T>\n\t| ValidatableValueDirectory<T>;\n\n/**\n * Transforms basic value datastore / protocol type into equivalent type\n * with validation support.\n *\n * @remarks\n * Use when some more specific or parameterized type equivalent of\n * `InternalTypes.Value(Directory|RequiredState|OptionalState)` is needed.\n *\n * Basically, wherever a `*ValueState` appears it is extended with\n * {@link ValidatableMetadata} to support validation.\n */\nexport type ValidatableValueStructure<\n\tT extends\n\t\t| InternalTypes.ValueDirectory<unknown>\n\t\t| InternalTypes.ValueRequiredState<unknown>\n\t\t| InternalTypes.ValueOptionalState<unknown>,\n>
|
|
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\tInternalUtilityTypes,\n\tOpaqueJsonDeserialized,\n} from \"@fluidframework/core-interfaces/internal\";\n\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\n\n/**\n * Metadata for a value that may have been validated by a {@link StateSchemaValidator} function.\n */\ninterface ValidatableMetadata<TValue> {\n\t/**\n\t * Contains a validated value or undefined if `value` is invalid.\n\t *\n\t * This property will not be present if the data has not been validated.\n\t * If it is present and `undefined`, the value has been checked and found to be invalid.\n\t * Otherwise it will be the validated value.\n\t */\n\tvalidatedValue?: OpaqueJsonDeserialized<TValue> | undefined;\n\t// typeCheck: \"do you have me?\";\n}\n\n/**\n * Represents data with optional value that may have been validated by a\n * {@link StateSchemaValidator} function.\n */\nexport interface ValidatableOptionalState<TValue>\n\textends Omit<InternalTypes.ValueOptionalState<TValue>, keyof ValidatableMetadata<TValue>>,\n\t\tValidatableMetadata<TValue> {}\n\n/**\n * Represents data with required value that may have been validated by a\n * {@link StateSchemaValidator} function.\n */\nexport interface ValidatableRequiredState<TValue>\n\textends Omit<InternalTypes.ValueRequiredState<TValue>, keyof ValidatableMetadata<TValue>>,\n\t\tValidatableMetadata<TValue> {}\n\n/**\n * A directory of validatable values, where each value may be an optional\n * state or another directory.\n *\n * @remarks\n * The is the validatable version of {@link InternalTypes.ValueDirectory}.\n */\nexport interface ValidatableValueDirectory<T> {\n\trev: number;\n\titems: {\n\t\t// Caution: any particular item may or may not exist\n\t\t// Typescript does not support absent keys without forcing type to also be undefined.\n\t\t// See https://github.com/microsoft/TypeScript/issues/42810.\n\t\t[name: string | number]: ValidatableOptionalState<T> | ValidatableValueDirectory<T>;\n\t};\n}\n\n/**\n * Convenience type for a validatable required state or a directory of values.\n *\n * @remarks\n * This is the validatable version of {@link InternalTypes.ValueDirectoryOrState}.\n */\nexport type ValidatableValueDirectoryOrState<T> =\n\t| ValidatableRequiredState<T>\n\t| ValidatableValueDirectory<T>;\n\n/**\n * Transforms basic value datastore / protocol type into equivalent type\n * with validation support.\n *\n * @remarks\n * Use when some more specific or parameterized type equivalent of\n * `InternalTypes.Value(Directory|RequiredState|OptionalState)` is needed.\n *\n * Basically, wherever a `*ValueState` appears it is extended with\n * {@link ValidatableMetadata} to support validation.\n */\nexport type ValidatableValueStructure<\n\tT extends\n\t\t| InternalTypes.ValueDirectory<unknown>\n\t\t| InternalTypes.ValueRequiredState<unknown>\n\t\t| InternalTypes.ValueOptionalState<unknown>,\n> =\n\tT extends InternalTypes.ValueDirectory<infer TValue>\n\t\t? InternalUtilityTypes.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\tInternalUtilityTypes.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? InternalUtilityTypes.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 { DeepReadonly, JsonDeserialized } from "@fluidframework/core-interfaces/internal/exposedUtilityTypes";
|
|
6
|
+
import type { StateSchemaValidator } from "./latestValueTypes.js";
|
|
7
|
+
import type { ValidatableRequiredState } from "./validatableTypes.js";
|
|
8
|
+
/**
|
|
9
|
+
* Creates a getter for a state value that validates the data with a validator if one is provided. Otherwise the value
|
|
10
|
+
* is returned directly.
|
|
11
|
+
*
|
|
12
|
+
* @param clientState - The client state to be validated.
|
|
13
|
+
* @param validator - The validator function to run.
|
|
14
|
+
* @returns Either returns the value directly if a validator is not provided, or a function that will return the
|
|
15
|
+
* validated data.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createValidatedGetter<T>(clientState: ValidatableRequiredState<T>, validator: StateSchemaValidator<T> | undefined): (() => DeepReadonly<JsonDeserialized<T>> | undefined) | DeepReadonly<JsonDeserialized<T>>;
|
|
18
|
+
//# sourceMappingURL=validatedGetter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validatedGetter.d.ts","sourceRoot":"","sources":["../src/validatedGetter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,YAAY,EACZ,gBAAgB,EAEhB,MAAM,8DAA8D,CAAC;AAGtE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAmBtE;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EACtC,WAAW,EAAE,wBAAwB,CAAC,CAAC,CAAC,EACxC,SAAS,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,SAAS,GAC5C,CAAC,MAAM,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,GAAG,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAgB3F"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.createValidatedGetter = void 0;
|
|
8
|
+
const internalUtils_js_1 = require("./internalUtils.js");
|
|
9
|
+
function createGetterFunction(clientState, validator) {
|
|
10
|
+
return () => {
|
|
11
|
+
if (!("validatedValue" in clientState)) {
|
|
12
|
+
// Stored `value` has not been validated yet, so validate it and save the result.
|
|
13
|
+
clientState.validatedValue = validator(clientState.value);
|
|
14
|
+
}
|
|
15
|
+
return (0, internalUtils_js_1.asDeeplyReadonlyDeserializedJson)(clientState.validatedValue);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Creates a getter for a state value that validates the data with a validator if one is provided. Otherwise the value
|
|
20
|
+
* is returned directly.
|
|
21
|
+
*
|
|
22
|
+
* @param clientState - The client state to be validated.
|
|
23
|
+
* @param validator - The validator function to run.
|
|
24
|
+
* @returns Either returns the value directly if a validator is not provided, or a function that will return the
|
|
25
|
+
* validated data.
|
|
26
|
+
*/
|
|
27
|
+
function createValidatedGetter(clientState, validator) {
|
|
28
|
+
// No validator
|
|
29
|
+
if (validator === undefined) {
|
|
30
|
+
return (0, internalUtils_js_1.asDeeplyReadonlyDeserializedJson)(clientState.value);
|
|
31
|
+
}
|
|
32
|
+
// Avoid creating another function since one already exists on the item
|
|
33
|
+
if (typeof clientState.value === "function") {
|
|
34
|
+
return clientState.value;
|
|
35
|
+
}
|
|
36
|
+
// OpaqueJsonDeserialized<T> is just a branded alias of JsonDeserialized<T>. At runtime the functions are still passed
|
|
37
|
+
// JSON data, regardless of their type representation. Passing that data to a function that expects `unknown`, like
|
|
38
|
+
// the user-provided validator function, is always valid, so StateSchemaValidator and StateSchemaValidatorToOpaque are
|
|
39
|
+
// functionally equivalent.
|
|
40
|
+
return createGetterFunction(clientState, validator);
|
|
41
|
+
}
|
|
42
|
+
exports.createValidatedGetter = createValidatedGetter;
|
|
43
|
+
//# sourceMappingURL=validatedGetter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validatedGetter.js","sourceRoot":"","sources":["../src/validatedGetter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,yDAAsE;AAQtE,SAAS,oBAAoB,CAC5B,WAAwC,EACxC,SAA0C;IAE1C,OAAO,GAAkD,EAAE;QAC1D,IAAI,CAAC,CAAC,gBAAgB,IAAI,WAAW,CAAC,EAAE,CAAC;YACxC,iFAAiF;YACjF,WAAW,CAAC,cAAc,GAAG,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,IAAA,mDAAgC,EAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IACrE,CAAC,CAAC;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,qBAAqB,CACpC,WAAwC,EACxC,SAA8C;IAE9C,eAAe;IACf,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,IAAA,mDAAgC,EAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC5D,CAAC;IAED,uEAAuE;IACvE,IAAI,OAAO,WAAW,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;QAC7C,OAAO,WAAW,CAAC,KAAK,CAAC;IAC1B,CAAC;IAED,sHAAsH;IACtH,mHAAmH;IACnH,sHAAsH;IACtH,2BAA2B;IAC3B,OAAO,oBAAoB,CAAC,WAAW,EAAE,SAA4C,CAAC,CAAC;AACxF,CAAC;AAnBD,sDAmBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tDeepReadonly,\n\tJsonDeserialized,\n\tOpaqueJsonDeserialized,\n} from \"@fluidframework/core-interfaces/internal/exposedUtilityTypes\";\n\nimport { asDeeplyReadonlyDeserializedJson } from \"./internalUtils.js\";\nimport type { StateSchemaValidator } from \"./latestValueTypes.js\";\nimport type { ValidatableRequiredState } from \"./validatableTypes.js\";\n\ntype StateSchemaValidatorToOpaque<T> = (\n\trawData: OpaqueJsonDeserialized<T>,\n) => OpaqueJsonDeserialized<T> | undefined;\n\nfunction createGetterFunction<T>(\n\tclientState: ValidatableRequiredState<T>,\n\tvalidator: StateSchemaValidatorToOpaque<T>,\n): () => DeepReadonly<JsonDeserialized<T>> | undefined {\n\treturn (): DeepReadonly<JsonDeserialized<T>> | undefined => {\n\t\tif (!(\"validatedValue\" in clientState)) {\n\t\t\t// Stored `value` has not been validated yet, so validate it and save the result.\n\t\t\tclientState.validatedValue = validator(clientState.value);\n\t\t}\n\t\treturn asDeeplyReadonlyDeserializedJson(clientState.validatedValue);\n\t};\n}\n\n/**\n * Creates a getter for a state value that validates the data with a validator if one is provided. Otherwise the value\n * is returned directly.\n *\n * @param clientState - The client state to be validated.\n * @param validator - The validator function to run.\n * @returns Either returns the value directly if a validator is not provided, or a function that will return the\n * validated data.\n */\nexport function createValidatedGetter<T>(\n\tclientState: ValidatableRequiredState<T>,\n\tvalidator: StateSchemaValidator<T> | undefined,\n): (() => DeepReadonly<JsonDeserialized<T>> | undefined) | DeepReadonly<JsonDeserialized<T>> {\n\t// No validator\n\tif (validator === undefined) {\n\t\treturn asDeeplyReadonlyDeserializedJson(clientState.value);\n\t}\n\n\t// Avoid creating another function since one already exists on the item\n\tif (typeof clientState.value === \"function\") {\n\t\treturn clientState.value;\n\t}\n\n\t// OpaqueJsonDeserialized<T> is just a branded alias of JsonDeserialized<T>. At runtime the functions are still passed\n\t// JSON data, regardless of their type representation. Passing that data to a function that expects `unknown`, like\n\t// the user-provided validator function, is always valid, so StateSchemaValidator and StateSchemaValidatorToOpaque are\n\t// functionally equivalent.\n\treturn createGetterFunction(clientState, validator as StateSchemaValidatorToOpaque<T>);\n}\n"]}
|
package/lib/alpha.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import type { InternalUtilityTypes as CoreInternalUtilityTypes, JsonDeserialized, JsonSerializable } from "@fluidframework/core-interfaces/internal/exposedUtilityTypes";
|
|
6
|
+
import type { Attendee } from "./presence.js";
|
|
6
7
|
/**
|
|
7
8
|
* Collection of utility types that are not intended to be used/imported
|
|
8
9
|
* directly outside of this package.
|
|
@@ -12,14 +13,22 @@ import type { InternalUtilityTypes as CoreInternalUtilityTypes, JsonDeserialized
|
|
|
12
13
|
*/
|
|
13
14
|
export declare namespace InternalUtilityTypes {
|
|
14
15
|
/**
|
|
15
|
-
* Yields `
|
|
16
|
-
* `Else` otherwise.
|
|
16
|
+
* Yields `IfParametersValid` when the given type is an acceptable shape for a
|
|
17
|
+
* notification. `Else` otherwise.
|
|
17
18
|
*
|
|
18
19
|
* @system
|
|
19
20
|
*/
|
|
20
|
-
type
|
|
21
|
+
type IfNotificationParametersSignature<Event, IfParametersValid, Else> = Event extends (...args: infer P) => void ? CoreInternalUtilityTypes.IfSameType<P, JsonSerializable<P>, IfParametersValid, Else> : Else;
|
|
21
22
|
/**
|
|
22
|
-
*
|
|
23
|
+
* Yields `IfSubscriber` when the given type is an acceptable shape for a notification
|
|
24
|
+
* listener (subscriber) function. `Else` otherwise.
|
|
25
|
+
*
|
|
26
|
+
* @system
|
|
27
|
+
*/
|
|
28
|
+
type IfNotificationSubscriberSignature<Event, IfSubscriber, Else> = Event extends (sender: Attendee, ...args: infer P) => void ? CoreInternalUtilityTypes.IfSameType<P, JsonSerializable<P>, IfSubscriber, Else> : Else;
|
|
29
|
+
/**
|
|
30
|
+
* Used to specify the kinds of notifications handled by a {@link NotificationListenable}
|
|
31
|
+
* by describing the custom parameters in a function signature.
|
|
23
32
|
*
|
|
24
33
|
* @remarks
|
|
25
34
|
*
|
|
@@ -38,8 +47,51 @@ export declare namespace InternalUtilityTypes {
|
|
|
38
47
|
* @system
|
|
39
48
|
*/
|
|
40
49
|
type NotificationListeners<E> = {
|
|
41
|
-
[P in keyof E as
|
|
50
|
+
[P in keyof E as IfNotificationParametersSignature<E[P], P, never>]: E[P];
|
|
42
51
|
};
|
|
52
|
+
/**
|
|
53
|
+
* Converts a notification subscriber signature into parameters signature
|
|
54
|
+
* (by removing the `sender: Attendee` parameter).
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* No attempt is made to validate that the original signature is valid with
|
|
58
|
+
* all parameters being JSON-serializable.
|
|
59
|
+
*
|
|
60
|
+
* @system
|
|
61
|
+
*/
|
|
62
|
+
type NotificationParametersSignatureFromSubscriberSignature<Event> = Event extends (sender: Attendee, ...args: infer P) => void ? (...args: P) => void : never;
|
|
63
|
+
/**
|
|
64
|
+
* Used to specify the kinds of notifications handled by a {@link NotificationListenable}
|
|
65
|
+
* by describing the subscriber signatures.
|
|
66
|
+
*
|
|
67
|
+
* @remarks
|
|
68
|
+
*
|
|
69
|
+
* Any object type is a valid NotificationListenersWithSubscriberSignatures,
|
|
70
|
+
* but only the notification-like properties of that type will be included.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
*
|
|
74
|
+
* ```typescript
|
|
75
|
+
* interface MyNotifications {
|
|
76
|
+
* load: (sender: Attendee, user: string, data: IUserData) => void;
|
|
77
|
+
* requestPause: (sender: Attendee, period: number) => void;
|
|
78
|
+
* }
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @system
|
|
82
|
+
*/
|
|
83
|
+
type NotificationListenersWithSubscriberSignatures<E> = {
|
|
84
|
+
[P in keyof E as IfNotificationSubscriberSignature<E[P], P, never>]: E[P];
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Converts a record of notification subscriber signatures into
|
|
88
|
+
* a record of base parameter signatures (which are the canonical form).
|
|
89
|
+
*
|
|
90
|
+
* @system
|
|
91
|
+
*/
|
|
92
|
+
type NotificationListenersFromSubscriberSignatures<E extends NotificationListenersWithSubscriberSignatures<E>> = {
|
|
93
|
+
[K in keyof NotificationListenersWithSubscriberSignatures<E>]: NotificationParametersSignatureFromSubscriberSignature<E[K]>;
|
|
94
|
+
} extends infer TListeners ? NotificationListeners<TListeners> : never;
|
|
43
95
|
/**
|
|
44
96
|
* {@link @fluidframework/core-interfaces#JsonDeserialized} version of the parameters of a function.
|
|
45
97
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exposedUtilityTypes.d.ts","sourceRoot":"","sources":["../src/exposedUtilityTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,oBAAoB,IAAI,wBAAwB,EAChD,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,8DAA8D,CAAC;AAEtE;;;;;;GAMG;AAEH,yBAAiB,oBAAoB,CAAC;IACrC;;;;;OAKG;IACH,KAAY,
|
|
1
|
+
{"version":3,"file":"exposedUtilityTypes.d.ts","sourceRoot":"","sources":["../src/exposedUtilityTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,oBAAoB,IAAI,wBAAwB,EAChD,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,8DAA8D,CAAC;AAEtE,OAAO,KAAK,EAAE,QAAQ,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CAAC,CAAC,CAAC;KACzE,CAAC;IAEF;;;;;OAKG;IACH,KAAY,6CAA6C,CACxD,CAAC,SAAS,6CAA6C,CAAC,CAAC,CAAC,IACvD;SACF,CAAC,IAAI,MAAM,6CAA6C,CAAC,CAAC,CAAC,GAAG,sDAAsD,CACpH,CAAC,CAAC,CAAC,CAAC,CACJ;KACD,SAAS,MAAM,UAAU,GAExB,qBAAqB,CAAC,UAAU,CAAC,GAChC,KAAK,CAAC;IAET;;;;OAIG;IACH,KAAY,0BAA0B,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,IAAI,CAAC,SAAS,CACzF,GAAG,IAAI,EAAE,MAAM,CAAC,KACZ,OAAO,GACT,gBAAgB,CAAC,CAAC,CAAC,GACnB,KAAK,CAAC;IAET;;;;OAIG;IACH,KAAY,0BAA0B,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,IAAI,CAAC,SAAS,CACzF,GAAG,IAAI,EAAE,MAAM,CAAC,KACZ,OAAO,GACT,gBAAgB,CAAC,CAAC,CAAC,GACnB,KAAK,CAAC;CACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exposedUtilityTypes.js","sourceRoot":"","sources":["../src/exposedUtilityTypes.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\tInternalUtilityTypes as CoreInternalUtilityTypes,\n\tJsonDeserialized,\n\tJsonSerializable,\n} from \"@fluidframework/core-interfaces/internal/exposedUtilityTypes\";\n\n/**\n * Collection of utility types that are not intended to be used/imported\n * directly outside of this package.\n *\n * @alpha\n * @system\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace InternalUtilityTypes {\n\t/**\n\t * Yields `
|
|
1
|
+
{"version":3,"file":"exposedUtilityTypes.js","sourceRoot":"","sources":["../src/exposedUtilityTypes.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\tInternalUtilityTypes as CoreInternalUtilityTypes,\n\tJsonDeserialized,\n\tJsonSerializable,\n} from \"@fluidframework/core-interfaces/internal/exposedUtilityTypes\";\n\nimport type { Attendee } from \"./presence.js\";\n\n/**\n * Collection of utility types that are not intended to be used/imported\n * directly outside of this package.\n *\n * @alpha\n * @system\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace InternalUtilityTypes {\n\t/**\n\t * Yields `IfParametersValid` when the given type is an acceptable shape for a\n\t * notification. `Else` otherwise.\n\t *\n\t * @system\n\t */\n\texport type IfNotificationParametersSignature<Event, IfParametersValid, Else> =\n\t\tEvent extends (...args: infer P) => void\n\t\t\t? CoreInternalUtilityTypes.IfSameType<P, JsonSerializable<P>, IfParametersValid, Else>\n\t\t\t: Else;\n\n\t/**\n\t * Yields `IfSubscriber` when the given type is an acceptable shape for a notification\n\t * listener (subscriber) function. `Else` otherwise.\n\t *\n\t * @system\n\t */\n\texport type IfNotificationSubscriberSignature<Event, IfSubscriber, Else> = Event extends (\n\t\tsender: Attendee,\n\t\t...args: infer P\n\t) => void\n\t\t? CoreInternalUtilityTypes.IfSameType<P, JsonSerializable<P>, IfSubscriber, Else>\n\t\t: Else;\n\n\t/**\n\t * Used to specify the kinds of notifications handled by a {@link NotificationListenable}\n\t * by describing the custom parameters in a function signature.\n\t *\n\t * @remarks\n\t *\n\t * Any object type is a valid NotificationListeners, but only the notification-like\n\t * properties of that type will be included.\n\t *\n\t * @example\n\t *\n\t * ```typescript\n\t * interface MyNotifications {\n\t * load: (user: string, data: IUserData) => void;\n\t * requestPause: (period: number) => void;\n\t * }\n\t * ```\n\t *\n\t * @system\n\t */\n\texport type NotificationListeners<E> = {\n\t\t[P in keyof E as IfNotificationParametersSignature<E[P], P, never>]: E[P];\n\t};\n\n\t/**\n\t * Converts a notification subscriber signature into parameters signature\n\t * (by removing the `sender: Attendee` parameter).\n\t *\n\t * @remarks\n\t * No attempt is made to validate that the original signature is valid with\n\t * all parameters being JSON-serializable.\n\t *\n\t * @system\n\t */\n\texport type NotificationParametersSignatureFromSubscriberSignature<Event> = Event extends (\n\t\tsender: Attendee,\n\t\t...args: infer P\n\t) => void\n\t\t? (...args: P) => void\n\t\t: never;\n\n\t/**\n\t * Used to specify the kinds of notifications handled by a {@link NotificationListenable}\n\t * by describing the subscriber signatures.\n\t *\n\t * @remarks\n\t *\n\t * Any object type is a valid NotificationListenersWithSubscriberSignatures,\n\t * but only the notification-like properties of that type will be included.\n\t *\n\t * @example\n\t *\n\t * ```typescript\n\t * interface MyNotifications {\n\t * load: (sender: Attendee, user: string, data: IUserData) => void;\n\t * requestPause: (sender: Attendee, period: number) => void;\n\t * }\n\t * ```\n\t *\n\t * @system\n\t */\n\texport type NotificationListenersWithSubscriberSignatures<E> = {\n\t\t[P in keyof E as IfNotificationSubscriberSignature<E[P], P, never>]: E[P];\n\t};\n\n\t/**\n\t * Converts a record of notification subscriber signatures into\n\t * a record of base parameter signatures (which are the canonical form).\n\t *\n\t * @system\n\t */\n\texport type NotificationListenersFromSubscriberSignatures<\n\t\tE extends NotificationListenersWithSubscriberSignatures<E>,\n\t> = {\n\t\t[K in keyof NotificationListenersWithSubscriberSignatures<E>]: NotificationParametersSignatureFromSubscriberSignature<\n\t\t\tE[K]\n\t\t>;\n\t} extends infer TListeners\n\t\t? // Additional filter is needed to convince TypeScript that the result is NotificationListeners shape\n\t\t\tNotificationListeners<TListeners>\n\t\t: never;\n\n\t/**\n\t * {@link @fluidframework/core-interfaces#JsonDeserialized} version of the parameters of a function.\n\t *\n\t * @system\n\t */\n\texport type JsonDeserializedParameters<T extends (...args: any[]) => unknown> = T extends (\n\t\t...args: infer P\n\t) => unknown\n\t\t? JsonDeserialized<P>\n\t\t: never;\n\n\t/**\n\t * {@link @fluidframework/core-interfaces#JsonSerializable} version of the parameters of a function.\n\t *\n\t * @system\n\t */\n\texport type JsonSerializableParameters<T extends (...args: any[]) => unknown> = T extends (\n\t\t...args: infer P\n\t) => unknown\n\t\t? JsonSerializable<P>\n\t\t: never;\n}\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -14,11 +14,11 @@ 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 "./broadcastControlsTypes.js";
|
|
16
16
|
export { getPresence, getPresenceAlpha, getPresenceFromDataStoreContext, } from "./getPresence.js";
|
|
17
|
-
export type { KeySchemaValidator, LatestMap, LatestMapArguments, LatestMapArgumentsRaw, LatestMapClientData, LatestMapEvents, LatestMapFactory, LatestMapItemRemovedClientData, LatestMapItemUpdatedClientData, LatestMapRaw, LatestMapRawEvents, StateMap, } from "./
|
|
18
|
-
export type { Latest, LatestArguments, LatestArgumentsRaw, LatestEvents, LatestFactory, LatestRaw, LatestRawEvents, } from "./
|
|
17
|
+
export type { KeySchemaValidator, LatestMap, LatestMapArguments, LatestMapArgumentsRaw, LatestMapClientData, LatestMapEvents, LatestMapFactory, LatestMapItemRemovedClientData, LatestMapItemUpdatedClientData, LatestMapRaw, LatestMapRawEvents, StateMap, } from "./latestMapTypes.js";
|
|
18
|
+
export type { Latest, LatestArguments, LatestArgumentsRaw, LatestEvents, LatestFactory, LatestRaw, LatestRawEvents, } from "./latestTypes.js";
|
|
19
19
|
export type { Accessor, LatestClientData, LatestData, LatestMetadata, ProxiedValueAccessor, RawValueAccessor, StateSchemaValidator, ValueAccessor, } from "./latestValueTypes.js";
|
|
20
20
|
export { Notifications } from "./notificationsManager.js";
|
|
21
|
-
export type { NotificationEmitter, NotificationListenable,
|
|
21
|
+
export type { NotificationEmitter, NotificationListenable, NotificationSubscriberSignatures, NotificationsManager, NotificationsManagerEvents, } from "./notificationsManagerTypes.js";
|
|
22
22
|
export { StateFactory } from "./stateFactory.js";
|
|
23
23
|
export type { InternalTypes } from "./exposedInternalTypes.js";
|
|
24
24
|
export type { InternalUtilityTypes } from "./exposedUtilityTypes.js";
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AAEH,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,YAAY,EACX,sBAAsB,EACtB,4BAA4B,EAC5B,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,GAChB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACN,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,cAAc,EACd,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,yBAAyB,GAC9B,MAAM,eAAe,CAAC;AAEvB,YAAY,EACX,iBAAiB,EACjB,wBAAwB,GACxB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACN,WAAW,EACX,gBAAgB,EAChB,+BAA+B,GAC/B,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACX,kBAAkB,EAClB,SAAS,EACT,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,8BAA8B,EAC9B,8BAA8B,EAC9B,YAAY,EACZ,kBAAkB,EAClB,QAAQ,GACR,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AAEH,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,YAAY,EACX,sBAAsB,EACtB,4BAA4B,EAC5B,eAAe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file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsBH,OAAO,EAIN,cAAc,GAId,MAAM,eAAe,CAAC;AAOvB,OAAO,EACN,WAAW,EACX,gBAAgB,EAChB,+BAA+B,GAC/B,MAAM,kBAAkB,CAAC;AAoC1B,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAS1D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC","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 \"./broadcastControlsTypes.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 \"./
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsBH,OAAO,EAIN,cAAc,GAId,MAAM,eAAe,CAAC;AAOvB,OAAO,EACN,WAAW,EACX,gBAAgB,EAChB,+BAA+B,GAC/B,MAAM,kBAAkB,CAAC;AAoC1B,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAS1D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC","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 \"./broadcastControlsTypes.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 \"./latestMapTypes.js\";\nexport type {\n\tLatest,\n\tLatestArguments,\n\tLatestArgumentsRaw,\n\tLatestEvents,\n\tLatestFactory,\n\tLatestRaw,\n\tLatestRawEvents,\n} from \"./latestTypes.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 { Notifications } from \"./notificationsManager.js\";\nexport type {\n\tNotificationEmitter,\n\tNotificationListenable,\n\tNotificationSubscriberSignatures,\n\tNotificationsManager,\n\tNotificationsManagerEvents,\n} from \"./notificationsManagerTypes.js\";\n\nexport { StateFactory } from \"./stateFactory.js\";\n\nexport type { InternalTypes } from \"./exposedInternalTypes.js\";\nexport type { InternalUtilityTypes } from \"./exposedUtilityTypes.js\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internalUtils.d.ts","sourceRoot":"","sources":["../src/internalUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EACX,wBAAwB,EACxB,wBAAwB,EACxB,MAAM,uBAAuB,CAAC;AAE/B;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAE7C,KAAK,yBAAyB,CAAC,CAAC,IAAI;KAClC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACrD,CAAC;AAEF,KAAK,aAAa,CAAC,CAAC,IAAI;KACtB,CAAC,IAAI,MAAM,yBAAyB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;C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AE5C,OAAO,KAAsD,CAAC;AAC/D,CAAC;AAWD;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAI,KAAQ;IAC3C,OAAO,KAAwC,CAAC;AACjD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAC3B,KAA0B;IAE1B,OAAO,KAA8D,CAAC;AACvE,CAAC;AA8CD;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CACnC,KAAgE;IAEhE,OAAO,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC;AAClC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tDeepReadonly,\n\tInternalUtilityTypes,\n\tJsonDeserialized,\n\tJsonSerializable,\n\tOpaqueJsonDeserialized,\n\tOpaqueJsonSerializable,\n} from \"@fluidframework/core-interfaces/internal\";\n\nimport type {\n\tValidatableOptionalState,\n\tValidatableRequiredState,\n} from \"./validatableTypes.js\";\n\n/**\n * Returns union of types of values in a record.\n */\nexport type RecordEntryTypes<T> = T[keyof T];\n\ntype MapNumberIndicesToStrings<T> = {\n\t[K in keyof T as K extends number ? `${K}` : K]: T[K];\n};\n\ntype KeyValuePairs<T> = {\n\t[K in keyof MapNumberIndicesToStrings<Required<T>>]: [K, Required<T>[K]];\n}[keyof MapNumberIndicesToStrings<Required<T>>][];\n\ntype RequiredAndNotUndefined<T> = {\n\t[K in keyof T]-?: Exclude<T[K], undefined>;\n};\n\n/**\n * Object.entries retyped to preserve known keys and their types.\n *\n * @privateRemarks\n * The is a defect in this utility when a string index appears in the object.\n * In such a case, the only result is `[string, T]`, where `T` is the type\n * of the string index entry.\n */\nexport const objectEntries = Object.entries as <const T>(o: T) => KeyValuePairs<T>;\n\n/**\n * Object.entries retyped to preserve known keys and their types.\n *\n * @remarks\n * Given `T` should not contain `undefined` values. If it does, use\n * {@link objectEntries} instead. Without `undefined` values, this\n * typing provides best handling of objects with optional properties.\n */\nexport const objectEntriesWithoutUndefined = Object.entries as <const T>(\n\to: T,\n) => KeyValuePairs<RequiredAndNotUndefined<T>>;\n\n/**\n * Object.keys retyped to preserve known keys and their types.\n */\nexport const objectKeys = Object.keys as <const T>(\n\to: T,\n) => (keyof MapNumberIndicesToStrings<T>)[];\n\n/**\n * Retrieve a value from a record with the given key, or create a new entry if\n * the key is not in the record.\n *\n * @param record - The record to index/update\n * @param key - The key to lookup in the record\n * @param defaultValue - a function which returns a default value. This is\n * called and used to set an initial value for the given key in the record if\n * none exists.\n * @returns either the existing value for the given key, or the newly-created\n * value (the result of `defaultValue`)\n */\nexport function getOrCreateRecord<const K extends string | number | symbol, const V>(\n\trecord: Record<K, V>,\n\tkey: K,\n\tdefaultValue: (key: K) => V,\n): V {\n\tif (!(key in record)) {\n\t\trecord[key] = defaultValue(key);\n\t}\n\treturn record[key];\n}\n\n/**\n * No-runtime-effect helper to apply deep immutability to a value's type.\n */\nexport function asDeeplyReadonly<T>(value: T): DeepReadonly<T> {\n\treturn value as DeepReadonly<T>;\n}\n\n// function overloads\nexport function asDeeplyReadonlyDeserializedJson<T>(\n\tvalue: OpaqueJsonDeserialized<T>,\n): DeepReadonly<JsonDeserialized<T>>;\nexport function asDeeplyReadonlyDeserializedJson<T>(\n\tvalue: OpaqueJsonDeserialized<T> | undefined,\n): DeepReadonly<JsonDeserialized<T>> | undefined;\n/**\n * No-runtime-effect helper to apply deep immutability to a value's opaque JSON\n * type, revealing the JSON type.\n */\nexport function asDeeplyReadonlyDeserializedJson<T>(\n\tvalue: OpaqueJsonDeserialized<T> | undefined,\n): DeepReadonly<JsonDeserialized<T>> | undefined {\n\treturn value as DeepReadonly<JsonDeserialized<T>> | undefined;\n}\n\n/**\n * Conditional type that reveals the underlying JSON type of an opaque JSON value. If `T` is an object, the key values\n * will be revealed.\n */\ntype RevealOpaqueJsonDeserialized<T> =\n\tT extends OpaqueJsonDeserialized<infer U>\n\t\t? JsonDeserialized<U>\n\t\t: { [Key in keyof T]: RevealOpaqueJsonDeserialized<T[Key]> };\n\n/**\n * No-runtime-effect helper to reveal the JSON type from a value's opaque JSON\n * types throughout a structure.\n *\n * @remarks\n * {@link OpaqueJsonDeserialized} instances will be replaced shallowly such\n * that nested instances are retained.\n */\nexport function revealOpaqueJson<T>(value: T): RevealOpaqueJsonDeserialized<T> {\n\treturn value as RevealOpaqueJsonDeserialized<T>;\n}\n\n/**\n * No-runtime-effect helper to automatically cast JSON type to Opaque JSON type\n * at outermost scope.\n *\n * @remarks\n * Types that satisfy {@link JsonSerializable} may also be deserialized. Thus,\n * the return type is both {@link OpaqueJsonSerializable} and\n * {@link OpaqueJsonDeserialized}.\n */\nexport function toOpaqueJson<const T>(\n\tvalue: JsonSerializable<T>,\n): OpaqueJsonSerializable<T> & OpaqueJsonDeserialized<T> {\n\treturn value as OpaqueJsonSerializable<T> & OpaqueJsonDeserialized<T>;\n}\n\n/**\n * Convert a union of types to an intersection of those types.\n *\n * @privateRemarks\n * First an always true extends clause is used (T extends T) to distribute T\n * into to a union of types contravariant over each member of the T union.\n * Then the constraint on the type parameter in this new context is inferred,\n * giving the intersection.\n *\n * Future: This definition is identical to one in `packages/dds/tree/src/util/typeUtils.ts`\n * and should be consolidated.\n */\ntype UnionToIntersection<T> = (T extends T ? (k: T) => unknown : never) extends (\n\tk: infer U,\n) => unknown\n\t? U\n\t: never;\n\n/**\n * Generates a union of types that are the remainder from a simple\n * Pick combination (that is the set of common properties).\n */\ntype PickRemainder<T> =\n\tPick<T, keyof T> extends infer Common\n\t\t? T extends unknown\n\t\t\t? Omit<T, keyof Common>\n\t\t\t: never\n\t\t: never;\n\n/**\n * Combines union of structure into a single structure where common properties\n * are unions of their respective types and optional properties are defined for\n * properties that are not common to each union member.\n *\n * @remarks\n * If a property is common to multiple, but not all union member and the\n * types are incompatible, the resulting type will be `never` for that\n * property. (This can be fixed, but might be best addressed by changing\n * T to be a tuple of types to be combined.)\n */\nexport type FlattenUnionWithOptionals<T> = InternalUtilityTypes.FlattenIntersection<\n\tPick<T, keyof T> & UnionToIntersection<Partial<PickRemainder<T>>>\n>;\n\n/**\n * Type guard to check if a state is a required state (has a value).\n *\n * @param state - The state to check\n * @returns True if the state has a value and is therefore a {@link ValidatableRequiredState}\n */\nexport function isValueRequiredState<T>(\n\tstate: ValidatableRequiredState<T> | ValidatableOptionalState<T>,\n): state is ValidatableRequiredState<T> {\n\treturn state.value !== undefined;\n}\n"]}
|