@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.
Files changed (76) hide show
  1. package/dist/apiProfile.d.ts +39 -0
  2. package/dist/apiProfile.js +19 -2
  3. package/dist/apiProfile.js.map +1 -1
  4. package/dist/assetFamily.d.ts +36 -0
  5. package/dist/assetFamily.js +73 -0
  6. package/dist/assetFamily.js.map +1 -0
  7. package/dist/assetFieldValues.d.ts +21 -0
  8. package/dist/{storageFieldValues.js → assetFieldValues.js} +159 -60
  9. package/dist/assetFieldValues.js.map +1 -0
  10. package/dist/assetGraph.d.ts +199 -0
  11. package/dist/assetGraph.js +214 -0
  12. package/dist/assetGraph.js.map +1 -0
  13. package/dist/assetJobs.d.ts +95 -0
  14. package/dist/assetJobs.js +41 -0
  15. package/dist/assetJobs.js.map +1 -0
  16. package/dist/assetSettings.d.ts +129 -0
  17. package/dist/assetSettings.js +87 -0
  18. package/dist/assetSettings.js.map +1 -0
  19. package/dist/assetValidators.d.ts +475 -0
  20. package/dist/assetValidators.js +83 -0
  21. package/dist/assetValidators.js.map +1 -0
  22. package/dist/bffProtocol.d.ts +29 -24
  23. package/dist/bffProtocol.js +5 -1
  24. package/dist/bffProtocol.js.map +1 -1
  25. package/dist/ciPreviewEnv.js +1 -1
  26. package/dist/ciPreviewEnv.js.map +1 -1
  27. package/dist/clipboardTransfer.js +112 -12
  28. package/dist/clipboardTransfer.js.map +1 -1
  29. package/dist/csv.js +118 -18
  30. package/dist/csv.js.map +1 -1
  31. package/dist/displayLabel.js +1 -1
  32. package/dist/displayLabel.js.map +1 -1
  33. package/dist/dotenv.js +5 -1
  34. package/dist/dotenv.js.map +1 -1
  35. package/dist/importMatch.js +118 -18
  36. package/dist/importMatch.js.map +1 -1
  37. package/dist/index.d.ts +7 -1
  38. package/dist/index.js +722 -80
  39. package/dist/index.js.map +1 -1
  40. package/dist/postLoginPath.d.ts +21 -0
  41. package/dist/postLoginPath.js +24 -0
  42. package/dist/postLoginPath.js.map +1 -0
  43. package/dist/previewDeployName.js +2 -2
  44. package/dist/previewDeployName.js.map +1 -1
  45. package/dist/recordTableColumns.js +112 -12
  46. package/dist/recordTableColumns.js.map +1 -1
  47. package/dist/recordTablePreload.js.map +1 -1
  48. package/dist/refDisplayRequests.js +112 -12
  49. package/dist/refDisplayRequests.js.map +1 -1
  50. package/dist/richDoc.d.ts +2 -2
  51. package/dist/richDoc.js +5 -5
  52. package/dist/richDoc.js.map +1 -1
  53. package/dist/schemaGenerator.d.ts +25 -1
  54. package/dist/schemaGenerator.js +4569 -18
  55. package/dist/schemaGenerator.js.map +1 -1
  56. package/dist/schemaShrink.d.ts +3 -1
  57. package/dist/schemaShrink.js +4451 -1
  58. package/dist/schemaShrink.js.map +1 -1
  59. package/dist/schemaShrinkValidators.d.ts +2 -2
  60. package/dist/schemaTypes.d.ts +123 -0
  61. package/dist/schemaTypes.js +107 -13
  62. package/dist/schemaTypes.js.map +1 -1
  63. package/dist/share.js +6 -1
  64. package/dist/share.js.map +1 -1
  65. package/dist/shareApiBridge.js +6 -1
  66. package/dist/shareApiBridge.js.map +1 -1
  67. package/dist/shareProposal.js +112 -12
  68. package/dist/shareProposal.js.map +1 -1
  69. package/dist/spaceBundle.js +112 -12
  70. package/dist/spaceBundle.js.map +1 -1
  71. package/dist/syncChannel.d.ts +15 -0
  72. package/dist/syncChannel.js +4642 -0
  73. package/dist/syncChannel.js.map +1 -0
  74. package/package.json +1 -1
  75. package/dist/storageFieldValues.d.ts +0 -10
  76. package/dist/storageFieldValues.js.map +0 -1
