lecodes-sdk 2.1.0 → 2.1.1

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/package.json CHANGED
@@ -45,7 +45,7 @@
45
45
  "marcidb-embedded": "^0.14.1",
46
46
  "sharp": "^0.35.2"
47
47
  },
48
- "version": "2.1.0",
48
+ "version": "2.1.1",
49
49
  "files": [
50
50
  "src",
51
51
  "dist",
@@ -83,9 +83,12 @@ export const describeServer = (server: LoadedServer): ServerDescription => {
83
83
  for (const [name, m] of Object.entries(db.$models as Record<string, Model>)) {
84
84
  const fields = Object.entries(m.fields as Record<string, Field<any, any>>).filter(([k]) => !shown[name] || shown[name].includes(k))
85
85
  const described = Object.fromEntries(fields.map(([k, f]) => [k, describeField(f)]))
86
- // a file field is, in the database, a relation to File: what a project declared is said here
86
+ // a file field is, in the database, a relation to File: what the project declared is said here —
87
+ // whether the row may have none, and the picture's rule when it is a t.image()
87
88
  for (const f of files) {
88
- if (f.model === name) described[f.key] = { kind: "file", optional: false, unique: false, index: false, hasDefault: false, array: f.array, isId: false }
89
+ if (f.model !== name) continue
90
+ const declared = (db.$given[name]?.fields as Record<string, Field<any, any>> | undefined)?.[f.key]?.def
91
+ described[f.key] = { kind: "file", optional: declared?.optional ?? false, unique: false, index: false, hasDefault: false, array: f.array, isId: false, ...(f.image ? { image: f.image } : {}) }
89
92
  }
90
93
  models[name] = { fields: described, ...(name === FILE_MODEL ? { files: true as const } : shown[name] ? { auth: true as const } : {}) }
91
94
  }
package/src/version.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  // same manifest). Its MAJOR is the bundle ↔ runtime contract: a bundle's `// sdk:` header line
5
5
  // and a host's embedded version must agree on the major for the host to run the bundle; minor
6
6
  // and patch never gate anything (features are detected, never versioned).
7
- export const SDK_VERSION = "2.1.0"
7
+ export const SDK_VERSION = "2.1.1"
8
8
 
9
9
  /** The major of a semver string, or null when it is not one. */
10
10
  export const sdkMajor = (version: string | null | undefined): number | null => {