appbuild-oceanbase-console 1.10.2 → 1.10.5
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/cjs/sdk.js +494 -169
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +494 -170
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +494 -169
- package/package.json +1 -1
- package/types/index.d.ts +1 -1
- package/types/migrations.d.ts +14 -0
- package/types/models.d.ts +50 -0
- package/types/sdk.d.ts +10 -0
- package/types/services/vcs.d.ts +133 -0
- package/dist/cjs/package.json +0 -3
- package/dist/esm/package.json +0 -3
package/dist/cjs/sdk.js
CHANGED
|
@@ -13795,6 +13795,154 @@ exports.AttributeStatus = void 0;
|
|
|
13795
13795
|
AttributeStatus["Failed"] = "failed";
|
|
13796
13796
|
})(exports.AttributeStatus || (exports.AttributeStatus = {}));
|
|
13797
13797
|
|
|
13798
|
+
/**
|
|
13799
|
+
* Helper class to generate permission strings for resources.
|
|
13800
|
+
*/
|
|
13801
|
+
class Permission {
|
|
13802
|
+
}
|
|
13803
|
+
/**
|
|
13804
|
+
* Generate read permission string for the provided role.
|
|
13805
|
+
*
|
|
13806
|
+
* @param {string} role
|
|
13807
|
+
* @returns {string}
|
|
13808
|
+
*/
|
|
13809
|
+
Permission.read = (role) => {
|
|
13810
|
+
return `read("${role}")`;
|
|
13811
|
+
};
|
|
13812
|
+
/**
|
|
13813
|
+
* Generate write permission string for the provided role.
|
|
13814
|
+
*
|
|
13815
|
+
* This is an alias of update, delete, and possibly create.
|
|
13816
|
+
* Don't use write in combination with update, delete, or create.
|
|
13817
|
+
*
|
|
13818
|
+
* @param {string} role
|
|
13819
|
+
* @returns {string}
|
|
13820
|
+
*/
|
|
13821
|
+
Permission.write = (role) => {
|
|
13822
|
+
return `write("${role}")`;
|
|
13823
|
+
};
|
|
13824
|
+
/**
|
|
13825
|
+
* Generate create permission string for the provided role.
|
|
13826
|
+
*
|
|
13827
|
+
* @param {string} role
|
|
13828
|
+
* @returns {string}
|
|
13829
|
+
*/
|
|
13830
|
+
Permission.create = (role) => {
|
|
13831
|
+
return `create("${role}")`;
|
|
13832
|
+
};
|
|
13833
|
+
/**
|
|
13834
|
+
* Generate update permission string for the provided role.
|
|
13835
|
+
*
|
|
13836
|
+
* @param {string} role
|
|
13837
|
+
* @returns {string}
|
|
13838
|
+
*/
|
|
13839
|
+
Permission.update = (role) => {
|
|
13840
|
+
return `update("${role}")`;
|
|
13841
|
+
};
|
|
13842
|
+
/**
|
|
13843
|
+
* Generate delete permission string for the provided role.
|
|
13844
|
+
*
|
|
13845
|
+
* @param {string} role
|
|
13846
|
+
* @returns {string}
|
|
13847
|
+
*/
|
|
13848
|
+
Permission.delete = (role) => {
|
|
13849
|
+
return `delete("${role}")`;
|
|
13850
|
+
};
|
|
13851
|
+
|
|
13852
|
+
/**
|
|
13853
|
+
* Helper class to generate role strings for `Permission`.
|
|
13854
|
+
*/
|
|
13855
|
+
class Role {
|
|
13856
|
+
/**
|
|
13857
|
+
* Grants access to anyone.
|
|
13858
|
+
*
|
|
13859
|
+
* This includes authenticated and unauthenticated users.
|
|
13860
|
+
*
|
|
13861
|
+
* @returns {string}
|
|
13862
|
+
*/
|
|
13863
|
+
static any() {
|
|
13864
|
+
return 'any';
|
|
13865
|
+
}
|
|
13866
|
+
/**
|
|
13867
|
+
* Grants access to a specific user by user ID.
|
|
13868
|
+
*
|
|
13869
|
+
* You can optionally pass verified or unverified for
|
|
13870
|
+
* `status` to target specific types of users.
|
|
13871
|
+
*
|
|
13872
|
+
* @param {string} id
|
|
13873
|
+
* @param {string} status
|
|
13874
|
+
* @returns {string}
|
|
13875
|
+
*/
|
|
13876
|
+
static user(id, status = '') {
|
|
13877
|
+
if (status === '') {
|
|
13878
|
+
return `user:${id}`;
|
|
13879
|
+
}
|
|
13880
|
+
return `user:${id}/${status}`;
|
|
13881
|
+
}
|
|
13882
|
+
/**
|
|
13883
|
+
* Grants access to any authenticated or anonymous user.
|
|
13884
|
+
*
|
|
13885
|
+
* You can optionally pass verified or unverified for
|
|
13886
|
+
* `status` to target specific types of users.
|
|
13887
|
+
*
|
|
13888
|
+
* @param {string} status
|
|
13889
|
+
* @returns {string}
|
|
13890
|
+
*/
|
|
13891
|
+
static users(status = '') {
|
|
13892
|
+
if (status === '') {
|
|
13893
|
+
return 'users';
|
|
13894
|
+
}
|
|
13895
|
+
return `users/${status}`;
|
|
13896
|
+
}
|
|
13897
|
+
/**
|
|
13898
|
+
* Grants access to any guest user without a session.
|
|
13899
|
+
*
|
|
13900
|
+
* Authenticated users don't have access to this role.
|
|
13901
|
+
*
|
|
13902
|
+
* @returns {string}
|
|
13903
|
+
*/
|
|
13904
|
+
static guests() {
|
|
13905
|
+
return 'guests';
|
|
13906
|
+
}
|
|
13907
|
+
/**
|
|
13908
|
+
* Grants access to a team by team ID.
|
|
13909
|
+
*
|
|
13910
|
+
* You can optionally pass a role for `role` to target
|
|
13911
|
+
* team members with the specified role.
|
|
13912
|
+
*
|
|
13913
|
+
* @param {string} id
|
|
13914
|
+
* @param {string} role
|
|
13915
|
+
* @returns {string}
|
|
13916
|
+
*/
|
|
13917
|
+
static team(id, role = '') {
|
|
13918
|
+
if (role === '') {
|
|
13919
|
+
return `team:${id}`;
|
|
13920
|
+
}
|
|
13921
|
+
return `team:${id}/${role}`;
|
|
13922
|
+
}
|
|
13923
|
+
/**
|
|
13924
|
+
* Grants access to a specific member of a team.
|
|
13925
|
+
*
|
|
13926
|
+
* When the member is removed from the team, they will
|
|
13927
|
+
* no longer have access.
|
|
13928
|
+
*
|
|
13929
|
+
* @param {string} id
|
|
13930
|
+
* @returns {string}
|
|
13931
|
+
*/
|
|
13932
|
+
static member(id) {
|
|
13933
|
+
return `member:${id}`;
|
|
13934
|
+
}
|
|
13935
|
+
/**
|
|
13936
|
+
* Grants access to a user with the specified label.
|
|
13937
|
+
*
|
|
13938
|
+
* @param {string} name
|
|
13939
|
+
* @returns {string}
|
|
13940
|
+
*/
|
|
13941
|
+
static label(name) {
|
|
13942
|
+
return `label:${name}`;
|
|
13943
|
+
}
|
|
13944
|
+
}
|
|
13945
|
+
|
|
13798
13946
|
/**
|
|
13799
13947
|
* Database Schema Migration Tool
|
|
13800
13948
|
*
|
|
@@ -13807,6 +13955,31 @@ class SchemaMigration {
|
|
|
13807
13955
|
constructor(databases) {
|
|
13808
13956
|
this.databases = databases;
|
|
13809
13957
|
}
|
|
13958
|
+
/**
|
|
13959
|
+
* Get default permissions for collections (read, create, update, delete all set to 'any')
|
|
13960
|
+
*/
|
|
13961
|
+
getDefaultPermissions() {
|
|
13962
|
+
return [
|
|
13963
|
+
Permission.read(Role.any()),
|
|
13964
|
+
Permission.create(Role.any()),
|
|
13965
|
+
Permission.update(Role.any()),
|
|
13966
|
+
Permission.delete(Role.any())
|
|
13967
|
+
];
|
|
13968
|
+
}
|
|
13969
|
+
/**
|
|
13970
|
+
* Check if an attribute key is a built-in field that cannot be modified
|
|
13971
|
+
* Built-in fields: id, createdAt, updatedAt
|
|
13972
|
+
*/
|
|
13973
|
+
isBuiltInAttribute(key) {
|
|
13974
|
+
return key === 'id' || key === 'createdAt' || key === 'updatedAt' || key === '$id' || key === '$createdAt' || key === '$updatedAt';
|
|
13975
|
+
}
|
|
13976
|
+
/**
|
|
13977
|
+
* Check if an index contains any built-in attributes
|
|
13978
|
+
* Built-in fields cannot have indexes created or deleted
|
|
13979
|
+
*/
|
|
13980
|
+
indexContainsBuiltInAttributes(index) {
|
|
13981
|
+
return index.attributes.some(attr => this.isBuiltInAttribute(attr));
|
|
13982
|
+
}
|
|
13810
13983
|
/**
|
|
13811
13984
|
* Generate migration plan by comparing current database state with target schema
|
|
13812
13985
|
*/
|
|
@@ -13816,9 +13989,29 @@ class SchemaMigration {
|
|
|
13816
13989
|
// Store schema for later use in execution
|
|
13817
13990
|
this._currentSchema = schema;
|
|
13818
13991
|
const operations = [];
|
|
13992
|
+
// If databaseId is empty, create a database with id "default"
|
|
13993
|
+
let databaseId = schema.databaseId;
|
|
13994
|
+
if (!databaseId || databaseId.trim() === '') {
|
|
13995
|
+
databaseId = 'default';
|
|
13996
|
+
try {
|
|
13997
|
+
yield this.databases.create({
|
|
13998
|
+
databaseId: databaseId,
|
|
13999
|
+
name: 'default',
|
|
14000
|
+
enabled: true
|
|
14001
|
+
});
|
|
14002
|
+
}
|
|
14003
|
+
catch (error) {
|
|
14004
|
+
// If database already exists, that's fine
|
|
14005
|
+
if (!(error instanceof AppwriteException && error.code === 409)) {
|
|
14006
|
+
throw error;
|
|
14007
|
+
}
|
|
14008
|
+
}
|
|
14009
|
+
// Update schema.databaseId for later use
|
|
14010
|
+
schema.databaseId = databaseId;
|
|
14011
|
+
}
|
|
13819
14012
|
// Get current tables
|
|
13820
14013
|
const currentTables = yield this.databases.listTables({
|
|
13821
|
-
databaseId:
|
|
14014
|
+
databaseId: databaseId,
|
|
13822
14015
|
total: true
|
|
13823
14016
|
});
|
|
13824
14017
|
const currentTablesMap = new Map();
|
|
@@ -13841,6 +14034,10 @@ class SchemaMigration {
|
|
|
13841
14034
|
// For new tables, create all attributes and indexes
|
|
13842
14035
|
// Process target attributes
|
|
13843
14036
|
for (const targetAttr of targetCollection.attributes) {
|
|
14037
|
+
// Skip built-in attributes (id, createdAt, updatedAt)
|
|
14038
|
+
if (this.isBuiltInAttribute(targetAttr.key)) {
|
|
14039
|
+
continue;
|
|
14040
|
+
}
|
|
13844
14041
|
operations.push({
|
|
13845
14042
|
type: 'createAttribute',
|
|
13846
14043
|
databaseId: schema.databaseId,
|
|
@@ -13852,6 +14049,11 @@ class SchemaMigration {
|
|
|
13852
14049
|
// Process target indexes
|
|
13853
14050
|
if (targetCollection.indexes) {
|
|
13854
14051
|
for (const targetIndex of targetCollection.indexes) {
|
|
14052
|
+
// Skip indexes that contain built-in attributes
|
|
14053
|
+
if (this.indexContainsBuiltInAttributes(targetIndex)) {
|
|
14054
|
+
console.log(`Skipping index ${targetIndex.key} because it contains built-in attributes`);
|
|
14055
|
+
continue;
|
|
14056
|
+
}
|
|
13855
14057
|
operations.push({
|
|
13856
14058
|
type: 'createIndex',
|
|
13857
14059
|
databaseId: schema.databaseId,
|
|
@@ -13888,6 +14090,10 @@ class SchemaMigration {
|
|
|
13888
14090
|
});
|
|
13889
14091
|
// Process target attributes
|
|
13890
14092
|
for (const targetAttr of targetCollection.attributes) {
|
|
14093
|
+
// Skip built-in attributes (id, createdAt, updatedAt)
|
|
14094
|
+
if (this.isBuiltInAttribute(targetAttr.key)) {
|
|
14095
|
+
continue;
|
|
14096
|
+
}
|
|
13891
14097
|
const currentCol = currentColumnsMap.get(targetAttr.key);
|
|
13892
14098
|
if (!currentCol) {
|
|
13893
14099
|
// Column doesn't exist - create it
|
|
@@ -13923,6 +14129,10 @@ class SchemaMigration {
|
|
|
13923
14129
|
}
|
|
13924
14130
|
// Check for columns to delete (columns in current but not in target)
|
|
13925
14131
|
for (const [key, currentAttr] of currentColumnsMap.entries()) {
|
|
14132
|
+
// Skip built-in attributes (id, createdAt, updatedAt)
|
|
14133
|
+
if (this.isBuiltInAttribute(key)) {
|
|
14134
|
+
continue;
|
|
14135
|
+
}
|
|
13926
14136
|
const targetAttr = targetCollection.attributes.find(a => a.key === key);
|
|
13927
14137
|
if (!targetAttr) {
|
|
13928
14138
|
operations.push({
|
|
@@ -13947,6 +14157,11 @@ class SchemaMigration {
|
|
|
13947
14157
|
});
|
|
13948
14158
|
// Process target indexes
|
|
13949
14159
|
for (const targetIndex of targetCollection.indexes) {
|
|
14160
|
+
// Skip indexes that contain built-in attributes
|
|
14161
|
+
if (this.indexContainsBuiltInAttributes(targetIndex)) {
|
|
14162
|
+
console.log(`Skipping index ${targetIndex.key} because it contains built-in attributes`);
|
|
14163
|
+
continue;
|
|
14164
|
+
}
|
|
13950
14165
|
const currentIndex = currentIndexesMap.get(targetIndex.key);
|
|
13951
14166
|
if (!currentIndex) {
|
|
13952
14167
|
// Index doesn't exist - create it
|
|
@@ -13982,6 +14197,12 @@ class SchemaMigration {
|
|
|
13982
14197
|
}
|
|
13983
14198
|
// Check for indexes to delete
|
|
13984
14199
|
for (const [key, currentIndex] of currentIndexesMap.entries()) {
|
|
14200
|
+
// Skip indexes that contain built-in attributes
|
|
14201
|
+
const indexAttributes = currentIndex.columns || [];
|
|
14202
|
+
if (indexAttributes.some((attr) => this.isBuiltInAttribute(attr))) {
|
|
14203
|
+
console.log(`Skipping deletion of index ${key} because it contains built-in attributes`);
|
|
14204
|
+
continue;
|
|
14205
|
+
}
|
|
13985
14206
|
const targetIndex = targetCollection.indexes.find(i => i.key === key);
|
|
13986
14207
|
if (!targetIndex) {
|
|
13987
14208
|
operations.push({
|
|
@@ -14304,7 +14525,7 @@ class SchemaMigration {
|
|
|
14304
14525
|
* Execute a single migration operation
|
|
14305
14526
|
*/
|
|
14306
14527
|
executeOperation(operation) {
|
|
14307
|
-
var _a, _b, _c, _d;
|
|
14528
|
+
var _a, _b, _c, _d, _e, _f;
|
|
14308
14529
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14309
14530
|
switch (operation.type) {
|
|
14310
14531
|
case 'createCollection':
|
|
@@ -14317,7 +14538,7 @@ class SchemaMigration {
|
|
|
14317
14538
|
name: operation.collectionName,
|
|
14318
14539
|
rowSecurity: (_a = targetCollection === null || targetCollection === void 0 ? void 0 : targetCollection.documentSecurity) !== null && _a !== void 0 ? _a : false,
|
|
14319
14540
|
enabled: (_b = targetCollection === null || targetCollection === void 0 ? void 0 : targetCollection.enabled) !== null && _b !== void 0 ? _b : true,
|
|
14320
|
-
permissions: targetCollection === null || targetCollection === void 0 ? void 0 : targetCollection.permissions
|
|
14541
|
+
permissions: (_c = targetCollection === null || targetCollection === void 0 ? void 0 : targetCollection.permissions) !== null && _c !== void 0 ? _c : this.getDefaultPermissions()
|
|
14321
14542
|
});
|
|
14322
14543
|
break;
|
|
14323
14544
|
case 'updateCollection':
|
|
@@ -14328,9 +14549,9 @@ class SchemaMigration {
|
|
|
14328
14549
|
databaseId: operation.databaseId,
|
|
14329
14550
|
tableId: operation.collectionId,
|
|
14330
14551
|
name: operation.collectionName || operation.collectionId,
|
|
14331
|
-
rowSecurity: (
|
|
14332
|
-
enabled: (
|
|
14333
|
-
permissions: updateTargetCollection === null || updateTargetCollection === void 0 ? void 0 : updateTargetCollection.permissions
|
|
14552
|
+
rowSecurity: (_d = updateTargetCollection === null || updateTargetCollection === void 0 ? void 0 : updateTargetCollection.documentSecurity) !== null && _d !== void 0 ? _d : false,
|
|
14553
|
+
enabled: (_e = updateTargetCollection === null || updateTargetCollection === void 0 ? void 0 : updateTargetCollection.enabled) !== null && _e !== void 0 ? _e : true,
|
|
14554
|
+
permissions: (_f = updateTargetCollection === null || updateTargetCollection === void 0 ? void 0 : updateTargetCollection.permissions) !== null && _f !== void 0 ? _f : this.getDefaultPermissions()
|
|
14334
14555
|
});
|
|
14335
14556
|
break;
|
|
14336
14557
|
case 'deleteCollection':
|
|
@@ -14343,12 +14564,22 @@ class SchemaMigration {
|
|
|
14343
14564
|
if (!operation.attribute) {
|
|
14344
14565
|
throw new Error('Attribute definition missing for createAttribute operation');
|
|
14345
14566
|
}
|
|
14567
|
+
// Skip built-in attributes (id, createdAt, updatedAt)
|
|
14568
|
+
if (this.isBuiltInAttribute(operation.attribute.key)) {
|
|
14569
|
+
console.log(`Skipping createAttribute for built-in field: ${operation.attribute.key}`);
|
|
14570
|
+
break;
|
|
14571
|
+
}
|
|
14346
14572
|
yield this.createAttribute(operation.databaseId, operation.collectionId, operation.attribute);
|
|
14347
14573
|
break;
|
|
14348
14574
|
case 'deleteAttribute':
|
|
14349
14575
|
if (!operation.attributeKey) {
|
|
14350
14576
|
throw new Error('Column key missing for deleteAttribute operation');
|
|
14351
14577
|
}
|
|
14578
|
+
// Skip built-in attributes (id, createdAt, updatedAt)
|
|
14579
|
+
if (this.isBuiltInAttribute(operation.attributeKey)) {
|
|
14580
|
+
console.log(`Skipping deleteAttribute for built-in field: ${operation.attributeKey}`);
|
|
14581
|
+
break;
|
|
14582
|
+
}
|
|
14352
14583
|
yield this.databases.deleteColumn({
|
|
14353
14584
|
databaseId: operation.databaseId,
|
|
14354
14585
|
tableId: operation.collectionId,
|
|
@@ -14361,6 +14592,11 @@ class SchemaMigration {
|
|
|
14361
14592
|
if (!operation.index) {
|
|
14362
14593
|
throw new Error('Index definition missing for createIndex operation');
|
|
14363
14594
|
}
|
|
14595
|
+
// Skip indexes that contain built-in attributes
|
|
14596
|
+
if (this.indexContainsBuiltInAttributes(operation.index)) {
|
|
14597
|
+
console.log(`Skipping createIndex for index ${operation.index.key} because it contains built-in attributes`);
|
|
14598
|
+
break;
|
|
14599
|
+
}
|
|
14364
14600
|
// Wait for all attributes used in the index to be available
|
|
14365
14601
|
yield this.waitForAttributesAvailable(operation.databaseId, operation.collectionId, operation.index.attributes);
|
|
14366
14602
|
yield this.databases.createIndex({
|
|
@@ -14384,12 +14620,18 @@ class SchemaMigration {
|
|
|
14384
14620
|
tableId: operation.collectionId,
|
|
14385
14621
|
total: true
|
|
14386
14622
|
});
|
|
14387
|
-
const
|
|
14388
|
-
if (!
|
|
14623
|
+
const indexToDelete = indexesList.indexes.find(idx => idx.key === operation.indexKey);
|
|
14624
|
+
if (!indexToDelete) {
|
|
14389
14625
|
// Index doesn't exist, skip deletion
|
|
14390
14626
|
console.log(`Index ${operation.indexKey} does not exist, skipping deletion`);
|
|
14391
14627
|
break;
|
|
14392
14628
|
}
|
|
14629
|
+
// Check if index contains built-in attributes
|
|
14630
|
+
const indexAttributes = indexToDelete.columns || [];
|
|
14631
|
+
if (indexAttributes.some((attr) => this.isBuiltInAttribute(attr))) {
|
|
14632
|
+
console.log(`Skipping deleteIndex for index ${operation.indexKey} because it contains built-in attributes`);
|
|
14633
|
+
break;
|
|
14634
|
+
}
|
|
14393
14635
|
}
|
|
14394
14636
|
catch (error) {
|
|
14395
14637
|
// If we can't list indexes, try to delete anyway (might fail gracefully)
|
|
@@ -14417,45 +14659,47 @@ class SchemaMigration {
|
|
|
14417
14659
|
key: attr.key,
|
|
14418
14660
|
required: attr.required
|
|
14419
14661
|
};
|
|
14662
|
+
// Required fields cannot have default values
|
|
14663
|
+
const defaultParams = attr.required ? {} : (attr.default !== undefined ? { xdefault: attr.default } : {});
|
|
14420
14664
|
switch (attr.type) {
|
|
14421
14665
|
case 'string':
|
|
14422
|
-
yield this.databases.createStringColumn(Object.assign(Object.assign({}, baseParams), { size: attr.size || 255,
|
|
14666
|
+
yield this.databases.createStringColumn(Object.assign(Object.assign(Object.assign(Object.assign({}, baseParams), { size: attr.size || 255 }), defaultParams), { array: attr.array, encrypt: attr.encrypt }));
|
|
14423
14667
|
break;
|
|
14424
14668
|
case 'integer':
|
|
14425
|
-
yield this.databases.createIntegerColumn(Object.assign(Object.assign({}, baseParams), { min: attr.min, max: attr.max,
|
|
14669
|
+
yield this.databases.createIntegerColumn(Object.assign(Object.assign(Object.assign(Object.assign({}, baseParams), { min: attr.min, max: attr.max }), defaultParams), { array: attr.array }));
|
|
14426
14670
|
break;
|
|
14427
14671
|
case 'float':
|
|
14428
|
-
yield this.databases.createFloatColumn(Object.assign(Object.assign({}, baseParams), { min: attr.min, max: attr.max,
|
|
14672
|
+
yield this.databases.createFloatColumn(Object.assign(Object.assign(Object.assign(Object.assign({}, baseParams), { min: attr.min, max: attr.max }), defaultParams), { array: attr.array }));
|
|
14429
14673
|
break;
|
|
14430
14674
|
case 'boolean':
|
|
14431
|
-
yield this.databases.createBooleanColumn(Object.assign(Object.assign({}, baseParams), {
|
|
14675
|
+
yield this.databases.createBooleanColumn(Object.assign(Object.assign(Object.assign({}, baseParams), defaultParams), { array: attr.array }));
|
|
14432
14676
|
break;
|
|
14433
14677
|
case 'datetime':
|
|
14434
|
-
yield this.databases.createDatetimeColumn(Object.assign(Object.assign({}, baseParams), {
|
|
14678
|
+
yield this.databases.createDatetimeColumn(Object.assign(Object.assign(Object.assign({}, baseParams), defaultParams), { array: attr.array }));
|
|
14435
14679
|
break;
|
|
14436
14680
|
case 'email':
|
|
14437
|
-
yield this.databases.createEmailColumn(Object.assign(Object.assign({}, baseParams), {
|
|
14681
|
+
yield this.databases.createEmailColumn(Object.assign(Object.assign(Object.assign({}, baseParams), defaultParams), { array: attr.array }));
|
|
14438
14682
|
break;
|
|
14439
14683
|
case 'enum':
|
|
14440
14684
|
if (!attr.elements) {
|
|
14441
14685
|
throw new Error('Enum column requires elements array');
|
|
14442
14686
|
}
|
|
14443
|
-
yield this.databases.createEnumColumn(Object.assign(Object.assign({}, baseParams), { elements: attr.elements,
|
|
14687
|
+
yield this.databases.createEnumColumn(Object.assign(Object.assign(Object.assign(Object.assign({}, baseParams), { elements: attr.elements }), defaultParams), { array: attr.array }));
|
|
14444
14688
|
break;
|
|
14445
14689
|
case 'url':
|
|
14446
|
-
yield this.databases.createUrlColumn(Object.assign(Object.assign({}, baseParams), {
|
|
14690
|
+
yield this.databases.createUrlColumn(Object.assign(Object.assign(Object.assign({}, baseParams), defaultParams), { array: attr.array }));
|
|
14447
14691
|
break;
|
|
14448
14692
|
case 'ip':
|
|
14449
|
-
yield this.databases.createIpColumn(Object.assign(Object.assign({}, baseParams), {
|
|
14693
|
+
yield this.databases.createIpColumn(Object.assign(Object.assign(Object.assign({}, baseParams), defaultParams), { array: attr.array }));
|
|
14450
14694
|
break;
|
|
14451
14695
|
case 'point':
|
|
14452
|
-
yield this.databases.createPointColumn(Object.assign(Object.assign({}, baseParams),
|
|
14696
|
+
yield this.databases.createPointColumn(Object.assign(Object.assign({}, baseParams), defaultParams));
|
|
14453
14697
|
break;
|
|
14454
14698
|
case 'line':
|
|
14455
|
-
yield this.databases.createLineColumn(Object.assign(Object.assign({}, baseParams),
|
|
14699
|
+
yield this.databases.createLineColumn(Object.assign(Object.assign({}, baseParams), defaultParams));
|
|
14456
14700
|
break;
|
|
14457
14701
|
case 'polygon':
|
|
14458
|
-
yield this.databases.createPolygonColumn(Object.assign(Object.assign({}, baseParams),
|
|
14702
|
+
yield this.databases.createPolygonColumn(Object.assign(Object.assign({}, baseParams), defaultParams));
|
|
14459
14703
|
break;
|
|
14460
14704
|
case 'relationship':
|
|
14461
14705
|
if (!attr.relatedCollectionId) {
|
|
@@ -25286,6 +25530,220 @@ class Vcs {
|
|
|
25286
25530
|
};
|
|
25287
25531
|
return this.client.call('delete', uri, apiHeaders, payload);
|
|
25288
25532
|
}
|
|
25533
|
+
getRepositoryFile(paramsOrFirst, ...rest) {
|
|
25534
|
+
let params;
|
|
25535
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
25536
|
+
params = (paramsOrFirst || {});
|
|
25537
|
+
}
|
|
25538
|
+
else {
|
|
25539
|
+
params = {
|
|
25540
|
+
installationId: paramsOrFirst,
|
|
25541
|
+
providerRepositoryId: rest[0],
|
|
25542
|
+
path: rest[1],
|
|
25543
|
+
ref: rest[2]
|
|
25544
|
+
};
|
|
25545
|
+
}
|
|
25546
|
+
const installationId = params.installationId;
|
|
25547
|
+
const providerRepositoryId = params.providerRepositoryId;
|
|
25548
|
+
const path = params.path;
|
|
25549
|
+
const ref = params.ref;
|
|
25550
|
+
if (typeof installationId === 'undefined') {
|
|
25551
|
+
throw new AppwriteException('Missing required parameter: "installationId"');
|
|
25552
|
+
}
|
|
25553
|
+
if (typeof providerRepositoryId === 'undefined') {
|
|
25554
|
+
throw new AppwriteException('Missing required parameter: "providerRepositoryId"');
|
|
25555
|
+
}
|
|
25556
|
+
if (typeof path === 'undefined') {
|
|
25557
|
+
throw new AppwriteException('Missing required parameter: "path"');
|
|
25558
|
+
}
|
|
25559
|
+
const apiPath = '/vcs/github/repositories/{installationId}/{providerRepositoryId}/file'.replace('{installationId}', installationId).replace('{providerRepositoryId}', providerRepositoryId);
|
|
25560
|
+
const payload = {};
|
|
25561
|
+
if (typeof path !== 'undefined') {
|
|
25562
|
+
payload['path'] = path;
|
|
25563
|
+
}
|
|
25564
|
+
if (typeof ref !== 'undefined') {
|
|
25565
|
+
payload['ref'] = ref;
|
|
25566
|
+
}
|
|
25567
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
25568
|
+
const apiHeaders = {};
|
|
25569
|
+
return this.client.call('get', uri, apiHeaders, payload);
|
|
25570
|
+
}
|
|
25571
|
+
createRepositoryFile(paramsOrFirst, ...rest) {
|
|
25572
|
+
let params;
|
|
25573
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
25574
|
+
params = (paramsOrFirst || {});
|
|
25575
|
+
}
|
|
25576
|
+
else {
|
|
25577
|
+
params = {
|
|
25578
|
+
installationId: paramsOrFirst,
|
|
25579
|
+
providerRepositoryId: rest[0],
|
|
25580
|
+
path: rest[1],
|
|
25581
|
+
content: rest[2],
|
|
25582
|
+
message: rest[3],
|
|
25583
|
+
branch: rest[4]
|
|
25584
|
+
};
|
|
25585
|
+
}
|
|
25586
|
+
const installationId = params.installationId;
|
|
25587
|
+
const providerRepositoryId = params.providerRepositoryId;
|
|
25588
|
+
const path = params.path;
|
|
25589
|
+
const content = params.content;
|
|
25590
|
+
const message = params.message;
|
|
25591
|
+
const branch = params.branch;
|
|
25592
|
+
if (typeof installationId === 'undefined') {
|
|
25593
|
+
throw new AppwriteException('Missing required parameter: "installationId"');
|
|
25594
|
+
}
|
|
25595
|
+
if (typeof providerRepositoryId === 'undefined') {
|
|
25596
|
+
throw new AppwriteException('Missing required parameter: "providerRepositoryId"');
|
|
25597
|
+
}
|
|
25598
|
+
if (typeof path === 'undefined') {
|
|
25599
|
+
throw new AppwriteException('Missing required parameter: "path"');
|
|
25600
|
+
}
|
|
25601
|
+
if (typeof content === 'undefined') {
|
|
25602
|
+
throw new AppwriteException('Missing required parameter: "content"');
|
|
25603
|
+
}
|
|
25604
|
+
if (typeof message === 'undefined') {
|
|
25605
|
+
throw new AppwriteException('Missing required parameter: "message"');
|
|
25606
|
+
}
|
|
25607
|
+
const apiPath = '/vcs/github/repositories/{installationId}/{providerRepositoryId}/file'.replace('{installationId}', installationId).replace('{providerRepositoryId}', providerRepositoryId);
|
|
25608
|
+
const payload = {};
|
|
25609
|
+
if (typeof path !== 'undefined') {
|
|
25610
|
+
payload['path'] = path;
|
|
25611
|
+
}
|
|
25612
|
+
if (typeof content !== 'undefined') {
|
|
25613
|
+
payload['content'] = content;
|
|
25614
|
+
}
|
|
25615
|
+
if (typeof message !== 'undefined') {
|
|
25616
|
+
payload['message'] = message;
|
|
25617
|
+
}
|
|
25618
|
+
if (typeof branch !== 'undefined') {
|
|
25619
|
+
payload['branch'] = branch;
|
|
25620
|
+
}
|
|
25621
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
25622
|
+
const apiHeaders = {
|
|
25623
|
+
'content-type': 'application/json',
|
|
25624
|
+
};
|
|
25625
|
+
return this.client.call('post', uri, apiHeaders, payload);
|
|
25626
|
+
}
|
|
25627
|
+
updateRepositoryFile(paramsOrFirst, ...rest) {
|
|
25628
|
+
let params;
|
|
25629
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
25630
|
+
params = (paramsOrFirst || {});
|
|
25631
|
+
}
|
|
25632
|
+
else {
|
|
25633
|
+
params = {
|
|
25634
|
+
installationId: paramsOrFirst,
|
|
25635
|
+
providerRepositoryId: rest[0],
|
|
25636
|
+
path: rest[1],
|
|
25637
|
+
content: rest[2],
|
|
25638
|
+
message: rest[3],
|
|
25639
|
+
sha: rest[4],
|
|
25640
|
+
branch: rest[5]
|
|
25641
|
+
};
|
|
25642
|
+
}
|
|
25643
|
+
const installationId = params.installationId;
|
|
25644
|
+
const providerRepositoryId = params.providerRepositoryId;
|
|
25645
|
+
const path = params.path;
|
|
25646
|
+
const content = params.content;
|
|
25647
|
+
const message = params.message;
|
|
25648
|
+
const sha = params.sha;
|
|
25649
|
+
const branch = params.branch;
|
|
25650
|
+
if (typeof installationId === 'undefined') {
|
|
25651
|
+
throw new AppwriteException('Missing required parameter: "installationId"');
|
|
25652
|
+
}
|
|
25653
|
+
if (typeof providerRepositoryId === 'undefined') {
|
|
25654
|
+
throw new AppwriteException('Missing required parameter: "providerRepositoryId"');
|
|
25655
|
+
}
|
|
25656
|
+
if (typeof path === 'undefined') {
|
|
25657
|
+
throw new AppwriteException('Missing required parameter: "path"');
|
|
25658
|
+
}
|
|
25659
|
+
if (typeof content === 'undefined') {
|
|
25660
|
+
throw new AppwriteException('Missing required parameter: "content"');
|
|
25661
|
+
}
|
|
25662
|
+
if (typeof message === 'undefined') {
|
|
25663
|
+
throw new AppwriteException('Missing required parameter: "message"');
|
|
25664
|
+
}
|
|
25665
|
+
if (typeof sha === 'undefined') {
|
|
25666
|
+
throw new AppwriteException('Missing required parameter: "sha"');
|
|
25667
|
+
}
|
|
25668
|
+
const apiPath = '/vcs/github/repositories/{installationId}/{providerRepositoryId}/file'.replace('{installationId}', installationId).replace('{providerRepositoryId}', providerRepositoryId);
|
|
25669
|
+
const payload = {};
|
|
25670
|
+
if (typeof path !== 'undefined') {
|
|
25671
|
+
payload['path'] = path;
|
|
25672
|
+
}
|
|
25673
|
+
if (typeof content !== 'undefined') {
|
|
25674
|
+
payload['content'] = content;
|
|
25675
|
+
}
|
|
25676
|
+
if (typeof message !== 'undefined') {
|
|
25677
|
+
payload['message'] = message;
|
|
25678
|
+
}
|
|
25679
|
+
if (typeof sha !== 'undefined') {
|
|
25680
|
+
payload['sha'] = sha;
|
|
25681
|
+
}
|
|
25682
|
+
if (typeof branch !== 'undefined') {
|
|
25683
|
+
payload['branch'] = branch;
|
|
25684
|
+
}
|
|
25685
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
25686
|
+
const apiHeaders = {
|
|
25687
|
+
'content-type': 'application/json',
|
|
25688
|
+
};
|
|
25689
|
+
return this.client.call('put', uri, apiHeaders, payload);
|
|
25690
|
+
}
|
|
25691
|
+
deleteRepositoryFile(paramsOrFirst, ...rest) {
|
|
25692
|
+
let params;
|
|
25693
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
25694
|
+
params = (paramsOrFirst || {});
|
|
25695
|
+
}
|
|
25696
|
+
else {
|
|
25697
|
+
params = {
|
|
25698
|
+
installationId: paramsOrFirst,
|
|
25699
|
+
providerRepositoryId: rest[0],
|
|
25700
|
+
path: rest[1],
|
|
25701
|
+
message: rest[2],
|
|
25702
|
+
sha: rest[3],
|
|
25703
|
+
branch: rest[4]
|
|
25704
|
+
};
|
|
25705
|
+
}
|
|
25706
|
+
const installationId = params.installationId;
|
|
25707
|
+
const providerRepositoryId = params.providerRepositoryId;
|
|
25708
|
+
const path = params.path;
|
|
25709
|
+
const message = params.message;
|
|
25710
|
+
const sha = params.sha;
|
|
25711
|
+
const branch = params.branch;
|
|
25712
|
+
if (typeof installationId === 'undefined') {
|
|
25713
|
+
throw new AppwriteException('Missing required parameter: "installationId"');
|
|
25714
|
+
}
|
|
25715
|
+
if (typeof providerRepositoryId === 'undefined') {
|
|
25716
|
+
throw new AppwriteException('Missing required parameter: "providerRepositoryId"');
|
|
25717
|
+
}
|
|
25718
|
+
if (typeof path === 'undefined') {
|
|
25719
|
+
throw new AppwriteException('Missing required parameter: "path"');
|
|
25720
|
+
}
|
|
25721
|
+
if (typeof message === 'undefined') {
|
|
25722
|
+
throw new AppwriteException('Missing required parameter: "message"');
|
|
25723
|
+
}
|
|
25724
|
+
if (typeof sha === 'undefined') {
|
|
25725
|
+
throw new AppwriteException('Missing required parameter: "sha"');
|
|
25726
|
+
}
|
|
25727
|
+
const apiPath = '/vcs/github/repositories/{installationId}/{providerRepositoryId}/file'.replace('{installationId}', installationId).replace('{providerRepositoryId}', providerRepositoryId);
|
|
25728
|
+
const payload = {};
|
|
25729
|
+
if (typeof path !== 'undefined') {
|
|
25730
|
+
payload['path'] = path;
|
|
25731
|
+
}
|
|
25732
|
+
if (typeof message !== 'undefined') {
|
|
25733
|
+
payload['message'] = message;
|
|
25734
|
+
}
|
|
25735
|
+
if (typeof sha !== 'undefined') {
|
|
25736
|
+
payload['sha'] = sha;
|
|
25737
|
+
}
|
|
25738
|
+
if (typeof branch !== 'undefined') {
|
|
25739
|
+
payload['branch'] = branch;
|
|
25740
|
+
}
|
|
25741
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
25742
|
+
const apiHeaders = {
|
|
25743
|
+
'content-type': 'application/json',
|
|
25744
|
+
};
|
|
25745
|
+
return this.client.call('delete', uri, apiHeaders, payload);
|
|
25746
|
+
}
|
|
25289
25747
|
}
|
|
25290
25748
|
|
|
25291
25749
|
var RealtimeCode;
|
|
@@ -25590,154 +26048,6 @@ class Realtime {
|
|
|
25590
26048
|
}
|
|
25591
26049
|
}
|
|
25592
26050
|
|
|
25593
|
-
/**
|
|
25594
|
-
* Helper class to generate permission strings for resources.
|
|
25595
|
-
*/
|
|
25596
|
-
class Permission {
|
|
25597
|
-
}
|
|
25598
|
-
/**
|
|
25599
|
-
* Generate read permission string for the provided role.
|
|
25600
|
-
*
|
|
25601
|
-
* @param {string} role
|
|
25602
|
-
* @returns {string}
|
|
25603
|
-
*/
|
|
25604
|
-
Permission.read = (role) => {
|
|
25605
|
-
return `read("${role}")`;
|
|
25606
|
-
};
|
|
25607
|
-
/**
|
|
25608
|
-
* Generate write permission string for the provided role.
|
|
25609
|
-
*
|
|
25610
|
-
* This is an alias of update, delete, and possibly create.
|
|
25611
|
-
* Don't use write in combination with update, delete, or create.
|
|
25612
|
-
*
|
|
25613
|
-
* @param {string} role
|
|
25614
|
-
* @returns {string}
|
|
25615
|
-
*/
|
|
25616
|
-
Permission.write = (role) => {
|
|
25617
|
-
return `write("${role}")`;
|
|
25618
|
-
};
|
|
25619
|
-
/**
|
|
25620
|
-
* Generate create permission string for the provided role.
|
|
25621
|
-
*
|
|
25622
|
-
* @param {string} role
|
|
25623
|
-
* @returns {string}
|
|
25624
|
-
*/
|
|
25625
|
-
Permission.create = (role) => {
|
|
25626
|
-
return `create("${role}")`;
|
|
25627
|
-
};
|
|
25628
|
-
/**
|
|
25629
|
-
* Generate update permission string for the provided role.
|
|
25630
|
-
*
|
|
25631
|
-
* @param {string} role
|
|
25632
|
-
* @returns {string}
|
|
25633
|
-
*/
|
|
25634
|
-
Permission.update = (role) => {
|
|
25635
|
-
return `update("${role}")`;
|
|
25636
|
-
};
|
|
25637
|
-
/**
|
|
25638
|
-
* Generate delete permission string for the provided role.
|
|
25639
|
-
*
|
|
25640
|
-
* @param {string} role
|
|
25641
|
-
* @returns {string}
|
|
25642
|
-
*/
|
|
25643
|
-
Permission.delete = (role) => {
|
|
25644
|
-
return `delete("${role}")`;
|
|
25645
|
-
};
|
|
25646
|
-
|
|
25647
|
-
/**
|
|
25648
|
-
* Helper class to generate role strings for `Permission`.
|
|
25649
|
-
*/
|
|
25650
|
-
class Role {
|
|
25651
|
-
/**
|
|
25652
|
-
* Grants access to anyone.
|
|
25653
|
-
*
|
|
25654
|
-
* This includes authenticated and unauthenticated users.
|
|
25655
|
-
*
|
|
25656
|
-
* @returns {string}
|
|
25657
|
-
*/
|
|
25658
|
-
static any() {
|
|
25659
|
-
return 'any';
|
|
25660
|
-
}
|
|
25661
|
-
/**
|
|
25662
|
-
* Grants access to a specific user by user ID.
|
|
25663
|
-
*
|
|
25664
|
-
* You can optionally pass verified or unverified for
|
|
25665
|
-
* `status` to target specific types of users.
|
|
25666
|
-
*
|
|
25667
|
-
* @param {string} id
|
|
25668
|
-
* @param {string} status
|
|
25669
|
-
* @returns {string}
|
|
25670
|
-
*/
|
|
25671
|
-
static user(id, status = '') {
|
|
25672
|
-
if (status === '') {
|
|
25673
|
-
return `user:${id}`;
|
|
25674
|
-
}
|
|
25675
|
-
return `user:${id}/${status}`;
|
|
25676
|
-
}
|
|
25677
|
-
/**
|
|
25678
|
-
* Grants access to any authenticated or anonymous user.
|
|
25679
|
-
*
|
|
25680
|
-
* You can optionally pass verified or unverified for
|
|
25681
|
-
* `status` to target specific types of users.
|
|
25682
|
-
*
|
|
25683
|
-
* @param {string} status
|
|
25684
|
-
* @returns {string}
|
|
25685
|
-
*/
|
|
25686
|
-
static users(status = '') {
|
|
25687
|
-
if (status === '') {
|
|
25688
|
-
return 'users';
|
|
25689
|
-
}
|
|
25690
|
-
return `users/${status}`;
|
|
25691
|
-
}
|
|
25692
|
-
/**
|
|
25693
|
-
* Grants access to any guest user without a session.
|
|
25694
|
-
*
|
|
25695
|
-
* Authenticated users don't have access to this role.
|
|
25696
|
-
*
|
|
25697
|
-
* @returns {string}
|
|
25698
|
-
*/
|
|
25699
|
-
static guests() {
|
|
25700
|
-
return 'guests';
|
|
25701
|
-
}
|
|
25702
|
-
/**
|
|
25703
|
-
* Grants access to a team by team ID.
|
|
25704
|
-
*
|
|
25705
|
-
* You can optionally pass a role for `role` to target
|
|
25706
|
-
* team members with the specified role.
|
|
25707
|
-
*
|
|
25708
|
-
* @param {string} id
|
|
25709
|
-
* @param {string} role
|
|
25710
|
-
* @returns {string}
|
|
25711
|
-
*/
|
|
25712
|
-
static team(id, role = '') {
|
|
25713
|
-
if (role === '') {
|
|
25714
|
-
return `team:${id}`;
|
|
25715
|
-
}
|
|
25716
|
-
return `team:${id}/${role}`;
|
|
25717
|
-
}
|
|
25718
|
-
/**
|
|
25719
|
-
* Grants access to a specific member of a team.
|
|
25720
|
-
*
|
|
25721
|
-
* When the member is removed from the team, they will
|
|
25722
|
-
* no longer have access.
|
|
25723
|
-
*
|
|
25724
|
-
* @param {string} id
|
|
25725
|
-
* @returns {string}
|
|
25726
|
-
*/
|
|
25727
|
-
static member(id) {
|
|
25728
|
-
return `member:${id}`;
|
|
25729
|
-
}
|
|
25730
|
-
/**
|
|
25731
|
-
* Grants access to a user with the specified label.
|
|
25732
|
-
*
|
|
25733
|
-
* @param {string} name
|
|
25734
|
-
* @returns {string}
|
|
25735
|
-
*/
|
|
25736
|
-
static label(name) {
|
|
25737
|
-
return `label:${name}`;
|
|
25738
|
-
}
|
|
25739
|
-
}
|
|
25740
|
-
|
|
25741
26051
|
var _a, _ID_hexTimestamp;
|
|
25742
26052
|
/**
|
|
25743
26053
|
* Helper class to generate ID strings for resources.
|
|
@@ -27559,8 +27869,22 @@ exports.MessageStatus = void 0;
|
|
|
27559
27869
|
MessageStatus["Failed"] = "failed";
|
|
27560
27870
|
})(exports.MessageStatus || (exports.MessageStatus = {}));
|
|
27561
27871
|
|
|
27872
|
+
// Default API endpoint, can be configured via setDefaultApiEndpoint
|
|
27873
|
+
let defaultApiEndpoint = 'https://appbuild.oceanbase.com/v1';
|
|
27874
|
+
/**
|
|
27875
|
+
* Set the default API endpoint for all SDK operations
|
|
27876
|
+
* @param endpoint - The API endpoint URL (e.g., 'https://appbuild.store/v1')
|
|
27877
|
+
*/
|
|
27878
|
+
function setDefaultApiEndpoint(endpoint) {
|
|
27879
|
+
defaultApiEndpoint = endpoint;
|
|
27880
|
+
}
|
|
27881
|
+
/**
|
|
27882
|
+
* Get the API endpoint, optionally scoped to a region
|
|
27883
|
+
* @param region - Optional region parameter (currently unused, reserved for future use)
|
|
27884
|
+
* @returns The API endpoint URL
|
|
27885
|
+
*/
|
|
27562
27886
|
function getApiEndpoint(region) {
|
|
27563
|
-
return
|
|
27887
|
+
return defaultApiEndpoint;
|
|
27564
27888
|
}
|
|
27565
27889
|
function createConsoleSdk(client) {
|
|
27566
27890
|
return {
|
|
@@ -27709,4 +28033,5 @@ exports.Vcs = Vcs;
|
|
|
27709
28033
|
exports.getApiEndpoint = getApiEndpoint;
|
|
27710
28034
|
exports.realtime = realtime;
|
|
27711
28035
|
exports.sdk = sdk;
|
|
28036
|
+
exports.setDefaultApiEndpoint = setDefaultApiEndpoint;
|
|
27712
28037
|
//# sourceMappingURL=sdk.js.map
|