@contentful/experience-design-system-cli 2.33.1-dev-build-9dba4a6.0 → 2.33.1-dev-build-06f1835.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 +1 -1
- package/dist/src/index.js +236 -90
- package/dist/src/session/core/components/group-allowed-values-by-prop.d.ts +2 -0
- package/dist/src/session/core/components/plan-cdf-restore.d.ts +2 -33
- package/dist/src/session/core/components/snapshot-types.d.ts +33 -0
- package/dist/src/session/core/shared/memoize-by-key.d.ts +1 -0
- package/dist/src/session/repositories/components/raw/interfaces/raw-component-row.d.ts +10 -0
- package/dist/src/session/repositories/components/raw/interfaces/raw-prop-row.d.ts +14 -0
- package/dist/src/session/repositories/components/raw/interfaces/raw-slot-allowed-component-row.d.ts +6 -0
- package/dist/src/session/repositories/components/raw/interfaces/raw-slot-row.d.ts +7 -0
- package/dist/src/session/repositories/components/raw/read.d.ts +12 -5
- package/dist/src/session/repositories/components/raw/reads/get-classified-props.d.ts +3 -0
- package/dist/src/session/repositories/components/raw/reads/get-component-descriptions.d.ts +3 -0
- package/dist/src/session/repositories/components/raw/reads/get-raw-component-rows.d.ts +3 -0
- package/dist/src/session/repositories/components/raw/reads/get-raw-prop-allowed-value-rows.d.ts +3 -0
- package/dist/src/session/repositories/components/raw/reads/get-raw-prop-allowed-values.d.ts +3 -0
- package/dist/src/session/repositories/components/raw/reads/get-raw-prop-name-at-position.d.ts +2 -0
- package/dist/src/session/repositories/components/raw/reads/get-raw-prop-rows.d.ts +3 -0
- package/dist/src/session/repositories/components/raw/reads/get-raw-slot-allowed-component-rows.d.ts +3 -0
- package/dist/src/session/repositories/components/raw/reads/get-raw-slot-rows.d.ts +3 -0
- package/dist/src/session/repositories/components/raw/reads/has-raw-prop-named.d.ts +2 -0
- package/dist/src/session/repositories/components/raw/row-mappers.d.ts +8 -0
- package/dist/src/session/repositories/components/raw/rows.d.ts +4 -0
- package/package.json +6 -6
package/dist/package.json
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -9211,7 +9211,7 @@ var init_replace_raw_prop_token_paths = __esm({
|
|
|
9211
9211
|
}
|
|
9212
9212
|
});
|
|
9213
9213
|
|
|
9214
|
-
// packages/experience-design-system-cli/src/session/repositories/components/raw/
|
|
9214
|
+
// packages/experience-design-system-cli/src/session/repositories/components/raw/row-mappers.ts
|
|
9215
9215
|
function mapRawComponentRow(row) {
|
|
9216
9216
|
return {
|
|
9217
9217
|
component_id: String(row.component_id),
|
|
@@ -9273,29 +9273,160 @@ function parseReviewReasons(raw) {
|
|
|
9273
9273
|
return [];
|
|
9274
9274
|
}
|
|
9275
9275
|
}
|
|
9276
|
-
|
|
9277
|
-
|
|
9276
|
+
var init_row_mappers = __esm({
|
|
9277
|
+
"packages/experience-design-system-cli/src/session/repositories/components/raw/row-mappers.ts"() {
|
|
9278
|
+
"use strict";
|
|
9279
|
+
}
|
|
9280
|
+
});
|
|
9281
|
+
|
|
9282
|
+
// packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-component-rows.ts
|
|
9283
|
+
function getRawComponentRows(db, sessionId2) {
|
|
9284
|
+
return db.prepare(
|
|
9278
9285
|
"SELECT component_id, name, source, framework, extraction_confidence, review_reasons, needs_review, source_path FROM raw_components WHERE session_id = ? ORDER BY rowid"
|
|
9279
9286
|
).all(sessionId2).map(mapRawComponentRow);
|
|
9280
|
-
|
|
9281
|
-
|
|
9282
|
-
|
|
9287
|
+
}
|
|
9288
|
+
var init_get_raw_component_rows = __esm({
|
|
9289
|
+
"packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-component-rows.ts"() {
|
|
9290
|
+
"use strict";
|
|
9291
|
+
init_row_mappers();
|
|
9292
|
+
}
|
|
9293
|
+
});
|
|
9294
|
+
|
|
9295
|
+
// packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-prop-rows.ts
|
|
9296
|
+
function getRawPropRows(db, sessionId2) {
|
|
9297
|
+
return db.prepare(
|
|
9283
9298
|
`SELECT component_id, name, type, required, category, default_value, description, token_reference, position,
|
|
9284
9299
|
rationale, source_start_line, source_end_line
|
|
9285
9300
|
FROM raw_props WHERE session_id = ? ORDER BY component_id, position`
|
|
9286
9301
|
).all(sessionId2).map(mapRawPropRow);
|
|
9287
|
-
|
|
9302
|
+
}
|
|
9303
|
+
var init_get_raw_prop_rows = __esm({
|
|
9304
|
+
"packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-prop-rows.ts"() {
|
|
9305
|
+
"use strict";
|
|
9306
|
+
init_row_mappers();
|
|
9307
|
+
}
|
|
9308
|
+
});
|
|
9309
|
+
|
|
9310
|
+
// packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-prop-allowed-value-rows.ts
|
|
9311
|
+
function getRawPropAllowedValueRows(db, sessionId2) {
|
|
9312
|
+
return db.prepare(
|
|
9288
9313
|
`SELECT component_id, prop_name, position, value
|
|
9289
9314
|
FROM raw_prop_allowed_values WHERE session_id = ? ORDER BY component_id, prop_name, position`
|
|
9290
9315
|
).all(sessionId2).map(mapAllowedValueSnapshotRow);
|
|
9291
|
-
|
|
9316
|
+
}
|
|
9317
|
+
var init_get_raw_prop_allowed_value_rows = __esm({
|
|
9318
|
+
"packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-prop-allowed-value-rows.ts"() {
|
|
9319
|
+
"use strict";
|
|
9320
|
+
init_row_mappers();
|
|
9321
|
+
}
|
|
9322
|
+
});
|
|
9323
|
+
|
|
9324
|
+
// packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-slot-rows.ts
|
|
9325
|
+
function getRawSlotRows(db, sessionId2) {
|
|
9326
|
+
return db.prepare(
|
|
9292
9327
|
`SELECT component_id, name, is_default, description, position
|
|
9293
9328
|
FROM raw_slots WHERE session_id = ? ORDER BY component_id, position`
|
|
9294
9329
|
).all(sessionId2).map(mapRawSlotRow);
|
|
9295
|
-
|
|
9330
|
+
}
|
|
9331
|
+
var init_get_raw_slot_rows = __esm({
|
|
9332
|
+
"packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-slot-rows.ts"() {
|
|
9333
|
+
"use strict";
|
|
9334
|
+
init_row_mappers();
|
|
9335
|
+
}
|
|
9336
|
+
});
|
|
9337
|
+
|
|
9338
|
+
// packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-slot-allowed-component-rows.ts
|
|
9339
|
+
function getRawSlotAllowedComponentRows(db, sessionId2) {
|
|
9340
|
+
return db.prepare(
|
|
9296
9341
|
`SELECT component_id, slot_name, position, allowed_component
|
|
9297
9342
|
FROM raw_slot_allowed_components WHERE session_id = ? ORDER BY component_id, slot_name, position`
|
|
9298
9343
|
).all(sessionId2).map(mapRawSlotAllowedComponentRow);
|
|
9344
|
+
}
|
|
9345
|
+
var init_get_raw_slot_allowed_component_rows = __esm({
|
|
9346
|
+
"packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-slot-allowed-component-rows.ts"() {
|
|
9347
|
+
"use strict";
|
|
9348
|
+
init_row_mappers();
|
|
9349
|
+
}
|
|
9350
|
+
});
|
|
9351
|
+
|
|
9352
|
+
// packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-classified-props.ts
|
|
9353
|
+
function getClassifiedProps(db, sessionId2) {
|
|
9354
|
+
return db.prepare(
|
|
9355
|
+
`SELECT component_id, name, position, cdf_type, cdf_category, cdf_token_kind
|
|
9356
|
+
FROM raw_props WHERE session_id = ? AND cdf_type IS NOT NULL`
|
|
9357
|
+
).all(sessionId2).map((row) => ({
|
|
9358
|
+
component_id: String(row.component_id),
|
|
9359
|
+
name: String(row.name),
|
|
9360
|
+
position: Number(row.position),
|
|
9361
|
+
cdf_type: String(row.cdf_type),
|
|
9362
|
+
cdf_category: String(row.cdf_category),
|
|
9363
|
+
cdf_token_kind: row.cdf_token_kind === null ? null : String(row.cdf_token_kind)
|
|
9364
|
+
}));
|
|
9365
|
+
}
|
|
9366
|
+
var init_get_classified_props = __esm({
|
|
9367
|
+
"packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-classified-props.ts"() {
|
|
9368
|
+
"use strict";
|
|
9369
|
+
}
|
|
9370
|
+
});
|
|
9371
|
+
|
|
9372
|
+
// packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-component-descriptions.ts
|
|
9373
|
+
function getComponentDescriptions(db, sessionId2) {
|
|
9374
|
+
return db.prepare(
|
|
9375
|
+
`SELECT component_id, description
|
|
9376
|
+
FROM raw_components WHERE session_id = ? AND description IS NOT NULL`
|
|
9377
|
+
).all(sessionId2).map((row) => ({
|
|
9378
|
+
component_id: String(row.component_id),
|
|
9379
|
+
description: String(row.description)
|
|
9380
|
+
}));
|
|
9381
|
+
}
|
|
9382
|
+
var init_get_component_descriptions = __esm({
|
|
9383
|
+
"packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-component-descriptions.ts"() {
|
|
9384
|
+
"use strict";
|
|
9385
|
+
}
|
|
9386
|
+
});
|
|
9387
|
+
|
|
9388
|
+
// packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-prop-allowed-values.ts
|
|
9389
|
+
function getRawPropAllowedValues(db, sessionId2) {
|
|
9390
|
+
return db.prepare(`SELECT component_id, prop_name, position, value FROM raw_prop_allowed_values WHERE session_id = ?`).all(sessionId2).map(mapAllowedValueSnapshotRow);
|
|
9391
|
+
}
|
|
9392
|
+
var init_get_raw_prop_allowed_values = __esm({
|
|
9393
|
+
"packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-prop-allowed-values.ts"() {
|
|
9394
|
+
"use strict";
|
|
9395
|
+
init_row_mappers();
|
|
9396
|
+
}
|
|
9397
|
+
});
|
|
9398
|
+
|
|
9399
|
+
// packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-prop-name-at-position.ts
|
|
9400
|
+
function getRawPropNameAtPosition(db, sessionId2, componentId, position) {
|
|
9401
|
+
const row = db.prepare(`SELECT name FROM raw_props WHERE session_id = ? AND component_id = ? AND position = ?`).get(sessionId2, componentId, position);
|
|
9402
|
+
return row ? String(row.name) : null;
|
|
9403
|
+
}
|
|
9404
|
+
var init_get_raw_prop_name_at_position = __esm({
|
|
9405
|
+
"packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-prop-name-at-position.ts"() {
|
|
9406
|
+
"use strict";
|
|
9407
|
+
}
|
|
9408
|
+
});
|
|
9409
|
+
|
|
9410
|
+
// packages/experience-design-system-cli/src/session/repositories/components/raw/reads/has-raw-prop-named.ts
|
|
9411
|
+
function hasRawPropNamed(db, sessionId2, componentId, propName) {
|
|
9412
|
+
const row = db.prepare("SELECT 1 as one FROM raw_props WHERE session_id = ? AND component_id = ? AND name = ?").get(sessionId2, componentId, propName);
|
|
9413
|
+
return row !== void 0;
|
|
9414
|
+
}
|
|
9415
|
+
var init_has_raw_prop_named = __esm({
|
|
9416
|
+
"packages/experience-design-system-cli/src/session/repositories/components/raw/reads/has-raw-prop-named.ts"() {
|
|
9417
|
+
"use strict";
|
|
9418
|
+
}
|
|
9419
|
+
});
|
|
9420
|
+
|
|
9421
|
+
// packages/experience-design-system-cli/src/session/repositories/components/raw/read.ts
|
|
9422
|
+
function getRawComponents(db, sessionId2, allowedNames) {
|
|
9423
|
+
const all = getRawComponentRows(db, sessionId2);
|
|
9424
|
+
const components = allowedNames ? all.filter((c2) => allowedNames.has(c2.name)) : all;
|
|
9425
|
+
if (components.length === 0) return [];
|
|
9426
|
+
const props = getRawPropRows(db, sessionId2);
|
|
9427
|
+
const allowedValues = getRawPropAllowedValueRows(db, sessionId2);
|
|
9428
|
+
const slots = getRawSlotRows(db, sessionId2);
|
|
9429
|
+
const allowedComponents = getRawSlotAllowedComponentRows(db, sessionId2);
|
|
9299
9430
|
const propsByComponent = indexRowsByKey(props, (p) => p.component_id);
|
|
9300
9431
|
const allowedValuesByProp = indexRowsByKey(allowedValues, (av) => `${av.component_id}::${av.prop_name}`);
|
|
9301
9432
|
const slotsByComponent = indexRowsByKey(slots, (s) => s.component_id);
|
|
@@ -9339,39 +9470,27 @@ function getRawComponents(db, sessionId2, allowedNames) {
|
|
|
9339
9470
|
})
|
|
9340
9471
|
);
|
|
9341
9472
|
}
|
|
9342
|
-
function getClassifiedProps(db, sessionId2) {
|
|
9343
|
-
return db.prepare(
|
|
9344
|
-
`SELECT component_id, name, position, cdf_type, cdf_category, cdf_token_kind
|
|
9345
|
-
FROM raw_props WHERE session_id = ? AND cdf_type IS NOT NULL`
|
|
9346
|
-
).all(sessionId2).map((row) => ({
|
|
9347
|
-
component_id: String(row.component_id),
|
|
9348
|
-
name: String(row.name),
|
|
9349
|
-
position: Number(row.position),
|
|
9350
|
-
cdf_type: String(row.cdf_type),
|
|
9351
|
-
cdf_category: String(row.cdf_category),
|
|
9352
|
-
cdf_token_kind: row.cdf_token_kind === null ? null : String(row.cdf_token_kind)
|
|
9353
|
-
}));
|
|
9354
|
-
}
|
|
9355
|
-
function getComponentDescriptions(db, sessionId2) {
|
|
9356
|
-
return db.prepare(
|
|
9357
|
-
`SELECT component_id, description
|
|
9358
|
-
FROM raw_components WHERE session_id = ? AND description IS NOT NULL`
|
|
9359
|
-
).all(sessionId2).map((row) => ({
|
|
9360
|
-
component_id: String(row.component_id),
|
|
9361
|
-
description: String(row.description)
|
|
9362
|
-
}));
|
|
9363
|
-
}
|
|
9364
|
-
function getRawPropAllowedValues(db, sessionId2) {
|
|
9365
|
-
return db.prepare(`SELECT component_id, prop_name, position, value FROM raw_prop_allowed_values WHERE session_id = ?`).all(sessionId2).map(mapAllowedValueSnapshotRow);
|
|
9366
|
-
}
|
|
9367
|
-
function getRawPropNameAtPosition(db, sessionId2, componentId, position) {
|
|
9368
|
-
const row = db.prepare(`SELECT name FROM raw_props WHERE session_id = ? AND component_id = ? AND position = ?`).get(sessionId2, componentId, position);
|
|
9369
|
-
return row ? String(row.name) : null;
|
|
9370
|
-
}
|
|
9371
9473
|
var init_read4 = __esm({
|
|
9372
9474
|
"packages/experience-design-system-cli/src/session/repositories/components/raw/read.ts"() {
|
|
9373
9475
|
"use strict";
|
|
9374
9476
|
init_index_rows_by_key();
|
|
9477
|
+
init_row_mappers();
|
|
9478
|
+
init_get_raw_component_rows();
|
|
9479
|
+
init_get_raw_prop_rows();
|
|
9480
|
+
init_get_raw_prop_allowed_value_rows();
|
|
9481
|
+
init_get_raw_slot_rows();
|
|
9482
|
+
init_get_raw_slot_allowed_component_rows();
|
|
9483
|
+
init_row_mappers();
|
|
9484
|
+
init_get_raw_component_rows();
|
|
9485
|
+
init_get_raw_prop_rows();
|
|
9486
|
+
init_get_raw_prop_allowed_value_rows();
|
|
9487
|
+
init_get_raw_slot_rows();
|
|
9488
|
+
init_get_raw_slot_allowed_component_rows();
|
|
9489
|
+
init_get_classified_props();
|
|
9490
|
+
init_get_component_descriptions();
|
|
9491
|
+
init_get_raw_prop_allowed_values();
|
|
9492
|
+
init_get_raw_prop_name_at_position();
|
|
9493
|
+
init_has_raw_prop_named();
|
|
9375
9494
|
}
|
|
9376
9495
|
});
|
|
9377
9496
|
|
|
@@ -9408,26 +9527,32 @@ function createRawProps(db, sessionId2, componentId, props) {
|
|
|
9408
9527
|
`INSERT INTO raw_prop_allowed_values (session_id, component_id, prop_name, position, value)
|
|
9409
9528
|
VALUES (?, ?, ?, ?, ?)`
|
|
9410
9529
|
);
|
|
9411
|
-
|
|
9412
|
-
|
|
9413
|
-
|
|
9414
|
-
|
|
9415
|
-
|
|
9416
|
-
|
|
9417
|
-
|
|
9418
|
-
|
|
9419
|
-
|
|
9420
|
-
|
|
9421
|
-
|
|
9422
|
-
|
|
9423
|
-
|
|
9424
|
-
|
|
9425
|
-
|
|
9426
|
-
|
|
9427
|
-
|
|
9428
|
-
|
|
9429
|
-
|
|
9430
|
-
|
|
9530
|
+
props.forEach((prop, position) => {
|
|
9531
|
+
insertPropRow(insertProp, sessionId2, componentId, prop, position);
|
|
9532
|
+
insertPropAllowedValues(insertAllowedValue, sessionId2, componentId, prop);
|
|
9533
|
+
});
|
|
9534
|
+
}
|
|
9535
|
+
function insertPropRow(insertProp, sessionId2, componentId, prop, position) {
|
|
9536
|
+
insertProp.run(
|
|
9537
|
+
sessionId2,
|
|
9538
|
+
componentId,
|
|
9539
|
+
prop.name,
|
|
9540
|
+
prop.type,
|
|
9541
|
+
prop.required ? 1 : 0,
|
|
9542
|
+
prop.category ?? null,
|
|
9543
|
+
prop.defaultValue ?? null,
|
|
9544
|
+
prop.description ?? null,
|
|
9545
|
+
prop.tokenReference ?? null,
|
|
9546
|
+
position,
|
|
9547
|
+
prop.sourceStartLine ?? null,
|
|
9548
|
+
prop.sourceEndLine ?? null
|
|
9549
|
+
);
|
|
9550
|
+
}
|
|
9551
|
+
function insertPropAllowedValues(insertAllowedValue, sessionId2, componentId, prop) {
|
|
9552
|
+
if (!prop.allowedValues) return;
|
|
9553
|
+
prop.allowedValues.forEach((value, position) => {
|
|
9554
|
+
insertAllowedValue.run(sessionId2, componentId, prop.name, position, value);
|
|
9555
|
+
});
|
|
9431
9556
|
}
|
|
9432
9557
|
function createRawSlots(db, sessionId2, componentId, slots) {
|
|
9433
9558
|
const insertSlot = db.prepare(
|
|
@@ -9438,13 +9563,19 @@ function createRawSlots(db, sessionId2, componentId, slots) {
|
|
|
9438
9563
|
`INSERT INTO raw_slot_allowed_components (session_id, component_id, slot_name, position, allowed_component)
|
|
9439
9564
|
VALUES (?, ?, ?, ?, ?)`
|
|
9440
9565
|
);
|
|
9441
|
-
|
|
9442
|
-
|
|
9443
|
-
|
|
9444
|
-
|
|
9445
|
-
|
|
9446
|
-
|
|
9447
|
-
|
|
9566
|
+
slots.forEach((slot, position) => {
|
|
9567
|
+
insertSlotRow(insertSlot, sessionId2, componentId, slot, position);
|
|
9568
|
+
insertSlotAllowedComponents(insertAllowedComponent, sessionId2, componentId, slot);
|
|
9569
|
+
});
|
|
9570
|
+
}
|
|
9571
|
+
function insertSlotRow(insertSlot, sessionId2, componentId, slot, position) {
|
|
9572
|
+
insertSlot.run(sessionId2, componentId, slot.name, slot.isDefault ? 1 : 0, slot.description ?? null, position);
|
|
9573
|
+
}
|
|
9574
|
+
function insertSlotAllowedComponents(insertAllowedComponent, sessionId2, componentId, slot) {
|
|
9575
|
+
if (!slot.allowedComponents) return;
|
|
9576
|
+
slot.allowedComponents.forEach((allowedComponent, position) => {
|
|
9577
|
+
insertAllowedComponent.run(sessionId2, componentId, slot.name, position, allowedComponent);
|
|
9578
|
+
});
|
|
9448
9579
|
}
|
|
9449
9580
|
function updateRawComponentsStatus(db, sessionId2, status) {
|
|
9450
9581
|
db.prepare("UPDATE raw_components SET status = ? WHERE session_id = ?").run(status, sessionId2);
|
|
@@ -9490,6 +9621,24 @@ var init_write4 = __esm({
|
|
|
9490
9621
|
}
|
|
9491
9622
|
});
|
|
9492
9623
|
|
|
9624
|
+
// packages/experience-design-system-cli/src/session/core/components/group-allowed-values-by-prop.ts
|
|
9625
|
+
function groupAllowedValuesByProp(avSnapshot, nameMatchedKeys) {
|
|
9626
|
+
const buckets = /* @__PURE__ */ new Map();
|
|
9627
|
+
for (const av of avSnapshot) {
|
|
9628
|
+
const key = `${av.component_id}::${av.prop_name}`;
|
|
9629
|
+
if (!nameMatchedKeys.has(key)) continue;
|
|
9630
|
+
const bucket = buckets.get(key) ?? { componentId: av.component_id, propName: av.prop_name, values: [] };
|
|
9631
|
+
bucket.values.push(av);
|
|
9632
|
+
buckets.set(key, bucket);
|
|
9633
|
+
}
|
|
9634
|
+
return [...buckets.values()];
|
|
9635
|
+
}
|
|
9636
|
+
var init_group_allowed_values_by_prop = __esm({
|
|
9637
|
+
"packages/experience-design-system-cli/src/session/core/components/group-allowed-values-by-prop.ts"() {
|
|
9638
|
+
"use strict";
|
|
9639
|
+
}
|
|
9640
|
+
});
|
|
9641
|
+
|
|
9493
9642
|
// packages/experience-design-system-cli/src/session/core/components/plan-cdf-restore.ts
|
|
9494
9643
|
function planCdfRestore(cdfSnapshot, descSnapshot, avSnapshot, currentProps) {
|
|
9495
9644
|
const byName = [];
|
|
@@ -9505,19 +9654,11 @@ function planCdfRestore(cdfSnapshot, descSnapshot, avSnapshot, currentProps) {
|
|
|
9505
9654
|
byPosition.push(snap);
|
|
9506
9655
|
}
|
|
9507
9656
|
}
|
|
9508
|
-
const buckets = /* @__PURE__ */ new Map();
|
|
9509
|
-
for (const av of avSnapshot) {
|
|
9510
|
-
const key = propKey(av.component_id, av.prop_name);
|
|
9511
|
-
if (!nameMatchedKeys.has(key)) continue;
|
|
9512
|
-
const bucket = buckets.get(key) ?? { componentId: av.component_id, propName: av.prop_name, values: [] };
|
|
9513
|
-
bucket.values.push(av);
|
|
9514
|
-
buckets.set(key, bucket);
|
|
9515
|
-
}
|
|
9516
9657
|
return {
|
|
9517
9658
|
byName,
|
|
9518
9659
|
byPosition,
|
|
9519
9660
|
descriptions: descSnapshot,
|
|
9520
|
-
allowedValues:
|
|
9661
|
+
allowedValues: groupAllowedValuesByProp(avSnapshot, nameMatchedKeys)
|
|
9521
9662
|
};
|
|
9522
9663
|
}
|
|
9523
9664
|
function propKey(componentId, propName) {
|
|
@@ -9526,6 +9667,24 @@ function propKey(componentId, propName) {
|
|
|
9526
9667
|
var init_plan_cdf_restore = __esm({
|
|
9527
9668
|
"packages/experience-design-system-cli/src/session/core/components/plan-cdf-restore.ts"() {
|
|
9528
9669
|
"use strict";
|
|
9670
|
+
init_group_allowed_values_by_prop();
|
|
9671
|
+
}
|
|
9672
|
+
});
|
|
9673
|
+
|
|
9674
|
+
// packages/experience-design-system-cli/src/session/core/shared/memoize-by-key.ts
|
|
9675
|
+
function memoizeByKey(lookup) {
|
|
9676
|
+
const cache = /* @__PURE__ */ new Map();
|
|
9677
|
+
return (a, b) => {
|
|
9678
|
+
const key = `${a}::${b}`;
|
|
9679
|
+
if (cache.has(key)) return cache.get(key);
|
|
9680
|
+
const value = lookup(a, b);
|
|
9681
|
+
cache.set(key, value);
|
|
9682
|
+
return value;
|
|
9683
|
+
};
|
|
9684
|
+
}
|
|
9685
|
+
var init_memoize_by_key = __esm({
|
|
9686
|
+
"packages/experience-design-system-cli/src/session/core/shared/memoize-by-key.ts"() {
|
|
9687
|
+
"use strict";
|
|
9529
9688
|
}
|
|
9530
9689
|
});
|
|
9531
9690
|
|
|
@@ -9585,8 +9744,8 @@ function storeRawComponents(db, sessionId2, components, options) {
|
|
|
9585
9744
|
}
|
|
9586
9745
|
if (options?.preserveCDF && cdfSnapshot.length > 0) {
|
|
9587
9746
|
const plan = planCdfRestore(cdfSnapshot, descSnapshot, avSnapshot, {
|
|
9588
|
-
hasPropNamed: (componentId, propName) =>
|
|
9589
|
-
propNameAtPosition:
|
|
9747
|
+
hasPropNamed: (componentId, propName) => hasRawPropNamed(db, sessionId2, componentId, propName),
|
|
9748
|
+
propNameAtPosition: memoizeByKey(
|
|
9590
9749
|
(componentId, position) => getRawPropNameAtPosition(db, sessionId2, componentId, position)
|
|
9591
9750
|
)
|
|
9592
9751
|
});
|
|
@@ -9598,20 +9757,6 @@ function storeRawComponents(db, sessionId2, components, options) {
|
|
|
9598
9757
|
updateSessionTimestamp(db, sessionId2, now);
|
|
9599
9758
|
});
|
|
9600
9759
|
}
|
|
9601
|
-
function hasPropByName(db, sessionId2, componentId, propName) {
|
|
9602
|
-
const row = db.prepare("SELECT 1 as one FROM raw_props WHERE session_id = ? AND component_id = ? AND name = ?").get(sessionId2, componentId, propName);
|
|
9603
|
-
return row !== void 0;
|
|
9604
|
-
}
|
|
9605
|
-
function memoize(lookup) {
|
|
9606
|
-
const cache = /* @__PURE__ */ new Map();
|
|
9607
|
-
return (componentId, position) => {
|
|
9608
|
-
const key = `${componentId}::${position}`;
|
|
9609
|
-
if (cache.has(key)) return cache.get(key);
|
|
9610
|
-
const value = lookup(componentId, position);
|
|
9611
|
-
cache.set(key, value);
|
|
9612
|
-
return value;
|
|
9613
|
-
};
|
|
9614
|
-
}
|
|
9615
9760
|
var init_store_raw_components = __esm({
|
|
9616
9761
|
"packages/experience-design-system-cli/src/session/services/components/store-raw-components.ts"() {
|
|
9617
9762
|
"use strict";
|
|
@@ -9620,6 +9765,7 @@ var init_store_raw_components = __esm({
|
|
|
9620
9765
|
init_read4();
|
|
9621
9766
|
init_write4();
|
|
9622
9767
|
init_plan_cdf_restore();
|
|
9768
|
+
init_memoize_by_key();
|
|
9623
9769
|
init_apply_cdf_restore();
|
|
9624
9770
|
}
|
|
9625
9771
|
});
|
|
@@ -1,34 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
name: string;
|
|
4
|
-
position: number;
|
|
5
|
-
cdf_type: string;
|
|
6
|
-
cdf_category: string;
|
|
7
|
-
cdf_token_kind: string | null;
|
|
8
|
-
}
|
|
9
|
-
export interface DescriptionSnapshotEntry {
|
|
10
|
-
component_id: string;
|
|
11
|
-
description: string;
|
|
12
|
-
}
|
|
13
|
-
export interface AllowedValueSnapshotEntry {
|
|
14
|
-
component_id: string;
|
|
15
|
-
prop_name: string;
|
|
16
|
-
position: number;
|
|
17
|
-
value: string;
|
|
18
|
-
}
|
|
19
|
-
export interface RestoredAllowedValues {
|
|
20
|
-
componentId: string;
|
|
21
|
-
propName: string;
|
|
22
|
-
values: AllowedValueSnapshotEntry[];
|
|
23
|
-
}
|
|
24
|
-
export interface CdfRestorePlan {
|
|
25
|
-
byName: CdfSnapshotEntry[];
|
|
26
|
-
byPosition: CdfSnapshotEntry[];
|
|
27
|
-
descriptions: DescriptionSnapshotEntry[];
|
|
28
|
-
allowedValues: RestoredAllowedValues[];
|
|
29
|
-
}
|
|
30
|
-
export interface CurrentPropsQuery {
|
|
31
|
-
hasPropNamed: (componentId: string, propName: string) => boolean;
|
|
32
|
-
propNameAtPosition: (componentId: string, position: number) => string | null;
|
|
33
|
-
}
|
|
1
|
+
import type { AllowedValueSnapshotEntry, CdfRestorePlan, CdfSnapshotEntry, CurrentPropsQuery, DescriptionSnapshotEntry } from './snapshot-types.js';
|
|
2
|
+
export type { AllowedValueSnapshotEntry, CdfRestorePlan, CdfSnapshotEntry, CurrentPropsQuery, DescriptionSnapshotEntry, RestoredAllowedValues, } from './snapshot-types.js';
|
|
34
3
|
export declare function planCdfRestore(cdfSnapshot: CdfSnapshotEntry[], descSnapshot: DescriptionSnapshotEntry[], avSnapshot: AllowedValueSnapshotEntry[], currentProps: CurrentPropsQuery): CdfRestorePlan;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface CdfSnapshotEntry {
|
|
2
|
+
component_id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
position: number;
|
|
5
|
+
cdf_type: string;
|
|
6
|
+
cdf_category: string;
|
|
7
|
+
cdf_token_kind: string | null;
|
|
8
|
+
}
|
|
9
|
+
export interface DescriptionSnapshotEntry {
|
|
10
|
+
component_id: string;
|
|
11
|
+
description: string;
|
|
12
|
+
}
|
|
13
|
+
export interface AllowedValueSnapshotEntry {
|
|
14
|
+
component_id: string;
|
|
15
|
+
prop_name: string;
|
|
16
|
+
position: number;
|
|
17
|
+
value: string;
|
|
18
|
+
}
|
|
19
|
+
export interface RestoredAllowedValues {
|
|
20
|
+
componentId: string;
|
|
21
|
+
propName: string;
|
|
22
|
+
values: AllowedValueSnapshotEntry[];
|
|
23
|
+
}
|
|
24
|
+
export interface CdfRestorePlan {
|
|
25
|
+
byName: CdfSnapshotEntry[];
|
|
26
|
+
byPosition: CdfSnapshotEntry[];
|
|
27
|
+
descriptions: DescriptionSnapshotEntry[];
|
|
28
|
+
allowedValues: RestoredAllowedValues[];
|
|
29
|
+
}
|
|
30
|
+
export interface CurrentPropsQuery {
|
|
31
|
+
hasPropNamed: (componentId: string, propName: string) => boolean;
|
|
32
|
+
propNameAtPosition: (componentId: string, position: number) => string | null;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function memoizeByKey<A extends string | number, B extends string | number, R>(lookup: (a: A, b: B) => R): (a: A, b: B) => R;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface RawPropRow {
|
|
2
|
+
component_id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
type: string;
|
|
5
|
+
required: number;
|
|
6
|
+
category: string | null;
|
|
7
|
+
default_value: string | null;
|
|
8
|
+
description: string | null;
|
|
9
|
+
token_reference: string | null;
|
|
10
|
+
position: number;
|
|
11
|
+
rationale: string | null;
|
|
12
|
+
source_start_line: number | null;
|
|
13
|
+
source_end_line: number | null;
|
|
14
|
+
}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import type { DatabaseSync } from 'node:sqlite';
|
|
2
2
|
import type { RawComponentDefinition } from '../../../../types.js';
|
|
3
|
-
|
|
3
|
+
export type { RawComponentRow, RawPropRow, RawSlotRow, RawSlotAllowedComponentRow } from './rows.js';
|
|
4
|
+
export { mapRawComponentRow, mapRawPropRow, mapRawSlotRow, mapRawSlotAllowedComponentRow, mapAllowedValueSnapshotRow, parseReviewReasons, } from './row-mappers.js';
|
|
5
|
+
export { getRawComponentRows } from './reads/get-raw-component-rows.js';
|
|
6
|
+
export { getRawPropRows } from './reads/get-raw-prop-rows.js';
|
|
7
|
+
export { getRawPropAllowedValueRows } from './reads/get-raw-prop-allowed-value-rows.js';
|
|
8
|
+
export { getRawSlotRows } from './reads/get-raw-slot-rows.js';
|
|
9
|
+
export { getRawSlotAllowedComponentRows } from './reads/get-raw-slot-allowed-component-rows.js';
|
|
10
|
+
export { getClassifiedProps } from './reads/get-classified-props.js';
|
|
11
|
+
export { getComponentDescriptions } from './reads/get-component-descriptions.js';
|
|
12
|
+
export { getRawPropAllowedValues } from './reads/get-raw-prop-allowed-values.js';
|
|
13
|
+
export { getRawPropNameAtPosition } from './reads/get-raw-prop-name-at-position.js';
|
|
14
|
+
export { hasRawPropNamed } from './reads/has-raw-prop-named.js';
|
|
4
15
|
export type RawComponentWithId = RawComponentDefinition & {
|
|
5
16
|
component_id: string;
|
|
6
17
|
};
|
|
7
18
|
export declare function getRawComponents(db: DatabaseSync, sessionId: string, allowedNames?: Set<string>): RawComponentWithId[];
|
|
8
|
-
export declare function getClassifiedProps(db: DatabaseSync, sessionId: string): CdfSnapshotEntry[];
|
|
9
|
-
export declare function getComponentDescriptions(db: DatabaseSync, sessionId: string): DescriptionSnapshotEntry[];
|
|
10
|
-
export declare function getRawPropAllowedValues(db: DatabaseSync, sessionId: string): AllowedValueSnapshotEntry[];
|
|
11
|
-
export declare function getRawPropNameAtPosition(db: DatabaseSync, sessionId: string, componentId: string, position: number): string | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AllowedValueSnapshotEntry } from '../../../core/components/plan-cdf-restore.js';
|
|
2
|
+
import type { RawComponentRow, RawPropRow, RawSlotAllowedComponentRow, RawSlotRow } from './rows.js';
|
|
3
|
+
export declare function mapRawComponentRow(row: Record<string, unknown>): RawComponentRow;
|
|
4
|
+
export declare function mapRawPropRow(row: Record<string, unknown>): RawPropRow;
|
|
5
|
+
export declare function mapAllowedValueSnapshotRow(row: Record<string, unknown>): AllowedValueSnapshotEntry;
|
|
6
|
+
export declare function mapRawSlotRow(row: Record<string, unknown>): RawSlotRow;
|
|
7
|
+
export declare function mapRawSlotAllowedComponentRow(row: Record<string, unknown>): RawSlotAllowedComponentRow;
|
|
8
|
+
export declare function parseReviewReasons(raw: string): string[];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { RawComponentRow } from './interfaces/raw-component-row.js';
|
|
2
|
+
export type { RawPropRow } from './interfaces/raw-prop-row.js';
|
|
3
|
+
export type { RawSlotRow } from './interfaces/raw-slot-row.js';
|
|
4
|
+
export type { RawSlotAllowedComponentRow } from './interfaces/raw-slot-allowed-component-row.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.33.1-dev-build-
|
|
3
|
+
"version": "2.33.1-dev-build-06f1835.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"svelte": "^5.56.4",
|
|
41
41
|
"ts-morph": "^27.0.2",
|
|
42
42
|
"typescript": "^5.9.3",
|
|
43
|
-
"@contentful/experience-design-system-cli-v2": "2.33.1-dev-build-
|
|
44
|
-
"@contentful/experience-design-system-types": "2.33.1-dev-build-
|
|
43
|
+
"@contentful/experience-design-system-cli-v2": "2.33.1-dev-build-06f1835.0",
|
|
44
|
+
"@contentful/experience-design-system-types": "2.33.1-dev-build-06f1835.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@tsconfig/node24": "^24.0.4",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"ink-testing-library": "^4.0.0",
|
|
54
54
|
"typescript-eslint": "^8.67.0",
|
|
55
55
|
"vitest": "^4.0.16",
|
|
56
|
-
"@contentful/experience-design-system-client": "2.33.1-dev-build-
|
|
57
|
-
"@contentful/experience-design-system-
|
|
58
|
-
"@contentful/experience-design-system-
|
|
56
|
+
"@contentful/experience-design-system-client": "2.33.1-dev-build-06f1835.0",
|
|
57
|
+
"@contentful/experience-design-system-extraction": "2.33.1-dev-build-06f1835.0",
|
|
58
|
+
"@contentful/experience-design-system-generation": "2.33.1-dev-build-06f1835.0"
|
|
59
59
|
},
|
|
60
60
|
"repository": {
|
|
61
61
|
"type": "git",
|