@fluidframework/core-interfaces 2.41.0 → 2.42.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 (46) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/exposedInternalUtilityTypes.d.ts +56 -4
  3. package/dist/exposedInternalUtilityTypes.d.ts.map +1 -1
  4. package/dist/exposedInternalUtilityTypes.js.map +1 -1
  5. package/dist/exposedUtilityTypes.d.ts +1 -0
  6. package/dist/exposedUtilityTypes.d.ts.map +1 -1
  7. package/dist/exposedUtilityTypes.js.map +1 -1
  8. package/dist/internal.d.ts +10 -0
  9. package/dist/internal.d.ts.map +1 -1
  10. package/dist/internal.js.map +1 -1
  11. package/dist/jsonSerializable.d.ts +2 -2
  12. package/dist/jsonSerializable.js.map +1 -1
  13. package/dist/jsonUtils.d.ts +70 -0
  14. package/dist/jsonUtils.d.ts.map +1 -0
  15. package/dist/jsonUtils.js +7 -0
  16. package/dist/jsonUtils.js.map +1 -0
  17. package/dist/opaqueJson.d.ts +60 -0
  18. package/dist/opaqueJson.d.ts.map +1 -0
  19. package/dist/opaqueJson.js +8 -0
  20. package/dist/opaqueJson.js.map +1 -0
  21. package/lib/exposedInternalUtilityTypes.d.ts +56 -4
  22. package/lib/exposedInternalUtilityTypes.d.ts.map +1 -1
  23. package/lib/exposedInternalUtilityTypes.js.map +1 -1
  24. package/lib/exposedUtilityTypes.d.ts +1 -0
  25. package/lib/exposedUtilityTypes.d.ts.map +1 -1
  26. package/lib/exposedUtilityTypes.js.map +1 -1
  27. package/lib/internal.d.ts +10 -0
  28. package/lib/internal.d.ts.map +1 -1
  29. package/lib/internal.js.map +1 -1
  30. package/lib/jsonSerializable.d.ts +2 -2
  31. package/lib/jsonSerializable.js.map +1 -1
  32. package/lib/jsonUtils.d.ts +70 -0
  33. package/lib/jsonUtils.d.ts.map +1 -0
  34. package/lib/jsonUtils.js +6 -0
  35. package/lib/jsonUtils.js.map +1 -0
  36. package/lib/opaqueJson.d.ts +60 -0
  37. package/lib/opaqueJson.d.ts.map +1 -0
  38. package/lib/opaqueJson.js +6 -0
  39. package/lib/opaqueJson.js.map +1 -0
  40. package/package.json +2 -2
  41. package/src/exposedInternalUtilityTypes.ts +186 -80
  42. package/src/exposedUtilityTypes.ts +1 -0
  43. package/src/internal.ts +24 -0
  44. package/src/jsonSerializable.ts +2 -2
  45. package/src/jsonUtils.ts +90 -0
  46. package/src/opaqueJson.ts +87 -0
@@ -0,0 +1,87 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { BrandedType } from "./brandedType.js";
7
+
8
+ /**
9
+ * Placeholder for value that is known to be JSON because it has been
10
+ * deserialized (`T` filtered through {@link JsonDeserialized} as out value).
11
+ *
12
+ * @remarks
13
+ * Usage:
14
+ *
15
+ * - Cast to with `as unknown as OpaqueJsonDeserialized<T>` when value `T`
16
+ * has been filtered through {@link JsonDeserialized}.
17
+ *
18
+ * - Cast from with `as unknown as JsonDeserialized<T>` when "instance" will
19
+ * be read.
20
+ *
21
+ * @sealed
22
+ * @beta
23
+ */
24
+ export declare class OpaqueJsonDeserialized<
25
+ T,
26
+ // These options are split from typical `JsonDeserializedOptions` as this type
27
+ // requires correct variance per the two options and AllowExactly has special
28
+ // variance and must be treated as invariant. In actuality, each member of the
29
+ // AllowExactly tuple is invariant, but tuple as a set is covariant. This is not
30
+ // expressible in TypeScript.
31
+ in out Option_AllowExactly extends unknown[] = [],
32
+ out Option_AllowExtensionOf = never,
33
+ > extends BrandedType<"JsonDeserialized"> {
34
+ protected readonly JsonDeserialized: {
35
+ Type: T;
36
+ Options: {
37
+ AllowExactly: Option_AllowExactly;
38
+ AllowExtensionOf: Option_AllowExtensionOf;
39
+ };
40
+ };
41
+ // Option_AllowExactly is covariant from above. This removes covariance, leaving only invariance.
42
+ protected readonly Option_AllowExactly_Invariance: (
43
+ Option_AllowExactly: Option_AllowExactly,
44
+ ) => void;
45
+ private constructor();
46
+ }
47
+
48
+ /**
49
+ * Placeholder for value that is known to be JSON because it will have been
50
+ * serialized checked (`T` filtered through {@link JsonSerializable} before "created").
51
+ *
52
+ * @remarks
53
+ * Usage:
54
+ *
55
+ * - Cast to with `as unknown as OpaqueJsonSerializable<T>` when value `T`
56
+ * has been filtered through {@link JsonSerializable}.
57
+ *
58
+ * - Cast from with `as unknown as JsonSerializable<T>` or `as unknown as T`
59
+ * when "instance" will be forwarded along.
60
+ *
61
+ * @sealed
62
+ * @beta
63
+ */
64
+ export declare class OpaqueJsonSerializable<
65
+ T,
66
+ // These options are split from typical `JsonSerializableOptions` as this type
67
+ // requires correct variance per the two options and AllowExactly has special
68
+ // variance and must be treated as invariant. In actuality, each member of the
69
+ // AllowExactly tuple is invariant, but tuple as a set is covariant. This is not
70
+ // expressible in TypeScript.
71
+ in out Option_AllowExactly extends unknown[] = [],
72
+ out Option_AllowExtensionOf = never,
73
+ // JsonSerializableOptions.IgnoreInaccessibleMembers is ignored
74
+ > extends BrandedType<"JsonSerializable"> {
75
+ protected readonly JsonSerializable: {
76
+ Type: T;
77
+ Options: {
78
+ AllowExactly: Option_AllowExactly;
79
+ AllowExtensionOf: Option_AllowExtensionOf;
80
+ };
81
+ };
82
+ // Option_AllowExactly is covariant from above. This removes covariance, leaving only invariance.
83
+ protected readonly Option_AllowExactly_Invariance: (
84
+ Option_AllowExactly: Option_AllowExactly,
85
+ ) => void;
86
+ private constructor();
87
+ }