@starcite/sdk 0.0.5 → 0.0.6

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/index.cjs CHANGED
@@ -1697,7 +1697,20 @@ var Starcite = class {
1697
1697
  async sessionFromIdentity(input) {
1698
1698
  let sessionId = input.id;
1699
1699
  let record;
1700
- if (!sessionId) {
1700
+ if (sessionId) {
1701
+ try {
1702
+ record = await this.createSession({
1703
+ id: sessionId,
1704
+ creator_principal: input.identity.toCreatorPrincipal(),
1705
+ title: input.title,
1706
+ metadata: input.metadata
1707
+ });
1708
+ } catch (error) {
1709
+ if (!(error instanceof StarciteApiError && error.status === 409)) {
1710
+ throw error;
1711
+ }
1712
+ }
1713
+ } else {
1701
1714
  record = await this.createSession({
1702
1715
  creator_principal: input.identity.toCreatorPrincipal(),
1703
1716
  title: input.title,