@kevisual/cnb 0.0.36 → 0.0.39

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/routes.d.ts CHANGED
@@ -741,63 +741,38 @@ declare class CNB extends CNBCore {
741
741
  setCookie(cookie: string): void;
742
742
  }
743
743
 
744
- declare const config: {
745
- PORT?: string;
746
- REDIS_HOST?: string;
747
- REDIS_PORT?: string;
748
- REDIS_PASSWORD?: string;
749
- REDIS_VERSION?: string;
750
- REDIS_DB?: string;
751
- REDIS_USER?: string;
752
- POSTGRES_HOST?: string;
753
- POSTGRES_PORT?: string;
754
- POSTGRES_PASSWORD?: string;
755
- POSTGRES_USER?: string;
756
- POSTGRES_DB?: string;
757
- MONGO_URI?: string;
758
- DATABASE_URL?: string;
759
- MINIO_ENDPOINT?: string;
760
- MINIO_BUCKET_NAME?: string;
761
- MINIO_ACCESS_KEY?: string;
762
- MINIO_SECRET_KEY?: string;
763
- MINIO_USE_SSL?: string;
764
- S3_ACCESS_KEY_ID?: string;
765
- S3_SECRET_ACCESS_KEY?: string;
766
- S3_REGION?: string;
767
- S3_BUCKET_NAME?: string;
768
- S3_ENDPOINT?: string;
769
- S3_FORCE_PATH_STYLE?: string;
770
- KEVISUAL_TOKEN?: string;
771
- KEVISUAL_API_URL?: string;
772
- KEVISUAL_NEW_API_KEY?: string;
773
- BAILIAN_API_KEY?: string;
774
- ZHIPU_API_KEY?: string;
775
- MINIMAX_API_KEY?: string;
776
- VOLCENGINE_API_KEY?: string;
777
- BAILIAN_CODE_API_KEY?: string;
778
- JIMENG_API_URL?: string;
779
- JIMENG_API_KEY?: string;
780
- JIMENG_TIMEOUT?: string;
781
- OPENCODE_URL?: string;
782
- OPENCODE_API_KEY?: string;
783
- OPENCODE_SERVER_PASSWORD?: string;
784
- OPENCODE_SERVER_USERNAME?: string;
785
- FEISHU_NOTIFY_WEBHOOK_URL?: string;
786
- NOCODB_URL?: string;
787
- NOCODB_API_KEY?: string;
788
- MEILISEARCH_URL?: string;
789
- MEILISEARCH_API_KEY?: string;
790
- POCKETBASE_URL?: string;
791
- POCKETBASE_TOKEN?: string;
792
- CNB_TOKEN?: string;
793
- CNB_API_KEY?: string;
794
- CNB_COOKIE?: string;
795
- CNB_REPO_SLUG?: string;
796
- KUBECONFIG_DATA?: string;
744
+ type CNBItem = {
745
+ username: string;
746
+ token: string;
747
+ cookie?: string;
748
+ runAt?: number;
749
+ owner?: boolean;
750
+ cnb: CNB;
797
751
  };
752
+ declare class CNBManager {
753
+ cnbMap: Map<string, CNBItem>;
754
+ constructor();
755
+ getDefaultCNB(): CNBItem;
756
+ getCNB(opts?: {
757
+ username?: string;
758
+ kevisualToken?: string;
759
+ }): Promise<CNBItem | null>;
760
+ /**
761
+ * 通过上下文获取 CNB 实例(直接返回 cnb 对象)
762
+ * @param ctx
763
+ * @returns CNB 实例
764
+ */
765
+ getContext(ctx: any): Promise<CNB>;
766
+ addCNB(opts: Partial<CNBItem>): CNBItem;
767
+ clearExpiredCNB(expireTime?: number): void;
768
+ clearUsername(username: string): void;
769
+ }
770
+
771
+ declare const cnbManager: CNBManager;
798
772
  declare const cnb: CNB;
799
773
  declare const app: QueryRouterServer<{
800
774
  [x: string]: any;
801
775
  }>;
776
+ declare const notCNBCheck: (ctx: any) => boolean;
802
777
 
803
- export { app, cnb, config };
778
+ export { app, cnb, cnbManager, notCNBCheck };