Skip to content

Commit 3b18f70

Browse files
Remove nodeKey field kind (#25847)
## Description There has never been a way to use the nodeKey field kind since before the simple simple-tree API layer was created. Any document using it is impossible to open with our existing view schema APIs, and would have had to have been created using either internal APIs or before shared-tree was stabilized in FF 2.0. ## Breaking Changes Removing support for nodeKey could cause a currently impossible to "view" document which uses it from before FF 2.0 to error on load rather than on view. As such documents are believed to not exist, and if they do exist are impossible to view or edit and never had forwards compat guarantees, erroring on load for them seems like a non-issue.
1 parent 7aae2a7 commit 3b18f70

File tree

4 files changed

+2
-53
lines changed

4 files changed

+2
-53
lines changed

packages/dds/tree/src/feature-libraries/default-schema/defaultFieldKinds.ts

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ export const required = new FieldKindWithEditor(
107107
// Which direction is allowed is a subjective policy choice.
108108
(other.kind === sequence.identifier ||
109109
other.kind === requiredIdentifier ||
110-
other.kind === optional.identifier ||
111-
other.kind === nodeKey.identifier) &&
110+
other.kind === optional.identifier) &&
112111
allowsTreeSchemaIdentifierSuperset(types, other.types),
113112
new Set(),
114113
);
@@ -129,28 +128,6 @@ export const sequence = new FieldKindWithEditor(
129128
new Set([]),
130129
);
131130

132-
const nodeKeyIdentifier = "NodeKey";
133-
134-
/**
135-
* Exactly one identifier.
136-
*
137-
* TODO: this is almost the same as identifier, but apparently unused.
138-
* Confirm if this is truly unused since before the document format was stabilized, and remove if possible.
139-
* @deprecated Superseded by {@link identifier}.
140-
*/
141-
export const nodeKey = new FieldKindWithEditor(
142-
nodeKeyIdentifier,
143-
Multiplicity.Single,
144-
noChangeHandler,
145-
(types, other) =>
146-
(other.kind === sequence.identifier ||
147-
other.kind === requiredIdentifier ||
148-
other.kind === optional.identifier ||
149-
other.kind === nodeKeyIdentifier) &&
150-
allowsTreeSchemaIdentifierSuperset(types, other.types),
151-
new Set(),
152-
);
153-
154131
const identifierFieldIdentifier = "Identifier";
155132

156133
/**
@@ -214,7 +191,6 @@ export const fieldKindConfigurations: ReadonlyMap<
214191
[
215192
brand(1),
216193
new Map<FieldKindIdentifier, FieldKindConfigurationEntry>([
217-
[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],
218194
[required.identifier, { kind: required, formatVersion: 1 }],
219195
[optional.identifier, { kind: optional, formatVersion: 1 }],
220196
[sequence.identifier, { kind: sequence, formatVersion: 1 }],
@@ -225,7 +201,6 @@ export const fieldKindConfigurations: ReadonlyMap<
225201
[
226202
brand(2),
227203
new Map<FieldKindIdentifier, FieldKindConfigurationEntry>([
228-
[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],
229204
[required.identifier, { kind: required, formatVersion: 2 }],
230205
[optional.identifier, { kind: optional, formatVersion: 2 }],
231206
[sequence.identifier, { kind: sequence, formatVersion: 1 }],
@@ -236,7 +211,6 @@ export const fieldKindConfigurations: ReadonlyMap<
236211
[
237212
brand(3),
238213
new Map<FieldKindIdentifier, FieldKindConfigurationEntry>([
239-
[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],
240214
[required.identifier, { kind: required, formatVersion: 2 }],
241215
[optional.identifier, { kind: optional, formatVersion: 2 }],
242216
[sequence.identifier, { kind: sequence, formatVersion: 2 }],
@@ -247,7 +221,6 @@ export const fieldKindConfigurations: ReadonlyMap<
247221
[
248222
brand(4),
249223
new Map<FieldKindIdentifier, FieldKindConfigurationEntry>([
250-
[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],
251224
[required.identifier, { kind: required, formatVersion: 2 }],
252225
[optional.identifier, { kind: optional, formatVersion: 2 }],
253226
[sequence.identifier, { kind: sequence, formatVersion: 3 }],
@@ -284,7 +257,7 @@ export function getCodecTreeForModularChangeFormat(
284257
* code which uses this should be audited for compatibility considerations.
285258
*/
286259
export const fieldKinds: ReadonlyMap<FieldKindIdentifier, FieldKindWithEditor> = new Map(
287-
[required, optional, sequence, nodeKey, identifier, forbidden].map((s) => [s.identifier, s]),
260+
[required, optional, sequence, identifier, forbidden].map((s) => [s.identifier, s]),
288261
);
289262

290263
// Create named Aliases for nicer intellisense.

packages/dds/tree/src/test/snapshots/output/codec-tree/MinVersionForCollab.v2_0.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@
2626
"name": "ModularChange",
2727
"version": 3,
2828
"children": [
29-
{
30-
"name": "FieldKind:NodeKey",
31-
"version": 1
32-
},
3329
{
3430
"name": "FieldKind:Value",
3531
"version": 2
@@ -78,10 +74,6 @@
7874
"name": "ModularChange",
7975
"version": 3,
8076
"children": [
81-
{
82-
"name": "FieldKind:NodeKey",
83-
"version": 1
84-
},
8577
{
8678
"name": "FieldKind:Value",
8779
"version": 2

packages/dds/tree/src/test/snapshots/output/codec-tree/MinVersionForCollab.v2_43.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@
2626
"name": "ModularChange",
2727
"version": 4,
2828
"children": [
29-
{
30-
"name": "FieldKind:NodeKey",
31-
"version": 1
32-
},
3329
{
3430
"name": "FieldKind:Value",
3531
"version": 2
@@ -78,10 +74,6 @@
7874
"name": "ModularChange",
7975
"version": 4,
8076
"children": [
81-
{
82-
"name": "FieldKind:NodeKey",
83-
"version": 1
84-
},
8577
{
8678
"name": "FieldKind:Value",
8779
"version": 2

packages/dds/tree/src/test/snapshots/output/codec-tree/MinVersionForCollab.v2_52.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@
2626
"name": "ModularChange",
2727
"version": 4,
2828
"children": [
29-
{
30-
"name": "FieldKind:NodeKey",
31-
"version": 1
32-
},
3329
{
3430
"name": "FieldKind:Value",
3531
"version": 2
@@ -78,10 +74,6 @@
7874
"name": "ModularChange",
7975
"version": 4,
8076
"children": [
81-
{
82-
"name": "FieldKind:NodeKey",
83-
"version": 1
84-
},
8577
{
8678
"name": "FieldKind:Value",
8779
"version": 2

0 commit comments

Comments
 (0)