@platforma-sdk/model 1.53.0 → 1.53.2

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.
@@ -1,77 +1,323 @@
1
- export type MigrationFn<From, To> = (prev: Readonly<From>) => To;
1
+ export type DataVersionKey = string;
2
+ export type DataVersionMap = Record<string, unknown>;
3
+ export type DataMigrateFn<From, To> = (prev: Readonly<From>) => To;
4
+ export type DataCreateFn<T> = () => T;
5
+ export type DataRecoverFn<T> = (version: DataVersionKey, data: unknown) => T;
6
+ /**
7
+ * Helper to define version keys with literal type inference and runtime validation.
8
+ * - Validates that all version values are unique
9
+ * - Validates that no version value is empty
10
+ * - Eliminates need for `as const` assertion
11
+ *
12
+ * @throws Error if duplicate or empty version values are found
13
+ *
14
+ * @example
15
+ * const Version = defineDataVersions({
16
+ * Initial: 'v1',
17
+ * AddedLabels: 'v2',
18
+ * });
19
+ *
20
+ * type VersionedData = {
21
+ * [Version.Initial]: DataV1;
22
+ * [Version.AddedLabels]: DataV2;
23
+ * };
24
+ */
25
+ export declare function defineDataVersions<const T extends Record<string, string>>(versions: T): T;
2
26
  /** Versioned data wrapper for persistence */
