Skip to content

Feat cli g2 #863

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 296 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
296 commits
Select commit Hold shift + click to select a range
3cee4c1
Merge pull request #840 from appwrite/feat-organization-support
christyjacob4 May 20, 2024
3a47c66
feat(cli): Pulling function code and definition
byawitz May 20, 2024
9c41789
Merge branch 'refs/heads/feat-cli-g2' into feat-split-project-actions
byawitz May 20, 2024
c0766e4
fix(cli): replacing ID import
byawitz May 20, 2024
5e1020a
Merge branch 'refs/heads/feat-create-resources' into feat-pull-function
byawitz May 20, 2024
fdd0014
refactor(cli): Messaging to Topics
byawitz May 20, 2024
836e79c
refactor(cli): Updater -> Spinner, and refactoring
byawitz May 20, 2024
d816f79
Merge branch 'refs/heads/feat-async-function-deployments' into feat-f…
byawitz May 20, 2024
bd4c054
feat(cli): Adding link to failed deployments
byawitz May 20, 2024
3aa0284
Merge pull request #837 from appwrite/feat-deploy-init-everything
christyjacob4 May 20, 2024
7cb45fe
refactoring(cli): refactoring
byawitz May 20, 2024
b33054e
feat(cli): Ignore function deployment status
byawitz May 20, 2024
6f4e994
Merge branch 'refs/heads/feat-adding-messaging' into feat-create-reso…
byawitz May 20, 2024
0a0a671
feat(cli): Interactive topics creation
byawitz May 20, 2024
c0b70a4
Merge branch 'refs/heads/feat-adding-messaging' into feat-split-proje…
byawitz May 20, 2024
5f846b9
Merge branch 'refs/heads/feat-split-project-actions' into feat-create…
byawitz May 20, 2024
9515981
Update templates/cli/lib/commands/push.js.twig
christyjacob4 May 20, 2024
b54147d
Merge pull request #839 from appwrite/feat-adding-messaging
christyjacob4 May 20, 2024
23523be
Update templates/cli/lib/commands/push.js.twig
christyjacob4 May 20, 2024
f029919
Merge pull request #844 from appwrite/feat-functions-deployment-status
christyjacob4 May 20, 2024
6d98968
Update templates/cli/lib/commands/push.js.twig
christyjacob4 May 20, 2024
c91aa21
Merge pull request #843 from appwrite/feat-async-function-deployments
christyjacob4 May 21, 2024
f400f39
Merge branch 'refs/heads/feat-cli-g2' into feat-create-resources
byawitz May 21, 2024
69d0eb2
Merge branch 'refs/heads/feat-cli-g2' into feat-split-project-actions
byawitz May 21, 2024
9b71779
Merge branch 'refs/heads/feat-split-project-actions' into feat-create…
byawitz May 21, 2024
b6b810e
Merge branch 'refs/heads/feat-create-resources' into feat-pull-function
byawitz May 21, 2024
60c2bd5
refactor(cli): twig tags
byawitz May 21, 2024
4dd832f
refactor(cli): twig multiple lines
byawitz May 21, 2024
0357a8a
feat(cli): Adding console for get methods
byawitz May 21, 2024
46a1b5e
feat(cli): Adding console whoami command
byawitz May 21, 2024
151f59b
feat(cli): Console whoami better error handling
byawitz May 21, 2024
d9fa0bb
feat(cli): Multiple accounts in CLI
byawitz May 21, 2024
2d8fe79
feat(cli): Init project forces login
byawitz May 21, 2024
abef847
refactor(cli): Refactor message text
byawitz May 22, 2024
b7f278b
Merge branch 'refs/heads/feat-split-project-actions' into feat-create…
byawitz May 22, 2024
634679a
chore(cli): rebasing head
byawitz May 22, 2024
06cecf1
Merge branch 'refs/heads/feat-create-resources' into feat-pull-function
byawitz May 22, 2024
283a063
chore(cli): rebasing head
byawitz May 22, 2024
8c3e359
refactor(cli): texts refactor
byawitz May 22, 2024
32ab736
Merge pull request #847 from appwrite/feat-pull-function
christyjacob4 May 22, 2024
f892673
refactor(cli): Omitting the `project` sub-command
byawitz May 22, 2024
43e8895
Merge branch 'refs/heads/feat-split-project-actions' into feat-create…
byawitz May 22, 2024
2b5a168
feat(cli): Console flow add an open flag
byawitz May 22, 2024
848e222
refactor(cli): Changing error to info
byawitz May 22, 2024
ee66125
refactor(cli): Review refactoring and adding option for json output
byawitz May 22, 2024
6eeef88
Merge branch 'refs/heads/feat-cli-whoami-command' into feat-multiple-…
byawitz May 22, 2024
fd78fad
feat(cli): Hooking migration before any command
byawitz May 22, 2024
9387d95
feat(cli): Interactive multiple account changing
byawitz May 22, 2024
d250003
feat(cli): Adding json option to list accounts
byawitz May 22, 2024
144e043
feat(cli): Interactive multiple user logout
byawitz May 22, 2024
9a61aef
fix(cli): Changing migrate to regular function
byawitz May 22, 2024
0cf5edd
fix(cli): Login question
byawitz May 22, 2024
7c07523
fix(cli): Extracting migrate
byawitz May 22, 2024
58df0ee
fix(cli): Renaming the migrate function name
byawitz May 22, 2024
8c77004
fix(cli): Excluding migrate from tests
byawitz May 22, 2024
c1e5c41
fix(cli): Adding migrate to tests
byawitz May 22, 2024
ea494b7
fix(cli): Adapting the `client` command and bug when getting key.
byawitz May 22, 2024
094e8dd
feat(cli): Non destructive db, starting
byawitz May 22, 2024
7015c31
Merge branch 'refs/heads/feat-split-project-actions' into feat-create…
byawitz May 23, 2024
a48c3e2
refactor(cli): Grouping init functionality
byawitz May 23, 2024
2bb8da3
refactor(cli): Project pull to update project name
byawitz May 23, 2024
cd505f3
refactor(cli): Project push to update remote project name
byawitz May 23, 2024
4d14115
feat(cli): Adding report flag
byawitz May 23, 2024
25d7032
refactor(cli): Refactoring sudo and make it globally available
byawitz May 23, 2024
ed76075
refactor(cli): Parallel DB and Collections creation, attribute in ser…
byawitz May 23, 2024
f9a9c9a
feat(cli): Non destructive database and collection update
byawitz May 23, 2024
4b3a3e1
Merge pull request #850 from appwrite/feat-cli-whoami-command
christyjacob4 May 24, 2024
349161f
feat(cli): Adding more data to Github issue link
byawitz May 24, 2024
8c7b894
refactor(cli): Multiple account login refactoring
byawitz May 24, 2024
338c14d
feat(cli): Comparing non changeable attributes and showing all changes
byawitz May 24, 2024
e5573b6
fix(cli): removing cli version from `steps-to-reproduce`
byawitz May 24, 2024
793689e
Merge branch 'refs/heads/feat-cli-g2' into feat-create-resources
byawitz May 24, 2024
bce40e8
feat(cli): Pulling function without questions, and review refactoring
byawitz May 24, 2024
8738085
Merge branch 'refs/heads/feat-report-error' into feat-cli-sudo
byawitz May 24, 2024
738a9f6
feat(cli): Give `paginate` the option to accept more queries
byawitz May 24, 2024
9096fae
refactor(cli): renaming to `--id` and adding verification
byawitz May 24, 2024
c82609d
refactor(cli): Moving --all logic into questions
byawitz May 24, 2024
cce2c3a
refactor(cli): Moving --force logic into questions
byawitz May 24, 2024
051891b
chore(cli): Allowing the use of `deploy` like `push`
byawitz May 24, 2024
768c4ed
refactor(cli): Changing commands from single to plural when applicable
byawitz May 24, 2024
ca5c806
feat(cli): Creating function from all available templates
byawitz May 24, 2024
7aaa344
Merge pull request #855 from appwrite/chore-backwards-compatibility
christyjacob4 May 27, 2024
e587222
Merge pull request #856 from appwrite/refactor-singular-to-plural
christyjacob4 May 27, 2024
284bc48
Improve CLI aliases
Meldiron May 27, 2024
7da50a3
Merge branch 'refs/heads/feat-create-resources' into feat-functions-t…
byawitz May 28, 2024
64726b2
refactor(cli): Review fixing
byawitz May 28, 2024
32452ff
refactor(cli): Review fixing
byawitz May 28, 2024
ffdc1cc
refactor(cli): Review fixing
byawitz May 28, 2024
cf290e2
Merge pull request #857 from appwrite/feat-functions-templates
christyjacob4 May 28, 2024
0ea07f1
feat(cli): Beta CLI releases
byawitz May 28, 2024
60b73a2
refactor(cli): Review fixing
byawitz May 28, 2024
7a9434c
Merge pull request #860 from appwrite/feat-cli-beta-publishing
christyjacob4 May 28, 2024
1f562c5
Merge branch 'refs/heads/feat-cli-g2' into feat-non-destructive-db-ac…
byawitz May 28, 2024
ea9f2fb
refactor(cli): Review fixing
byawitz May 28, 2024
bb80ece
refactor(cli): Review fixing
byawitz May 28, 2024
e97c08e
Merge branch 'refs/heads/feat-cli-g2' into feat-non-destructive-db-ac…
byawitz May 28, 2024
69f5132
Merge branch 'refs/heads/feat-cli-g2' into feat-create-resources
byawitz May 28, 2024
84b4c66
refactor(cli): Review fixing
byawitz May 28, 2024
acbec0b
Merge pull request #861 from appwrite/chore-cli-upgrade-response
christyjacob4 May 28, 2024
569a24b
Merge branch 'refs/heads/feat-cli-g2' into feat-create-resources
byawitz May 28, 2024
a34f5de
feat(cli): Added option for twig functions and
byawitz May 28, 2024
d66b6ae
feat(cli): Added twig `methodHaveConsolePreview` function
byawitz May 28, 2024
0081b07
feat(cli): Expanding console flow to list and various get commands
byawitz May 28, 2024
0b7a25a
Merge branch 'feat-cli-g2' into feat-multiple-accounts-and-instances
Meldiron May 29, 2024
ceda8a6
Merge branch 'feat-cli-g2' into feat-report-error
Meldiron May 29, 2024
69c5d66
Merge branch 'feat-cli-g2' into feat-cli-sudo
Meldiron May 29, 2024
34dac24
Merge branch 'feat-cli-g2' into feat-non-destructive-db-actions
Meldiron May 29, 2024
43e6fc9
Merge branch 'feat-create-resources' into feat-console-flow
Meldiron May 29, 2024
353d2a6
selection, configuration and settings of CLI local development
Meldiron May 29, 2024
8b4df13
fix(cli): Leading slash for project endpoints
byawitz May 29, 2024
26054b2
Merge branch 'refs/heads/master' into feat-cli-g2
byawitz May 29, 2024
9e2e51b
Merge branch 'refs/heads/feat-cli-g2' into feat-non-destructive-db-ac…
byawitz May 29, 2024
11de1cc
Merge branch 'refs/heads/feat-cli-g2' into feat-report-error
byawitz May 29, 2024
5a0111e
Merge branch 'refs/heads/feat-cli-g2' into feat-cli-sudo
byawitz May 29, 2024
6ce7b0a
Merge remote-tracking branch 'origin/feat-cli-sudo' into feat-cli-sudo
byawitz May 29, 2024
ff9bfb4
Merge branch 'refs/heads/feat-report-error' into feat-cli-sudo
byawitz May 29, 2024
ab9e297
Merge branch 'refs/heads/feat-cli-g2' into feat-multiple-accounts-and…
byawitz May 29, 2024
f0be8ee
Merge branch 'refs/heads/feat-cli-g2' into feat-create-resources
byawitz May 29, 2024
7051e44
Merge branch 'refs/heads/feat-create-resources' into feat-console-flow
byawitz May 29, 2024
8e639d1
fix(cli): Pull and update project available services, auth security s…
byawitz May 29, 2024
224c3fd
chore(cli): Updating project commands descriptions
byawitz May 29, 2024
02be0f0
feat(cli): Updating push to include the project
byawitz May 29, 2024
9ac316d
feat(cli): Updating push to include the project
byawitz May 29, 2024
e089e9c
feat(cli): Pull all resources
byawitz May 29, 2024
f7e92bc
Merge remote-tracking branch 'refs/remotes/origin/feat-console-flow' …
byawitz May 29, 2024
3d36787
Merge branch 'refs/heads/feat-pull-project-settings' into feat-push-p…
byawitz May 29, 2024
94b8dd4
Merge branch 'refs/heads/feat-pull-project-settings' into feat-report…
byawitz May 29, 2024
8eac05a
Merge branch 'refs/heads/feat-report-error' into feat-cli-sudo
byawitz May 29, 2024
d0cc1c2
feat(cli): Adapting pull to cliConfig
byawitz May 29, 2024
b7f6f56
Merge branch 'refs/heads/feat-cli-sudo' into feat-non-destructive-db-…
byawitz May 29, 2024
0c1bc45
chore(cli): Adapting pull request
byawitz May 29, 2024
cf2ce7d
Merge branch 'refs/heads/feat-non-destructive-db-actions' into feat-m…
byawitz May 29, 2024
705647d
chore(cli): Adding headless login
byawitz May 29, 2024
2962472
Merge branch 'refs/heads/feat-multiple-accounts-and-instances' into f…
byawitz May 29, 2024
87e88c3
chore(cli): Adapting pull request
byawitz May 29, 2024
0575002
More progress on local development
Meldiron May 30, 2024
063ac9e
refactor(cli): Texts and removing unnecessary options
byawitz May 30, 2024
cc0f854
refactor(cli): Texts and Adding stacktrace
byawitz May 30, 2024
5cd9f93
refactor(cli): removing implemented feature
byawitz May 30, 2024
db6ebfe
refactor(cli): refactoring to one function
byawitz May 30, 2024
0135a4f
refactor(cli): removing unneeded async
byawitz May 30, 2024
dcea1df
feat(cli): Skipping unavailable push resources
byawitz May 30, 2024
f78b368
Merge pull request #865 from appwrite/feat-push-pull-all
christyjacob4 May 30, 2024
2e8f560
feat(cli): Showing deployed function URL
byawitz May 30, 2024
b35b4bb
Merge pull request #866 from appwrite/feat-function-deployment-url
christyjacob4 May 30, 2024
1d0350b
Merge pull request #848 from appwrite/feat-create-resources
christyjacob4 May 30, 2024
a2d49e7
Update templates/cli/lib/parser.js.twig
christyjacob4 May 31, 2024
acdb9fc
Merge pull request #854 from appwrite/feat-non-destructive-db-actions
christyjacob4 May 31, 2024
a6f08c8
Apply suggestions from code review
christyjacob4 May 31, 2024
ebc1464
Merge pull request #864 from appwrite/feat-pull-project-settings
christyjacob4 May 31, 2024
5804bf7
Update hot swap logic
Meldiron May 31, 2024
68b026b
refactor(cli): Internal client instead of a generic fetch
byawitz May 31, 2024
3d2646a
Merge remote-tracking branch 'origin/feat-report-error' into feat-rep…
byawitz May 31, 2024
e4483bb
Merge branch 'refs/heads/feat-report-error' into feat-cli-sudo
byawitz May 31, 2024
7efedaf
refactor(cli): Adding pagination and reorder questions
byawitz May 31, 2024
930685c
feat(cli): headless project setup
byawitz May 31, 2024
5bba9cd
feat(cli): creating project if not exist
byawitz May 31, 2024
3621c3c
refactor(cli): reorder questions
byawitz May 31, 2024
64c364e
Merge branch 'refs/heads/feat-multiple-accounts-and-instances' into f…
byawitz May 31, 2024
d36a623
wip
byawitz Jun 3, 2024
4ca5402
Finish run function Docker implementation
Meldiron Jun 3, 2024
93ea80a
Add tags to dev command
Meldiron Jun 3, 2024
7583db3
Merge remote-tracking branch 'origin/feat-multiple-accounts-and-insta…
Meldiron Jun 4, 2024
73e3c40
Add env var and headers support to local development
Meldiron Jun 5, 2024
406ef22
feat: Init project only ID
byawitz Jun 7, 2024
fb8e08a
feat: Init to local only & database creation
byawitz Jun 7, 2024
9717830
refactor: Improve command line to use `rawArgs`
byawitz Jun 7, 2024
2fd8f2b
feat: Added list search
byawitz Jun 7, 2024
0b817a7
feat: Added Register
byawitz Jun 7, 2024
acef728
feat: Tip for detailed error
byawitz Jun 7, 2024
990557a
feat: clearer function summary
byawitz Jun 7, 2024
33a5680
feat: Adding error when enable to open with default browser
byawitz Jun 7, 2024
471fc85
feat: Adding endpoint to whoami
byawitz Jun 7, 2024
f24abb6
feat: Adding self-hosted to project init
byawitz Jun 7, 2024
85167e9
feat: Removing unusable accounts
byawitz Jun 7, 2024
069f70c
feat: Ask when deleting, and explanations
byawitz Jun 7, 2024
6d8b6f2
refactor: Make sure `min` and `max` are numbers
byawitz Jun 7, 2024
f64000e
refactor: Asking unanswered questions
byawitz Jun 7, 2024
1251bff
Merge pull request #852 from appwrite/feat-report-error
christyjacob4 Jun 10, 2024
81ded63
Merge pull request #853 from appwrite/feat-cli-sudo
christyjacob4 Jun 10, 2024
c393058
Merge pull request #871 from appwrite/feat-search-list
christyjacob4 Jun 10, 2024
06b2a4b
Merge pull request #870 from appwrite/feat-improve-report
christyjacob4 Jun 10, 2024
034d08e
Update templates/cli/lib/questions.js.twig
christyjacob4 Jun 11, 2024
49488a6
Merge pull request #875 from appwrite/feat-collection-push-improvements
christyjacob4 Jun 11, 2024
469594c
Merge branch 'refs/heads/feat-arg-project-init' into feat-general-imp…
byawitz Jun 11, 2024
8420eb0
fix: reviews
byawitz Jun 11, 2024
cc78c01
Merge remote-tracking branch 'origin/feat-general-improvements' into …
byawitz Jun 11, 2024
4ae99d5
fix: reviews
byawitz Jun 11, 2024
b5ca8bf
fix: reviews
byawitz Jun 11, 2024
aabddae
fix: texts
byawitz Jun 11, 2024
dea75b4
refactor: Removing login from init
byawitz Jun 11, 2024
5fe0bd2
refactor: Removing self-hosted from login
byawitz Jun 11, 2024
2db03b5
Merge pull request #874 from appwrite/feat-general-improvements
christyjacob4 Jun 11, 2024
9116fc0
feat: Fetching function templates from API
byawitz Jun 11, 2024
7ed643e
Update templates/cli/lib/commands/init.js.twig
christyjacob4 Jun 11, 2024
57984ba
Merge pull request #877 from appwrite/feat-function-init-improvments
christyjacob4 Jun 11, 2024
0cf2882
refactor: Removing `--open` option
byawitz Jun 11, 2024
fcb2ddc
Merge pull request #868 from appwrite/feat-arg-project-init
christyjacob4 Jun 11, 2024
3b04fe8
Merge branch 'refs/heads/feat-console-flow' into feat-multiple-accoun…
byawitz Jun 11, 2024
3e054b0
Merge remote-tracking branch 'origin/feat-multiple-accounts-and-insta…
byawitz Jun 11, 2024
309d764
refactor: reviews
byawitz Jun 11, 2024
4641f61
refactor: removing redundant exports and questions.
byawitz Jun 11, 2024
0860867
refactor: renaming login to sessions
byawitz Jun 11, 2024
11fe1ff
Merge pull request #851 from appwrite/feat-multiple-accounts-and-inst…
christyjacob4 Jun 11, 2024
0e8c129
refactor: reviews
byawitz Jun 11, 2024
169bb86
refactor: reviews
byawitz Jun 11, 2024
2014675
Merge pull request #849 from appwrite/feat-console-flow
christyjacob4 Jun 11, 2024
c024a81
Finish local development
Meldiron Jun 12, 2024
7b0f655
PR review changes
Meldiron Jun 14, 2024
59a0d36
Merge remote-tracking branch 'origin/feat-cli-g2' into feat-cli-local…
Meldiron Jun 14, 2024
2ac1569
PR review changes
Meldiron Jun 14, 2024
ba59b6b
Merge remote-tracking branch 'origin/feat-cli-g2' into fix-cli-aliases
Meldiron Jun 14, 2024
90e4b9d
Remove leftovers
Meldiron Jun 14, 2024
c1e497d
Fix after merge
Meldiron Jun 14, 2024
8abc65a
Merge pull request #858 from appwrite/fix-cli-aliases
christyjacob4 Jun 14, 2024
fcde6cb
PR review changes
Meldiron Jun 17, 2024
797104f
More PR review changes
Meldiron Jun 17, 2024
cebd23e
PR review changes
Meldiron Jun 17, 2024
303cc6d
Merge pull request #862 from appwrite/feat-cli-local-development
christyjacob4 Jun 17, 2024
d3fcdf8
fix: typo
byawitz Jun 18, 2024
fe3bcaa
fix: missing import
byawitz Jun 18, 2024
6711fbd
feat: expanding functions update paramateters
byawitz Jun 18, 2024
88b97a9
chore: Module to commonjs
byawitz Jun 19, 2024
a5d86a7
Merge pull request #882 from appwrite/feat-cli-g2-fixes
Meldiron Jun 19, 2024
d32af69
feat: Adding register command
byawitz Jun 21, 2024
438cfb0
refactor: Local development error string.
byawitz Jun 21, 2024
3b9d6ad
refactor: tip for invalid logins
byawitz Jun 21, 2024
e8248bc
refactor: tip for no organizations
byawitz Jun 21, 2024
fbd10ef
fix: Show Organizations and Projects instead of an object
byawitz Jun 21, 2024
725fd50
fix: Add function success creation instructions
byawitz Jun 21, 2024
237e38b
fix: some appwrite dev function fixes
byawitz Jun 21, 2024
7fe7fad
fix: project init
byawitz Jun 21, 2024
fa69720
fix: updating pulling scheme for 1.6.x branch
byawitz Jun 21, 2024
1bd130a
fix: undefined old session
byawitz Jun 21, 2024
6e0412c
fix: local dev
byawitz Jun 21, 2024
c9d4570
Update templates/cli/lib/commands/generic.js.twig
christyjacob4 Jun 25, 2024
0d04b38
Update templates/cli/lib/commands/generic.js.twig
christyjacob4 Jun 25, 2024
c09ea49
Update templates/cli/lib/commands/init.js.twig
christyjacob4 Jun 25, 2024
bc6f25e
Update templates/cli/lib/questions.js.twig
christyjacob4 Jun 25, 2024
80509c5
Update templates/cli/lib/questions.js.twig
christyjacob4 Jun 25, 2024
eec04ca
Update templates/cli/lib/config.js.twig
christyjacob4 Jun 25, 2024
b07adcb
Update templates/cli/lib/config.js.twig
christyjacob4 Jun 25, 2024
8405ebb
Update templates/cli/lib/parser.js.twig
christyjacob4 Jun 25, 2024
d907ef8
Merge pull request #886 from appwrite/feat-cli-g2-fixes
christyjacob4 Jun 25, 2024
c772d4f
Changes after manual QA
Meldiron Jun 26, 2024
d17c805
Fix bug
Meldiron Jun 26, 2024
a0e0a4f
fix(cli): Apply non destructive changes
byawitz Jun 26, 2024
2a6b24f
fix(cli): Ask for all changes
byawitz Jun 26, 2024
5dff224
Merge pull request #889 from appwrite/feat-cli-g2-bug-fixes
Meldiron Jul 1, 2024
2a10501
Remove temporary CI/CD
Meldiron Jul 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
292 changes: 181 additions & 111 deletions composer.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions example.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function getSSLPage($url) {
$platform = 'console';
// $platform = 'server';

$spec = getSSLPage("https://raw.githubusercontent.com/appwrite/appwrite/1.5.x/app/config/specs/swagger2-latest-{$platform}.json");
$spec = getSSLPage("https://raw.githubusercontent.com/appwrite/appwrite/1.6.x/app/config/specs/swagger2-latest-{$platform}.json");

if(empty($spec)) {
throw new Exception('Failed to fetch spec from Appwrite server');
Expand Down Expand Up @@ -186,7 +186,7 @@ function getSSLPage($url) {
->setTwitter('appwrite_io')
->setDiscord('564160730845151244', 'https://appwrite.io/discord')
->setDefaultHeaders([
'X-Appwrite-Response-Format' => '0.15.0',
'X-Appwrite-Response-Format' => '1.5.0',
])
;

Expand Down Expand Up @@ -393,7 +393,7 @@ function getSSLPage($url) {
;

$sdk->generate(__DIR__ . '/examples/apple');

// DotNet
$sdk = new SDK(new DotNet(), new Swagger2($spec));

Expand Down Expand Up @@ -442,7 +442,7 @@ function getSSLPage($url) {
// Android

$sdk = new SDK(new Android(), new Swagger2($spec));

$sdk
->setName('Android')
->setNamespace('io appwrite')
Expand All @@ -466,7 +466,7 @@ function getSSLPage($url) {

// Kotlin
$sdk = new SDK(new Kotlin(), new Swagger2($spec));

$sdk
->setName('Kotlin')
->setNamespace('io appwrite')
Expand Down
9 changes: 9 additions & 0 deletions src/SDK/Language.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ public function getFilters(): array
return [];
}

/**
* Language specific functions.
* @return array
*/
public function getFunctions(): array
{
return [];
}

protected function toPascalCase(string $value): string
{
return \ucfirst($this->toCamelCase($value));
Expand Down
111 changes: 109 additions & 2 deletions src/SDK/Language/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,66 @@

namespace Appwrite\SDK\Language;

use Twig\TwigFunction;

class CLI extends Node
{
/**
* List of functions to ignore for console preview.
* @var array
*/
private $consoleIgnoreFunctions = [
'listidentities',
'listmfafactors',
'getprefs',
'getsession',
'getattribute',
'listdocumentlogs',
'getindex',
'listcollectionlogs',
'getcollectionusage',
'listlogs',
'listruntimes',
'getusage',
'getusage',
'listvariables',
'getvariable',
'listproviderlogs',
'listsubscriberlogs',
'getsubscriber',
'listtopiclogs',
'getemailtemplate',
'getsmstemplate',
'getfiledownload',
'getfilepreview',
'getfileview',
'getusage',
'listlogs',
'getprefs',
'getusage',
'listlogs',
'getmembership',
'listmemberships',
'listmfafactors',
'getmfarecoverycodes',
'getprefs',
'listtargets',
'gettarget',
];

/**
* List of SDK services to ignore for console preview.
* @var array
*/
private $consoleIgnoreServices = [
'health',
'migrations',
'locale',
'avatars',
'project',
'proxy',
'vcs'
];
/**
* @var array
*/
Expand Down Expand Up @@ -127,6 +185,16 @@ public function getFiles(): array
'destination' => 'lib/questions.js',
'template' => 'cli/lib/questions.js.twig',
],
[
'scope' => 'default',
'destination' => 'lib/validations.js',
'template' => 'cli/lib/validations.js.twig',
],
[
'scope' => 'default',
'destination' => 'lib/spinner.js',
'template' => 'cli/lib/spinner.js.twig',
],
[
'scope' => 'default',
'destination' => 'lib/parser.js',
Expand All @@ -152,6 +220,11 @@ public function getFiles(): array
'destination' => 'lib/client.js',
'template' => 'cli/lib/client.js.twig',
],
[
'scope' => 'default',
'destination' => 'lib/id.js',
'template' => 'cli/lib/id.js.twig',
],
[
'scope' => 'default',
'destination' => 'lib/utils.js',
Expand All @@ -164,8 +237,28 @@ public function getFiles(): array
],
[
'scope' => 'default',
'destination' => 'lib/commands/deploy.js',
'template' => 'cli/lib/commands/deploy.js.twig',
'destination' => 'lib/commands/pull.js',
'template' => 'cli/lib/commands/pull.js.twig',
],
[
'scope' => 'default',
'destination' => 'lib/commands/push.js',
'template' => 'cli/lib/commands/push.js.twig',
],
[
'scope' => 'default',
'destination' => 'lib/commands/run.js',
'template' => 'cli/lib/commands/run.js.twig',
],
[
'scope' => 'default',
'destination' => 'lib/emulation/docker.js',
'template' => 'cli/lib/emulation/docker.js.twig',
],
[
'scope' => 'default',
'destination' => 'lib/emulation/utils.js',
'template' => 'cli/lib/emulation/utils.js.twig',
],
[
'scope' => 'service',
Expand Down Expand Up @@ -270,4 +363,18 @@ public function getParamExample(array $param): string

return $output;
}

/**
* Language specific filters.
* @return array
*/
public function getFunctions(): array
{
return [
/** Return true if the entered service->method is enabled for a console preview link */
new TwigFunction('hasConsolePreview', fn($method, $service) => preg_match('/^([Gg]et|[Ll]ist)/', $method)
&& !in_array(strtolower($method), $this->consoleIgnoreFunctions)
&& !in_array($service, $this->consoleIgnoreServices)),
];
}
}
7 changes: 7 additions & 0 deletions src/SDK/SDK.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ public function __construct(Language $language, Spec $spec)
'debug' => true
]);

/**
* Add language-specific functions
*/
foreach ($this->language->getFunctions() as $function) {
$this->twig->addFunction($function);
}

/**
* Add language specific filters
*/
Expand Down
20 changes: 11 additions & 9 deletions templates/cli/base/params.twig
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
if (!fs.lstatSync(folderPath).isDirectory()) {
throw new Error('The path is not a directory.');
}

const ignorer = ignore();

const func = localConfig.getFunction(functionId);

ignorer.add('.appwrite');

if (func.ignore) {
ignorer.add(func.ignore);
log('Ignoring files using configuration from appwrite.json');
} else if (fs.existsSync(pathLib.join({{ parameter.name | caseCamel | escapeKeyword }}, '.gitignore'))) {
ignorer.add(fs.readFileSync(pathLib.join({{ parameter.name | caseCamel | escapeKeyword }}, '.gitignore')).toString());
log('Ignoring files in .gitignore');
}

const files = getAllFiles({{ parameter.name | caseCamel | escapeKeyword }}).map((file) => pathLib.relative({{ parameter.name | caseCamel | escapeKeyword }}, file)).filter((file) => !ignorer.ignores(file));

await tar
Expand Down Expand Up @@ -77,8 +77,10 @@
{% endif %}
{% endfor %}
{% if method.type == 'location' %}
payload['project'] = localConfig.getProject().projectId
payload['key'] = globalConfig.getKey();
const queryParams = new URLSearchParams(payload);
apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`;
{% endif %}
if (!overrideForCli) {
payload['project'] = localConfig.getProject().projectId
payload['key'] = globalConfig.getKey();
const queryParams = new URLSearchParams(payload);
apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`;
}
{% endif %}
24 changes: 19 additions & 5 deletions templates/cli/base/requests/api.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,27 @@
{% endfor %}
}, payload{% if method.type == 'location' %}, 'arraybuffer'{% endif %});

