@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/csv.js
CHANGED
|
@@ -4795,7 +4795,7 @@ function extractPlainText(value, maxLength) {
|
|
|
4795
4795
|
}
|
|
4796
4796
|
|
|
4797
4797
|
// packages/@columnus/shared/src/displayLabel.ts
|
|
4798
|
-
var CONVEX_DOCUMENT_ID = /^[a-z0-9]{
|
|
4798
|
+
var CONVEX_DOCUMENT_ID = /^[a-z0-9]{26,64}$/;
|
|
4799
4799
|
function looksLikeId(s) {
|
|
4800
4800
|
return CONVEX_DOCUMENT_ID.test(s);
|
|
4801
4801
|
}
|
|
@@ -4813,7 +4813,13 @@ var RESERVED_TABLE_NAMES = /* @__PURE__ */ new Set([
|
|
|
4813
4813
|
"columnus_api_output_secrets",
|
|
4814
4814
|
"columnus_api_sync_routes",
|
|
4815
4815
|
"columnus_api_outbox",
|
|
4816
|
-
"columnus_api_delivery"
|
|
4816
|
+
"columnus_api_delivery",
|
|
4817
|
+
"columnus_assets",
|
|
4818
|
+
"columnus_asset_versions",
|
|
4819
|
+
"columnus_asset_refs",
|
|
4820
|
+
"columnus_asset_profiles",
|
|
4821
|
+
"columnus_asset_settings",
|
|
4822
|
+
"columnus_asset_jobs"
|
|
4817
4823
|
]);
|
|
4818
4824
|
var displayTemplatesSchema = external_exports.object({
|
|
4819
4825
|
id: external_exports.string().optional(),
|
|
@@ -4846,6 +4852,12 @@ var TABLE_COLORS = [
|
|
|
4846
4852
|
"lavender"
|
|
4847
4853
|
];
|
|
4848
4854
|
var tableColorSchema = external_exports.enum(TABLE_COLORS);
|
|
4855
|
+
var TABLE_KINDS = ["record", "asset"];
|
|
4856
|
+
var tableKindSchema = external_exports.enum(TABLE_KINDS);
|
|
4857
|
+
var assetBindingSchema = external_exports.object({
|
|
4858
|
+
profile: external_exports.string().min(1),
|
|
4859
|
+
enforced: external_exports.boolean().optional()
|
|
4860
|
+
});
|
|
4849
4861
|
var fieldTypeSchema = external_exports.lazy(
|
|
4850
4862
|
() => external_exports.discriminatedUnion("kind", [
|
|
4851
4863
|
external_exports.object({ kind: external_exports.literal("string") }),
|
|
@@ -4873,7 +4885,9 @@ var fieldTypeSchema = external_exports.lazy(
|
|
|
4873
4885
|
name: external_exports.string().regex(IDENT),
|
|
4874
4886
|
label: external_exports.string().optional(),
|
|
4875
4887
|
type: fieldTypeSchema,
|
|
4876
|
-
optional: external_exports.boolean()
|
|
4888
|
+
optional: external_exports.boolean(),
|
|
4889
|
+
/** Nested image/file placements bind a Media profile like top-level ones. */
|
|
4890
|
+
asset: assetBindingSchema.optional()
|
|
4877
4891
|
})
|
|
4878
4892
|
)
|
|
4879
4893
|
}),
|
|
@@ -4887,7 +4901,9 @@ var fieldSchema = external_exports.object({
|
|
|
4887
4901
|
name: external_exports.string().regex(IDENT, "must be a valid identifier"),
|
|
4888
4902
|
label: external_exports.string().optional(),
|
|
4889
4903
|
type: fieldTypeSchema,
|
|
4890
|
-
optional: external_exports.boolean()
|
|
4904
|
+
optional: external_exports.boolean(),
|
|
4905
|
+
/** Image/file fields may pin a Media profile; existence is enforced at upload/pick. */
|
|
4906
|
+
asset: assetBindingSchema.optional()
|
|
4891
4907
|
});
|
|
4892
4908
|
var indexSchema = external_exports.object({
|
|
4893
4909
|
name: external_exports.string().regex(IDENT),
|
|
@@ -4904,6 +4920,8 @@ var tableSchema = external_exports.object({
|
|
|
4904
4920
|
}),
|
|
4905
4921
|
label: external_exports.string().optional(),
|
|
4906
4922
|
color: tableColorSchema.optional(),
|
|
4923
|
+
/** Asset metadata tables are typed root tables but never ordinary user records. */
|
|
4924
|
+
kind: tableKindSchema.optional().default("record"),
|
|
4907
4925
|
fields: external_exports.array(fieldSchema),
|
|
4908
4926
|
indexes: external_exports.array(indexSchema).default([]),
|
|
4909
4927
|
searchIndexes: external_exports.array(searchIndexSchema).default([]),
|
|
@@ -4913,6 +4931,7 @@ external_exports.object({
|
|
|
4913
4931
|
tables: external_exports.array(tableSchema)
|
|
4914
4932
|
}).superRefine((manifest, ctx) => {
|
|
4915
4933
|
const tableNames = /* @__PURE__ */ new Set();
|
|
4934
|
+
const tablesByName = /* @__PURE__ */ new Map();
|
|
4916
4935
|
for (const t of manifest.tables) {
|
|
4917
4936
|
if (tableNames.has(t.name)) {
|
|
4918
4937
|
ctx.addIssue({
|
|
@@ -4922,6 +4941,37 @@ external_exports.object({
|
|
|
4922
4941
|
});
|
|
4923
4942
|
}
|
|
4924
4943
|
tableNames.add(t.name);
|
|
4944
|
+
tablesByName.set(t.name, t);
|
|
4945
|
+
if (tableKind(t) === "asset") {
|
|
4946
|
+
if (t.indexes.length > 0) {
|
|
4947
|
+
ctx.addIssue({
|
|
4948
|
+
code: external_exports.ZodIssueCode.custom,
|
|
4949
|
+
message: `${t.name} is an asset metadata table and cannot define indexes`,
|
|
4950
|
+
path: ["tables"]
|
|
4951
|
+
});
|
|
4952
|
+
}
|
|
4953
|
+
if (t.searchIndexes.length > 0) {
|
|
4954
|
+
ctx.addIssue({
|
|
4955
|
+
code: external_exports.ZodIssueCode.custom,
|
|
4956
|
+
message: `${t.name} is an asset metadata table and cannot define search indexes`,
|
|
4957
|
+
path: ["tables"]
|
|
4958
|
+
});
|
|
4959
|
+
}
|
|
4960
|
+
if (t.displayTemplates !== void 0) {
|
|
4961
|
+
ctx.addIssue({
|
|
4962
|
+
code: external_exports.ZodIssueCode.custom,
|
|
4963
|
+
message: `${t.name} is an asset metadata table and cannot define display templates`,
|
|
4964
|
+
path: ["tables"]
|
|
4965
|
+
});
|
|
4966
|
+
}
|
|
4967
|
+
if (t.color !== void 0) {
|
|
4968
|
+
ctx.addIssue({
|
|
4969
|
+
code: external_exports.ZodIssueCode.custom,
|
|
4970
|
+
message: `${t.name} is an asset metadata table and cannot define a color`,
|
|
4971
|
+
path: ["tables"]
|
|
4972
|
+
});
|
|
4973
|
+
}
|
|
4974
|
+
}
|
|
4925
4975
|
const fieldNames = /* @__PURE__ */ new Set();
|
|
4926
4976
|
for (const f of t.fields) {
|
|
4927
4977
|
if (fieldNames.has(f.name)) {
|
|
@@ -4932,36 +4982,43 @@ external_exports.object({
|
|
|
4932
4982
|
});
|
|
4933
4983
|
}
|
|
4934
4984
|
fieldNames.add(f.name);
|
|
4985
|
+
assertAssetBindingAllowed(ctx, t, f);
|
|
4935
4986
|
}
|
|
4936
4987
|
}
|
|
4937
4988
|
for (const t of manifest.tables) {
|
|
4938
4989
|
for (const f of t.fields) {
|
|
4939
|
-
const
|
|
4940
|
-
if (
|
|
4990
|
+
const invalidRef = findInvalidReference(f.type, tablesByName);
|
|
4991
|
+
if (invalidRef) {
|
|
4941
4992
|
ctx.addIssue({
|
|
4942
4993
|
code: external_exports.ZodIssueCode.custom,
|
|
4943
|
-
message: `${t.name}.${f.name}
|
|
4994
|
+
message: `${t.name}.${f.name} ${invalidRef}`,
|
|
4944
4995
|
path: ["tables"]
|
|
4945
4996
|
});
|
|
4946
4997
|
}
|
|
4947
4998
|
}
|
|
4948
4999
|
}
|
|
4949
5000
|
});
|
|
4950
|
-
function
|
|
5001
|
+
function findInvalidReference(t, tablesByName) {
|
|
4951
5002
|
switch (t.kind) {
|
|
4952
|
-
case "id":
|
|
4953
|
-
|
|
5003
|
+
case "id": {
|
|
5004
|
+
const target = tablesByName.get(t.table);
|
|
5005
|
+
if (!target) return `references unknown table: ${t.table}`;
|
|
5006
|
+
if (tableKind(target) === "asset") {
|
|
5007
|
+
return `cannot reference asset metadata table: ${t.table}`;
|
|
5008
|
+
}
|
|
5009
|
+
return null;
|
|
5010
|
+
}
|
|
4954
5011
|
case "array":
|
|
4955
|
-
return
|
|
5012
|
+
return findInvalidReference(t.element, tablesByName);
|
|
4956
5013
|
case "object":
|
|
4957
5014
|
for (const f of t.fields) {
|
|
4958
|
-
const r =
|
|
5015
|
+
const r = findInvalidReference(f.type, tablesByName);
|
|
4959
5016
|
if (r) return r;
|
|
4960
5017
|
}
|
|
4961
5018
|
return null;
|
|
4962
5019
|
case "union":
|
|
4963
5020
|
for (const o of t.options) {
|
|
4964
|
-
const r =
|
|
5021
|
+
const r = findInvalidReference(o, tablesByName);
|
|
4965
5022
|
if (r) return r;
|
|
4966
5023
|
}
|
|
4967
5024
|
return null;
|
|
@@ -4969,6 +5026,49 @@ function findDanglingRef(t, known) {
|
|
|
4969
5026
|
return null;
|
|
4970
5027
|
}
|
|
4971
5028
|
}
|
|
5029
|
+
function tableKind(table) {
|
|
5030
|
+
return table.kind ?? "record";
|
|
5031
|
+
}
|
|
5032
|
+
function isFileFieldType(t) {
|
|
5033
|
+
return t.kind === "file" || t.kind === "image";
|
|
5034
|
+
}
|
|
5035
|
+
function isFileArrayFieldType(t) {
|
|
5036
|
+
return t.kind === "array" && (t.element.kind === "file" || t.element.kind === "image");
|
|
5037
|
+
}
|
|
5038
|
+
function isStorageFieldType(t) {
|
|
5039
|
+
return isFileFieldType(t) || isFileArrayFieldType(t);
|
|
5040
|
+
}
|
|
5041
|
+
function assertAssetBindingAllowed(ctx, table, field) {
|
|
5042
|
+
if (field.asset && tableKind(table) === "asset") {
|
|
5043
|
+
ctx.addIssue({
|
|
5044
|
+
code: external_exports.ZodIssueCode.custom,
|
|
5045
|
+
message: `${table.name}.${field.name} asset metadata fields cannot define a Media profile`,
|
|
5046
|
+
path: ["tables"]
|
|
5047
|
+
});
|
|
5048
|
+
} else if (field.asset && !isStorageFieldType(field.type)) {
|
|
5049
|
+
ctx.addIssue({
|
|
5050
|
+
code: external_exports.ZodIssueCode.custom,
|
|
5051
|
+
message: `${table.name}.${field.name} asset profile can only be set on image/file fields`,
|
|
5052
|
+
path: ["tables"]
|
|
5053
|
+
});
|
|
5054
|
+
}
|
|
5055
|
+
assertAssetBindingsInType(ctx, table, field.type);
|
|
5056
|
+
}
|
|
5057
|
+
function assertAssetBindingsInType(ctx, table, type) {
|
|
5058
|
+
switch (type.kind) {
|
|
5059
|
+
case "array":
|
|
5060
|
+
assertAssetBindingsInType(ctx, table, type.element);
|
|
5061
|
+
return;
|
|
5062
|
+
case "object":
|
|
5063
|
+
for (const field of type.fields) assertAssetBindingAllowed(ctx, table, field);
|
|
5064
|
+
return;
|
|
5065
|
+
case "union":
|
|
5066
|
+
for (const option of type.options) assertAssetBindingsInType(ctx, table, option);
|
|
5067
|
+
return;
|
|
5068
|
+
default:
|
|
5069
|
+
return;
|
|
5070
|
+
}
|
|
5071
|
+
}
|
|
4972
5072
|
function validateFieldValue(value, type, optional) {
|
|
4973
5073
|
if (value === void 0 || value === null) {
|
|
4974
5074
|
if (optional) return null;
|
|
@@ -5035,10 +5135,10 @@ function validateFieldValue(value, type, optional) {
|
|
|
5035
5135
|
}
|
|
5036
5136
|
}
|
|
5037
5137
|
|
|
5038
|
-
// packages/@columnus/shared/src/
|
|
5039
|
-
var
|
|
5040
|
-
function
|
|
5041
|
-
return
|
|
5138
|
+
// packages/@columnus/shared/src/assetFieldValues.ts
|
|
5139
|
+
var ASSET_ID = /^[a-z0-9]+$/i;
|
|
5140
|
+
function isValidAssetId(value) {
|
|
5141
|
+
return ASSET_ID.test(value) && value.length >= 10;
|
|
5042
5142
|
}
|
|
5043
5143
|
|
|
5044
5144
|
// packages/@columnus/shared/src/refGraph.ts
|
|
@@ -5253,7 +5353,7 @@ function coerceCsvValue(raw, type, optional) {
|
|
|
5253
5353
|
return ok(raw);
|
|
5254
5354
|
case "file":
|
|
5255
5355
|
case "image":
|
|
5256
|
-
if (!
|
|
5356
|
+
if (!isValidAssetId(raw)) return fail("Invalid asset id");
|
|
5257
5357
|
return ok(raw);
|
|
5258
5358
|
case "number": {
|
|
5259
5359
|
const n = Number(raw);
|