3
- export type Versioned<T> = {
4
- version: number;
27
+ export type DataVersioned<T> = {
28
+ version: DataVersionKey;
5
29
  data: T;
6
30
  };
7
- /** Result of upgrade operation, may include warning if migration failed */
8
- export type UpgradeResult<T> = Versioned<T> & {
31
+ /** Create a DataVersioned wrapper with correct shape */
32
+ export declare function makeDataVersioned<T>(version: DataVersionKey, data: T): DataVersioned<T>;
33
+ /** Result of migration operation, may include warning if migration failed */
34
+ export type DataMigrationResult<T> = DataVersioned<T> & {
9
35
  warning?: string;
10
36
  };
11
- /** Internal builder for chaining migrations */
12
- declare class DataModelBuilder<State> {
37
+ /** Thrown by recover() to signal unrecoverable data. */
38
+ export declare class DataUnrecoverableError extends Error {
39
+ name: string;
40
+ constructor(dataVersion: DataVersionKey);
41
+ }
42
+ export declare function isDataUnrecoverableError(error: unknown): error is DataUnrecoverableError;
43
+ type MigrationStep = {
44
+ fromVersion: DataVersionKey;
45
+ toVersion: DataVersionKey;
46
+ migrate: (data: unknown) => unknown;
47
+ };
48
+ /**
49
+ * Default recover function for unknown versions.
50
+ * Use as fallback at the end of custom recover functions.
51
+ *
52
+ * @example
53
+ * .recover((version, data) => {
54
+ * if (version === 'legacy') {
55
+ * return transformLegacyData(data);
56
+ * }
57
+ * return defaultRecover(version, data);
58
+ * })
59
+ */
60
+ export declare const defaultRecover: DataRecoverFn<never>;
61
+ /** Symbol for internal builder creation method */
62
+ declare const FROM_BUILDER: unique symbol;
63
+ /** Internal state passed from builder to DataModel */
64
+ type BuilderState<S> = {
65
+ versionChain: DataVersionKey[];
66
+ steps: MigrationStep[];
67
+ initialDataFn: () => S;
68
+ recoverFn?: DataRecoverFn<S>;
69
+ };
70
+ /**
71
+ * Final builder state after recover() is called.
72
+ * Only allows calling create() to finalize the DataModel.
73
+ *
74
+ * @typeParam VersionedData - Map of version keys to their data types
75
+ * @typeParam CurrentVersion - The current (final) version in the chain
76
+ * @internal
77
+ */
78
+ declare class DataModelBuilderWithRecover<VersionedData extends DataVersionMap, CurrentVersion extends keyof VersionedData & string> {
79
+ private readonly versionChain;
13
80
  private readonly migrationSteps;
14
- private constructor();
15
- /** Start a migration chain from an initial type */
16
- static from<T = unknown>(): DataModelBuilder<T>;
17
- /** Add a migration step */
18
- migrate<Next>(fn: MigrationFn<State, Next>): DataModelBuilder<Next>;
19
- /** Finalize with initial data, creating the DataModel */
20
- create<S>(initialData: () => S, ..._: [State] extends [S] ? [] : [never]): DataModel<S>;
81
+ private readonly recoverFn;
82
+ /** @internal */
83
+ constructor({ versionChain, steps, recoverFn, }: {
84
+ versionChain: DataVersionKey[];
85
+ steps: MigrationStep[];
86
+ recoverFn: DataRecoverFn<VersionedData[CurrentVersion]>;
87
+ });
88
+ /**
89
+ * Finalize the DataModel with initial data factory.
90
+ *
91
+ * The initial data factory is called when creating new blocks or when
92
+ * migration/recovery fails and data must be reset.
93
+ *
94
+ * @param initialData - Factory function returning initial state (must exactly match CurrentVersion's data type)
95
+ * @returns Finalized DataModel instance
96
+ *
97
+ * @example
98
+ * .init(() => ({ numbers: [], labels: [], description: '' }))
99
+ */
100
+ init<S extends VersionedData[CurrentVersion]>(initialData: DataCreateFn<S>, ..._noExtraKeys: Exclude<keyof S, keyof VersionedData[CurrentVersion]> extends never ? [] : [never]): DataModel<VersionedData[CurrentVersion]>;
101
+ }
102
+ /**
103
+ * Internal builder for constructing DataModel with type-safe migration chains.
104
+ *
105
+ * Tracks the current version through the generic type system, ensuring:
106
+ * - Migration functions receive correctly typed input
107
+ * - Migration functions must return the correct output type
108
+ * - Version keys must exist in the VersionedData map
109
+ * - All versions must be covered before calling init()
110
+ *
111
+ * @typeParam VersionedData - Map of version keys to their data types
112
+ * @typeParam CurrentVersion - The current version in the migration chain
113
+ * @typeParam RemainingVersions - Versions not yet covered by migrations
114
+ * @internal
115
+ */
116
+ declare class DataModelMigrationChain<VersionedData extends DataVersionMap, CurrentVersion extends keyof VersionedData & string, RemainingVersions extends keyof VersionedData & string = Exclude<keyof VersionedData & string, CurrentVersion>> {
117
+ private readonly versionChain;
118
+ private readonly migrationSteps;
119
+ /** @internal */
120
+ constructor({ versionChain, steps, }: {
121
+ versionChain: DataVersionKey[];
122
+ steps?: MigrationStep[];
123
+ });
124
+ /**
125
+ * Add a migration step to transform data from current version to next version.
126
+ *
127
+ * Migration functions:
128
+ * - Receive data typed as the current version's data type (readonly)
129
+ * - Must return data matching the target version's data type
130
+ * - Should be pure functions (no side effects)
131
+ * - May throw errors (will result in data reset with warning)
132
+ *
133
+ * @typeParam NextVersion - The target version key (must be in RemainingVersions)
134
+ * @param nextVersion - The version key to migrate to
135
+ * @param fn - Migration function transforming current data to next version
136
+ * @returns Builder with updated current version
137
+ *
138
+ * @example
139
+ * .migrate(Version.V2, (data) => ({ ...data, labels: [] }))
140
+ */
141
+ migrate<NextVersion extends RemainingVersions>(nextVersion: NextVersion, fn: DataMigrateFn<VersionedData[CurrentVersion], VersionedData[NextVersion]>): DataModelMigrationChain<VersionedData, NextVersion, Exclude<RemainingVersions, NextVersion>>;
142
+ /**
143
+ * Set a recovery handler for unknown or legacy versions.
144
+ *
145
+ * The recover function is called when data has a version not in the migration chain.
146
+ * It should either:
147
+ * - Transform the data to the current version's format and return it
148
+ * - Call `defaultRecover(version, data)` to signal unrecoverable data
149
+ *
150
+ * Can only be called once. After calling, only `init()` is available.
151
+ *
152
+ * @param fn - Recovery function that transforms unknown data or throws
153
+ * @returns Builder with only init() method available
154
+ *
155
+ * @example
156
+ * .recover((version, data) => {
157
+ * if (version === 'legacy' && isLegacyFormat(data)) {
158
+ * return transformLegacy(data);
159
+ * }
160
+ * return defaultRecover(version, data);
161
+ * })
162
+ */
163
+ recover(fn: DataRecoverFn<VersionedData[CurrentVersion]>): DataModelBuilderWithRecover<VersionedData, CurrentVersion>;
164
+ /**
165
+ * Finalize the DataModel with initial data factory.
166
+ *
167
+ * Can only be called when all versions in VersionedData have been covered
168
+ * by the migration chain (RemainingVersions is empty).
169
+ *
170
+ * The initial data factory is called when creating new blocks or when
171
+ * migration/recovery fails and data must be reset.
172
+ *
173
+ * @param initialData - Factory function returning initial state (must exactly match CurrentVersion's data type)
174
+ * @returns Finalized DataModel instance
175
+ *
176
+ * @example
177
+ * .init(() => ({ numbers: [], labels: [], description: '' }))
178
+ */
179
+ init<S extends VersionedData[CurrentVersion]>(this: DataModelMigrationChain<VersionedData, CurrentVersion, never>, initialData: DataCreateFn<S>, ..._noExtraKeys: Exclude<keyof S, keyof VersionedData[CurrentVersion]> extends never ? [] : [never]): DataModel<VersionedData[CurrentVersion]>;
180
+ }
181
+ /**
182
+ * Builder entry point for creating DataModel with type-safe migrations.
183
+ *
184
+ * @typeParam VersionedData - Map of version keys to their data types
185
+ *
186
+ * @example
187
+ * const Version = defineDataVersions({
188
+ * V1: 'v1',
189
+ * V2: 'v2',
190
+ * });
191
+ *
192
+ * type VersionedData = {
193
+ * [Version.V1]: { count: number };
194
+ * [Version.V2]: { count: number; label: string };
195
+ * };
196
+ *
197
+ * const dataModel = new DataModelBuilder<VersionedData>()
198
+ * .from(Version.V1)
199
+ * .migrate(Version.V2, (data) => ({ ...data, label: '' }))
200
+ * .init(() => ({ count: 0, label: '' }));
201
+ */
202
+ export declare class DataModelBuilder<VersionedData extends DataVersionMap> {
203
+ /**
204
+ * Start a migration chain from an initial version.
205
+ *
206
+ * @typeParam InitialVersion - The starting version key (inferred from argument)
207
+ * @param initialVersion - The version key to start from
208
+ * @returns Migration chain builder for adding migrations
209
+ *
210
+ * @example
211
+ * new DataModelBuilder<VersionedData>()
212
+ * .from(Version.V1)
213
+ * .migrate(Version.V2, (data) => ({ ...data, newField: '' }))
214
+ */
215
+ from<InitialVersion extends keyof VersionedData & string>(initialVersion: InitialVersion): DataModelMigrationChain<VersionedData, InitialVersion, Exclude<keyof VersionedData & string, InitialVersion>>;
21
216
  }
22
217
  /**
23
218
  * DataModel defines the block's data structure, initial values, and migrations.
24
219
  * Used by BlockModelV3 to manage data state.
25
220
  *
221
+ * Two ways to create a DataModel:
222
+ *
223
+ * 1. **Simple (no migrations)** - Use `DataModel.create()`:
26
224
  * @example
27
- * // Simple data model (no migrations)
28
225
  * const dataModel = DataModel.create<BlockData>(() => ({
29
226
  * numbers: [],
30
227
  * labels: [],
31
228
  * }));
32
229
  *
33
- * // Data model with migrations
34
- * const dataModel = DataModel
35
- * .from<V1>()
36
- * .migrate((data) => ({ ...data, labels: [] })) // v1 → v2
37
- * .migrate((data) => ({ ...data, description: '' })) // v2 → v3
38
- * .create<BlockData>(() => ({ numbers: [], labels: [], description: '' }));
230
+ * 2. **With migrations** - Use `new DataModelBuilder<VersionedData>()`:
231
+ * @example
232
+ * const Version = defineDataVersions({
233
+ * V1: 'v1',
234
+ * V2: 'v2',
235
+ * V3: 'v3',
236
+ * });
237
+ *
238
+ * type VersionedData = {
239
+ * [Version.V1]: { numbers: number[] };
240
+ * [Version.V2]: { numbers: number[]; labels: string[] };
241
+ * [Version.V3]: { numbers: number[]; labels: string[]; description: string };
242
+ * };
243
+ *
244
+ * const dataModel = new DataModelBuilder<VersionedData>()
245
+ * .from(Version.V1)
246
+ * .migrate(Version.V2, (data) => ({ ...data, labels: [] }))
247
+ * .migrate(Version.V3, (data) => ({ ...data, description: '' }))
248
+ * .recover((version, data) => {
249
+ * if (version === 'legacy' && typeof data === 'object' && data !== null && 'numbers' in data) {
250
+ * return { numbers: (data as { numbers: number[] }).numbers, labels: [], description: '' };
251
+ * }
252
+ * return defaultRecover(version, data);
253
+ * })
254
+ * .init(() => ({ numbers: [], labels: [], description: '' }));
39
255
  */
40
256
  export declare class DataModel<State> {
257
+ private readonly versionChain;
41
258
  private readonly steps;
42
- private readonly _initialData;
259
+ private readonly initialDataFn;
260
+ private readonly recoverFn;
43
261
  private constructor();
44
- /** Start a migration chain from an initial type */
45
- static from<S>(): DataModelBuilder<S>;
46
- /** Create a data model with just initial data (no migrations) */
47
- static create<S>(initialData: () => S): DataModel<S>;
48
- /** Create from builder (internal use) */
49
- static _fromBuilder<S>(steps: Array<(x: unknown) => unknown>, initialData: () => S): DataModel<S>;
50
262
  /**
51
- * Latest version number.
52
- * Version 1 = initial state, each migration adds 1.
263
+ * Create a DataModel with just initial data (no migrations).
264
+ *
265
+ * Use this for simple blocks that don't need version migrations.
266
+ * The version will be set to an internal default value.
267
+ *
268
+ * @typeParam S - The state type
269
+ * @param initialData - Factory function returning initial state
270
+ * @param version - Optional custom version key (defaults to internal version)
271
+ * @returns Finalized DataModel instance
272
+ *
273
+ * @example
274
+ * const dataModel = DataModel.create<BlockData>(() => ({
275
+ * numbers: [],
276
+ * labels: [],
277
+ * }));
278
+ */
279
+ static create<S>(initialData: () => S, version?: DataVersionKey): DataModel<S>;
280
+ /**
281
+ * Internal method for creating DataModel from builder.
282
+ * Uses Symbol key to prevent external access.
283
+ * @internal
284
+ */
285
+ static [FROM_BUILDER]<S>(state: BuilderState<S>): DataModel<S>;
286
+ /**
287
+ * The latest (current) version key in the migration chain.
288
+ */
289
+ get version(): DataVersionKey;
290
+ /**
291
+ * Number of migration steps defined.
53
292
  */
54
- get version(): number;
55
- /** Number of migration steps */
56
293
  get migrationCount(): number;
57
- /** Get initial data */
294
+ /**
295
+ * Get a fresh copy of the initial data.
296
+ */
58
297
  initialData(): State;
59
- /** Get default data wrapped with current version */
60
- getDefaultData(): Versioned<State>;
61
298
  /**
62
- * Upgrade versioned data from any version to the latest.
63
- * Applies only the migrations needed (skips already-applied ones).
64
- * If a migration fails, returns default data with a warning.
299
+ * Get initial data wrapped with current version.
300
+ * Used when creating new blocks or resetting to defaults.
301
+ */
302
+ getDefaultData(): DataVersioned<State>;
303
+ private recoverFrom;
304
+ /**
305
+ * Migrate versioned data from any version to the latest.
306
+ *
307
+ * - If data is already at latest version, returns as-is
308
+ * - If version is in chain, applies needed migrations
309
+ * - If version is unknown, calls recover function
310
+ * - If migration/recovery fails, returns default data with warning
311
+ *
312
+ * @param versioned - Data with version tag
313
+ * @returns Migration result with data at latest version
65
314
  */
66
- upgrade(versioned: Versioned<unknown>): UpgradeResult<State>;
315
+ migrate(versioned: DataVersioned<unknown>): DataMigrationResult<State>;
67
316
  /**
68
317
  * Register callbacks for use in the VM.
69
318
  * Called by BlockModelV3.create() to set up internal callbacks.
70
319
  *
71
- * All callbacks are prefixed with `__pl_` to indicate internal SDK use:
72
- * - `__pl_data_initial`: returns initial data for new blocks
73
- * - `__pl_data_upgrade`: upgrades versioned data from any version to latest
74
- * - `__pl_storage_initial`: returns initial BlockStorage as JSON string
320
+ * @internal
75
321
  */
76
322
  registerCallbacks(): void;
77
323
  }
@@ -1 +1 @@
1
- {"version":3,"file":"block_migrations.d.ts","sourceRoot":"","sources":["../src/block_migrations.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,WAAW,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK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