@@ -172,6 +172,11 @@ export declare const apiTableAccessSchema: z.ZodObject<{
172
172
  }>>;
173
173
  /** Scan ceiling for Read/guest list plans; callers may only lower. Not applied to Sync/Resync. */
174
174
  maxScanLimit: z.ZodOptional<z.ZodNumber>;
175
+ /**
176
+ * Media source scope for the fixed `columnus_assets` source. Omit for all
177
+ * live Media; an empty list intentionally grants no Media assets.
178
+ */
179
+ assetProfiles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
175
180
  }, "strip", z.ZodTypeAny, {
176
181
  table: string;
177
182
  read: boolean;
@@ -219,6 +224,7 @@ export declare const apiTableAccessSchema: z.ZodObject<{
219
224
  } | undefined;
220
225
  } | undefined;
221
226
  maxScanLimit?: number | undefined;
227
+ assetProfiles?: string[] | undefined;
222
228
  }, {
223
229
  table: string;
224
230
  read: boolean;
@@ -266,6 +272,7 @@ export declare const apiTableAccessSchema: z.ZodObject<{
266
272
  } | undefined;
267
273
  } | undefined;
268
274
  maxScanLimit?: number | undefined;
275
+ assetProfiles?: string[] | undefined;
269
276
  }>;
270
277
  export type ApiTableAccess = z.infer<typeof apiTableAccessSchema>;
271
278
  export declare const apiProfileSnapshotSchema: z.ZodObject<{
@@ -446,6 +453,11 @@ export declare const apiProfileSnapshotSchema: z.ZodObject<{
446
453
  }>>;
447
454
  /** Scan ceiling for Read/guest list plans; callers may only lower. Not applied to Sync/Resync. */
448
455
  maxScanLimit: z.ZodOptional<z.ZodNumber>;
456
+ /**
457
+ * Media source scope for the fixed `columnus_assets` source. Omit for all
458
+ * live Media; an empty list intentionally grants no Media assets.
459
+ */
460
+ assetProfiles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
449
461
  }, "strip", z.ZodTypeAny, {
450
462
  table: string;
451
463
  read: boolean;
@@ -493,6 +505,7 @@ export declare const apiProfileSnapshotSchema: z.ZodObject<{
493
505
  } | undefined;
494
506
  } | undefined;
495
507
  maxScanLimit?: number | undefined;
508
+ assetProfiles?: string[] | undefined;
496
509
  }, {
497
510
  table: string;
498
511
  read: boolean;
@@ -540,6 +553,7 @@ export declare const apiProfileSnapshotSchema: z.ZodObject<{
540
553
  } | undefined;
541
554
  } | undefined;
542
555
  maxScanLimit?: number | undefined;
556
+ assetProfiles?: string[] | undefined;
543
557
  }>, "many">>;
544
558
  autoAcceptProposals: z.ZodOptional<z.ZodBoolean>;
545
559
  apiVersion: z.ZodNumber;
@@ -598,6 +612,7 @@ export declare const apiProfileSnapshotSchema: z.ZodObject<{
598
612
  } | undefined;
599
613
  } | undefined;
600
614
  maxScanLimit?: number | undefined;
615
+ assetProfiles?: string[] | undefined;
601
616
  }[] | undefined;
602
617
  autoAcceptProposals?: boolean | undefined;
