@contentful/experience-design-system-cli 2.25.1-dev-build-fd6bdcd.0 → 2.25.1-dev-build-298eb6a.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.25.1-dev-build-fd6bdcd.0",
3
+ "version": "2.25.1-dev-build-298eb6a.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -26,6 +26,15 @@ export interface StepRow {
26
26
  }
27
27
  export declare function getPipelineDbPath(): string;
28
28
  export declare function openPipelineDb(dbPath?: string): DatabaseSync;
29
+ export type RawPropTokenPathKind = 'set' | 'allowed';
30
+ export interface RawPropTokenPathGroup {
31
+ componentId: string;
32
+ propName: string;
33
+ kind: RawPropTokenPathKind;
34
+ paths: string[];
35
+ }
36
+ export declare function replaceRawPropTokenPaths(db: DatabaseSync, sessionId: string, componentId: string, propName: string, kind: RawPropTokenPathKind, paths: string[]): void;
37
+ export declare function loadRawPropTokenPaths(db: DatabaseSync, sessionId: string): RawPropTokenPathGroup[];
29
38
  export interface ApplyToolCallsResult {
30
39
  classified: number;
31
40
  excluded: number;
@@ -185,6 +185,40 @@ export function openPipelineDb(dbPath) {
185
185
  }
186
186
  }
187
187
  function applyDbMigrations(db) {
188
+ const migrations = [
189
+ {
190
+ name: '001-raw-prop-token-paths',
191
+ sql: `
192
+ CREATE TABLE IF NOT EXISTS raw_prop_token_paths (
193
+ session_id TEXT NOT NULL,
194
+ component_id TEXT NOT NULL,
195
+ prop_name TEXT NOT NULL,
196
+ kind TEXT NOT NULL CHECK (kind IN ('set', 'allowed')),
197
+ position INTEGER NOT NULL,
198
+ path TEXT NOT NULL,
199
+ PRIMARY KEY (session_id, component_id, prop_name, kind, position),
200
+ FOREIGN KEY (session_id, component_id, prop_name)
201
+ REFERENCES raw_props(session_id, component_id, name) ON DELETE CASCADE
202
+ );
203
+ `,
204
+ },
205
+ ];
206
+ const hasAppliedMigration = db.prepare('SELECT 1 FROM migrations WHERE name = ?');
207
+ const recordMigration = db.prepare('INSERT INTO migrations (name, applied_at) VALUES (?, ?)');
208
+ for (const migration of migrations) {
209
+ if (hasAppliedMigration.get(migration.name))
210
+ continue;
211
+ db.exec('BEGIN');
212
+ try {
213
+ db.exec(migration.sql);
214
+ recordMigration.run(migration.name, new Date().toISOString());
215
+ db.exec('COMMIT');
216
+ }
217
+ catch (e) {
218
+ db.exec('ROLLBACK');
219
+ throw e;
220
+ }
221
+ }
188
222
  const cols = db.prepare('PRAGMA table_info(raw_slots)').all();
189
223
  if (!cols.some((c) => c.name === 'required')) {
190
224
  db.exec('ALTER TABLE raw_slots ADD COLUMN required INTEGER NOT NULL DEFAULT 1 CHECK (required IN (0, 1))');
@@ -337,6 +371,50 @@ function applyDbMigrations(db) {
337
371
  `);
338
372
  }
339
373
  }
374
+ export function replaceRawPropTokenPaths(db, sessionId, componentId, propName, kind, paths) {
375
+ const deletePaths = db.prepare(`DELETE FROM raw_prop_token_paths
376
+ WHERE session_id = ? AND component_id = ? AND prop_name = ? AND kind = ?`);
377
+ const insertPath = db.prepare(`INSERT INTO raw_prop_token_paths (session_id, component_id, prop_name, kind, position, path)
378
+ VALUES (?, ?, ?, ?, ?, ?)`);
379
+ db.exec('BEGIN');
380
+ try {
381
+ deletePaths.run(sessionId, componentId, propName, kind);
382
+ paths.forEach((path, position) => {
383
+ insertPath.run(sessionId, componentId, propName, kind, position, path);
384
+ });
385
+ db.exec('COMMIT');
386
+ }
387
+ catch (e) {
388
+ db.exec('ROLLBACK');
389
+ throw e;
390
+ }
391
+ }
392
+ export function loadRawPropTokenPaths(db, sessionId) {
393
+ const rows = db
394
+ .prepare(`SELECT component_id, prop_name, kind, position, path
395
+ FROM raw_prop_token_paths
396
+ WHERE session_id = ?
397
+ ORDER BY component_id, prop_name, kind, position`)
398
+ .all(sessionId);
399
+ const groups = [];
400
+ for (const row of rows) {
401
+ const previous = groups.at(-1);
402
+ if (previous &&
403
+ previous.componentId === row.component_id &&
404
+ previous.propName === row.prop_name &&
405
+ previous.kind === row.kind) {
406
+ previous.paths.push(row.path);
407
+ continue;
408
+ }
409
+ groups.push({
410
+ componentId: row.component_id,
411
+ propName: row.prop_name,
412
+ kind: row.kind,
413
+ paths: [row.path],
414
+ });
415
+ }
416
+ return groups;
417
+ }
340
418
  export function loadComponentReviewMetadata(db, sessionId, componentName) {
341
419
  const compRow = db
342
420
  .prepare(`SELECT component_id, source, source_path FROM raw_components WHERE session_id = ? AND name = ?`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.25.1-dev-build-fd6bdcd.0",
3
+ "version": "2.25.1-dev-build-298eb6a.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -34,10 +34,10 @@
34
34
  "react": "^18.3.1",
35
35
  "react-devtools-core": "^4.19.1",
36
36
  "react-dom": "^18.3.1",
37
- "@contentful/experience-design-system-client": "2.25.1-dev-build-fd6bdcd.0",
38
- "@contentful/experience-design-system-extraction": "2.25.1-dev-build-fd6bdcd.0",
39
- "@contentful/experience-design-system-generation": "2.25.1-dev-build-fd6bdcd.0",
40
- "@contentful/experience-design-system-types": "2.25.1-dev-build-fd6bdcd.0"
37
+ "@contentful/experience-design-system-extraction": "2.25.1-dev-build-298eb6a.0",
38
+ "@contentful/experience-design-system-types": "2.25.1-dev-build-298eb6a.0",
39
+ "@contentful/experience-design-system-generation": "2.25.1-dev-build-298eb6a.0",
40
+ "@contentful/experience-design-system-client": "2.25.1-dev-build-298eb6a.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@tsconfig/node24": "^24.0.4",