lecodes-sdk 2.0.12 → 2.0.13
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/types/version.d.ts +1 -1
- package/dist/types.json +1 -1
- package/package.json +1 -1
- package/src/server/db/defineDb.ts +1 -0
- package/src/server/db/types.ts +5 -1
- package/src/server/runtime.ts +4 -1
- package/src/version.ts +1 -1
package/package.json
CHANGED
|
@@ -339,6 +339,7 @@ export const defineDb = <const S extends Schema>(declared: S & ValidateRefs<S>,
|
|
|
339
339
|
Object.defineProperties(db, {
|
|
340
340
|
$schema: { get: () => seal().schema },
|
|
341
341
|
$models: { get: () => seal().models },
|
|
342
|
+
$given: { get: () => own },
|
|
342
343
|
$auth: { get: () => seal().auth },
|
|
343
344
|
$files: { get: () => seal().files },
|
|
344
345
|
})
|
package/src/server/db/types.ts
CHANGED
|
@@ -203,7 +203,11 @@ type DbBase<S extends Schema> = {
|
|
|
203
203
|
$transaction<P extends readonly Op<any>[]>(ops: [...P]): Promise<{ [K in keyof P]: P[K] extends Op<infer T> ? T : never }>
|
|
204
204
|
/** The `.marci` schema text this db syncs with. */
|
|
205
205
|
readonly $schema: string
|
|
206
|
-
/** @internal
|
|
206
|
+
/** @internal the models as the schema has them — a model with a `t.file()` field carries the files' relation. */
|
|
207
|
+
readonly $models: Record<string, Model>
|
|
208
|
+
/** @internal the models as `defineDb` received them, by their names here — the objects the project holds,
|
|
209
|
+
* so a host can tell which name the project gave a model it knows by identity. */
|
|
210
|
+
readonly $given: Record<string, Model>
|
|
207
211
|
/** @internal the collections sign-in works on; null = a db without `withAuth`. */
|
|
208
212
|
readonly $auth: AuthBinding | null
|
|
209
213
|
/** @internal the schema's `t.file()` fields (../files/models.ts). */
|
package/src/server/runtime.ts
CHANGED
|
@@ -40,9 +40,12 @@ export const loadServerModules = (
|
|
|
40
40
|
if (!reg) throw new Error("loadServerModules: no server bundle registered (globalThis.__lecodesServer)")
|
|
41
41
|
const out: LoadedServer = { endpoints: new Map(), channels: new Map(), dbs: [], manifest: reg.manifest }
|
|
42
42
|
for (const [mod, exports] of Object.entries(reg.modules)) {
|
|
43
|
+
// the compile's word on each export (serverSplit.ts): a function that is not async is the
|
|
44
|
+
// server's helper, never an endpoint — an old manifest without kinds counts every function
|
|
45
|
+
const kinds = new Map((reg.manifest?.modules?.[mod] ?? []).map(e => [e.name, e.kind]))
|
|
43
46
|
for (const [name, value] of Object.entries(exports)) {
|
|
44
47
|
const id = `${mod}#${name}`
|
|
45
|
-
if (typeof value === "function") out.endpoints.set(id, value as (...args: any[]) => unknown)
|
|
48
|
+
if (typeof value === "function") { if (kinds.get(name) !== "other") out.endpoints.set(id, value as (...args: any[]) => unknown) }
|
|
46
49
|
else if (isChannel(value)) { value.__id = id; out.channels.set(id, value) }
|
|
47
50
|
else if (isDb(value)) out.dbs.push(value)
|
|
48
51
|
}
|
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.0.
|
|
7
|
+
export const SDK_VERSION = "2.0.13"
|
|
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 => {
|