@01.software/sdk 0.5.10 → 0.6.0
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/README.md +12 -0
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -134,6 +134,18 @@ const { docs, totalDocs, hasNextPage } = await client.from('products').find({
|
|
|
134
134
|
select: { title: true, slug: true },
|
|
135
135
|
})
|
|
136
136
|
|
|
137
|
+
// Query with populate/joins control
|
|
138
|
+
const { docs } = await client.from('products').find({
|
|
139
|
+
select: { title: true, slug: true, price: true, thumbnail: true },
|
|
140
|
+
joins: false, // disable joins for lightweight list
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
// Override relationship populate
|
|
144
|
+
const product = await client.from('products').findById(id, {
|
|
145
|
+
populate: { brands: { name: true, logo: true } },
|
|
146
|
+
joins: { variants: { limit: 50 } },
|
|
147
|
+
})
|
|
148
|
+
|
|
137
149
|
// Single item query - returns document directly
|
|
138
150
|
const product = await client.from('products').findById('id')
|
|
139
151
|
|
package/dist/index.cjs
CHANGED
|
@@ -825,7 +825,7 @@ var CollectionQueryBuilder = class {
|
|
|
825
825
|
async find(options) {
|
|
826
826
|
return this.api.requestFind(
|
|
827
827
|
`/api/${String(this.collection)}`,
|
|
828
|
-
options
|
|
828
|
+
{ depth: 1, ...options }
|
|
829
829
|
);
|
|
830
830
|
}
|
|
831
831
|
/**
|
|
@@ -836,7 +836,7 @@ var CollectionQueryBuilder = class {
|
|
|
836
836
|
async findById(id, options) {
|
|
837
837
|
return this.api.requestFindById(
|
|
838
838
|
`/api/${String(this.collection)}/${String(id)}`,
|
|
839
|
-
options
|
|
839
|
+
{ depth: 1, ...options }
|
|
840
840
|
);
|
|
841
841
|
}
|
|
842
842
|
/**
|