@@ -75,8 +75,18 @@ import { checkAndApplyTablesDBChanges } from "./utils/database-sync.js";
7575const POLL_DEBOUNCE = 2000 ; // Milliseconds
7676const POLL_DEFAULT_VALUE = 30 ;
7777
78- interface PushResourcesOptions {
78+ export interface PushOptions {
7979 skipDeprecated ?: boolean ;
80+ functionOptions ?: {
81+ async ?: boolean ;
82+ code ?: boolean ;
83+ withVariables ?: boolean ;
84+ } ;
85+ siteOptions ?: {
86+ async ?: boolean ;
87+ code ?: boolean ;
88+ withVariables ?: boolean ;
89+ } ;
8090}
8191
8292interface PushSiteOptions {
@@ -108,20 +118,7 @@ export class Push {
108118
109119 public async pushResources (
110120 config : ConfigType ,
111- options : {
112- skipDeprecated ?: boolean ;
113- functionOptions ?: {
114- async ?: boolean ;
115- code ?: boolean ;
116- withVariables ?: boolean ;
117- } ;
118- siteOptions ?: {
119- async ?: boolean ;
120- code ?: boolean ;
121- withVariables ?: boolean ;
122- } ;
123- attempts ?: number ;
124- } = { skipDeprecated : true } ,
121+ options : PushOptions = { skipDeprecated : true } ,
125122 ) : Promise < {
126123 results : Record < string , any > ;
127124 errors : any [ ] ;
@@ -228,7 +225,7 @@ export class Push {
228225 if ( config . tables && config . tables . length > 0 ) {
229226 try {
230227 log ( "Pushing tables ..." ) ;
231- const result = await this . pushTables ( config . tables , options . attempts ) ;
228+ const result = await this . pushTables ( config . tables ) ;
232229 results . tables = result ;
233230 allErrors . push ( ...result . errors ) ;
234231 } catch ( e : any ) {
@@ -257,10 +254,7 @@ export class Push {
257254 } ;
258255 } ,
259256 ) ;
260- const result = await this . pushCollections (
261- collectionsWithDbNames ,
262- options . attempts ,
263- ) ;
257+ const result = await this . pushCollections ( collectionsWithDbNames ) ;
264258 results . collections = result ;
265259 allErrors . push ( ...result . errors ) ;
266260 } catch ( e : any ) {
@@ -1275,14 +1269,11 @@ export class Push {
12751269 } ;
12761270 }
12771271
1278- public async pushCollections (
1279- collections : any [ ] ,
1280- attempts ?: number ,
1281- ) : Promise < {
1272+ public async pushCollections ( collections : any [ ] ) : Promise < {
12821273 successfullyPushed : number ;
12831274 errors : any [ ] ;
12841275 } > {
1285- const pools = new Pools ( attempts ?? POLL_DEFAULT_VALUE ) ;
1276+ const pools = new Pools ( POLL_DEFAULT_VALUE ) ;
12861277 const attributes = new Attributes ( pools ) ;
12871278
12881279 const errors : any [ ] = [ ] ;
@@ -1438,7 +1429,9 @@ async function createPushInstance(): Promise<Push> {
14381429
14391430const pushResources = async ( {
14401431 skipDeprecated = false ,
1441- } : PushResourcesOptions = { } ) : Promise < void > => {
1432+ } : {
1433+ skipDeprecated ?: boolean ;
1434+ } = { } ) : Promise < void > => {
14421435 if ( cliConfig . all ) {
14431436 checkDeployConditions ( localConfig ) ;
14441437
@@ -1966,9 +1959,7 @@ const pushTable = async ({
19661959 }
19671960} ;
19681961
1969- const pushCollection = async ( {
1970- attempts,
1971- } : PushTableOptions = { } ) : Promise < void > => {
1962+ const pushCollection = async ( { } : PushTableOptions = { } ) : Promise < void > => {
19721963 warn (
19731964 "appwrite push collection has been deprecated. Please consider using 'appwrite push tables' instead" ,
19741965 ) ;
@@ -2029,7 +2020,7 @@ const pushCollection = async ({
20292020 log ( "Pushing collections ..." ) ;
20302021
20312022 const pushInstance = await createPushInstance ( ) ;
2032- const result = await pushInstance . pushCollections ( collections , attempts ) ;
2023+ const result = await pushInstance . pushCollections ( collections ) ;
20332024
20342025 const { successfullyPushed, errors } = result ;
20352026
0 commit comments