@columnus/shared 0.1.54 → 0.1.56
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/apiProfile.d.ts +39 -0
- package/dist/apiProfile.js +19 -2
- package/dist/apiProfile.js.map +1 -1
- package/dist/assetFamily.d.ts +36 -0
- package/dist/assetFamily.js +73 -0
- package/dist/assetFamily.js.map +1 -0
- package/dist/assetFieldValues.d.ts +21 -0
- package/dist/{storageFieldValues.js → assetFieldValues.js} +159 -60
- package/dist/assetFieldValues.js.map +1 -0
- package/dist/assetGraph.d.ts +199 -0
- package/dist/assetGraph.js +214 -0
- package/dist/assetGraph.js.map +1 -0
- package/dist/assetJobs.d.ts +95 -0
- package/dist/assetJobs.js +41 -0
- package/dist/assetJobs.js.map +1 -0
- package/dist/assetSettings.d.ts +129 -0
- package/dist/assetSettings.js +87 -0
- package/dist/assetSettings.js.map +1 -0
- package/dist/assetValidators.d.ts +475 -0
- package/dist/assetValidators.js +83 -0
- package/dist/assetValidators.js.map +1 -0
- package/dist/bffProtocol.d.ts +29 -24
- package/dist/bffProtocol.js +5 -1
- package/dist/bffProtocol.js.map +1 -1
- package/dist/ciPreviewEnv.js +20 -3
- package/dist/ciPreviewEnv.js.map +1 -1
- package/dist/clipboardTransfer.js +112 -12
- package/dist/clipboardTransfer.js.map +1 -1
- package/dist/csv.js +118 -18
- package/dist/csv.js.map +1 -1
- package/dist/displayLabel.js +1 -1
- package/dist/displayLabel.js.map +1 -1
- package/dist/dotenv.js +5 -1
- package/dist/dotenv.js.map +1 -1
- package/dist/importMatch.js +118 -18
- package/dist/importMatch.js.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +741 -82
- package/dist/index.js.map +1 -1
- package/dist/postLoginPath.d.ts +21 -0
- package/dist/postLoginPath.js +24 -0
- package/dist/postLoginPath.js.map +1 -0
- package/dist/previewDeployName.d.ts +0 -7
- package/dist/previewDeployName.js +21 -4
- package/dist/previewDeployName.js.map +1 -1
- package/dist/recordTableColumns.js +112 -12
- package/dist/recordTableColumns.js.map +1 -1
- package/dist/recordTablePreload.js.map +1 -1
- package/dist/refDisplayRequests.js +112 -12
- package/dist/refDisplayRequests.js.map +1 -1
- package/dist/richDoc.d.ts +2 -2
- package/dist/richDoc.js +5 -5
- package/dist/richDoc.js.map +1 -1
- package/dist/schemaGenerator.d.ts +25 -1
- package/dist/schemaGenerator.js +4569 -18
- package/dist/schemaGenerator.js.map +1 -1
- package/dist/schemaShrink.d.ts +3 -1
- package/dist/schemaShrink.js +4451 -1
- package/dist/schemaShrink.js.map +1 -1
- package/dist/schemaShrinkValidators.d.ts +2 -2
- package/dist/schemaTypes.d.ts +123 -0
- package/dist/schemaTypes.js +107 -13
- package/dist/schemaTypes.js.map +1 -1
- package/dist/share.js +6 -1
- package/dist/share.js.map +1 -1
- package/dist/shareApiBridge.js +6 -1
- package/dist/shareApiBridge.js.map +1 -1
- package/dist/shareProposal.js +112 -12
- package/dist/shareProposal.js.map +1 -1
- package/dist/spaceBundle.js +112 -12
- package/dist/spaceBundle.js.map +1 -1
- package/dist/syncChannel.d.ts +15 -0
- package/dist/syncChannel.js +4642 -0
- package/dist/syncChannel.js.map +1 -0
- package/package.json +1 -1
- package/dist/storageFieldValues.d.ts +0 -10
- package/dist/storageFieldValues.js.map +0 -1
package/dist/shareProposal.js
CHANGED
|
@@ -4277,7 +4277,13 @@ var RESERVED_TABLE_NAMES = /* @__PURE__ */ new Set([
|
|
|
4277
4277
|
"columnus_api_output_secrets",
|
|
4278
4278
|
"columnus_api_sync_routes",
|
|
4279
4279
|
"columnus_api_outbox",
|
|
4280
|
-
"columnus_api_delivery"
|
|
4280
|
+
"columnus_api_delivery",
|
|
4281
|
+
"columnus_assets",
|
|
4282
|
+
"columnus_asset_versions",
|
|
4283
|
+
"columnus_asset_refs",
|
|
4284
|
+
"columnus_asset_profiles",
|
|
4285
|
+
"columnus_asset_settings",
|
|
4286
|
+
"columnus_asset_jobs"
|
|
4281
4287
|
]);
|
|
4282
4288
|
var displayTemplatesSchema = external_exports.object({
|
|
4283
4289
|
id: external_exports.string().optional(),
|
|
@@ -4310,6 +4316,12 @@ var TABLE_COLORS = [
|
|
|
4310
4316
|
"lavender"
|
|
4311
4317
|
];
|
|
4312
4318
|
var tableColorSchema = external_exports.enum(TABLE_COLORS);
|
|
4319
|
+
var TABLE_KINDS = ["record", "asset"];
|
|
4320
|
+
var tableKindSchema = external_exports.enum(TABLE_KINDS);
|
|
4321
|
+
var assetBindingSchema = external_exports.object({
|
|
4322
|
+
profile: external_exports.string().min(1),
|
|
4323
|
+
enforced: external_exports.boolean().optional()
|
|
4324
|
+
});
|
|
4313
4325
|
var fieldTypeSchema = external_exports.lazy(
|
|
4314
4326
|
() => external_exports.discriminatedUnion("kind", [
|
|
4315
4327
|
external_exports.object({ kind: external_exports.literal("string") }),
|
|
@@ -4337,7 +4349,9 @@ var fieldTypeSchema = external_exports.lazy(
|
|
|
4337
4349
|
name: external_exports.string().regex(IDENT),
|
|
4338
4350
|
label: external_exports.string().optional(),
|
|
4339
4351
|
type: fieldTypeSchema,
|
|
4340
|
-
optional: external_exports.boolean()
|
|
4352
|
+
optional: external_exports.boolean(),
|
|
4353
|
+
/** Nested image/file placements bind a Media profile like top-level ones. */
|
|
4354
|
+
asset: assetBindingSchema.optional()
|
|
4341
4355
|
})
|
|
4342
4356
|
)
|
|
4343
4357
|
}),
|
|
@@ -4351,7 +4365,9 @@ var fieldSchema = external_exports.object({
|
|
|
4351
4365
|
name: external_exports.string().regex(IDENT, "must be a valid identifier"),
|
|
4352
4366
|
label: external_exports.string().optional(),
|
|
4353
4367
|
type: fieldTypeSchema,
|
|
4354
|
-
optional: external_exports.boolean()
|
|
4368
|
+
optional: external_exports.boolean(),
|
|
4369
|
+
/** Image/file fields may pin a Media profile; existence is enforced at upload/pick. */
|
|
4370
|
+
asset: assetBindingSchema.optional()
|
|
4355
4371
|
});
|
|
4356
4372
|
var indexSchema = external_exports.object({
|
|
4357
4373
|
name: external_exports.string().regex(IDENT),
|
|
@@ -4368,6 +4384,8 @@ var tableSchema = external_exports.object({
|
|
|
4368
4384
|
}),
|
|
4369
4385
|
label: external_exports.string().optional(),
|
|
4370
4386
|
color: tableColorSchema.optional(),
|
|
4387
|
+
/** Asset metadata tables are typed root tables but never ordinary user records. */
|
|
4388
|
+
kind: tableKindSchema.optional().default("record"),
|
|
4371
4389
|
fields: external_exports.array(fieldSchema),
|
|
4372
4390
|
indexes: external_exports.array(indexSchema).default([]),
|
|
4373
4391
|
searchIndexes: external_exports.array(searchIndexSchema).default([]),
|
|
@@ -4377,6 +4395,7 @@ external_exports.object({
|
|
|
4377
4395
|
tables: external_exports.array(tableSchema)
|
|
4378
4396
|
}).superRefine((manifest, ctx) => {
|
|
4379
4397
|
const tableNames = /* @__PURE__ */ new Set();
|
|
4398
|
+
const tablesByName = /* @__PURE__ */ new Map();
|
|
4380
4399
|
for (const t of manifest.tables) {
|
|
4381
4400
|
if (tableNames.has(t.name)) {
|
|
4382
4401
|
ctx.addIssue({
|
|
@@ -4386,6 +4405,37 @@ external_exports.object({
|
|
|
4386
4405
|
});
|
|
4387
4406
|
}
|
|
4388
4407
|
tableNames.add(t.name);
|
|
4408
|
+
tablesByName.set(t.name, t);
|
|
4409
|
+
if (tableKind(t) === "asset") {
|
|
4410
|
+
if (t.indexes.length > 0) {
|
|
4411
|
+
ctx.addIssue({
|
|
4412
|
+
code: external_exports.ZodIssueCode.custom,
|
|
4413
|
+
message: `${t.name} is an asset metadata table and cannot define indexes`,
|
|
4414
|
+
path: ["tables"]
|
|
4415
|
+
});
|
|
4416
|
+
}
|
|
4417
|
+
if (t.searchIndexes.length > 0) {
|
|
4418
|
+
ctx.addIssue({
|
|
4419
|
+
code: external_exports.ZodIssueCode.custom,
|
|
4420
|
+
message: `${t.name} is an asset metadata table and cannot define search indexes`,
|
|
4421
|
+
path: ["tables"]
|
|
4422
|
+
});
|
|
4423
|
+
}
|
|
4424
|
+
if (t.displayTemplates !== void 0) {
|
|
4425
|
+
ctx.addIssue({
|
|
4426
|
+
code: external_exports.ZodIssueCode.custom,
|
|
4427
|
+
message: `${t.name} is an asset metadata table and cannot define display templates`,
|
|
4428
|
+
path: ["tables"]
|
|
4429
|
+
});
|
|
4430
|
+
}
|
|
4431
|
+
if (t.color !== void 0) {
|
|
4432
|
+
ctx.addIssue({
|
|
4433
|
+
code: external_exports.ZodIssueCode.custom,
|
|
4434
|
+
message: `${t.name} is an asset metadata table and cannot define a color`,
|
|
4435
|
+
path: ["tables"]
|
|
4436
|
+
});
|
|
4437
|
+
}
|
|
4438
|
+
}
|
|
4389
4439
|
const fieldNames = /* @__PURE__ */ new Set();
|
|
4390
4440
|
for (const f of t.fields) {
|
|
4391
4441
|
if (fieldNames.has(f.name)) {
|
|
@@ -4396,36 +4446,43 @@ external_exports.object({
|
|
|
4396
4446
|
});
|
|
4397
4447
|
}
|
|
4398
4448
|
fieldNames.add(f.name);
|
|
4449
|
+
assertAssetBindingAllowed(ctx, t, f);
|
|
4399
4450
|
}
|
|
4400
4451
|
}
|
|
4401
4452
|
for (const t of manifest.tables) {
|
|
4402
4453
|
for (const f of t.fields) {
|
|
4403
|
-
const
|
|
4404
|
-
if (
|
|
4454
|
+
const invalidRef = findInvalidReference(f.type, tablesByName);
|
|
4455
|
+
if (invalidRef) {
|
|
4405
4456
|
ctx.addIssue({
|
|
4406
4457
|
code: external_exports.ZodIssueCode.custom,
|
|
4407
|
-
message: `${t.name}.${f.name}
|
|
4458
|
+
message: `${t.name}.${f.name} ${invalidRef}`,
|
|
4408
4459
|
path: ["tables"]
|
|
4409
4460
|
});
|
|
4410
4461
|
}
|
|
4411
4462
|
}
|
|
4412
4463
|
}
|
|
4413
4464
|
});
|
|
4414
|
-
function
|
|
4465
|
+
function findInvalidReference(t, tablesByName) {
|
|
4415
4466
|
switch (t.kind) {
|
|
4416
|
-
case "id":
|
|
4417
|
-
|
|
4467
|
+
case "id": {
|
|
4468
|
+
const target = tablesByName.get(t.table);
|
|
4469
|
+
if (!target) return `references unknown table: ${t.table}`;
|
|
4470
|
+
if (tableKind(target) === "asset") {
|
|
4471
|
+
return `cannot reference asset metadata table: ${t.table}`;
|
|
4472
|
+
}
|
|
4473
|
+
return null;
|
|
4474
|
+
}
|
|
4418
4475
|
case "array":
|
|
4419
|
-
return
|
|
4476
|
+
return findInvalidReference(t.element, tablesByName);
|
|
4420
4477
|
case "object":
|
|
4421
4478
|
for (const f of t.fields) {
|
|
4422
|
-
const r =
|
|
4479
|
+
const r = findInvalidReference(f.type, tablesByName);
|
|
4423
4480
|
if (r) return r;
|
|
4424
4481
|
}
|
|
4425
4482
|
return null;
|
|
4426
4483
|
case "union":
|
|
4427
4484
|
for (const o of t.options) {
|
|
4428
|
-
const r =
|
|
4485
|
+
const r = findInvalidReference(o, tablesByName);
|
|
4429
4486
|
if (r) return r;
|
|
4430
4487
|
}
|
|
4431
4488
|
return null;
|
|
@@ -4433,6 +4490,49 @@ function findDanglingRef(t, known) {
|
|
|
4433
4490
|
return null;
|
|
4434
4491
|
}
|
|
4435
4492
|
}
|
|
4493
|
+
function tableKind(table) {
|
|
4494
|
+
return table.kind ?? "record";
|
|
4495
|
+
}
|
|
4496
|
+
function isFileFieldType(t) {
|
|
4497
|
+
return t.kind === "file" || t.kind === "image";
|
|
4498
|
+
}
|
|
4499
|
+
function isFileArrayFieldType(t) {
|
|
4500
|
+
return t.kind === "array" && (t.element.kind === "file" || t.element.kind === "image");
|
|
4501
|
+
}
|
|
4502
|
+
function isStorageFieldType(t) {
|
|
4503
|
+
return isFileFieldType(t) || isFileArrayFieldType(t);
|
|
4504
|
+
}
|
|
4505
|
+
function assertAssetBindingAllowed(ctx, table, field) {
|
|
4506
|
+
if (field.asset && tableKind(table) === "asset") {
|
|
4507
|
+
ctx.addIssue({
|
|
4508
|
+
code: external_exports.ZodIssueCode.custom,
|
|
4509
|
+
message: `${table.name}.${field.name} asset metadata fields cannot define a Media profile`,
|
|
4510
|
+
path: ["tables"]
|
|
4511
|
+
});
|
|
4512
|
+
} else if (field.asset && !isStorageFieldType(field.type)) {
|
|
4513
|
+
ctx.addIssue({
|
|
4514
|
+
code: external_exports.ZodIssueCode.custom,
|
|
4515
|
+
message: `${table.name}.${field.name} asset profile can only be set on image/file fields`,
|
|
4516
|
+
path: ["tables"]
|
|
4517
|
+
});
|
|
4518
|
+
}
|
|
4519
|
+
assertAssetBindingsInType(ctx, table, field.type);
|
|
4520
|
+
}
|
|
4521
|
+
function assertAssetBindingsInType(ctx, table, type) {
|
|
4522
|
+
switch (type.kind) {
|
|
4523
|
+
case "array":
|
|
4524
|
+
assertAssetBindingsInType(ctx, table, type.element);
|
|
4525
|
+
return;
|
|
4526
|
+
case "object":
|
|
4527
|
+
for (const field of type.fields) assertAssetBindingAllowed(ctx, table, field);
|
|
4528
|
+
return;
|
|
4529
|
+
case "union":
|
|
4530
|
+
for (const option of type.options) assertAssetBindingsInType(ctx, table, option);
|
|
4531
|
+
return;
|
|
4532
|
+
default:
|
|
4533
|
+
return;
|
|
4534
|
+
}
|
|
4535
|
+
}
|
|
4436
4536
|
function validateFieldValue(value, type, optional) {
|
|
4437
4537
|
if (value === void 0 || value === null) {
|
|
4438
4538
|
if (optional) return null;
|