603
618
  }, {
@@ -654,6 +669,7 @@ export declare const apiProfileSnapshotSchema: z.ZodObject<{
654
669
  } | undefined;
655
670
  } | undefined;
656
671
  maxScanLimit?: number | undefined;
672
+ assetProfiles?: string[] | undefined;
657
673
  }[] | undefined;
658
674
  autoAcceptProposals?: boolean | undefined;
659
675
  }>;
@@ -836,6 +852,11 @@ export declare const apiProfilesSchema: z.ZodArray<z.ZodObject<{
836
852
  }>>;
837
853
  /** Scan ceiling for Read/guest list plans; callers may only lower. Not applied to Sync/Resync. */
838
854
  maxScanLimit: z.ZodOptional<z.ZodNumber>;
855
+ /**
856
+ * Media source scope for the fixed `columnus_assets` source. Omit for all
857
+ * live Media; an empty list intentionally grants no Media assets.
858
+ */
859
+ assetProfiles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
839
860
  }, "strip", z.ZodTypeAny, {
840
861
  table: string;
841
862
  read: boolean;
@@ -883,6 +904,7 @@ export declare const apiProfilesSchema: z.ZodArray<z.ZodObject<{
883
904
  } | undefined;
884
905
  } | undefined;
885
906
  maxScanLimit?: number | undefined;
907
+ assetProfiles?: string[] | undefined;
886
908
  }, {
887
909
  table: string;
888
910
  read: boolean;
@@ -930,6 +952,7 @@ export declare const apiProfilesSchema: z.ZodArray<z.ZodObject<{
930
952
  } | undefined;
931
953
  } | undefined;
932
954
  maxScanLimit?: number | undefined;
955
+ assetProfiles?: string[] | undefined;
933
956
  }>, "many">>;
934
957
  autoAcceptProposals: z.ZodOptional<z.ZodBoolean>;
935
958
  apiVersion: z.ZodNumber;
@@ -988,6 +1011,7 @@ export declare const apiProfilesSchema: z.ZodArray<z.ZodObject<{
988
1011
  } | undefined;
989
1012
  } | undefined;
990
1013
  maxScanLimit?: number | undefined;
1014
+ assetProfiles?: string[] | undefined;
991
1015
  }[] | undefined;
992
1016
  autoAcceptProposals?: boolean | undefined;
993
1017
  }, {
@@ -1044,6 +1068,7 @@ export declare const apiProfilesSchema: z.ZodArray<z.ZodObject<{
1044
1068
  } | undefined;
1045
1069
  } | undefined;
1046
1070
  maxScanLimit?: number | undefined;
1071
+ assetProfiles?: string[] | undefined;
1047
1072
  }[] | undefined;
1048
1073
  autoAcceptProposals?: boolean | undefined;
1049
1074
  }>, "many">;
