@odla-ai/chapter 0.8.0 → 0.9.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/dist/index.cjs CHANGED
@@ -848,13 +848,15 @@ async function projectApplicant(deps, applicant) {
848
848
  }
849
849
 
850
850
  // src/clerk.ts
851
+ var heal = (status) => status === 422 ? { ok: true, status, existed: true } : { ok: false, status };
851
852
  function clerkInviteRequest(input) {
852
853
  return {
853
854
  path: "/v1/invitations",
854
855
  body: {
855
856
  email_address: input.email,
856
857
  notify: true,
857
- ...input.redirectUrl ? { redirect_url: input.redirectUrl } : {}
858
+ ...input.redirectUrl ? { redirect_url: input.redirectUrl } : {},
859
+ ...input.publicMetadata ? { public_metadata: input.publicMetadata } : {}
858
860
  }
859
861
  };
860
862
  }
@@ -865,7 +867,7 @@ async function createClerkInvitation(secretKey, input, fetchImpl = fetch) {
865
867
  headers: { authorization: `Bearer ${secretKey}`, "content-type": "application/json" },
866
868
  body: JSON.stringify(body)
867
869
  });
868
- return { ok: res.ok, status: res.status };
870
+ return res.ok ? { ok: true, status: res.status } : heal(res.status);
869
871
  }
870
872
  function clerkUserRequest(input) {
871
873
  return {
@@ -874,7 +876,8 @@ function clerkUserRequest(input) {
874
876
  email_address: [input.email],
875
877
  skip_password_requirement: true,
876
878
  ...input.firstName ? { first_name: input.firstName } : {},
877
- ...input.lastName ? { last_name: input.lastName } : {}
879
+ ...input.lastName ? { last_name: input.lastName } : {},
880
+ ...input.publicMetadata ? { public_metadata: input.publicMetadata } : {}
878
881
  }
879
882
  };
880
883
  }
@@ -885,7 +888,7 @@ async function createClerkUser(secretKey, input, fetchImpl = fetch) {
885
888
  headers: { authorization: `Bearer ${secretKey}`, "content-type": "application/json" },
886
889
  body: JSON.stringify(body)
887
890
  });
888
- return { ok: res.ok, status: res.status };
891
+ return res.ok ? { ok: true, status: res.status } : heal(res.status);
889
892
  }
890
893
 
891
894
  // src/session.ts