@contentful/experience-design-system-cli 2.33.1-dev-build-91bf692.0 → 2.33.1-dev-build-d7fc540.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 +245 -610
- package/dist/src/session/db.d.ts +8 -2
- package/package.json +6 -6
- package/dist/src/session/core/components/group-allowed-values-by-prop.d.ts +0 -2
- package/dist/src/session/core/components/mappers/map-raw-component-to-with-id.d.ts +0 -6
- package/dist/src/session/core/components/mappers/map-raw-prop-to-definition.d.ts +0 -4
- package/dist/src/session/core/components/mappers/map-raw-slot-to-definition.d.ts +0 -4
- package/dist/src/session/core/components/plan-cdf-restore.d.ts +0 -3
- package/dist/src/session/core/components/snapshot-types.d.ts +0 -33
- package/dist/src/session/core/shared/memoize-by-key.d.ts +0 -1
- package/dist/src/session/repositories/components/raw/interfaces/raw-component-row.d.ts +0 -10
- package/dist/src/session/repositories/components/raw/interfaces/raw-prop-row.d.ts +0 -14
- package/dist/src/session/repositories/components/raw/interfaces/raw-slot-allowed-component-row.d.ts +0 -6
- package/dist/src/session/repositories/components/raw/interfaces/raw-slot-row.d.ts +0 -7
- package/dist/src/session/repositories/components/raw/read.d.ts +0 -16
- package/dist/src/session/repositories/components/raw/reads/get-classified-props.d.ts +0 -3
- package/dist/src/session/repositories/components/raw/reads/get-component-descriptions.d.ts +0 -3
- package/dist/src/session/repositories/components/raw/reads/get-raw-component-rows.d.ts +0 -3
- package/dist/src/session/repositories/components/raw/reads/get-raw-prop-allowed-value-rows.d.ts +0 -3
- package/dist/src/session/repositories/components/raw/reads/get-raw-prop-allowed-values.d.ts +0 -3
- package/dist/src/session/repositories/components/raw/reads/get-raw-prop-name-at-position.d.ts +0 -2
- package/dist/src/session/repositories/components/raw/reads/get-raw-prop-rows.d.ts +0 -3
- package/dist/src/session/repositories/components/raw/reads/get-raw-slot-allowed-component-rows.d.ts +0 -3
- package/dist/src/session/repositories/components/raw/reads/get-raw-slot-rows.d.ts +0 -3
- package/dist/src/session/repositories/components/raw/reads/has-raw-prop-named.d.ts +0 -2
- package/dist/src/session/repositories/components/raw/row-mappers.d.ts +0 -8
- package/dist/src/session/repositories/components/raw/rows.d.ts +0 -4
- package/dist/src/session/repositories/components/raw/write.d.ts +0 -12
- package/dist/src/session/services/components/apply-cdf-restore.d.ts +0 -3
- package/dist/src/session/services/components/store-raw-components.d.ts +0 -6
package/dist/package.json
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -9211,602 +9211,6 @@ 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/row-mappers.ts
|
|
9215
|
-
function mapRawComponentRow(row) {
|
|
9216
|
-
return {
|
|
9217
|
-
component_id: String(row.component_id),
|
|
9218
|
-
name: String(row.name),
|
|
9219
|
-
source: String(row.source),
|
|
9220
|
-
framework: String(row.framework),
|
|
9221
|
-
extraction_confidence: row.extraction_confidence === null ? null : Number(row.extraction_confidence),
|
|
9222
|
-
review_reasons: String(row.review_reasons ?? "[]"),
|
|
9223
|
-
needs_review: Number(row.needs_review ?? 0),
|
|
9224
|
-
source_path: row.source_path === null ? null : String(row.source_path)
|
|
9225
|
-
};
|
|
9226
|
-
}
|
|
9227
|
-
function mapRawPropRow(row) {
|
|
9228
|
-
return {
|
|
9229
|
-
component_id: String(row.component_id),
|
|
9230
|
-
name: String(row.name),
|
|
9231
|
-
type: String(row.type),
|
|
9232
|
-
required: Number(row.required),
|
|
9233
|
-
category: row.category === null ? null : String(row.category),
|
|
9234
|
-
default_value: row.default_value === null ? null : String(row.default_value),
|
|
9235
|
-
description: row.description === null ? null : String(row.description),
|
|
9236
|
-
token_reference: row.token_reference === null ? null : String(row.token_reference),
|
|
9237
|
-
position: Number(row.position),
|
|
9238
|
-
rationale: row.rationale === null ? null : String(row.rationale),
|
|
9239
|
-
source_start_line: row.source_start_line === null ? null : Number(row.source_start_line),
|
|
9240
|
-
source_end_line: row.source_end_line === null ? null : Number(row.source_end_line)
|
|
9241
|
-
};
|
|
9242
|
-
}
|
|
9243
|
-
function mapAllowedValueSnapshotRow(row) {
|
|
9244
|
-
return {
|
|
9245
|
-
component_id: String(row.component_id),
|
|
9246
|
-
prop_name: String(row.prop_name),
|
|
9247
|
-
position: Number(row.position),
|
|
9248
|
-
value: String(row.value)
|
|
9249
|
-
};
|
|
9250
|
-
}
|
|
9251
|
-
function mapRawSlotRow(row) {
|
|
9252
|
-
return {
|
|
9253
|
-
component_id: String(row.component_id),
|
|
9254
|
-
name: String(row.name),
|
|
9255
|
-
is_default: Number(row.is_default),
|
|
9256
|
-
description: row.description === null ? null : String(row.description),
|
|
9257
|
-
position: Number(row.position)
|
|
9258
|
-
};
|
|
9259
|
-
}
|
|
9260
|
-
function mapRawSlotAllowedComponentRow(row) {
|
|
9261
|
-
return {
|
|
9262
|
-
component_id: String(row.component_id),
|
|
9263
|
-
slot_name: String(row.slot_name),
|
|
9264
|
-
position: Number(row.position),
|
|
9265
|
-
allowed_component: String(row.allowed_component)
|
|
9266
|
-
};
|
|
9267
|
-
}
|
|
9268
|
-
function parseReviewReasons(raw) {
|
|
9269
|
-
try {
|
|
9270
|
-
const parsed = JSON.parse(raw);
|
|
9271
|
-
return Array.isArray(parsed) ? parsed.filter((v) => typeof v === "string") : [];
|
|
9272
|
-
} catch {
|
|
9273
|
-
return [];
|
|
9274
|
-
}
|
|
9275
|
-
}
|
|
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/core/components/mappers/map-raw-component-to-with-id.ts
|
|
9283
|
-
function mapRawComponentToWithId(row, props, slots) {
|
|
9284
|
-
return {
|
|
9285
|
-
component_id: row.component_id,
|
|
9286
|
-
name: row.name,
|
|
9287
|
-
source: row.source,
|
|
9288
|
-
framework: row.framework,
|
|
9289
|
-
extractionConfidence: row.extraction_confidence ?? null,
|
|
9290
|
-
reviewReasons: parseReviewReasons(row.review_reasons),
|
|
9291
|
-
needsReview: Boolean(row.needs_review),
|
|
9292
|
-
sourcePath: row.source_path ?? void 0,
|
|
9293
|
-
props,
|
|
9294
|
-
slots
|
|
9295
|
-
};
|
|
9296
|
-
}
|
|
9297
|
-
var init_map_raw_component_to_with_id = __esm({
|
|
9298
|
-
"packages/experience-design-system-cli/src/session/core/components/mappers/map-raw-component-to-with-id.ts"() {
|
|
9299
|
-
"use strict";
|
|
9300
|
-
init_row_mappers();
|
|
9301
|
-
}
|
|
9302
|
-
});
|
|
9303
|
-
|
|
9304
|
-
// packages/experience-design-system-cli/src/session/core/components/mappers/map-raw-prop-to-definition.ts
|
|
9305
|
-
function mapRawPropToDefinition(row, allowedValueRows) {
|
|
9306
|
-
const prop = {
|
|
9307
|
-
name: row.name,
|
|
9308
|
-
type: row.type,
|
|
9309
|
-
required: Boolean(row.required)
|
|
9310
|
-
};
|
|
9311
|
-
if (row.category !== null) prop.category = row.category;
|
|
9312
|
-
if (row.default_value !== null) prop.defaultValue = row.default_value;
|
|
9313
|
-
if (row.description !== null) prop.description = row.description;
|
|
9314
|
-
if (row.token_reference !== null) prop.tokenReference = row.token_reference;
|
|
9315
|
-
if (allowedValueRows && allowedValueRows.length > 0) {
|
|
9316
|
-
prop.allowedValues = allowedValueRows.map((v) => v.value);
|
|
9317
|
-
}
|
|
9318
|
-
if (row.source_start_line !== null) prop.sourceStartLine = row.source_start_line;
|
|
9319
|
-
if (row.source_end_line !== null) prop.sourceEndLine = row.source_end_line;
|
|
9320
|
-
return prop;
|
|
9321
|
-
}
|
|
9322
|
-
var init_map_raw_prop_to_definition = __esm({
|
|
9323
|
-
"packages/experience-design-system-cli/src/session/core/components/mappers/map-raw-prop-to-definition.ts"() {
|
|
9324
|
-
"use strict";
|
|
9325
|
-
}
|
|
9326
|
-
});
|
|
9327
|
-
|
|
9328
|
-
// packages/experience-design-system-cli/src/session/core/components/mappers/map-raw-slot-to-definition.ts
|
|
9329
|
-
function mapRawSlotToDefinition(row, allowedComponentRows) {
|
|
9330
|
-
const slot = {
|
|
9331
|
-
name: row.name,
|
|
9332
|
-
isDefault: Boolean(row.is_default)
|
|
9333
|
-
};
|
|
9334
|
-
if (row.description !== null) slot.description = row.description;
|
|
9335
|
-
if (allowedComponentRows && allowedComponentRows.length > 0) {
|
|
9336
|
-
slot.allowedComponents = allowedComponentRows.map((v) => v.allowed_component);
|
|
9337
|
-
}
|
|
9338
|
-
return slot;
|
|
9339
|
-
}
|
|
9340
|
-
var init_map_raw_slot_to_definition = __esm({
|
|
9341
|
-
"packages/experience-design-system-cli/src/session/core/components/mappers/map-raw-slot-to-definition.ts"() {
|
|
9342
|
-
"use strict";
|
|
9343
|
-
}
|
|
9344
|
-
});
|
|
9345
|
-
|
|
9346
|
-
// packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-component-rows.ts
|
|
9347
|
-
function getRawComponentRows(db, sessionId2) {
|
|
9348
|
-
return db.prepare(
|
|
9349
|
-
"SELECT component_id, name, source, framework, extraction_confidence, review_reasons, needs_review, source_path FROM raw_components WHERE session_id = ? ORDER BY rowid"
|
|
9350
|
-
).all(sessionId2).map(mapRawComponentRow);
|
|
9351
|
-
}
|
|
9352
|
-
var init_get_raw_component_rows = __esm({
|
|
9353
|
-
"packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-component-rows.ts"() {
|
|
9354
|
-
"use strict";
|
|
9355
|
-
init_row_mappers();
|
|
9356
|
-
}
|
|
9357
|
-
});
|
|
9358
|
-
|
|
9359
|
-
// packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-prop-rows.ts
|
|
9360
|
-
function getRawPropRows(db, sessionId2) {
|
|
9361
|
-
return db.prepare(
|
|
9362
|
-
`SELECT component_id, name, type, required, category, default_value, description, token_reference, position,
|
|
9363
|
-
rationale, source_start_line, source_end_line
|
|
9364
|
-
FROM raw_props WHERE session_id = ? ORDER BY component_id, position`
|
|
9365
|
-
).all(sessionId2).map(mapRawPropRow);
|
|
9366
|
-
}
|
|
9367
|
-
var init_get_raw_prop_rows = __esm({
|
|
9368
|
-
"packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-prop-rows.ts"() {
|
|
9369
|
-
"use strict";
|
|
9370
|
-
init_row_mappers();
|
|
9371
|
-
}
|
|
9372
|
-
});
|
|
9373
|
-
|
|
9374
|
-
// packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-prop-allowed-value-rows.ts
|
|
9375
|
-
function getRawPropAllowedValueRows(db, sessionId2) {
|
|
9376
|
-
return db.prepare(
|
|
9377
|
-
`SELECT component_id, prop_name, position, value
|
|
9378
|
-
FROM raw_prop_allowed_values WHERE session_id = ? ORDER BY component_id, prop_name, position`
|
|
9379
|
-
).all(sessionId2).map(mapAllowedValueSnapshotRow);
|
|
9380
|
-
}
|
|
9381
|
-
var init_get_raw_prop_allowed_value_rows = __esm({
|
|
9382
|
-
"packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-prop-allowed-value-rows.ts"() {
|
|
9383
|
-
"use strict";
|
|
9384
|
-
init_row_mappers();
|
|
9385
|
-
}
|
|
9386
|
-
});
|
|
9387
|
-
|
|
9388
|
-
// packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-slot-rows.ts
|
|
9389
|
-
function getRawSlotRows(db, sessionId2) {
|
|
9390
|
-
return db.prepare(
|
|
9391
|
-
`SELECT component_id, name, is_default, description, position
|
|
9392
|
-
FROM raw_slots WHERE session_id = ? ORDER BY component_id, position`
|
|
9393
|
-
).all(sessionId2).map(mapRawSlotRow);
|
|
9394
|
-
}
|
|
9395
|
-
var init_get_raw_slot_rows = __esm({
|
|
9396
|
-
"packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-slot-rows.ts"() {
|
|
9397
|
-
"use strict";
|
|
9398
|
-
init_row_mappers();
|
|
9399
|
-
}
|
|
9400
|
-
});
|
|
9401
|
-
|
|
9402
|
-
// packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-slot-allowed-component-rows.ts
|
|
9403
|
-
function getRawSlotAllowedComponentRows(db, sessionId2) {
|
|
9404
|
-
return db.prepare(
|
|
9405
|
-
`SELECT component_id, slot_name, position, allowed_component
|
|
9406
|
-
FROM raw_slot_allowed_components WHERE session_id = ? ORDER BY component_id, slot_name, position`
|
|
9407
|
-
).all(sessionId2).map(mapRawSlotAllowedComponentRow);
|
|
9408
|
-
}
|
|
9409
|
-
var init_get_raw_slot_allowed_component_rows = __esm({
|
|
9410
|
-
"packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-slot-allowed-component-rows.ts"() {
|
|
9411
|
-
"use strict";
|
|
9412
|
-
init_row_mappers();
|
|
9413
|
-
}
|
|
9414
|
-
});
|
|
9415
|
-
|
|
9416
|
-
// packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-classified-props.ts
|
|
9417
|
-
function getClassifiedProps(db, sessionId2) {
|
|
9418
|
-
return db.prepare(
|
|
9419
|
-
`SELECT component_id, name, position, cdf_type, cdf_category, cdf_token_kind
|
|
9420
|
-
FROM raw_props WHERE session_id = ? AND cdf_type IS NOT NULL`
|
|
9421
|
-
).all(sessionId2).map((row) => ({
|
|
9422
|
-
component_id: String(row.component_id),
|
|
9423
|
-
name: String(row.name),
|
|
9424
|
-
position: Number(row.position),
|
|
9425
|
-
cdf_type: String(row.cdf_type),
|
|
9426
|
-
cdf_category: String(row.cdf_category),
|
|
9427
|
-
cdf_token_kind: row.cdf_token_kind === null ? null : String(row.cdf_token_kind)
|
|
9428
|
-
}));
|
|
9429
|
-
}
|
|
9430
|
-
var init_get_classified_props = __esm({
|
|
9431
|
-
"packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-classified-props.ts"() {
|
|
9432
|
-
"use strict";
|
|
9433
|
-
}
|
|
9434
|
-
});
|
|
9435
|
-
|
|
9436
|
-
// packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-component-descriptions.ts
|
|
9437
|
-
function getComponentDescriptions(db, sessionId2) {
|
|
9438
|
-
return db.prepare(
|
|
9439
|
-
`SELECT component_id, description
|
|
9440
|
-
FROM raw_components WHERE session_id = ? AND description IS NOT NULL`
|
|
9441
|
-
).all(sessionId2).map((row) => ({
|
|
9442
|
-
component_id: String(row.component_id),
|
|
9443
|
-
description: String(row.description)
|
|
9444
|
-
}));
|
|
9445
|
-
}
|
|
9446
|
-
var init_get_component_descriptions = __esm({
|
|
9447
|
-
"packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-component-descriptions.ts"() {
|
|
9448
|
-
"use strict";
|
|
9449
|
-
}
|
|
9450
|
-
});
|
|
9451
|
-
|
|
9452
|
-
// packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-prop-allowed-values.ts
|
|
9453
|
-
function getRawPropAllowedValues(db, sessionId2) {
|
|
9454
|
-
return db.prepare(`SELECT component_id, prop_name, position, value FROM raw_prop_allowed_values WHERE session_id = ?`).all(sessionId2).map(mapAllowedValueSnapshotRow);
|
|
9455
|
-
}
|
|
9456
|
-
var init_get_raw_prop_allowed_values = __esm({
|
|
9457
|
-
"packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-prop-allowed-values.ts"() {
|
|
9458
|
-
"use strict";
|
|
9459
|
-
init_row_mappers();
|
|
9460
|
-
}
|
|
9461
|
-
});
|
|
9462
|
-
|
|
9463
|
-
// packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-prop-name-at-position.ts
|
|
9464
|
-
function getRawPropNameAtPosition(db, sessionId2, componentId, position) {
|
|
9465
|
-
const row = db.prepare(`SELECT name FROM raw_props WHERE session_id = ? AND component_id = ? AND position = ?`).get(sessionId2, componentId, position);
|
|
9466
|
-
return row ? String(row.name) : null;
|
|
9467
|
-
}
|
|
9468
|
-
var init_get_raw_prop_name_at_position = __esm({
|
|
9469
|
-
"packages/experience-design-system-cli/src/session/repositories/components/raw/reads/get-raw-prop-name-at-position.ts"() {
|
|
9470
|
-
"use strict";
|
|
9471
|
-
}
|
|
9472
|
-
});
|
|
9473
|
-
|
|
9474
|
-
// packages/experience-design-system-cli/src/session/repositories/components/raw/reads/has-raw-prop-named.ts
|
|
9475
|
-
function hasRawPropNamed(db, sessionId2, componentId, propName) {
|
|
9476
|
-
const row = db.prepare("SELECT 1 as one FROM raw_props WHERE session_id = ? AND component_id = ? AND name = ?").get(sessionId2, componentId, propName);
|
|
9477
|
-
return row !== void 0;
|
|
9478
|
-
}
|
|
9479
|
-
var init_has_raw_prop_named = __esm({
|
|
9480
|
-
"packages/experience-design-system-cli/src/session/repositories/components/raw/reads/has-raw-prop-named.ts"() {
|
|
9481
|
-
"use strict";
|
|
9482
|
-
}
|
|
9483
|
-
});
|
|
9484
|
-
|
|
9485
|
-
// packages/experience-design-system-cli/src/session/repositories/components/raw/read.ts
|
|
9486
|
-
function getRawComponents(db, sessionId2, allowedNames) {
|
|
9487
|
-
const componentRows = getRawComponentRows(db, sessionId2);
|
|
9488
|
-
const components = allowedNames ? componentRows.filter((c2) => allowedNames.has(c2.name)) : componentRows;
|
|
9489
|
-
if (components.length === 0) return [];
|
|
9490
|
-
const propRows = getRawPropRows(db, sessionId2);
|
|
9491
|
-
const allowedValueRows = getRawPropAllowedValueRows(db, sessionId2);
|
|
9492
|
-
const slotRows = getRawSlotRows(db, sessionId2);
|
|
9493
|
-
const allowedComponentRows = getRawSlotAllowedComponentRows(db, sessionId2);
|
|
9494
|
-
const propsByComponent = indexRowsByKey(propRows, (p) => p.component_id);
|
|
9495
|
-
const allowedValuesByProp = indexRowsByKey(allowedValueRows, (av) => `${av.component_id}::${av.prop_name}`);
|
|
9496
|
-
const slotsByComponent = indexRowsByKey(slotRows, (s) => s.component_id);
|
|
9497
|
-
const allowedComponentsBySlot = indexRowsByKey(allowedComponentRows, (ac) => `${ac.component_id}::${ac.slot_name}`);
|
|
9498
|
-
return components.map((c2) => {
|
|
9499
|
-
const props = (propsByComponent.get(c2.component_id) ?? []).map(
|
|
9500
|
-
(p) => mapRawPropToDefinition(p, allowedValuesByProp.get(`${c2.component_id}::${p.name}`))
|
|
9501
|
-
);
|
|
9502
|
-
const slots = (slotsByComponent.get(c2.component_id) ?? []).map(
|
|
9503
|
-
(s) => mapRawSlotToDefinition(s, allowedComponentsBySlot.get(`${c2.component_id}::${s.name}`))
|
|
9504
|
-
);
|
|
9505
|
-
return mapRawComponentToWithId(c2, props, slots);
|
|
9506
|
-
});
|
|
9507
|
-
}
|
|
9508
|
-
var init_read4 = __esm({
|
|
9509
|
-
"packages/experience-design-system-cli/src/session/repositories/components/raw/read.ts"() {
|
|
9510
|
-
"use strict";
|
|
9511
|
-
init_index_rows_by_key();
|
|
9512
|
-
init_map_raw_component_to_with_id();
|
|
9513
|
-
init_map_raw_prop_to_definition();
|
|
9514
|
-
init_map_raw_slot_to_definition();
|
|
9515
|
-
init_get_raw_component_rows();
|
|
9516
|
-
init_get_raw_prop_rows();
|
|
9517
|
-
init_get_raw_prop_allowed_value_rows();
|
|
9518
|
-
init_get_raw_slot_rows();
|
|
9519
|
-
init_get_raw_slot_allowed_component_rows();
|
|
9520
|
-
init_row_mappers();
|
|
9521
|
-
init_get_raw_component_rows();
|
|
9522
|
-
init_get_raw_prop_rows();
|
|
9523
|
-
init_get_raw_prop_allowed_value_rows();
|
|
9524
|
-
init_get_raw_slot_rows();
|
|
9525
|
-
init_get_raw_slot_allowed_component_rows();
|
|
9526
|
-
init_get_classified_props();
|
|
9527
|
-
init_get_component_descriptions();
|
|
9528
|
-
init_get_raw_prop_allowed_values();
|
|
9529
|
-
init_get_raw_prop_name_at_position();
|
|
9530
|
-
init_has_raw_prop_named();
|
|
9531
|
-
}
|
|
9532
|
-
});
|
|
9533
|
-
|
|
9534
|
-
// packages/experience-design-system-cli/src/session/repositories/components/raw/write.ts
|
|
9535
|
-
function deleteRawComponentsForSession(db, sessionId2) {
|
|
9536
|
-
db.prepare("DELETE FROM raw_components WHERE session_id = ?").run(sessionId2);
|
|
9537
|
-
}
|
|
9538
|
-
function createRawComponent(db, sessionId2, comp, extractedAt) {
|
|
9539
|
-
const componentId = deriveComponentId(comp.name, comp.source);
|
|
9540
|
-
db.prepare(
|
|
9541
|
-
`INSERT INTO raw_components (session_id, component_id, name, source, framework, extracted_at, extraction_confidence, review_reasons, needs_review, source_path)
|
|
9542
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
|
|
9543
|
-
).run(
|
|
9544
|
-
sessionId2,
|
|
9545
|
-
componentId,
|
|
9546
|
-
comp.name,
|
|
9547
|
-
comp.source,
|
|
9548
|
-
comp.framework,
|
|
9549
|
-
extractedAt,
|
|
9550
|
-
comp.extractionConfidence ?? null,
|
|
9551
|
-
JSON.stringify(comp.reviewReasons ?? []),
|
|
9552
|
-
comp.needsReview ? 1 : 0,
|
|
9553
|
-
comp.sourcePath ?? null
|
|
9554
|
-
);
|
|
9555
|
-
return componentId;
|
|
9556
|
-
}
|
|
9557
|
-
function createRawProps(db, sessionId2, componentId, props) {
|
|
9558
|
-
const insertProp = db.prepare(
|
|
9559
|
-
`INSERT INTO raw_props
|
|
9560
|
-
(session_id, component_id, name, type, required, category, default_value, description, token_reference, position, source_start_line, source_end_line)
|
|
9561
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
|
|
9562
|
-
);
|
|
9563
|
-
const insertAllowedValue = db.prepare(
|
|
9564
|
-
`INSERT INTO raw_prop_allowed_values (session_id, component_id, prop_name, position, value)
|
|
9565
|
-
VALUES (?, ?, ?, ?, ?)`
|
|
9566
|
-
);
|
|
9567
|
-
props.forEach((prop, position) => {
|
|
9568
|
-
insertPropRow(insertProp, sessionId2, componentId, prop, position);
|
|
9569
|
-
insertPropAllowedValues(insertAllowedValue, sessionId2, componentId, prop);
|
|
9570
|
-
});
|
|
9571
|
-
}
|
|
9572
|
-
function insertPropRow(insertProp, sessionId2, componentId, prop, position) {
|
|
9573
|
-
insertProp.run(
|
|
9574
|
-
sessionId2,
|
|
9575
|
-
componentId,
|
|
9576
|
-
prop.name,
|
|
9577
|
-
prop.type,
|
|
9578
|
-
prop.required ? 1 : 0,
|
|
9579
|
-
prop.category ?? null,
|
|
9580
|
-
prop.defaultValue ?? null,
|
|
9581
|
-
prop.description ?? null,
|
|
9582
|
-
prop.tokenReference ?? null,
|
|
9583
|
-
position,
|
|
9584
|
-
prop.sourceStartLine ?? null,
|
|
9585
|
-
prop.sourceEndLine ?? null
|
|
9586
|
-
);
|
|
9587
|
-
}
|
|
9588
|
-
function insertPropAllowedValues(insertAllowedValue, sessionId2, componentId, prop) {
|
|
9589
|
-
if (!prop.allowedValues) return;
|
|
9590
|
-
prop.allowedValues.forEach((value, position) => {
|
|
9591
|
-
insertAllowedValue.run(sessionId2, componentId, prop.name, position, value);
|
|
9592
|
-
});
|
|
9593
|
-
}
|
|
9594
|
-
function createRawSlots(db, sessionId2, componentId, slots) {
|
|
9595
|
-
const insertSlot = db.prepare(
|
|
9596
|
-
`INSERT INTO raw_slots (session_id, component_id, name, is_default, description, position)
|
|
9597
|
-
VALUES (?, ?, ?, ?, ?, ?)`
|
|
9598
|
-
);
|
|
9599
|
-
const insertAllowedComponent = db.prepare(
|
|
9600
|
-
`INSERT INTO raw_slot_allowed_components (session_id, component_id, slot_name, position, allowed_component)
|
|
9601
|
-
VALUES (?, ?, ?, ?, ?)`
|
|
9602
|
-
);
|
|
9603
|
-
slots.forEach((slot, position) => {
|
|
9604
|
-
insertSlotRow(insertSlot, sessionId2, componentId, slot, position);
|
|
9605
|
-
insertSlotAllowedComponents(insertAllowedComponent, sessionId2, componentId, slot);
|
|
9606
|
-
});
|
|
9607
|
-
}
|
|
9608
|
-
function insertSlotRow(insertSlot, sessionId2, componentId, slot, position) {
|
|
9609
|
-
insertSlot.run(sessionId2, componentId, slot.name, slot.isDefault ? 1 : 0, slot.description ?? null, position);
|
|
9610
|
-
}
|
|
9611
|
-
function insertSlotAllowedComponents(insertAllowedComponent, sessionId2, componentId, slot) {
|
|
9612
|
-
if (!slot.allowedComponents) return;
|
|
9613
|
-
slot.allowedComponents.forEach((allowedComponent, position) => {
|
|
9614
|
-
insertAllowedComponent.run(sessionId2, componentId, slot.name, position, allowedComponent);
|
|
9615
|
-
});
|
|
9616
|
-
}
|
|
9617
|
-
function updateRawComponentsStatus(db, sessionId2, status) {
|
|
9618
|
-
db.prepare("UPDATE raw_components SET status = ? WHERE session_id = ?").run(status, sessionId2);
|
|
9619
|
-
}
|
|
9620
|
-
function updateRawPropCdfByName(db, sessionId2, componentId, propName, cdfType, cdfCategory, cdfTokenKind) {
|
|
9621
|
-
const result = db.prepare(
|
|
9622
|
-
`UPDATE raw_props SET cdf_type = ?, cdf_category = ?, cdf_token_kind = ?
|
|
9623
|
-
WHERE session_id = ? AND component_id = ? AND name = ?`
|
|
9624
|
-
).run(cdfType, cdfCategory, cdfTokenKind, sessionId2, componentId, propName);
|
|
9625
|
-
return Number(result.changes);
|
|
9626
|
-
}
|
|
9627
|
-
function updateRawPropCdfByPosition(db, sessionId2, componentId, position, cdfType, cdfCategory, cdfTokenKind) {
|
|
9628
|
-
const result = db.prepare(
|
|
9629
|
-
`UPDATE raw_props SET cdf_type = ?, cdf_category = ?, cdf_token_kind = ?
|
|
9630
|
-
WHERE session_id = ? AND component_id = ? AND position = ? AND cdf_type IS NULL`
|
|
9631
|
-
).run(cdfType, cdfCategory, cdfTokenKind, sessionId2, componentId, position);
|
|
9632
|
-
return Number(result.changes);
|
|
9633
|
-
}
|
|
9634
|
-
function updateRawComponentDescription(db, sessionId2, componentId, description) {
|
|
9635
|
-
db.prepare("UPDATE raw_components SET description = ? WHERE session_id = ? AND component_id = ?").run(
|
|
9636
|
-
description,
|
|
9637
|
-
sessionId2,
|
|
9638
|
-
componentId
|
|
9639
|
-
);
|
|
9640
|
-
}
|
|
9641
|
-
function deleteRawPropAllowedValuesForProp(db, sessionId2, componentId, propName) {
|
|
9642
|
-
db.prepare("DELETE FROM raw_prop_allowed_values WHERE session_id = ? AND component_id = ? AND prop_name = ?").run(
|
|
9643
|
-
sessionId2,
|
|
9644
|
-
componentId,
|
|
9645
|
-
propName
|
|
9646
|
-
);
|
|
9647
|
-
}
|
|
9648
|
-
function createRawPropAllowedValue(db, sessionId2, componentId, propName, position, value) {
|
|
9649
|
-
db.prepare(
|
|
9650
|
-
`INSERT OR IGNORE INTO raw_prop_allowed_values (session_id, component_id, prop_name, position, value)
|
|
9651
|
-
VALUES (?, ?, ?, ?, ?)`
|
|
9652
|
-
).run(sessionId2, componentId, propName, position, value);
|
|
9653
|
-
}
|
|
9654
|
-
var init_write4 = __esm({
|
|
9655
|
-
"packages/experience-design-system-cli/src/session/repositories/components/raw/write.ts"() {
|
|
9656
|
-
"use strict";
|
|
9657
|
-
init_derive_component_id();
|
|
9658
|
-
}
|
|
9659
|
-
});
|
|
9660
|
-
|
|
9661
|
-
// packages/experience-design-system-cli/src/session/core/components/group-allowed-values-by-prop.ts
|
|
9662
|
-
function groupAllowedValuesByProp(avSnapshot, nameMatchedKeys) {
|
|
9663
|
-
const buckets = /* @__PURE__ */ new Map();
|
|
9664
|
-
for (const av of avSnapshot) {
|
|
9665
|
-
const key = `${av.component_id}::${av.prop_name}`;
|
|
9666
|
-
if (!nameMatchedKeys.has(key)) continue;
|
|
9667
|
-
const bucket = buckets.get(key) ?? { componentId: av.component_id, propName: av.prop_name, values: [] };
|
|
9668
|
-
bucket.values.push(av);
|
|
9669
|
-
buckets.set(key, bucket);
|
|
9670
|
-
}
|
|
9671
|
-
return [...buckets.values()];
|
|
9672
|
-
}
|
|
9673
|
-
var init_group_allowed_values_by_prop = __esm({
|
|
9674
|
-
"packages/experience-design-system-cli/src/session/core/components/group-allowed-values-by-prop.ts"() {
|
|
9675
|
-
"use strict";
|
|
9676
|
-
}
|
|
9677
|
-
});
|
|
9678
|
-
|
|
9679
|
-
// packages/experience-design-system-cli/src/session/core/components/plan-cdf-restore.ts
|
|
9680
|
-
function planCdfRestore(cdfSnapshot, descSnapshot, avSnapshot, currentProps) {
|
|
9681
|
-
const byName = [];
|
|
9682
|
-
const byPosition = [];
|
|
9683
|
-
const nameMatchedKeys = /* @__PURE__ */ new Set();
|
|
9684
|
-
for (const snap of cdfSnapshot) {
|
|
9685
|
-
if (currentProps.hasPropNamed(snap.component_id, snap.name)) {
|
|
9686
|
-
byName.push(snap);
|
|
9687
|
-
nameMatchedKeys.add(propKey(snap.component_id, snap.name));
|
|
9688
|
-
continue;
|
|
9689
|
-
}
|
|
9690
|
-
if (currentProps.propNameAtPosition(snap.component_id, snap.position) !== null) {
|
|
9691
|
-
byPosition.push(snap);
|
|
9692
|
-
}
|
|
9693
|
-
}
|
|
9694
|
-
return {
|
|
9695
|
-
byName,
|
|
9696
|
-
byPosition,
|
|
9697
|
-
descriptions: descSnapshot,
|
|
9698
|
-
allowedValues: groupAllowedValuesByProp(avSnapshot, nameMatchedKeys)
|
|
9699
|
-
};
|
|
9700
|
-
}
|
|
9701
|
-
function propKey(componentId, propName) {
|
|
9702
|
-
return `${componentId}::${propName}`;
|
|
9703
|
-
}
|
|
9704
|
-
var init_plan_cdf_restore = __esm({
|
|
9705
|
-
"packages/experience-design-system-cli/src/session/core/components/plan-cdf-restore.ts"() {
|
|
9706
|
-
"use strict";
|
|
9707
|
-
init_group_allowed_values_by_prop();
|
|
9708
|
-
}
|
|
9709
|
-
});
|
|
9710
|
-
|
|
9711
|
-
// packages/experience-design-system-cli/src/session/core/shared/memoize-by-key.ts
|
|
9712
|
-
function memoizeByKey(lookup) {
|
|
9713
|
-
const cache = /* @__PURE__ */ new Map();
|
|
9714
|
-
return (a, b) => {
|
|
9715
|
-
const key = `${a}::${b}`;
|
|
9716
|
-
if (cache.has(key)) return cache.get(key);
|
|
9717
|
-
const value = lookup(a, b);
|
|
9718
|
-
cache.set(key, value);
|
|
9719
|
-
return value;
|
|
9720
|
-
};
|
|
9721
|
-
}
|
|
9722
|
-
var init_memoize_by_key = __esm({
|
|
9723
|
-
"packages/experience-design-system-cli/src/session/core/shared/memoize-by-key.ts"() {
|
|
9724
|
-
"use strict";
|
|
9725
|
-
}
|
|
9726
|
-
});
|
|
9727
|
-
|
|
9728
|
-
// packages/experience-design-system-cli/src/session/services/components/apply-cdf-restore.ts
|
|
9729
|
-
function applyCdfRestore(db, sessionId2, plan) {
|
|
9730
|
-
for (const snap of plan.byName) {
|
|
9731
|
-
updateRawPropCdfByName(
|
|
9732
|
-
db,
|
|
9733
|
-
sessionId2,
|
|
9734
|
-
snap.component_id,
|
|
9735
|
-
snap.name,
|
|
9736
|
-
snap.cdf_type,
|
|
9737
|
-
snap.cdf_category,
|
|
9738
|
-
snap.cdf_token_kind
|
|
9739
|
-
);
|
|
9740
|
-
}
|
|
9741
|
-
for (const snap of plan.byPosition) {
|
|
9742
|
-
updateRawPropCdfByPosition(
|
|
9743
|
-
db,
|
|
9744
|
-
sessionId2,
|
|
9745
|
-
snap.component_id,
|
|
9746
|
-
snap.position,
|
|
9747
|
-
snap.cdf_type,
|
|
9748
|
-
snap.cdf_category,
|
|
9749
|
-
snap.cdf_token_kind
|
|
9750
|
-
);
|
|
9751
|
-
}
|
|
9752
|
-
for (const snap of plan.descriptions) {
|
|
9753
|
-
updateRawComponentDescription(db, sessionId2, snap.component_id, snap.description);
|
|
9754
|
-
}
|
|
9755
|
-
for (const bucket of plan.allowedValues) {
|
|
9756
|
-
deleteRawPropAllowedValuesForProp(db, sessionId2, bucket.componentId, bucket.propName);
|
|
9757
|
-
for (const av of bucket.values) {
|
|
9758
|
-
createRawPropAllowedValue(db, sessionId2, bucket.componentId, bucket.propName, av.position, av.value);
|
|
9759
|
-
}
|
|
9760
|
-
}
|
|
9761
|
-
}
|
|
9762
|
-
var init_apply_cdf_restore = __esm({
|
|
9763
|
-
"packages/experience-design-system-cli/src/session/services/components/apply-cdf-restore.ts"() {
|
|
9764
|
-
"use strict";
|
|
9765
|
-
init_write4();
|
|
9766
|
-
}
|
|
9767
|
-
});
|
|
9768
|
-
|
|
9769
|
-
// packages/experience-design-system-cli/src/session/services/components/store-raw-components.ts
|
|
9770
|
-
function storeRawComponents(db, sessionId2, components, options) {
|
|
9771
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
9772
|
-
withTransaction(db, () => {
|
|
9773
|
-
const cdfSnapshot = options?.preserveCDF ? getClassifiedProps(db, sessionId2) : [];
|
|
9774
|
-
const descSnapshot = options?.preserveCDF ? getComponentDescriptions(db, sessionId2) : [];
|
|
9775
|
-
const avSnapshot = options?.preserveCDF && cdfSnapshot.length > 0 ? getRawPropAllowedValues(db, sessionId2) : [];
|
|
9776
|
-
deleteRawComponentsForSession(db, sessionId2);
|
|
9777
|
-
for (const comp of components) {
|
|
9778
|
-
const componentId = createRawComponent(db, sessionId2, comp, now);
|
|
9779
|
-
createRawProps(db, sessionId2, componentId, comp.props);
|
|
9780
|
-
createRawSlots(db, sessionId2, componentId, comp.slots);
|
|
9781
|
-
}
|
|
9782
|
-
if (options?.preserveCDF && cdfSnapshot.length > 0) {
|
|
9783
|
-
const plan = planCdfRestore(cdfSnapshot, descSnapshot, avSnapshot, {
|
|
9784
|
-
hasPropNamed: (componentId, propName) => hasRawPropNamed(db, sessionId2, componentId, propName),
|
|
9785
|
-
propNameAtPosition: memoizeByKey(
|
|
9786
|
-
(componentId, position) => getRawPropNameAtPosition(db, sessionId2, componentId, position)
|
|
9787
|
-
)
|
|
9788
|
-
});
|
|
9789
|
-
applyCdfRestore(db, sessionId2, plan);
|
|
9790
|
-
}
|
|
9791
|
-
if (options?.status) {
|
|
9792
|
-
updateRawComponentsStatus(db, sessionId2, options.status);
|
|
9793
|
-
}
|
|
9794
|
-
updateSessionTimestamp(db, sessionId2, now);
|
|
9795
|
-
});
|
|
9796
|
-
}
|
|
9797
|
-
var init_store_raw_components = __esm({
|
|
9798
|
-
"packages/experience-design-system-cli/src/session/services/components/store-raw-components.ts"() {
|
|
9799
|
-
"use strict";
|
|
9800
|
-
init_with_transaction();
|
|
9801
|
-
init_write();
|
|
9802
|
-
init_read4();
|
|
9803
|
-
init_write4();
|
|
9804
|
-
init_plan_cdf_restore();
|
|
9805
|
-
init_memoize_by_key();
|
|
9806
|
-
init_apply_cdf_restore();
|
|
9807
|
-
}
|
|
9808
|
-
});
|
|
9809
|
-
|
|
9810
9214
|
// packages/experience-design-system-cli/src/session/cache-keys.ts
|
|
9811
9215
|
var cache_keys_exports = {};
|
|
9812
9216
|
__export(cache_keys_exports, {
|
|
@@ -10352,6 +9756,239 @@ function updateStep(db, stepId, status, outputs, error) {
|
|
|
10352
9756
|
throw e;
|
|
10353
9757
|
}
|
|
10354
9758
|
}
|
|
9759
|
+
function storeRawComponents(db, sessionId2, components, options) {
|
|
9760
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
9761
|
+
const insertComp = db.prepare(
|
|
9762
|
+
`INSERT INTO raw_components (session_id, component_id, name, source, framework, extracted_at, extraction_confidence, review_reasons, needs_review, source_path)
|
|
9763
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
|
|
9764
|
+
);
|
|
9765
|
+
const insertProp = db.prepare(
|
|
9766
|
+
`INSERT INTO raw_props
|
|
9767
|
+
(session_id, component_id, name, type, required, category, default_value, description, token_reference, position, source_start_line, source_end_line)
|
|
9768
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
|
|
9769
|
+
);
|
|
9770
|
+
const insertAllowedValue = db.prepare(
|
|
9771
|
+
`INSERT INTO raw_prop_allowed_values (session_id, component_id, prop_name, position, value)
|
|
9772
|
+
VALUES (?, ?, ?, ?, ?)`
|
|
9773
|
+
);
|
|
9774
|
+
const insertSlot = db.prepare(
|
|
9775
|
+
`INSERT INTO raw_slots (session_id, component_id, name, is_default, description, position)
|
|
9776
|
+
VALUES (?, ?, ?, ?, ?, ?)`
|
|
9777
|
+
);
|
|
9778
|
+
const insertAllowedComponent = db.prepare(
|
|
9779
|
+
`INSERT INTO raw_slot_allowed_components (session_id, component_id, slot_name, position, allowed_component)
|
|
9780
|
+
VALUES (?, ?, ?, ?, ?)`
|
|
9781
|
+
);
|
|
9782
|
+
db.exec("BEGIN");
|
|
9783
|
+
try {
|
|
9784
|
+
let cdfSnapshot = [];
|
|
9785
|
+
let descSnapshot = [];
|
|
9786
|
+
let avSnapshot = [];
|
|
9787
|
+
if (options?.preserveCDF) {
|
|
9788
|
+
cdfSnapshot = db.prepare(
|
|
9789
|
+
`SELECT component_id, name, position, cdf_type, cdf_category, cdf_token_kind
|
|
9790
|
+
FROM raw_props WHERE session_id = ? AND cdf_type IS NOT NULL`
|
|
9791
|
+
).all(sessionId2);
|
|
9792
|
+
descSnapshot = db.prepare(
|
|
9793
|
+
`SELECT component_id, description
|
|
9794
|
+
FROM raw_components WHERE session_id = ? AND description IS NOT NULL`
|
|
9795
|
+
).all(sessionId2);
|
|
9796
|
+
if (cdfSnapshot.length > 0) {
|
|
9797
|
+
avSnapshot = db.prepare(
|
|
9798
|
+
`SELECT component_id, prop_name, position, value
|
|
9799
|
+
FROM raw_prop_allowed_values WHERE session_id = ?`
|
|
9800
|
+
).all(sessionId2);
|
|
9801
|
+
}
|
|
9802
|
+
}
|
|
9803
|
+
db.prepare("DELETE FROM raw_components WHERE session_id = ?").run(sessionId2);
|
|
9804
|
+
for (const comp of components) {
|
|
9805
|
+
const componentId = deriveComponentId(comp.name, comp.source);
|
|
9806
|
+
insertComp.run(
|
|
9807
|
+
sessionId2,
|
|
9808
|
+
componentId,
|
|
9809
|
+
comp.name,
|
|
9810
|
+
comp.source,
|
|
9811
|
+
comp.framework,
|
|
9812
|
+
now,
|
|
9813
|
+
comp.extractionConfidence ?? null,
|
|
9814
|
+
JSON.stringify(comp.reviewReasons ?? []),
|
|
9815
|
+
comp.needsReview ? 1 : 0,
|
|
9816
|
+
comp.sourcePath ?? null
|
|
9817
|
+
);
|
|
9818
|
+
for (let i = 0; i < comp.props.length; i++) {
|
|
9819
|
+
const prop = comp.props[i];
|
|
9820
|
+
insertProp.run(
|
|
9821
|
+
sessionId2,
|
|
9822
|
+
componentId,
|
|
9823
|
+
prop.name,
|
|
9824
|
+
prop.type,
|
|
9825
|
+
prop.required ? 1 : 0,
|
|
9826
|
+
prop.category ?? null,
|
|
9827
|
+
prop.defaultValue ?? null,
|
|
9828
|
+
prop.description ?? null,
|
|
9829
|
+
prop.tokenReference ?? null,
|
|
9830
|
+
i,
|
|
9831
|
+
prop.sourceStartLine ?? null,
|
|
9832
|
+
prop.sourceEndLine ?? null
|
|
9833
|
+
);
|
|
9834
|
+
if (prop.allowedValues) {
|
|
9835
|
+
prop.allowedValues.forEach((v, j) => insertAllowedValue.run(sessionId2, componentId, prop.name, j, v));
|
|
9836
|
+
}
|
|
9837
|
+
}
|
|
9838
|
+
for (let i = 0; i < comp.slots.length; i++) {
|
|
9839
|
+
const slot = comp.slots[i];
|
|
9840
|
+
insertSlot.run(sessionId2, componentId, slot.name, slot.isDefault ? 1 : 0, slot.description ?? null, i);
|
|
9841
|
+
if (slot.allowedComponents) {
|
|
9842
|
+
slot.allowedComponents.forEach(
|
|
9843
|
+
(ac, j) => insertAllowedComponent.run(sessionId2, componentId, slot.name, j, ac)
|
|
9844
|
+
);
|
|
9845
|
+
}
|
|
9846
|
+
}
|
|
9847
|
+
}
|
|
9848
|
+
if (options?.preserveCDF && cdfSnapshot.length > 0) {
|
|
9849
|
+
const updateCDFByName = db.prepare(
|
|
9850
|
+
`UPDATE raw_props SET cdf_type = ?, cdf_category = ?, cdf_token_kind = ?
|
|
9851
|
+
WHERE session_id = ? AND component_id = ? AND name = ?`
|
|
9852
|
+
);
|
|
9853
|
+
const updateCDFByPosition = db.prepare(
|
|
9854
|
+
`UPDATE raw_props SET cdf_type = ?, cdf_category = ?, cdf_token_kind = ?
|
|
9855
|
+
WHERE session_id = ? AND component_id = ? AND position = ? AND cdf_type IS NULL`
|
|
9856
|
+
);
|
|
9857
|
+
const restoredPropKeys = /* @__PURE__ */ new Set();
|
|
9858
|
+
const unmatchedSnaps = [];
|
|
9859
|
+
for (const snap of cdfSnapshot) {
|
|
9860
|
+
const result = updateCDFByName.run(
|
|
9861
|
+
snap.cdf_type,
|
|
9862
|
+
snap.cdf_category,
|
|
9863
|
+
snap.cdf_token_kind,
|
|
9864
|
+
sessionId2,
|
|
9865
|
+
snap.component_id,
|
|
9866
|
+
snap.name
|
|
9867
|
+
);
|
|
9868
|
+
if (Number(result.changes) > 0) {
|
|
9869
|
+
restoredPropKeys.add(`${snap.component_id}::${snap.name}`);
|
|
9870
|
+
} else {
|
|
9871
|
+
unmatchedSnaps.push(snap);
|
|
9872
|
+
}
|
|
9873
|
+
}
|
|
9874
|
+
for (const snap of unmatchedSnaps) {
|
|
9875
|
+
const result = updateCDFByPosition.run(
|
|
9876
|
+
snap.cdf_type,
|
|
9877
|
+
snap.cdf_category,
|
|
9878
|
+
snap.cdf_token_kind,
|
|
9879
|
+
sessionId2,
|
|
9880
|
+
snap.component_id,
|
|
9881
|
+
snap.position
|
|
9882
|
+
);
|
|
9883
|
+
if (Number(result.changes) > 0) {
|
|
9884
|
+
const matched = db.prepare(`SELECT name FROM raw_props WHERE session_id = ? AND component_id = ? AND position = ?`).get(sessionId2, snap.component_id, snap.position);
|
|
9885
|
+
if (matched) {
|
|
9886
|
+
restoredPropKeys.add(`${snap.component_id}::${matched.name}`);
|
|
9887
|
+
}
|
|
9888
|
+
}
|
|
9889
|
+
}
|
|
9890
|
+
const updateDesc = db.prepare(
|
|
9891
|
+
`UPDATE raw_components SET description = ? WHERE session_id = ? AND component_id = ?`
|
|
9892
|
+
);
|
|
9893
|
+
for (const snap of descSnapshot) {
|
|
9894
|
+
updateDesc.run(snap.description, sessionId2, snap.component_id);
|
|
9895
|
+
}
|
|
9896
|
+
const relevantAV = avSnapshot.filter((av) => restoredPropKeys.has(`${av.component_id}::${av.prop_name}`));
|
|
9897
|
+
if (relevantAV.length > 0) {
|
|
9898
|
+
const deleteAV = db.prepare(
|
|
9899
|
+
`DELETE FROM raw_prop_allowed_values WHERE session_id = ? AND component_id = ? AND prop_name = ?`
|
|
9900
|
+
);
|
|
9901
|
+
const insertAV = db.prepare(
|
|
9902
|
+
`INSERT OR IGNORE INTO raw_prop_allowed_values (session_id, component_id, prop_name, position, value)
|
|
9903
|
+
VALUES (?, ?, ?, ?, ?)`
|
|
9904
|
+
);
|
|
9905
|
+
const deletedKeys = /* @__PURE__ */ new Set();
|
|
9906
|
+
for (const av of relevantAV) {
|
|
9907
|
+
const key = `${av.component_id}::${av.prop_name}`;
|
|
9908
|
+
if (!deletedKeys.has(key)) {
|
|
9909
|
+
deleteAV.run(sessionId2, av.component_id, av.prop_name);
|
|
9910
|
+
deletedKeys.add(key);
|
|
9911
|
+
}
|
|
9912
|
+
insertAV.run(sessionId2, av.component_id, av.prop_name, av.position, av.value);
|
|
9913
|
+
}
|
|
9914
|
+
}
|
|
9915
|
+
}
|
|
9916
|
+
if (options?.status) {
|
|
9917
|
+
db.prepare("UPDATE raw_components SET status = ? WHERE session_id = ?").run(options.status, sessionId2);
|
|
9918
|
+
}
|
|
9919
|
+
db.prepare("UPDATE sessions SET updated_at = ? WHERE id = ?").run(now, sessionId2);
|
|
9920
|
+
db.exec("COMMIT");
|
|
9921
|
+
} catch (e) {
|
|
9922
|
+
db.exec("ROLLBACK");
|
|
9923
|
+
throw e;
|
|
9924
|
+
}
|
|
9925
|
+
}
|
|
9926
|
+
function loadRawComponents(db, sessionId2, allowedNames) {
|
|
9927
|
+
const all = db.prepare(
|
|
9928
|
+
"SELECT component_id, name, source, framework, extraction_confidence, review_reasons, needs_review, source_path FROM raw_components WHERE session_id = ? ORDER BY rowid"
|
|
9929
|
+
).all(sessionId2);
|
|
9930
|
+
const components = allowedNames ? all.filter((c2) => allowedNames.has(c2.name)) : all;
|
|
9931
|
+
if (components.length === 0) return [];
|
|
9932
|
+
const props = db.prepare(
|
|
9933
|
+
`SELECT component_id, name, type, required, category, default_value, description, token_reference, position,
|
|
9934
|
+
rationale, source_start_line, source_end_line
|
|
9935
|
+
FROM raw_props WHERE session_id = ? ORDER BY component_id, position`
|
|
9936
|
+
).all(sessionId2);
|
|
9937
|
+
const allowedValues = db.prepare(
|
|
9938
|
+
`SELECT component_id, prop_name, position, value
|
|
9939
|
+
FROM raw_prop_allowed_values WHERE session_id = ? ORDER BY component_id, prop_name, position`
|
|
9940
|
+
).all(sessionId2);
|
|
9941
|
+
const slots = db.prepare(
|
|
9942
|
+
`SELECT component_id, name, is_default, description, position
|
|
9943
|
+
FROM raw_slots WHERE session_id = ? ORDER BY component_id, position`
|
|
9944
|
+
).all(sessionId2);
|
|
9945
|
+
const allowedComponents = db.prepare(
|
|
9946
|
+
`SELECT component_id, slot_name, position, allowed_component
|
|
9947
|
+
FROM raw_slot_allowed_components WHERE session_id = ? ORDER BY component_id, slot_name, position`
|
|
9948
|
+
).all(sessionId2);
|
|
9949
|
+
const propsByComponent = indexRowsByKey(props, (p) => p.component_id);
|
|
9950
|
+
const allowedValuesByProp = indexRowsByKey(allowedValues, (av) => `${av.component_id}::${av.prop_name}`);
|
|
9951
|
+
const slotsByComponent = indexRowsByKey(slots, (s) => s.component_id);
|
|
9952
|
+
const allowedComponentsBySlot = indexRowsByKey(allowedComponents, (ac) => `${ac.component_id}::${ac.slot_name}`);
|
|
9953
|
+
return components.map(
|
|
9954
|
+
(c2) => ({
|
|
9955
|
+
component_id: c2.component_id,
|
|
9956
|
+
name: c2.name,
|
|
9957
|
+
source: c2.source,
|
|
9958
|
+
framework: c2.framework,
|
|
9959
|
+
extractionConfidence: c2.extraction_confidence ?? null,
|
|
9960
|
+
reviewReasons: parseReviewReasons(c2.review_reasons),
|
|
9961
|
+
needsReview: Boolean(c2.needs_review),
|
|
9962
|
+
sourcePath: c2.source_path ?? void 0,
|
|
9963
|
+
props: (propsByComponent.get(c2.component_id) ?? []).map((p) => {
|
|
9964
|
+
const av = allowedValuesByProp.get(`${c2.component_id}::${p.name}`);
|
|
9965
|
+
const prop = {
|
|
9966
|
+
name: p.name,
|
|
9967
|
+
type: p.type,
|
|
9968
|
+
required: Boolean(p.required)
|
|
9969
|
+
};
|
|
9970
|
+
if (p.category !== null) prop.category = p.category;
|
|
9971
|
+
if (p.default_value !== null) prop.defaultValue = p.default_value;
|
|
9972
|
+
if (p.description !== null) prop.description = p.description;
|
|
9973
|
+
if (p.token_reference !== null) prop.tokenReference = p.token_reference;
|
|
9974
|
+
if (av && av.length > 0) prop.allowedValues = av.map((v) => v.value);
|
|
9975
|
+
if (p.source_start_line !== null) prop.sourceStartLine = p.source_start_line;
|
|
9976
|
+
if (p.source_end_line !== null) prop.sourceEndLine = p.source_end_line;
|
|
9977
|
+
return prop;
|
|
9978
|
+
}),
|
|
9979
|
+
slots: (slotsByComponent.get(c2.component_id) ?? []).map((s) => {
|
|
9980
|
+
const ac = allowedComponentsBySlot.get(`${c2.component_id}::${s.name}`);
|
|
9981
|
+
const slot = {
|
|
9982
|
+
name: s.name,
|
|
9983
|
+
isDefault: Boolean(s.is_default)
|
|
9984
|
+
};
|
|
9985
|
+
if (s.description !== null) slot.description = s.description;
|
|
9986
|
+
if (ac && ac.length > 0) slot.allowedComponents = ac.map((v) => v.allowed_component);
|
|
9987
|
+
return slot;
|
|
9988
|
+
})
|
|
9989
|
+
})
|
|
9990
|
+
);
|
|
9991
|
+
}
|
|
10355
9992
|
function rewrittenSourcePaths(basePath) {
|
|
10356
9993
|
for (const [emitted, sources] of TS_ESM_EXTENSION_REWRITES) {
|
|
10357
9994
|
if (!basePath.endsWith(emitted)) continue;
|
|
@@ -10530,7 +10167,7 @@ function renameEmptySlots(db, sessionId2, componentId, componentName, slotCount)
|
|
|
10530
10167
|
}
|
|
10531
10168
|
return { renames, warnings };
|
|
10532
10169
|
}
|
|
10533
|
-
function
|
|
10170
|
+
function parseReviewReasons(raw) {
|
|
10534
10171
|
try {
|
|
10535
10172
|
const parsed = JSON.parse(raw ?? "[]");
|
|
10536
10173
|
return Array.isArray(parsed) ? parsed.filter((reason) => typeof reason === "string") : [];
|
|
@@ -10784,7 +10421,7 @@ function loadScopeComponents(db, sessionId2) {
|
|
|
10784
10421
|
const slotsByComponent = indexRowsByKey(slotRows, (s) => s.component_id);
|
|
10785
10422
|
const allowedBySlot = indexRowsByKey(allowedRows, (a) => `${a.component_id}::${a.slot_name}`);
|
|
10786
10423
|
return rows.map((r) => {
|
|
10787
|
-
const reviewReasons =
|
|
10424
|
+
const reviewReasons = parseReviewReasons(r.review_reasons);
|
|
10788
10425
|
const nonAuthorableReason = reviewReasons.find((reason) => reason.startsWith("non-authorable:"));
|
|
10789
10426
|
return {
|
|
10790
10427
|
name: r.name,
|
|
@@ -11142,9 +10779,9 @@ function copyMapTokensFromCache(db, sourceSessionId, targetSessionId) {
|
|
|
11142
10779
|
const targetComponentId = targetIdByName.get(row.component_name);
|
|
11143
10780
|
if (!targetComponentId) continue;
|
|
11144
10781
|
if (!targetProps.has(`${targetComponentId}::${row.prop_name}`)) continue;
|
|
11145
|
-
const
|
|
11146
|
-
if (!clearedProps.has(
|
|
11147
|
-
clearedProps.add(
|
|
10782
|
+
const propKey = `${targetComponentId}::${row.prop_name}`;
|
|
10783
|
+
if (!clearedProps.has(propKey)) {
|
|
10784
|
+
clearedProps.add(propKey);
|
|
11148
10785
|
db.prepare(`DELETE FROM raw_prop_token_paths WHERE session_id = ? AND component_id = ? AND prop_name = ?`).run(
|
|
11149
10786
|
targetSessionId,
|
|
11150
10787
|
targetComponentId,
|
|
@@ -11152,7 +10789,7 @@ function copyMapTokensFromCache(db, sourceSessionId, targetSessionId) {
|
|
|
11152
10789
|
);
|
|
11153
10790
|
}
|
|
11154
10791
|
insertPath.run(targetSessionId, targetComponentId, row.prop_name, row.source, row.position, row.path);
|
|
11155
|
-
copiedProps.add(
|
|
10792
|
+
copiedProps.add(propKey);
|
|
11156
10793
|
}
|
|
11157
10794
|
copiedCount = copiedProps.size;
|
|
11158
10795
|
db.prepare("UPDATE sessions SET updated_at = ? WHERE id = ?").run(now, targetSessionId);
|
|
@@ -11250,8 +10887,6 @@ var init_db = __esm({
|
|
|
11250
10887
|
init_apply_tool_calls();
|
|
11251
10888
|
init_replace_raw_token_name_paths();
|
|
11252
10889
|
init_replace_raw_prop_token_paths();
|
|
11253
|
-
init_read4();
|
|
11254
|
-
init_store_raw_components();
|
|
11255
10890
|
SCHEMA = `
|
|
11256
10891
|
PRAGMA journal_mode = WAL;
|
|
11257
10892
|
PRAGMA foreign_keys = ON;
|
|
@@ -11493,7 +11128,7 @@ async function ensureRefineSession(sessionId2, artifactsRoot, initialSnapshot) {
|
|
|
11493
11128
|
}
|
|
11494
11129
|
async function writeScopeDecisionsSnapshot(db, sessionId2, decisions) {
|
|
11495
11130
|
const acceptedSet = new Set(decisions.accepted);
|
|
11496
|
-
const rawComponents =
|
|
11131
|
+
const rawComponents = loadRawComponents(db, sessionId2);
|
|
11497
11132
|
const records = rawComponents.map((c2) => {
|
|
11498
11133
|
const status = acceptedSet.has(c2.name) ? "accepted" : "rejected";
|
|
11499
11134
|
const proposal = {
|
|
@@ -12548,7 +12183,7 @@ function useSession({ sessionId: sessionId2, artifactsRoot, reviewRoot }) {
|
|
|
12548
12183
|
const db = openPipelineDb();
|
|
12549
12184
|
let rawComponents;
|
|
12550
12185
|
try {
|
|
12551
|
-
rawComponents =
|
|
12186
|
+
rawComponents = loadRawComponents(db, sessionId2);
|
|
12552
12187
|
} finally {
|
|
12553
12188
|
db.close();
|
|
12554
12189
|
}
|
|
@@ -16943,7 +16578,7 @@ async function loadAndValidateForReview(sessionId2, projectRoot) {
|
|
|
16943
16578
|
const db = openPipelineDb();
|
|
16944
16579
|
let rawComponents;
|
|
16945
16580
|
try {
|
|
16946
|
-
rawComponents =
|
|
16581
|
+
rawComponents = loadRawComponents(db, sessionId2);
|
|
16947
16582
|
} finally {
|
|
16948
16583
|
db.close();
|
|
16949
16584
|
}
|
|
@@ -17062,7 +16697,7 @@ function registerAnalyzeEditCommand(program) {
|
|
|
17062
16697
|
const db = openPipelineDb();
|
|
17063
16698
|
let rawComponentCount = 0;
|
|
17064
16699
|
try {
|
|
17065
|
-
rawComponentCount =
|
|
16700
|
+
rawComponentCount = loadRawComponents(db, sessionId2).length;
|
|
17066
16701
|
} finally {
|
|
17067
16702
|
db.close();
|
|
17068
16703
|
}
|
|
@@ -31483,7 +31118,7 @@ function registerAnalyzeSelectAgentCommand(program) {
|
|
|
31483
31118
|
let rawComponents;
|
|
31484
31119
|
let scannedFiles = [];
|
|
31485
31120
|
try {
|
|
31486
|
-
rawComponents =
|
|
31121
|
+
rawComponents = loadRawComponents(db, sessionId2);
|
|
31487
31122
|
scannedFiles = loadScannedFiles(db, sessionId2);
|
|
31488
31123
|
} finally {
|
|
31489
31124
|
db.close();
|
|
@@ -33625,7 +33260,7 @@ async function runGenerateSkill(skill, opts, verbose = false) {
|
|
|
33625
33260
|
const acceptedNames = await loadAcceptedNames(sessionId2);
|
|
33626
33261
|
const db = openPipelineDb();
|
|
33627
33262
|
try {
|
|
33628
|
-
allComponents =
|
|
33263
|
+
allComponents = loadRawComponents(db, sessionId2, acceptedNames ?? void 0);
|
|
33629
33264
|
} finally {
|
|
33630
33265
|
db.close();
|
|
33631
33266
|
}
|
package/dist/src/session/db.d.ts
CHANGED
|
@@ -16,8 +16,6 @@ export { storeDtcgTokens as storeDTCGTokens } from './services/tokens/store-dtcg
|
|
|
16
16
|
export { applyTokenToolCalls, type ApplyTokenToolCallsResult } from './services/tokens/apply-tool-calls.js';
|
|
17
17
|
export { replaceRawTokenNamePaths } from './services/tokens/replace-raw-token-name-paths.js';
|
|
18
18
|
export { replaceRawPropTokenPaths } from './services/tokens/replace-raw-prop-token-paths.js';
|
|
19
|
-
export { getRawComponents as loadRawComponents, type RawComponentWithId } from './repositories/components/raw/read.js';
|
|
20
|
-
export { storeRawComponents } from './services/components/store-raw-components.js';
|
|
21
19
|
export type StepStatus = 'pending' | 'complete' | 'failed' | 'interrupted';
|
|
22
20
|
export type CommandName = 'analyze extract' | 'analyze select' | 'generate components' | 'generate tokens' | 'generate edit' | 'apply preview' | 'apply select' | 'apply push' | 'print components' | 'print tokens' | 'map tokens' | 'fetch existing entities' | 'import';
|
|
23
21
|
export interface SessionRow {
|
|
@@ -81,6 +79,14 @@ export type { SessionResolution };
|
|
|
81
79
|
export declare function getOrCreateSession(db: DatabaseSync, sessionFlag: string | undefined, sessionName: string | undefined, hints: MatchHints): SessionResolution;
|
|
82
80
|
export declare function createStep(db: DatabaseSync, sessionId: string, command: CommandName, inputs: Record<string, string>): number;
|
|
83
81
|
export declare function updateStep(db: DatabaseSync, stepId: number, status: 'complete' | 'failed', outputs: Record<string, string>, error?: string): void;
|
|
82
|
+
export declare function storeRawComponents(db: DatabaseSync, sessionId: string, components: RawComponentDefinition[], options?: {
|
|
83
|
+
status?: string;
|
|
84
|
+
preserveCDF?: boolean;
|
|
85
|
+
}): void;
|
|
86
|
+
export type RawComponentWithId = RawComponentDefinition & {
|
|
87
|
+
component_id: string;
|
|
88
|
+
};
|
|
89
|
+
export declare function loadRawComponents(db: DatabaseSync, sessionId: string, allowedNames?: Set<string>): RawComponentWithId[];
|
|
84
90
|
export declare function loadComponentSourceRef(name: string, sourcePath: string, propNames?: string[], propTypes?: string[]): Promise<ComponentSourceRef>;
|
|
85
91
|
export declare function loadComponentSourceRefs(db: DatabaseSync, sessionId: string): Promise<ComponentSourceRef[]>;
|
|
86
92
|
export declare function renameEmptySlots(db: DatabaseSync, sessionId: string, componentId: string, componentName: string, slotCount: number): {
|
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-d7fc540.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-d7fc540.0",
|
|
44
|
+
"@contentful/experience-design-system-types": "2.33.1-dev-build-d7fc540.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-extraction": "2.33.1-dev-build-
|
|
58
|
-
"@contentful/experience-design-system-generation": "2.33.1-dev-build-
|
|
56
|
+
"@contentful/experience-design-system-client": "2.33.1-dev-build-d7fc540.0",
|
|
57
|
+
"@contentful/experience-design-system-extraction": "2.33.1-dev-build-d7fc540.0",
|
|
58
|
+
"@contentful/experience-design-system-generation": "2.33.1-dev-build-d7fc540.0"
|
|
59
59
|
},
|
|
60
60
|
"repository": {
|
|
61
61
|
"type": "git",
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { RawComponentDefinition, RawPropDefinition, RawSlotDefinition } from '../../../../types.js';
|
|
2
|
-
import type { RawComponentRow } from '../../../repositories/components/raw/interfaces/raw-component-row.js';
|
|
3
|
-
export type RawComponentWithId = RawComponentDefinition & {
|
|
4
|
-
component_id: string;
|
|
5
|
-
};
|
|
6
|
-
export declare function mapRawComponentToWithId(row: RawComponentRow, props: RawPropDefinition[], slots: RawSlotDefinition[]): RawComponentWithId;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { RawPropDefinition } from '../../../../types.js';
|
|
2
|
-
import type { RawPropRow } from '../../../repositories/components/raw/interfaces/raw-prop-row.js';
|
|
3
|
-
import type { AllowedValueSnapshotEntry } from '../snapshot-types.js';
|
|
4
|
-
export declare function mapRawPropToDefinition(row: RawPropRow, allowedValueRows: AllowedValueSnapshotEntry[] | undefined): RawPropDefinition;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { RawSlotDefinition } from '../../../../types.js';
|
|
2
|
-
import type { RawSlotRow } from '../../../repositories/components/raw/interfaces/raw-slot-row.js';
|
|
3
|
-
import type { RawSlotAllowedComponentRow } from '../../../repositories/components/raw/interfaces/raw-slot-allowed-component-row.js';
|
|
4
|
-
export declare function mapRawSlotToDefinition(row: RawSlotRow, allowedComponentRows: RawSlotAllowedComponentRow[] | undefined): RawSlotDefinition;
|
|
@@ -1,3 +0,0 @@
|
|
|
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';
|
|
3
|
-
export declare function planCdfRestore(cdfSnapshot: CdfSnapshotEntry[], descSnapshot: DescriptionSnapshotEntry[], avSnapshot: AllowedValueSnapshotEntry[], currentProps: CurrentPropsQuery): CdfRestorePlan;
|
|
@@ -1,33 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
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;
|
|
@@ -1,14 +0,0 @@
|
|
|
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,16 +0,0 @@
|
|
|
1
|
-
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
-
import { type RawComponentWithId } from '../../../core/components/mappers/map-raw-component-to-with-id.js';
|
|
3
|
-
export type { RawComponentRow, RawPropRow, RawSlotRow, RawSlotAllowedComponentRow } from './rows.js';
|
|
4
|
-
export { mapRawComponentRow, mapRawPropRow, mapRawSlotRow, mapRawSlotAllowedComponentRow, mapAllowedValueSnapshotRow, parseReviewReasons, } from './row-mappers.js';
|
|
5
|
-
export type { RawComponentWithId } from '../../../core/components/mappers/map-raw-component-to-with-id.js';
|
|
6
|
-
export { getRawComponentRows } from './reads/get-raw-component-rows.js';
|
|
7
|
-
export { getRawPropRows } from './reads/get-raw-prop-rows.js';
|
|
8
|
-
export { getRawPropAllowedValueRows } from './reads/get-raw-prop-allowed-value-rows.js';
|
|
9
|
-
export { getRawSlotRows } from './reads/get-raw-slot-rows.js';
|
|
10
|
-
export { getRawSlotAllowedComponentRows } from './reads/get-raw-slot-allowed-component-rows.js';
|
|
11
|
-
export { getClassifiedProps } from './reads/get-classified-props.js';
|
|
12
|
-
export { getComponentDescriptions } from './reads/get-component-descriptions.js';
|
|
13
|
-
export { getRawPropAllowedValues } from './reads/get-raw-prop-allowed-values.js';
|
|
14
|
-
export { getRawPropNameAtPosition } from './reads/get-raw-prop-name-at-position.js';
|
|
15
|
-
export { hasRawPropNamed } from './reads/has-raw-prop-named.js';
|
|
16
|
-
export declare function getRawComponents(db: DatabaseSync, sessionId: string, allowedNames?: Set<string>): RawComponentWithId[];
|
|
@@ -1,8 +0,0 @@
|
|
|
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[];
|
|
@@ -1,4 +0,0 @@
|
|
|
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';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
-
import type { RawComponentDefinition } from '../../../../types.js';
|
|
3
|
-
export declare function deleteRawComponentsForSession(db: DatabaseSync, sessionId: string): void;
|
|
4
|
-
export declare function createRawComponent(db: DatabaseSync, sessionId: string, comp: RawComponentDefinition, extractedAt: string): string;
|
|
5
|
-
export declare function createRawProps(db: DatabaseSync, sessionId: string, componentId: string, props: RawComponentDefinition['props']): void;
|
|
6
|
-
export declare function createRawSlots(db: DatabaseSync, sessionId: string, componentId: string, slots: RawComponentDefinition['slots']): void;
|
|
7
|
-
export declare function updateRawComponentsStatus(db: DatabaseSync, sessionId: string, status: string): void;
|
|
8
|
-
export declare function updateRawPropCdfByName(db: DatabaseSync, sessionId: string, componentId: string, propName: string, cdfType: string, cdfCategory: string, cdfTokenKind: string | null): number;
|
|
9
|
-
export declare function updateRawPropCdfByPosition(db: DatabaseSync, sessionId: string, componentId: string, position: number, cdfType: string, cdfCategory: string, cdfTokenKind: string | null): number;
|
|
10
|
-
export declare function updateRawComponentDescription(db: DatabaseSync, sessionId: string, componentId: string, description: string): void;
|
|
11
|
-
export declare function deleteRawPropAllowedValuesForProp(db: DatabaseSync, sessionId: string, componentId: string, propName: string): void;
|
|
12
|
-
export declare function createRawPropAllowedValue(db: DatabaseSync, sessionId: string, componentId: string, propName: string, position: number, value: string): void;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
-
import type { RawComponentDefinition } from '../../../types.js';
|
|
3
|
-
export declare function storeRawComponents(db: DatabaseSync, sessionId: string, components: RawComponentDefinition[], options?: {
|
|
4
|
-
status?: string;
|
|
5
|
-
preserveCDF?: boolean;
|
|
6
|
-
}): void;
|