@@ -1051,6 +1076,8 @@ export declare const apiProfilesSchema: z.ZodArray<z.ZodObject<{
1051
1076
  export declare function editorAccessEnabled(access: ApiTableAccess): boolean;
1052
1077
  /** The profile's access entry for `table`, if any. */
1053
1078
  export declare function findTableAccess(tableAccess: readonly ApiTableAccess[] | undefined, table: string): ApiTableAccess | undefined;
1079
+ /** Normalize legacy `tables` profiles into the current per-source access shape. */
1080
+ export declare function profileTableAccesses(profile: Pick<ApiProfileSnapshot, "tables" | "tableAccess">): readonly ApiTableAccess[];
1054
1081
  /**
1055
1082
  * Fail if any patch table lacks current `editorAccess: true` on the profile.
1056
1083
  * Single source for the editor write gate: the component enforces it on write,
@@ -1061,6 +1088,18 @@ export declare function assertPatchesHaveEditorAccess(profile: Pick<ApiProfileSn
1061
1088
  }[]): void;
1062
1089
  /** Tables opted into push sync. Sync is deliberately opt-in, including legacy profiles. */
1063
1090
  export declare function syncEnabledTables(profile: Pick<ApiProfileSnapshot, "tableAccess">): string[];
1091
+ /** Minimal root Media projection needed to decide API/Sync membership. */
1092
+ export type AssetScopeSnapshot = {
1093
+ isDeleted?: unknown;
1094
+ wipedAt?: unknown;
1095
+ profileSlugs?: unknown;
1096
+ };
1097
+ /**
1098
+ * Media is readable only while live. An omitted profile allowlist means all
1099
+ * live Media; an explicit empty list is useful for disabling the source while
1100
+ * retaining a draft access row.
1101
+ */
1102
+ export declare function assetMatchesProfileScope(asset: AssetScopeSnapshot | null | undefined, assetProfiles: readonly string[] | undefined): boolean;
1064
1103
  export type ResolvedApiToken = {
1065
1104
  tokenId: string;
1066
1105
  profileId: string;
@@ -4167,7 +4167,12 @@ var apiTableAccessSchema = external_exports.object({
4167
4167
  */
4168
4168
  rowQuery: clampQuerySchema.optional(),
4169
4169
  /** Scan ceiling for Read/guest list plans; callers may only lower. Not applied to Sync/Resync. */
4170
- maxScanLimit: external_exports.number().int().positive().optional()
4170
+ maxScanLimit: external_exports.number().int().positive().optional(),
4171
+ /**
4172
+ * Media source scope for the fixed `columnus_assets` source. Omit for all
4173
+ * live Media; an empty list intentionally grants no Media assets.
4174
+ */
4175
+ assetProfiles: external_exports.array(external_exports.string().min(1)).max(100).optional()
4171
4176
  });
4172
4177
  var apiProfileSnapshotSchema = external_exports.object({
4173
4178
  id: external_exports.string(),
@@ -4186,6 +4191,9 @@ function editorAccessEnabled(access) {
4186
4191
  function findTableAccess(tableAccess, table) {
4187
4192
  return tableAccess?.find((entry) => entry.table === table);
4188
4193
  }
4194
+ function profileTableAccesses(profile) {
4195
+ return profile.tableAccess ?? profile.tables.map((table) => ({ table, read: true }));
4196
+ }
4189
4197
  function assertPatchesHaveEditorAccess(profile, patches) {
4190
4198
  const byTable = new Map((profile.tableAccess ?? []).map((access) => [access.table, access]));
4191
4199
  for (const patch of patches) {
@@ -4204,7 +4212,16 @@ function syncEnabledTables(profile) {
4204
4212
  }
4205
4213
  return [...tables];
4206
4214
  }
4215
+ function assetMatchesProfileScope(asset, assetProfiles) {
4216
+ if (!asset || asset.isDeleted === true || asset.wipedAt !== void 0) return false;
4217
+ if (assetProfiles === void 0) return true;
4218
+ if (assetProfiles.length === 0) return false;
4219
+ const profileSet = new Set(assetProfiles);
4220
+ return Array.isArray(asset.profileSlugs) && asset.profileSlugs.some(
4221
+ (profile) => typeof profile === "string" && profileSet.has(profile)
4222
+ );
4223
+ }
4207
4224
 
4208
- export { apiProfileSnapshotSchema, apiProfilesSchema, apiTableAccessSchema, assertPatchesHaveEditorAccess, editorAccessEnabled, findTableAccess, syncEnabledTables };
4225
+ export { apiProfileSnapshotSchema, apiProfilesSchema, apiTableAccessSchema, assertPatchesHaveEditorAccess, assetMatchesProfileScope, editorAccessEnabled, findTableAccess, profileTableAccesses, syncEnabledTables };
4209
4226
  //# sourceMappingURL=apiProfile.js.map
4210
4227
  //# sourceMappingURL=apiProfile.js.map