memorysync-sdk 1.5.0 → 1.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/dist/index.mjs CHANGED
@@ -532,7 +532,7 @@ var IntegrationsNamespace = class extends Namespace {
532
532
  };
533
533
 
534
534
  // src/control-plane.ts
535
- var SDK_VERSION = "1.5.0";
535
+ var SDK_VERSION = "1.6.0";
536
536
  function safeJson(text) {
537
537
  try {
538
538
  return JSON.parse(text);
@@ -748,7 +748,7 @@ var ControlPlaneClient = class {
748
748
  "User-Agent": `memorysync-sdk-js/${SDK_VERSION}`
749
749
  };
750
750
  if (requiresAuth) headers.Authorization = `Bearer ${this.accessToken}`;
751
- const selectedProject = options.projectId?.trim() ?? this.projectId;
751
+ const selectedProject = options.project === false ? void 0 : options.projectId?.trim() ?? this.projectId;
752
752
  if (selectedProject) headers["X-Project-ID"] = selectedProject;
753
753
  if (options.body !== void 0) headers["Content-Type"] = "application/json";
754
754
  const controller = new AbortController();
@@ -809,6 +809,31 @@ var ControlPlaneClient = class {
809
809
  positiveId(keyId, "keyId");
810
810
  return this.request("POST", `/org/api-keys/${keyId}/test`, options);
811
811
  }
812
+ async signup(request) {
813
+ nonEmpty(request.email, "email");
814
+ if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(request.email)) {
815
+ throw new ValidationError("email must be a valid email address");
816
+ }
817
+ nonEmpty(request.password, "password");
818
+ if (request.password.length < 8) {
819
+ throw new ValidationError("password must contain at least 8 characters");
820
+ }
821
+ nonEmpty(request.organizationName, "organizationName");
822
+ const organizationLength = request.organizationName.trim().length;
823
+ if (organizationLength < 2 || organizationLength > 100) {
824
+ throw new ValidationError("organizationName must contain between 2 and 100 characters");
825
+ }
826
+ return this.request("POST", "/auth/signup", {
827
+ auth: false,
828
+ project: false,
829
+ body: {
830
+ email: request.email,
831
+ password: request.password,
832
+ organization_name: request.organizationName,
833
+ ...request.fullName === void 0 ? {} : { full_name: request.fullName }
834
+ }
835
+ });
836
+ }
812
837
  async login(request, options = {}) {
813
838
  nonEmpty(request.email, "email");
814
839
  nonEmpty(request.password, "password");
@@ -818,9 +843,32 @@ var ControlPlaneClient = class {
818
843
  return this.request("POST", "/auth/login", {
819
844
  ...options,
820
845
  auth: false,
846
+ project: false,
821
847
  body: { email: request.email, password: request.password }
822
848
  });
823
849
  }
850
+ async refresh(request) {
851
+ nonEmpty(request.refreshToken, "refreshToken");
852
+ return this.request("POST", "/auth/refresh", {
853
+ auth: false,
854
+ project: false,
855
+ body: { refresh_token: request.refreshToken }
856
+ });
857
+ }
858
+ async logout(request) {
859
+ nonEmpty(request.refreshToken, "refreshToken");
860
+ return this.request("POST", "/auth/logout", {
861
+ auth: false,
862
+ project: false,
863
+ body: { refresh_token: request.refreshToken }
864
+ });
865
+ }
866
+ async me() {
867
+ return this.request("GET", "/auth/me", { project: false });
868
+ }
869
+ async logoutAll() {
870
+ return this.request("POST", "/auth/logout-all", { project: false });
871
+ }
824
872
  async getCurrentPlan(options = {}) {
825
873
  return this.request("GET", "/org/billing/current-plan", options);
826
874
  }
@@ -1040,7 +1088,7 @@ var ControlPlaneClient = class {
1040
1088
  };
1041
1089
 
1042
1090
  // src/index.ts
1043
- var SDK_VERSION2 = "1.5.0";
1091
+ var SDK_VERSION2 = "1.6.0";
1044
1092
  function camelToSnakeKey(key) {
1045
1093
  return key.replace(/([A-Z])/g, "_$1").toLowerCase();
1046
1094
  }