@pylonsync/sdk 0.3.168 → 0.3.169

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +28 -0
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.3.168",
6
+ "version": "0.3.169",
7
7
  "type": "module",
8
8
  "main": "src/index.ts",
9
9
  "types": "src/index.ts",
package/src/index.ts CHANGED
@@ -395,6 +395,16 @@ export interface ManifestField {
395
395
  /** Set when the field is `field.X().readonly()` — see
396
396
  * [`FieldDefinition.readonly`]. Omitted by default. */
397
397
  readonly?: boolean;
398
+ /** Default value to fill on insert when the row omits this field.
399
+ * - `"now"` → runtime stamps the current UTC time
400
+ * - any literal → runtime stamps that exact value
401
+ * Maps to `field.X().defaultNow()` / `.default(value)`. */
402
+ default?: "now" | string | number | boolean | null;
403
+ /** Allowed values for `field.enum([...])` — recorded so codegen
404
+ * can emit a literal-union type and runtime validation can
405
+ * reject out-of-set inserts. Plain `field.string()` doesn't
406
+ * carry this; only `field.enum()`. */
407
+ enumValues?: readonly string[];
398
408
  }
399
409
 
400
410
  export interface ManifestIndex {
@@ -504,6 +514,24 @@ export function entitiesToManifest(
504
514
  if (fb._def.readonly) {
505
515
  f.readonly = true;
506
516
  }
517
+ // `default` + `enumValues` are surfaced on the fluent
518
+ // FieldBuilder via the v0.4 SDK. Read off the private
519
+ // backing slot so both APIs serialize identically — apps
520
+ // using the procedural `field` exports get the same
521
+ // ManifestField shape as fluent apps.
522
+ const extra = fb._def as FieldDefinition & {
523
+ default?: { kind: "value"; value: unknown } | { kind: "now" };
524
+ enumValues?: readonly string[];
525
+ };
526
+ if (extra.default) {
527
+ f.default =
528
+ extra.default.kind === "now"
529
+ ? "now"
530
+ : (extra.default.value as ManifestField["default"]);
531
+ }
532
+ if (extra.enumValues && extra.enumValues.length > 0) {
533
+ f.enumValues = extra.enumValues;
534
+ }
507
535
  return f;
508
536
  }),
509
537
  indexes: (e.indexes ?? []).map((idx) => ({