connectbase-client 0.5.2 → 0.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/README.md +152 -0
- package/dist/connect-base.umd.js +2 -2
- package/dist/index.d.mts +364 -1
- package/dist/index.d.ts +364 -1
- package/dist/index.js +245 -0
- package/dist/index.mjs +245 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -577,6 +577,251 @@ var DatabaseAPI = class {
|
|
|
577
577
|
{ where }
|
|
578
578
|
);
|
|
579
579
|
}
|
|
580
|
+
// ============ Aggregation ============
|
|
581
|
+
/**
|
|
582
|
+
* 집계 파이프라인 실행 (MongoDB 스타일)
|
|
583
|
+
*/
|
|
584
|
+
async aggregate(tableId, pipeline) {
|
|
585
|
+
const prefix = this.getPublicPrefix();
|
|
586
|
+
return this.http.post(
|
|
587
|
+
`${prefix}/aggregate`,
|
|
588
|
+
{ table_id: tableId, pipeline }
|
|
589
|
+
);
|
|
590
|
+
}
|
|
591
|
+
// ============ Search ============
|
|
592
|
+
/**
|
|
593
|
+
* 전문 검색
|
|
594
|
+
*/
|
|
595
|
+
async search(tableId, query, fields, options) {
|
|
596
|
+
const prefix = this.getPublicPrefix();
|
|
597
|
+
return this.http.post(
|
|
598
|
+
`${prefix}/search`,
|
|
599
|
+
{ table_id: tableId, query, fields, ...options }
|
|
600
|
+
);
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* 자동완성 검색
|
|
604
|
+
*/
|
|
605
|
+
async autocomplete(tableId, query, field, options) {
|
|
606
|
+
const prefix = this.getPublicPrefix();
|
|
607
|
+
return this.http.post(
|
|
608
|
+
`${prefix}/autocomplete`,
|
|
609
|
+
{ table_id: tableId, query, field, ...options }
|
|
610
|
+
);
|
|
611
|
+
}
|
|
612
|
+
// ============ Geo Queries ============
|
|
613
|
+
/**
|
|
614
|
+
* 지리 쿼리 (반경, 박스, 폴리곤)
|
|
615
|
+
*/
|
|
616
|
+
async geoQuery(tableId, field, query, options) {
|
|
617
|
+
const prefix = this.getPublicPrefix();
|
|
618
|
+
return this.http.post(
|
|
619
|
+
`${prefix}/geo`,
|
|
620
|
+
{ table_id: tableId, field, ...query, ...options }
|
|
621
|
+
);
|
|
622
|
+
}
|
|
623
|
+
// ============ Batch & Transactions ============
|
|
624
|
+
/**
|
|
625
|
+
* 배치 쓰기 (여러 테이블 다중 문서 원자적 처리)
|
|
626
|
+
*/
|
|
627
|
+
async batch(operations) {
|
|
628
|
+
const prefix = this.getPublicPrefix();
|
|
629
|
+
return this.http.post(
|
|
630
|
+
`${prefix}/batch`,
|
|
631
|
+
{ operations }
|
|
632
|
+
);
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* 트랜잭션 실행 (읽기 → 쓰기 ACID)
|
|
636
|
+
*/
|
|
637
|
+
async transaction(reads, writes) {
|
|
638
|
+
const prefix = this.getPublicPrefix();
|
|
639
|
+
return this.http.post(
|
|
640
|
+
`${prefix}/transactions`,
|
|
641
|
+
{ reads, writes }
|
|
642
|
+
);
|
|
643
|
+
}
|
|
644
|
+
// ============ Populate (Relation Query) ============
|
|
645
|
+
/**
|
|
646
|
+
* 데이터 조회 시 릴레이션 로딩 (JOIN)
|
|
647
|
+
*/
|
|
648
|
+
async getDataWithPopulate(tableId, options) {
|
|
649
|
+
const prefix = this.getPublicPrefix();
|
|
650
|
+
return this.http.post(
|
|
651
|
+
`${prefix}/tables/${tableId}/data/query`,
|
|
652
|
+
{
|
|
653
|
+
where: options.where,
|
|
654
|
+
order_by: options.orderBy,
|
|
655
|
+
order_direction: options.orderDirection,
|
|
656
|
+
limit: options.limit,
|
|
657
|
+
offset: options.offset,
|
|
658
|
+
select: options.select,
|
|
659
|
+
exclude: options.exclude,
|
|
660
|
+
populate: options.populate
|
|
661
|
+
}
|
|
662
|
+
);
|
|
663
|
+
}
|
|
664
|
+
// ============ Security Rules (RLS) ============
|
|
665
|
+
/**
|
|
666
|
+
* 보안 규칙 목록 조회
|
|
667
|
+
*/
|
|
668
|
+
async listSecurityRules(appId) {
|
|
669
|
+
const response = await this.http.get(
|
|
670
|
+
`/v1/apps/${appId}/security/rules`
|
|
671
|
+
);
|
|
672
|
+
return response.rules;
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* 보안 규칙 생성
|
|
676
|
+
*/
|
|
677
|
+
async createSecurityRule(appId, data) {
|
|
678
|
+
return this.http.post(
|
|
679
|
+
`/v1/apps/${appId}/security/rules`,
|
|
680
|
+
data
|
|
681
|
+
);
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* 보안 규칙 수정
|
|
685
|
+
*/
|
|
686
|
+
async updateSecurityRule(appId, ruleId, data) {
|
|
687
|
+
return this.http.put(
|
|
688
|
+
`/v1/apps/${appId}/security/rules/${ruleId}`,
|
|
689
|
+
data
|
|
690
|
+
);
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* 보안 규칙 삭제
|
|
694
|
+
*/
|
|
695
|
+
async deleteSecurityRule(appId, ruleId) {
|
|
696
|
+
await this.http.delete(`/v1/apps/${appId}/security/rules/${ruleId}`);
|
|
697
|
+
}
|
|
698
|
+
// ============ Indexes ============
|
|
699
|
+
/**
|
|
700
|
+
* 테이블 인덱스 목록 조회
|
|
701
|
+
*/
|
|
702
|
+
async listIndexes(appId, tableId) {
|
|
703
|
+
const response = await this.http.get(
|
|
704
|
+
`/v1/apps/${appId}/tables/${tableId}/indexes`
|
|
705
|
+
);
|
|
706
|
+
return response.indexes;
|
|
707
|
+
}
|
|
708
|
+
/**
|
|
709
|
+
* 인덱스 생성
|
|
710
|
+
*/
|
|
711
|
+
async createIndex(appId, tableId, data) {
|
|
712
|
+
return this.http.post(
|
|
713
|
+
`/v1/apps/${appId}/tables/${tableId}/indexes`,
|
|
714
|
+
data
|
|
715
|
+
);
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* 인덱스 삭제
|
|
719
|
+
*/
|
|
720
|
+
async deleteIndex(appId, tableId, indexId) {
|
|
721
|
+
await this.http.delete(`/v1/apps/${appId}/tables/${tableId}/indexes/${indexId}`);
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* 인덱스 분석 및 추천
|
|
725
|
+
*/
|
|
726
|
+
async analyzeIndexes(appId, tableId) {
|
|
727
|
+
return this.http.get(
|
|
728
|
+
`/v1/apps/${appId}/tables/${tableId}/indexes/analyze`
|
|
729
|
+
);
|
|
730
|
+
}
|
|
731
|
+
// ============ Relations ============
|
|
732
|
+
/**
|
|
733
|
+
* 테이블 릴레이션 목록 조회
|
|
734
|
+
*/
|
|
735
|
+
async listRelations(appId, tableId) {
|
|
736
|
+
const response = await this.http.get(
|
|
737
|
+
`/v1/apps/${appId}/tables/${tableId}/relations`
|
|
738
|
+
);
|
|
739
|
+
return response.relations;
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* 릴레이션 생성
|
|
743
|
+
*/
|
|
744
|
+
async createRelation(appId, tableId, data) {
|
|
745
|
+
return this.http.post(
|
|
746
|
+
`/v1/apps/${appId}/tables/${tableId}/relations`,
|
|
747
|
+
data
|
|
748
|
+
);
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* 릴레이션 삭제
|
|
752
|
+
*/
|
|
753
|
+
async deleteRelation(appId, tableId, relationName) {
|
|
754
|
+
await this.http.delete(`/v1/apps/${appId}/tables/${tableId}/relations/${relationName}`);
|
|
755
|
+
}
|
|
756
|
+
// ============ Triggers ============
|
|
757
|
+
/**
|
|
758
|
+
* 트리거 목록 조회
|
|
759
|
+
*/
|
|
760
|
+
async listTriggers(appId) {
|
|
761
|
+
const response = await this.http.get(
|
|
762
|
+
`/v1/apps/${appId}/triggers`
|
|
763
|
+
);
|
|
764
|
+
return response.triggers;
|
|
765
|
+
}
|
|
766
|
+
/**
|
|
767
|
+
* 트리거 생성
|
|
768
|
+
*/
|
|
769
|
+
async createTrigger(appId, data) {
|
|
770
|
+
return this.http.post(
|
|
771
|
+
`/v1/apps/${appId}/triggers`,
|
|
772
|
+
data
|
|
773
|
+
);
|
|
774
|
+
}
|
|
775
|
+
/**
|
|
776
|
+
* 트리거 수정
|
|
777
|
+
*/
|
|
778
|
+
async updateTrigger(appId, triggerId, data) {
|
|
779
|
+
return this.http.put(
|
|
780
|
+
`/v1/apps/${appId}/triggers/${triggerId}`,
|
|
781
|
+
data
|
|
782
|
+
);
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* 트리거 삭제
|
|
786
|
+
*/
|
|
787
|
+
async deleteTrigger(appId, triggerId) {
|
|
788
|
+
await this.http.delete(`/v1/apps/${appId}/triggers/${triggerId}`);
|
|
789
|
+
}
|
|
790
|
+
// ============ Lifecycle ============
|
|
791
|
+
/**
|
|
792
|
+
* TTL 정책 설정
|
|
793
|
+
*/
|
|
794
|
+
async setTTL(appId, config) {
|
|
795
|
+
return this.http.post(
|
|
796
|
+
`/v1/apps/${appId}/lifecycle/ttl`,
|
|
797
|
+
config
|
|
798
|
+
);
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* TTL 정책 조회
|
|
802
|
+
*/
|
|
803
|
+
async getTTL(appId, tableName) {
|
|
804
|
+
return this.http.get(
|
|
805
|
+
`/v1/apps/${appId}/lifecycle/ttl/${tableName}`
|
|
806
|
+
);
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* 보관 정책 설정
|
|
810
|
+
*/
|
|
811
|
+
async setRetentionPolicy(appId, policy) {
|
|
812
|
+
return this.http.post(
|
|
813
|
+
`/v1/apps/${appId}/lifecycle/retention`,
|
|
814
|
+
policy
|
|
815
|
+
);
|
|
816
|
+
}
|
|
817
|
+
/**
|
|
818
|
+
* 보관 정책 조회
|
|
819
|
+
*/
|
|
820
|
+
async getRetentionPolicy(appId, tableName) {
|
|
821
|
+
return this.http.get(
|
|
822
|
+
`/v1/apps/${appId}/lifecycle/retention/${tableName}`
|
|
823
|
+
);
|
|
824
|
+
}
|
|
580
825
|
};
|
|
581
826
|
|
|
582
827
|
// src/api/storage.ts
|