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.d.mts CHANGED
@@ -373,16 +373,39 @@ interface ControlPlaneConfig {
373
373
  interface ControlPlaneRequestOptions {
374
374
  projectId?: string;
375
375
  }
376
+ interface SignupRequest {
377
+ email: string;
378
+ password: string;
379
+ organizationName: string;
380
+ fullName?: string;
381
+ }
382
+ interface SignupResponse {
383
+ message: string;
384
+ email: string;
385
+ requiresVerification: boolean;
386
+ }
376
387
  interface LoginRequest {
377
388
  email: string;
378
389
  password: string;
379
390
  }
391
+ interface TokenPair {
392
+ accessToken: string;
393
+ refreshToken: string;
394
+ tokenType: string;
395
+ }
396
+ interface RefreshRequest {
397
+ refreshToken: string;
398
+ }
399
+ interface CurrentUserResponse {
400
+ userId: string;
401
+ role: string | null;
402
+ org: string | number | null;
403
+ sid: number | null;
404
+ oauthScopes?: string[];
405
+ oauthAppId?: string | null;
406
+ }
380
407
  interface LoginResponse {
381
- tokens: {
382
- accessToken: string;
383
- refreshToken: string;
384
- tokenType: string;
385
- };
408
+ tokens: TokenPair;
386
409
  session: {
387
410
  userId: number;
388
411
  organizationId: number;
@@ -717,7 +740,12 @@ declare class ControlPlaneClient {
717
740
  private throwForStatus;
718
741
  bulkRevokeApiKeys(request: BulkRevokeApiKeysRequest, options?: ControlPlaneRequestOptions): Promise<BulkRevokeApiKeysResponse>;
719
742
  testApiKey(keyId: number, options?: ControlPlaneRequestOptions): Promise<ApiKeyTestResponse>;
743
+ signup(request: SignupRequest): Promise<SignupResponse>;
720
744
  login(request: LoginRequest, options?: ControlPlaneRequestOptions): Promise<LoginResponse>;
745
+ refresh(request: RefreshRequest): Promise<TokenPair>;
746
+ logout(request: RefreshRequest): Promise<void>;
747
+ me(): Promise<CurrentUserResponse>;
748
+ logoutAll(): Promise<void>;
721
749
  getCurrentPlan(options?: ControlPlaneRequestOptions): Promise<CurrentPlanResponse>;
722
750
  listSessions(options?: ControlPlaneRequestOptions): Promise<SessionListResponse>;
723
751
  revokeSession(sessionId: number, options?: ControlPlaneRequestOptions): Promise<void>;
@@ -1228,4 +1256,4 @@ declare class MemorySyncClient {
1228
1256
  }): Promise<Record<string, unknown>>;
1229
1257
  }
1230
1258
 
1231
- export { type AddRequest, type AddResponse, type AddSkippedResponse, type ApiKeyTestResponse, type ApiKeyTestStatus, AuthError, type BatchUpdateItem, type BatchUpdateItemResult, type BatchUpdateResponse, type BulkAddItem, type BulkAddItemResult, type BulkAddResponse, type BulkRevokeApiKeyResult, type BulkRevokeApiKeysRequest, type BulkRevokeApiKeysResponse, type ComposeRequest, type ComposeResponse, ConnectionOAuthNamespace, ConnectionsNamespace, ControlPlaneClient, type ControlPlaneConfig, type ControlPlaneRequestOptions, type CreateExportRequest, type CreateExportResponse, type CreateOrganizationRequest, type CreateProjectRequest, type CreateWebhookRequest, type CreatedWebhook, type CurrentPlanResponse, type ExportDownloadUrl, type ExportFilters, type ExportFormat, type ExportJob, type ExportJobListResponse, type ExportJobStatus, type ExportListQuery, type ExportResponse, type ExportScope, type FeedbackResponse, type FeedbackSignal, type FeedbackSummary, type FeedbackTrend, type ForgetFilters, type ForgetRequest, GoogleDriveNamespace, GranolaNamespace, type HistoryResponse, type Integration, type IntegrationQuery, IntegrationsNamespace, type LoginRequest, type LoginResponse, type MemoryRecord, MemorySyncClient, type MemorySyncConfig, MemorySyncError, NotFoundError, ObjectsNamespace, type Ontology, type OntologyUpdateRequest, type OrganizationMembership, type Plan, type PlanLimits, type Project, ProvidersNamespace, type QueryFilters, type QueryRequest, type QueryResponse, RateLimitError, type RecentWebhookDeliveryQuery, type RelationCreateRequest, type RelationRecord, type RelationshipType, type RenameProjectRequest, type ReplayWebhookDeliveriesRequest, type ReplayWebhookDeliveriesResponse, type RevisionEntry, type RevisionEvent, S3Namespace, ServerError, type Session, type SessionListResponse, SlackNamespace, type SummarizeRequest, SyncJobsNamespace, type TestWebhookRequest, type TestWebhookResponse, type UpdateRequest, type UpdateWebhookRequest, type UploadRequest, ValidationError, WebCrawlerNamespace, type Webhook, type WebhookDelivery, type WebhookDeliveryListResponse, type WebhookDeliveryQuery, type WebhookEventTypesResponse, type WebhookHealth, type WebhookListResponse, type WebhookRetryConfig, type WebhookSignatureConfig };
1259
+ export { type AddRequest, type AddResponse, type AddSkippedResponse, type ApiKeyTestResponse, type ApiKeyTestStatus, AuthError, type BatchUpdateItem, type BatchUpdateItemResult, type BatchUpdateResponse, type BulkAddItem, type BulkAddItemResult, type BulkAddResponse, type BulkRevokeApiKeyResult, type BulkRevokeApiKeysRequest, type BulkRevokeApiKeysResponse, type ComposeRequest, type ComposeResponse, ConnectionOAuthNamespace, ConnectionsNamespace, ControlPlaneClient, type ControlPlaneConfig, type ControlPlaneRequestOptions, type CreateExportRequest, type CreateExportResponse, type CreateOrganizationRequest, type CreateProjectRequest, type CreateWebhookRequest, type CreatedWebhook, type CurrentPlanResponse, type CurrentUserResponse, type ExportDownloadUrl, type ExportFilters, type ExportFormat, type ExportJob, type ExportJobListResponse, type ExportJobStatus, type ExportListQuery, type ExportResponse, type ExportScope, type FeedbackResponse, type FeedbackSignal, type FeedbackSummary, type FeedbackTrend, type ForgetFilters, type ForgetRequest, GoogleDriveNamespace, GranolaNamespace, type HistoryResponse, type Integration, type IntegrationQuery, IntegrationsNamespace, type LoginRequest, type LoginResponse, type MemoryRecord, MemorySyncClient, type MemorySyncConfig, MemorySyncError, NotFoundError, ObjectsNamespace, type Ontology, type OntologyUpdateRequest, type OrganizationMembership, type Plan, type PlanLimits, type Project, ProvidersNamespace, type QueryFilters, type QueryRequest, type QueryResponse, RateLimitError, type RecentWebhookDeliveryQuery, type RefreshRequest, type RelationCreateRequest, type RelationRecord, type RelationshipType, type RenameProjectRequest, type ReplayWebhookDeliveriesRequest, type ReplayWebhookDeliveriesResponse, type RevisionEntry, type RevisionEvent, S3Namespace, ServerError, type Session, type SessionListResponse, type SignupRequest, type SignupResponse, SlackNamespace, type SummarizeRequest, SyncJobsNamespace, type TestWebhookRequest, type TestWebhookResponse, type TokenPair, type UpdateRequest, type UpdateWebhookRequest, type UploadRequest, ValidationError, WebCrawlerNamespace, type Webhook, type WebhookDelivery, type WebhookDeliveryListResponse, type WebhookDeliveryQuery, type WebhookEventTypesResponse, type WebhookHealth, type WebhookListResponse, type WebhookRetryConfig, type WebhookSignatureConfig };
package/dist/index.d.ts CHANGED
@@ -373,16 +373,39 @@ interface ControlPlaneConfig {
373
373
  interface ControlPlaneRequestOptions {
374
374
  projectId?: string;
375
375
  }
376
+ interface SignupRequest {
377
+ email: string;
378
+ password: string;
379
+ organizationName: string;
380
+ fullName?: string;
381
+ }
382
+ interface SignupResponse {
383
+ message: string;
384
+ email: string;
385
+ requiresVerification: boolean;
386
+ }
376
387
  interface LoginRequest {
377
388
  email: string;
378
389
  password: string;
379
390
  }
391
+ interface TokenPair {
392
+ accessToken: string;
393
+ refreshToken: string;
394
+ tokenType: string;
395
+ }
396
+ interface RefreshRequest {
397
+ refreshToken: string;
398
+ }
399
+ interface CurrentUserResponse {
400
+ userId: string;
401
+ role: string | null;
402
+ org: string | number | null;
403
+ sid: number | null;
404
+ oauthScopes?: string[];
405
+ oauthAppId?: string | null;
406
+ }
380
407
  interface LoginResponse {
381
- tokens: {
382
- accessToken: string;
383
- refreshToken: string;
384
- tokenType: string;
385
- };
408
+ tokens: TokenPair;
386
409
  session: {
387
410
  userId: number;
388
411
  organizationId: number;
@@ -717,7 +740,12 @@ declare class ControlPlaneClient {
717
740
  private throwForStatus;
718
741
  bulkRevokeApiKeys(request: BulkRevokeApiKeysRequest, options?: ControlPlaneRequestOptions): Promise<BulkRevokeApiKeysResponse>;
719
742
  testApiKey(keyId: number, options?: ControlPlaneRequestOptions): Promise<ApiKeyTestResponse>;
743
+ signup(request: SignupRequest): Promise<SignupResponse>;
720
744
  login(request: LoginRequest, options?: ControlPlaneRequestOptions): Promise<LoginResponse>;
745
+ refresh(request: RefreshRequest): Promise<TokenPair>;
746
+ logout(request: RefreshRequest): Promise<void>;
747
+ me(): Promise<CurrentUserResponse>;
748
+ logoutAll(): Promise<void>;
721
749
  getCurrentPlan(options?: ControlPlaneRequestOptions): Promise<CurrentPlanResponse>;
722
750
  listSessions(options?: ControlPlaneRequestOptions): Promise<SessionListResponse>;
723
751
  revokeSession(sessionId: number, options?: ControlPlaneRequestOptions): Promise<void>;
@@ -1228,4 +1256,4 @@ declare class MemorySyncClient {
1228
1256
  }): Promise<Record<string, unknown>>;
1229
1257
  }
1230
1258
 
1231
- export { type AddRequest, type AddResponse, type AddSkippedResponse, type ApiKeyTestResponse, type ApiKeyTestStatus, AuthError, type BatchUpdateItem, type BatchUpdateItemResult, type BatchUpdateResponse, type BulkAddItem, type BulkAddItemResult, type BulkAddResponse, type BulkRevokeApiKeyResult, type BulkRevokeApiKeysRequest, type BulkRevokeApiKeysResponse, type ComposeRequest, type ComposeResponse, ConnectionOAuthNamespace, ConnectionsNamespace, ControlPlaneClient, type ControlPlaneConfig, type ControlPlaneRequestOptions, type CreateExportRequest, type CreateExportResponse, type CreateOrganizationRequest, type CreateProjectRequest, type CreateWebhookRequest, type CreatedWebhook, type CurrentPlanResponse, type ExportDownloadUrl, type ExportFilters, type ExportFormat, type ExportJob, type ExportJobListResponse, type ExportJobStatus, type ExportListQuery, type ExportResponse, type ExportScope, type FeedbackResponse, type FeedbackSignal, type FeedbackSummary, type FeedbackTrend, type ForgetFilters, type ForgetRequest, GoogleDriveNamespace, GranolaNamespace, type HistoryResponse, type Integration, type IntegrationQuery, IntegrationsNamespace, type LoginRequest, type LoginResponse, type MemoryRecord, MemorySyncClient, type MemorySyncConfig, MemorySyncError, NotFoundError, ObjectsNamespace, type Ontology, type OntologyUpdateRequest, type OrganizationMembership, type Plan, type PlanLimits, type Project, ProvidersNamespace, type QueryFilters, type QueryRequest, type QueryResponse, RateLimitError, type RecentWebhookDeliveryQuery, type RelationCreateRequest, type RelationRecord, type RelationshipType, type RenameProjectRequest, type ReplayWebhookDeliveriesRequest, type ReplayWebhookDeliveriesResponse, type RevisionEntry, type RevisionEvent, S3Namespace, ServerError, type Session, type SessionListResponse, SlackNamespace, type SummarizeRequest, SyncJobsNamespace, type TestWebhookRequest, type TestWebhookResponse, type UpdateRequest, type UpdateWebhookRequest, type UploadRequest, ValidationError, WebCrawlerNamespace, type Webhook, type WebhookDelivery, type WebhookDeliveryListResponse, type WebhookDeliveryQuery, type WebhookEventTypesResponse, type WebhookHealth, type WebhookListResponse, type WebhookRetryConfig, type WebhookSignatureConfig };
1259
+ export { type AddRequest, type AddResponse, type AddSkippedResponse, type ApiKeyTestResponse, type ApiKeyTestStatus, AuthError, type BatchUpdateItem, type BatchUpdateItemResult, type BatchUpdateResponse, type BulkAddItem, type BulkAddItemResult, type BulkAddResponse, type BulkRevokeApiKeyResult, type BulkRevokeApiKeysRequest, type BulkRevokeApiKeysResponse, type ComposeRequest, type ComposeResponse, ConnectionOAuthNamespace, ConnectionsNamespace, ControlPlaneClient, type ControlPlaneConfig, type ControlPlaneRequestOptions, type CreateExportRequest, type CreateExportResponse, type CreateOrganizationRequest, type CreateProjectRequest, type CreateWebhookRequest, type CreatedWebhook, type CurrentPlanResponse, type CurrentUserResponse, type ExportDownloadUrl, type ExportFilters, type ExportFormat, type ExportJob, type ExportJobListResponse, type ExportJobStatus, type ExportListQuery, type ExportResponse, type ExportScope, type FeedbackResponse, type FeedbackSignal, type FeedbackSummary, type FeedbackTrend, type ForgetFilters, type ForgetRequest, GoogleDriveNamespace, GranolaNamespace, type HistoryResponse, type Integration, type IntegrationQuery, IntegrationsNamespace, type LoginRequest, type LoginResponse, type MemoryRecord, MemorySyncClient, type MemorySyncConfig, MemorySyncError, NotFoundError, ObjectsNamespace, type Ontology, type OntologyUpdateRequest, type OrganizationMembership, type Plan, type PlanLimits, type Project, ProvidersNamespace, type QueryFilters, type QueryRequest, type QueryResponse, RateLimitError, type RecentWebhookDeliveryQuery, type RefreshRequest, type RelationCreateRequest, type RelationRecord, type RelationshipType, type RenameProjectRequest, type ReplayWebhookDeliveriesRequest, type ReplayWebhookDeliveriesResponse, type RevisionEntry, type RevisionEvent, S3Namespace, ServerError, type Session, type SessionListResponse, type SignupRequest, type SignupResponse, SlackNamespace, type SummarizeRequest, SyncJobsNamespace, type TestWebhookRequest, type TestWebhookResponse, type TokenPair, type UpdateRequest, type UpdateWebhookRequest, type UploadRequest, ValidationError, WebCrawlerNamespace, type Webhook, type WebhookDelivery, type WebhookDeliveryListResponse, type WebhookDeliveryQuery, type WebhookEventTypesResponse, type WebhookHealth, type WebhookListResponse, type WebhookRetryConfig, type WebhookSignatureConfig };
package/dist/index.js CHANGED
@@ -576,7 +576,7 @@ var IntegrationsNamespace = class extends Namespace {
576
576
  };
577
577
 
578
578
  // src/control-plane.ts
579
- var SDK_VERSION = "1.5.0";
579
+ var SDK_VERSION = "1.6.0";
580
580
  function safeJson(text) {
581
581
  try {
582
582
  return JSON.parse(text);
@@ -792,7 +792,7 @@ var ControlPlaneClient = class {
792
792
  "User-Agent": `memorysync-sdk-js/${SDK_VERSION}`
793
793
  };
794
794
  if (requiresAuth) headers.Authorization = `Bearer ${this.accessToken}`;
795
- const selectedProject = options.projectId?.trim() ?? this.projectId;
795
+ const selectedProject = options.project === false ? void 0 : options.projectId?.trim() ?? this.projectId;
796
796
  if (selectedProject) headers["X-Project-ID"] = selectedProject;
797
797
  if (options.body !== void 0) headers["Content-Type"] = "application/json";
798
798
  const controller = new AbortController();
@@ -853,6 +853,31 @@ var ControlPlaneClient = class {
853
853
  positiveId(keyId, "keyId");
854
854
  return this.request("POST", `/org/api-keys/${keyId}/test`, options);
855
855
  }
856
+ async signup(request) {
857
+ nonEmpty(request.email, "email");
858
+ if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(request.email)) {
859
+ throw new ValidationError("email must be a valid email address");
860
+ }
861
+ nonEmpty(request.password, "password");
862
+ if (request.password.length < 8) {
863
+ throw new ValidationError("password must contain at least 8 characters");
864
+ }
865
+ nonEmpty(request.organizationName, "organizationName");
866
+ const organizationLength = request.organizationName.trim().length;
867
+ if (organizationLength < 2 || organizationLength > 100) {
868
+ throw new ValidationError("organizationName must contain between 2 and 100 characters");
869
+ }
870
+ return this.request("POST", "/auth/signup", {
871
+ auth: false,
872
+ project: false,
873
+ body: {
874
+ email: request.email,
875
+ password: request.password,
876
+ organization_name: request.organizationName,
877
+ ...request.fullName === void 0 ? {} : { full_name: request.fullName }
878
+ }
879
+ });
880
+ }
856
881
  async login(request, options = {}) {
857
882
  nonEmpty(request.email, "email");
858
883
  nonEmpty(request.password, "password");
@@ -862,9 +887,32 @@ var ControlPlaneClient = class {
862
887
  return this.request("POST", "/auth/login", {
863
888
  ...options,
864
889
  auth: false,
890
+ project: false,
865
891
  body: { email: request.email, password: request.password }
866
892
  });
867
893
  }
894
+ async refresh(request) {
895
+ nonEmpty(request.refreshToken, "refreshToken");
896
+ return this.request("POST", "/auth/refresh", {
897
+ auth: false,
898
+ project: false,
899
+ body: { refresh_token: request.refreshToken }
900
+ });
901
+ }
902
+ async logout(request) {
903
+ nonEmpty(request.refreshToken, "refreshToken");
904
+ return this.request("POST", "/auth/logout", {
905
+ auth: false,
906
+ project: false,
907
+ body: { refresh_token: request.refreshToken }
908
+ });
909
+ }
910
+ async me() {
911
+ return this.request("GET", "/auth/me", { project: false });
912
+ }
913
+ async logoutAll() {
914
+ return this.request("POST", "/auth/logout-all", { project: false });
915
+ }
868
916
  async getCurrentPlan(options = {}) {
869
917
  return this.request("GET", "/org/billing/current-plan", options);
870
918
  }
@@ -1084,7 +1132,7 @@ var ControlPlaneClient = class {
1084
1132
  };
1085
1133
 
1086
1134
  // src/index.ts
1087
- var SDK_VERSION2 = "1.5.0";
1135
+ var SDK_VERSION2 = "1.6.0";
1088
1136
  function camelToSnakeKey(key) {
1089
1137
  return key.replace(/([A-Z])/g, "_$1").toLowerCase();
1090
1138
  }