Skip to content

Commit

Permalink
Fix bulk links (#345)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericanderson authored May 23, 2024
1 parent 4ee6e25 commit 4dbac7e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/smart-feet-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@osdk/client": patch
---

Fixes link direction for experiental bulk loads
20 changes: 19 additions & 1 deletion examples-extra/basic/cli/src/public/checkUnstableBulkLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,33 @@
* limitations under the License.
*/

import { Employee } from "@osdk/examples.basic.sdk";
import { Employee, WeatherStation } from "@osdk/examples.basic.sdk";
import { client } from "../client.js";
import { logger } from "../logger.js";

export async function checkUnstableBulkLinks() {
// Test one to many
const stations = await client(WeatherStation).fetchPage();
for await (
const {
object,
linkApiName,
otherObjectApiName,
otherObjectPk,
} of client.__UNSTABLE_getBulkLinks(stations.data, [
"boundariesUsState",
])
) {
logger.info(
`Found link ${object.$objectType}:${object.$primaryKey} <- (${linkApiName}) -> ${otherObjectApiName}:${otherObjectPk}`,
);
}

const { data: employees } = await client(Employee).fetchPage({
pageSize: 100,
});

// test many to many
logger.debug("Fetching the bulk links");

for await (
Expand Down
4 changes: 2 additions & 2 deletions packages/client/src/__unstable/ConjureSupport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,14 @@ export class MetadataClient {
if (objectTypeRidManySide === objectTypeRid) {
helper(
manyToOneLinkMetadata,
"SOURCE",
"TARGET",
objectTypeRidOneSide,
);
}
if (objectTypeRidOneSide === objectTypeRid) {
helper(
oneToManyLinkMetadata,
"TARGET",
"SOURCE",
objectTypeRidManySide,
);
}
Expand Down

0 comments on commit 4dbac7e

Please sign in to comment.