{% if method.type == 'location' %}
fs.writeFileSync(destination, response);
{%~ if method.type == 'location' %}
if (overrideForCli) {
response = Buffer.from(response);
}

{% endif %}
fs.writeFileSync(destination, response);
{%~ endif %}
if (parseOutput) {
{%~ if hasConsolePreview(method.name,service.name) %}
if(console) {
showConsoleLink('{{service.name}}', '{{ method.name }}'
{%- for parameter in method.parameters.path -%}{%- set param = (parameter.name | caseCamel | escapeKeyword) -%}{%- if param ends with 'Id' -%}, {{ param }} {%- endif -%}{%- endfor -%}
);
} else {
parse(response)
success()
}
{%~ else %}
parse(response)
success()
{%~ endif %}
}
return response;

return response;
10 changes: 5 additions & 5 deletions templates/cli/base/requests/file.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% for parameter in method.parameters.all %}
{% if parameter.type == 'file' %}
const size = {{ parameter.name | caseCamel | escapeKeyword }}.size;

const apiHeaders = {
{% for parameter in method.parameters.header %}
'{{ parameter.name }}': ${{ parameter.name | caseCamel | escapeKeyword }},
Expand Down Expand Up @@ -45,7 +45,7 @@
}

let uploadableChunkTrimmed;

if(currentPosition + 1 >= client.CHUNK_SIZE) {
uploadableChunkTrimmed = uploadableChunk;
} else {
Expand Down Expand Up @@ -99,17 +99,17 @@
}

{% if method.packaging %}
fs.unlinkSync(filePath);
await fs.unlink(filePath,()=>{});
{% endif %}
{% if method.type == 'location' %}
fs.writeFileSync(destination, response);
{% endif %}

if (parseOutput) {
parse(response)
success()
}

return response;
{% endif %}
{% endfor %}
{% endfor %}
Loading