@columnus/shared 0.1.55 → 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 +1 -1
- 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 +722 -80
- 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.js +2 -2
- 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
|
@@ -4598,7 +4598,13 @@ var RESERVED_TABLE_NAMES = /* @__PURE__ */ new Set([
|
|
|
4598
4598
|
"columnus_api_output_secrets",
|
|
4599
4599
|
"columnus_api_sync_routes",
|
|
4600
4600
|
"columnus_api_outbox",
|
|
4601
|
-
"columnus_api_delivery"
|
|
4601
|
+
"columnus_api_delivery",
|
|
4602
|
+
"columnus_assets",
|
|
4603
|
+
"columnus_asset_versions",
|
|
4604
|
+
"columnus_asset_refs",
|
|
4605
|
+
"columnus_asset_profiles",
|
|
4606
|
+
"columnus_asset_settings",
|
|
4607
|
+
"columnus_asset_jobs"
|
|
4602
4608
|
]);
|
|
4603
4609
|
var displayTemplatesSchema = external_exports.object({
|
|
4604
4610
|
id: external_exports.string().optional(),
|
|
@@ -4631,6 +4637,12 @@ var TABLE_COLORS = [
|
|
|
4631
4637
|
"lavender"
|
|
4632
4638
|
];
|
|
4633
4639
|
var tableColorSchema = external_exports.enum(TABLE_COLORS);
|
|
4640
|
+
var TABLE_KINDS = ["record", "asset"];
|
|
4641
|
+
var tableKindSchema = external_exports.enum(TABLE_KINDS);
|
|
4642
|
+
var assetBindingSchema = external_exports.object({
|
|
4643
|
+
profile: external_exports.string().min(1),
|
|
4644
|
+
enforced: external_exports.boolean().optional()
|
|
4645
|
+
});
|
|
4634
4646
|
var fieldTypeSchema = external_exports.lazy(
|
|
4635
4647
|
() => external_exports.discriminatedUnion("kind", [
|
|
4636
4648
|
external_exports.object({ kind: external_exports.literal("string") }),
|
|
@@ -4658,7 +4670,9 @@ var fieldTypeSchema = external_exports.lazy(
|
|
|
4658
4670
|
name: external_exports.string().regex(IDENT),
|
|
4659
4671
|
label: external_exports.string().optional(),
|
|
4660
4672
|
type: fieldTypeSchema,
|
|
4661
|
-
optional: external_exports.boolean()
|
|
4673
|
+
optional: external_exports.boolean(),
|
|
4674
|
+
/** Nested image/file placements bind a Media profile like top-level ones. */
|
|
4675
|
+
asset: assetBindingSchema.optional()
|
|
4662
4676
|
})
|
|
4663
4677
|
)
|
|
4664
4678
|
}),
|
|
@@ -4672,7 +4686,9 @@ var fieldSchema = external_exports.object({
|
|
|
4672
4686
|
name: external_exports.string().regex(IDENT, "must be a valid identifier"),
|
|
4673
4687
|
label: external_exports.string().optional(),
|
|
4674
4688
|
type: fieldTypeSchema,
|
|
4675
|
-
optional: external_exports.boolean()
|
|
4689
|
+
optional: external_exports.boolean(),
|
|
4690
|
+
/** Image/file fields may pin a Media profile; existence is enforced at upload/pick. */
|
|
4691
|
+
asset: assetBindingSchema.optional()
|
|
4676
4692
|
});
|
|
4677
4693
|
var indexSchema = external_exports.object({
|
|
4678
4694
|
name: external_exports.string().regex(IDENT),
|
|
@@ -4689,6 +4705,8 @@ var tableSchema = external_exports.object({
|
|
|
4689
4705
|
}),
|
|
4690
4706
|
label: external_exports.string().optional(),
|
|
4691
4707
|
color: tableColorSchema.optional(),
|
|
4708
|
+
/** Asset metadata tables are typed root tables but never ordinary user records. */
|
|
4709
|
+
kind: tableKindSchema.optional().default("record"),
|
|
4692
4710
|
fields: external_exports.array(fieldSchema),
|
|
4693
4711
|
indexes: external_exports.array(indexSchema).default([]),
|
|
4694
4712
|
searchIndexes: external_exports.array(searchIndexSchema).default([]),
|
|
@@ -4698,6 +4716,7 @@ external_exports.object({
|
|
|
4698
4716
|
tables: external_exports.array(tableSchema)
|
|
4699
4717
|
}).superRefine((manifest, ctx) => {
|
|
4700
4718
|
const tableNames = /* @__PURE__ */ new Set();
|
|
4719
|
+
const tablesByName = /* @__PURE__ */ new Map();
|
|
4701
4720
|
for (const t of manifest.tables) {
|
|
4702
4721
|
if (tableNames.has(t.name)) {
|
|
4703
4722
|
ctx.addIssue({
|
|
@@ -4707,6 +4726,37 @@ external_exports.object({
|
|
|
4707
4726
|
});
|
|
4708
4727
|
}
|
|
4709
4728
|
tableNames.add(t.name);
|
|
4729
|
+
tablesByName.set(t.name, t);
|
|
4730
|
+
if (tableKind(t) === "asset") {
|
|
4731
|
+
if (t.indexes.length > 0) {
|
|
4732
|
+
ctx.addIssue({
|
|
4733
|
+
code: external_exports.ZodIssueCode.custom,
|
|
4734
|
+
message: `${t.name} is an asset metadata table and cannot define indexes`,
|
|
4735
|
+
path: ["tables"]
|
|
4736
|
+
});
|
|
4737
|
+
}
|
|
4738
|
+
if (t.searchIndexes.length > 0) {
|
|
4739
|
+
ctx.addIssue({
|
|
4740
|
+
code: external_exports.ZodIssueCode.custom,
|
|
4741
|
+
message: `${t.name} is an asset metadata table and cannot define search indexes`,
|
|
4742
|
+
path: ["tables"]
|
|
4743
|
+
});
|
|
4744
|
+
}
|
|
4745
|
+
if (t.displayTemplates !== void 0) {
|
|
4746
|
+
ctx.addIssue({
|
|
4747
|
+
code: external_exports.ZodIssueCode.custom,
|
|
4748
|
+
message: `${t.name} is an asset metadata table and cannot define display templates`,
|
|
4749
|
+
path: ["tables"]
|
|
4750
|
+
});
|
|
4751
|
+
}
|
|
4752
|
+
if (t.color !== void 0) {
|
|
4753
|
+
ctx.addIssue({
|
|
4754
|
+
code: external_exports.ZodIssueCode.custom,
|
|
4755
|
+
message: `${t.name} is an asset metadata table and cannot define a color`,
|
|
4756
|
+
path: ["tables"]
|
|
4757
|
+
});
|
|
4758
|
+
}
|
|
4759
|
+
}
|
|
4710
4760
|
const fieldNames = /* @__PURE__ */ new Set();
|
|
4711
4761
|
for (const f of t.fields) {
|
|
4712
4762
|
if (fieldNames.has(f.name)) {
|
|
@@ -4717,36 +4767,43 @@ external_exports.object({
|
|
|
4717
4767
|
});
|
|
4718
4768
|
}
|
|
4719
4769
|
fieldNames.add(f.name);
|
|
4770
|
+
assertAssetBindingAllowed(ctx, t, f);
|
|
4720
4771
|
}
|
|
4721
4772
|
}
|
|
4722
4773
|
for (const t of manifest.tables) {
|
|
4723
4774
|
for (const f of t.fields) {
|
|
4724
|
-
const
|
|
4725
|
-
if (
|
|
4775
|
+
const invalidRef = findInvalidReference(f.type, tablesByName);
|
|
4776
|
+
if (invalidRef) {
|
|
4726
4777
|
ctx.addIssue({
|
|
4727
4778
|
code: external_exports.ZodIssueCode.custom,
|
|
4728
|
-
message: `${t.name}.${f.name}
|
|
4779
|
+
message: `${t.name}.${f.name} ${invalidRef}`,
|
|
4729
4780
|
path: ["tables"]
|
|
4730
4781
|
});
|
|
4731
4782
|
}
|
|
4732
4783
|
}
|
|
4733
4784
|
}
|
|
4734
4785
|
});
|
|
4735
|
-
function
|
|
4786
|
+
function findInvalidReference(t, tablesByName) {
|
|
4736
4787
|
switch (t.kind) {
|
|
4737
|
-
case "id":
|
|
4738
|
-
|
|
4788
|
+
case "id": {
|
|
4789
|
+
const target = tablesByName.get(t.table);
|
|
4790
|
+
if (!target) return `references unknown table: ${t.table}`;
|
|
4791
|
+
if (tableKind(target) === "asset") {
|
|
4792
|
+
return `cannot reference asset metadata table: ${t.table}`;
|
|
4793
|
+
}
|
|
4794
|
+
return null;
|
|
4795
|
+
}
|
|
4739
4796
|
case "array":
|
|
4740
|
-
return
|
|
4797
|
+
return findInvalidReference(t.element, tablesByName);
|
|
4741
4798
|
case "object":
|
|
4742
4799
|
for (const f of t.fields) {
|
|
4743
|
-
const r =
|
|
4800
|
+
const r = findInvalidReference(f.type, tablesByName);
|
|
4744
4801
|
if (r) return r;
|
|
4745
4802
|
}
|
|
4746
4803
|
return null;
|
|
4747
4804
|
case "union":
|
|
4748
4805
|
for (const o of t.options) {
|
|
4749
|
-
const r =
|
|
4806
|
+
const r = findInvalidReference(o, tablesByName);
|
|
4750
4807
|
if (r) return r;
|
|
4751
4808
|
}
|
|
4752
4809
|
return null;
|
|
@@ -4754,6 +4811,49 @@ function findDanglingRef(t, known) {
|
|
|
4754
4811
|
return null;
|
|
4755
4812
|
}
|
|
4756
4813
|
}
|
|
4814
|
+
function tableKind(table) {
|
|
4815
|
+
return table.kind ?? "record";
|
|
4816
|
+
}
|
|
4817
|
+
function isFileFieldType(t) {
|
|
4818
|
+
return t.kind === "file" || t.kind === "image";
|
|
4819
|
+
}
|
|
4820
|
+
function isFileArrayFieldType(t) {
|
|
4821
|
+
return t.kind === "array" && (t.element.kind === "file" || t.element.kind === "image");
|
|
4822
|
+
}
|
|
4823
|
+
function isStorageFieldType(t) {
|
|
4824
|
+
return isFileFieldType(t) || isFileArrayFieldType(t);
|
|
4825
|
+
}
|
|
4826
|
+
function assertAssetBindingAllowed(ctx, table, field) {
|
|
4827
|
+
if (field.asset && tableKind(table) === "asset") {
|
|
4828
|
+
ctx.addIssue({
|
|
4829
|
+
code: external_exports.ZodIssueCode.custom,
|
|
4830
|
+
message: `${table.name}.${field.name} asset metadata fields cannot define a Media profile`,
|
|
4831
|
+
path: ["tables"]
|
|
4832
|
+
});
|
|
4833
|
+
} else if (field.asset && !isStorageFieldType(field.type)) {
|
|
4834
|
+
ctx.addIssue({
|
|
4835
|
+
code: external_exports.ZodIssueCode.custom,
|
|
4836
|
+
message: `${table.name}.${field.name} asset profile can only be set on image/file fields`,
|
|
4837
|
+
path: ["tables"]
|
|
4838
|
+
});
|
|
4839
|
+
}
|
|
4840
|
+
assertAssetBindingsInType(ctx, table, field.type);
|
|
4841
|
+
}
|
|
4842
|
+
function assertAssetBindingsInType(ctx, table, type) {
|
|
4843
|
+
switch (type.kind) {
|
|
4844
|
+
case "array":
|
|
4845
|
+
assertAssetBindingsInType(ctx, table, type.element);
|
|
4846
|
+
return;
|
|
4847
|
+
case "object":
|
|
4848
|
+
for (const field of type.fields) assertAssetBindingAllowed(ctx, table, field);
|
|
4849
|
+
return;
|
|
4850
|
+
case "union":
|
|
4851
|
+
for (const option of type.options) assertAssetBindingsInType(ctx, table, option);
|
|
4852
|
+
return;
|
|
4853
|
+
default:
|
|
4854
|
+
return;
|
|
4855
|
+
}
|
|
4856
|
+
}
|
|
4757
4857
|
|
|
4758
4858
|
// packages/@columnus/shared/src/refGraph.ts
|
|
4759
4859
|
function refEdgesForType(type) {
|