@lacrous/omnicloud 0.2.33 → 0.2.34

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.cts CHANGED
@@ -864,6 +864,28 @@ interface BrowserSessionRecord {
864
864
  userAgent: string | null;
865
865
  ip: string | null;
866
866
  }
867
+ interface ApiTokenRecord {
868
+ id: string;
869
+ userId: string;
870
+ name: string;
871
+ tokenHash: string;
872
+ createdAt: Date;
873
+ revokedAt: Date | null;
874
+ lastUsedAt: Date | null;
875
+ }
876
+ /** Personal API tokens. Holds only token hashes, never raw tokens. */
877
+ interface ApiTokenRepository {
878
+ create(input: {
879
+ userId: string;
880
+ name: string;
881
+ tokenHash: string;
882
+ }): Promise<ApiTokenRecord>;
883
+ findByTokenHash(tokenHash: string): Promise<ApiTokenRecord | null>;
884
+ findByIdForUser(userId: string, id: string): Promise<ApiTokenRecord | null>;
885
+ listForUser(userId: string): Promise<ApiTokenRecord[]>;
886
+ touch(id: string, at: Date): Promise<void>;
887
+ revoke(id: string, at: Date): Promise<void>;
888
+ }
867
889
  /** Server-side browser sessions. Holds only token hashes, never raw tokens. */
868
890
  interface BrowserSessionRepository {
869
891
  create(input: {
@@ -1067,6 +1089,7 @@ interface Repos {
1067
1089
  users: UserRepository;
1068
1090
  sessions: SessionRepository;
1069
1091
  browserSessions: BrowserSessionRepository;
1092
+ apiTokens: ApiTokenRepository;
1070
1093
  uploadOperations: UploadOperationRepository;
1071
1094
  storages: StorageRepository;
1072
1095
  folders: FolderRepository;
package/dist/index.d.ts CHANGED
@@ -864,6 +864,28 @@ interface BrowserSessionRecord {
864
864
  userAgent: string | null;
865
865
  ip: string | null;
866
866
  }
867
+ interface ApiTokenRecord {
868
+ id: string;
869
+ userId: string;
870
+ name: string;
871
+ tokenHash: string;
872
+ createdAt: Date;
873
+ revokedAt: Date | null;
874
+ lastUsedAt: Date | null;
875
+ }
876
+ /** Personal API tokens. Holds only token hashes, never raw tokens. */
877
+ interface ApiTokenRepository {
878
+ create(input: {
879
+ userId: string;
880
+ name: string;
881
+ tokenHash: string;
882
+ }): Promise<ApiTokenRecord>;
883
+ findByTokenHash(tokenHash: string): Promise<ApiTokenRecord | null>;
884
+ findByIdForUser(userId: string, id: string): Promise<ApiTokenRecord | null>;
885
+ listForUser(userId: string): Promise<ApiTokenRecord[]>;
886
+ touch(id: string, at: Date): Promise<void>;
887
+ revoke(id: string, at: Date): Promise<void>;
888
+ }
867
889
  /** Server-side browser sessions. Holds only token hashes, never raw tokens. */
868
890
  interface BrowserSessionRepository {
869
891
  create(input: {
@@ -1067,6 +1089,7 @@ interface Repos {
1067
1089
  users: UserRepository;
1068
1090
  sessions: SessionRepository;
1069
1091
  browserSessions: BrowserSessionRepository;
1092
+ apiTokens: ApiTokenRepository;
1070
1093
  uploadOperations: UploadOperationRepository;
1071
1094
  storages: StorageRepository;
1072
1095
  folders: FolderRepository;
package/dist/index.js CHANGED
@@ -1406,6 +1406,9 @@ async function resolveItemQuery(folders, userId, input) {
1406
1406
  // ../core/src/services/auth-session-service.ts
1407
1407
  import { createHash as createHash3, randomBytes } from "crypto";
1408
1408
 
1409
+ // ../core/src/services/api-token-service.ts
1410
+ import { randomBytes as randomBytes2 } from "crypto";
1411
+
1409
1412
  // ../core/src/services/version-retention.ts
1410
1413
  function versionsToPrune(versions, currentVersionId, policy, now) {
1411
1414
  const historical = versions.filter((version) => version.id !== currentVersionId).sort((a, b) => b.versionNumber - a.versionNumber);
@@ -2781,7 +2784,7 @@ import { Transform as Transform2 } from "stream";
2781
2784
  import { pipeline } from "stream/promises";
2782
2785
 
2783
2786
  // ../core/src/utils/secret-box.ts
2784
- import { createCipheriv, createDecipheriv, randomBytes as randomBytes2, scryptSync } from "crypto";
2787
+ import { createCipheriv, createDecipheriv, randomBytes as randomBytes3, scryptSync } from "crypto";
2785
2788
 
2786
2789
  // ../telegram/src/client.ts
2787
2790
  import { Api, TelegramClient } from "telegram";