@bondsports/types 2.4.99-squad-b-1 → 2.4.100

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.
@@ -102,4 +102,3 @@ export * from './folders.enums';
102
102
  export * from './index';
103
103
  export * from './interfaces';
104
104
  export * from './session-participants.consts';
105
- export * from './team-folder-metadata';
@@ -26,5 +26,4 @@ __exportStar(require("./folders.enums"), exports);
26
26
  __exportStar(require("./index"), exports);
27
27
  __exportStar(require("./interfaces"), exports);
28
28
  __exportStar(require("./session-participants.consts"), exports);
29
- __exportStar(require("./team-folder-metadata"), exports);
30
29
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/types/folders/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA2GA,4CAAuF;AAAxD,oHAAA,2BAA2B,OAAA;AAC1D,4CAA0B;AAC1B,2CAAyB;AACzB,+DAA6C;AAC7C,8DAA4C;AAC5C,8DAA4C;AAC5C,kDAAgC;AAChC,0CAAwB;AACxB,+CAA6B;AAC7B,gEAA8C;AAC9C,yDAAuC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/types/folders/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA2GA,4CAAuF;AAAxD,oHAAA,2BAA2B,OAAA;AAC1D,4CAA0B;AAC1B,2CAAyB;AACzB,+DAA6C;AAC7C,8DAA4C;AAC5C,8DAA4C;AAC5C,kDAAgC;AAChC,0CAAwB;AACxB,+CAA6B;AAC7B,gEAA8C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bondsports/types",
3
- "version": "2.4.99-squad-b-1",
3
+ "version": "2.4.100",
4
4
  "description": "backend types module for Bond-Sports",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {
@@ -1,54 +0,0 @@
1
- import { ProductSubTypesEnum } from '../../services/enums.service';
2
- /**
3
- * A value for a JSON Merge Patch field: `undefined` leaves the stored value
4
- * untouched, `null` removes the key, and any other value overwrites it.
5
- */
6
- export type TMergePatchValue<T> = T | null | undefined;
7
- /**
8
- * Fluent wrapper around a team-folder `FolderContent.metadata` record. It
9
- * centralizes every metadata read/write so callers never index the raw JSONB
10
- * by string key, and it owns the two domain rules that previously lived inline
11
- * in services:
12
- *
13
- * - JSON Merge Patch semantics for the optional player fields (omit = keep,
14
- * `null` = delete, value = overwrite), via {@link applyJerseyNumber} /
15
- * {@link applyPosition}.
16
- * - Non-player roles (coach / organizer) never carry a jersey number or
17
- * position; {@link isNonPlayerRole} + {@link clearPlayerFields} express that.
18
- *
19
- * Unknown keys (e.g. `productUserId`) are preserved across edits. Instances are
20
- * mutated in place and the mutators return `this` so edits can be chained;
21
- * {@link toRecord} produces the object to persist.
22
- */
23
- export declare class TeamFolderMetadata {
24
- private readonly data;
25
- private constructor();
26
- /**
27
- * Wraps an existing metadata record (or starts from empty). The source is
28
- * shallow-copied, so the caller's object is never mutated.
29
- */
30
- static from(source?: Record<string, unknown> | null): TeamFolderMetadata;
31
- get teamRole(): string | undefined;
32
- get jerseyNumber(): number | null;
33
- get position(): string | null;
34
- /**
35
- * True when the stored role is a non-playing role (coach / organizer) that
36
- * must not carry a jersey number or position.
37
- */
38
- get isNonPlayerRole(): boolean;
39
- setRole(subtype: ProductSubTypesEnum | string): this;
40
- applyJerseyNumber(value: TMergePatchValue<number>): this;
41
- applyPosition(value: TMergePatchValue<string>): this;
42
- /**
43
- * Removes the player-only fields (jersey number and position). Used when the
44
- * resolved role is a coach or organizer.
45
- */
46
- clearPlayerFields(): this;
47
- /**
48
- * Returns a shallow copy of the underlying metadata for persistence. The
49
- * return type mirrors the `FolderContent.metadata` JSONB column, which is an
50
- * untyped record; use the typed getters above for reads.
51
- */
52
- toRecord(): Record<string, unknown>;
53
- private applyOptionalField;
54
- }
@@ -1,98 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TeamFolderMetadata = void 0;
4
- const enums_service_1 = require("../../services/enums.service");
5
- const TEAM_ROLE_KEY = 'teamRole';
6
- const JERSEY_NUMBER_KEY = 'jerseyNumber';
7
- const POSITION_KEY = 'position';
8
- /**
9
- * Fluent wrapper around a team-folder `FolderContent.metadata` record. It
10
- * centralizes every metadata read/write so callers never index the raw JSONB
11
- * by string key, and it owns the two domain rules that previously lived inline
12
- * in services:
13
- *
14
- * - JSON Merge Patch semantics for the optional player fields (omit = keep,
15
- * `null` = delete, value = overwrite), via {@link applyJerseyNumber} /
16
- * {@link applyPosition}.
17
- * - Non-player roles (coach / organizer) never carry a jersey number or
18
- * position; {@link isNonPlayerRole} + {@link clearPlayerFields} express that.
19
- *
20
- * Unknown keys (e.g. `productUserId`) are preserved across edits. Instances are
21
- * mutated in place and the mutators return `this` so edits can be chained;
22
- * {@link toRecord} produces the object to persist.
23
- */
24
- class TeamFolderMetadata {
25
- constructor(source) {
26
- this.data = { ...source };
27
- }
28
- /**
29
- * Wraps an existing metadata record (or starts from empty). The source is
30
- * shallow-copied, so the caller's object is never mutated.
31
- */
32
- static from(source) {
33
- return new TeamFolderMetadata(source ?? {});
34
- }
35
- get teamRole() {
36
- const value = this.data[TEAM_ROLE_KEY];
37
- return typeof value === 'string' ? value : undefined;
38
- }
39
- get jerseyNumber() {
40
- const value = this.data[JERSEY_NUMBER_KEY];
41
- return typeof value === 'number' ? value : null;
42
- }
43
- get position() {
44
- const value = this.data[POSITION_KEY];
45
- return typeof value === 'string' ? value : null;
46
- }
47
- /**
48
- * True when the stored role is a non-playing role (coach / organizer) that
49
- * must not carry a jersey number or position.
50
- */
51
- get isNonPlayerRole() {
52
- const role = this.teamRole;
53
- if (!role) {
54
- return false;
55
- }
56
- return enums_service_1.PARTICIPANT_SUBTYPES_EXCLUDED_FROM_USER_VALIDATION.includes(role);
57
- }
58
- setRole(subtype) {
59
- this.data[TEAM_ROLE_KEY] = subtype;
60
- return this;
61
- }
62
- applyJerseyNumber(value) {
63
- return this.applyOptionalField(JERSEY_NUMBER_KEY, value);
64
- }
65
- applyPosition(value) {
66
- return this.applyOptionalField(POSITION_KEY, value);
67
- }
68
- /**
69
- * Removes the player-only fields (jersey number and position). Used when the
70
- * resolved role is a coach or organizer.
71
- */
72
- clearPlayerFields() {
73
- delete this.data[JERSEY_NUMBER_KEY];
74
- delete this.data[POSITION_KEY];
75
- return this;
76
- }
77
- /**
78
- * Returns a shallow copy of the underlying metadata for persistence. The
79
- * return type mirrors the `FolderContent.metadata` JSONB column, which is an
80
- * untyped record; use the typed getters above for reads.
81
- */
82
- toRecord() {
83
- return { ...this.data };
84
- }
85
- applyOptionalField(key, value) {
86
- if (value === undefined) {
87
- return this;
88
- }
89
- if (value === null) {
90
- delete this.data[key];
91
- return this;
92
- }
93
- this.data[key] = value;
94
- return this;
95
- }
96
- }
97
- exports.TeamFolderMetadata = TeamFolderMetadata;
98
- //# sourceMappingURL=team-folder-metadata.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"team-folder-metadata.js","sourceRoot":"","sources":["../../../../src/types/folders/types/team-folder-metadata.ts"],"names":[],"mappings":";;;AAAA,gEAAuH;AAQvH,MAAM,aAAa,GAAG,UAAU,CAAC;AACjC,MAAM,iBAAiB,GAAG,cAAc,CAAC;AACzC,MAAM,YAAY,GAAG,UAAU,CAAC;AAEhC;;;;;;;;;;;;;;;GAeG;AACH,MAAa,kBAAkB;IAG9B,YAAoB,MAA+B;QAClD,IAAI,CAAC,IAAI,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,IAAI,CAAC,MAAuC;QAClD,OAAO,IAAI,kBAAkB,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,IAAI,QAAQ;QACX,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAEvC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,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