appwrite-utils-cli 1.7.8 → 1.8.1

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.
Files changed (111) hide show
  1. package/CHANGELOG.md +14 -199
  2. package/README.md +87 -30
  3. package/dist/adapters/AdapterFactory.js +5 -25
  4. package/dist/adapters/DatabaseAdapter.d.ts +17 -2
  5. package/dist/adapters/LegacyAdapter.d.ts +2 -1
  6. package/dist/adapters/LegacyAdapter.js +212 -16
  7. package/dist/adapters/TablesDBAdapter.d.ts +2 -12
  8. package/dist/adapters/TablesDBAdapter.js +261 -57
  9. package/dist/cli/commands/databaseCommands.js +10 -10
  10. package/dist/cli/commands/functionCommands.js +17 -8
  11. package/dist/collections/attributes.js +447 -125
  12. package/dist/collections/methods.js +197 -186
  13. package/dist/collections/tableOperations.d.ts +86 -0
  14. package/dist/collections/tableOperations.js +434 -0
  15. package/dist/collections/transferOperations.d.ts +3 -2
  16. package/dist/collections/transferOperations.js +93 -12
  17. package/dist/config/services/ConfigLoaderService.d.ts +7 -0
  18. package/dist/config/services/ConfigLoaderService.js +47 -1
  19. package/dist/config/yamlConfig.d.ts +221 -88
  20. package/dist/examples/yamlTerminologyExample.d.ts +1 -1
  21. package/dist/examples/yamlTerminologyExample.js +6 -3
  22. package/dist/functions/deployments.js +5 -23
  23. package/dist/functions/fnConfigDiscovery.d.ts +3 -0
  24. package/dist/functions/fnConfigDiscovery.js +108 -0
  25. package/dist/functions/methods.js +4 -2
  26. package/dist/functions/pathResolution.d.ts +37 -0
  27. package/dist/functions/pathResolution.js +185 -0
  28. package/dist/functions/templates/count-docs-in-collection/README.md +54 -0
  29. package/dist/functions/templates/count-docs-in-collection/package.json +25 -0
  30. package/dist/functions/templates/count-docs-in-collection/src/main.ts +159 -0
  31. package/dist/functions/templates/count-docs-in-collection/src/request.ts +9 -0
  32. package/dist/functions/templates/count-docs-in-collection/tsconfig.json +28 -0
  33. package/dist/functions/templates/hono-typescript/README.md +286 -0
  34. package/dist/functions/templates/hono-typescript/package.json +26 -0
  35. package/dist/functions/templates/hono-typescript/src/adapters/request.ts +74 -0
  36. package/dist/functions/templates/hono-typescript/src/adapters/response.ts +106 -0
  37. package/dist/functions/templates/hono-typescript/src/app.ts +180 -0
  38. package/dist/functions/templates/hono-typescript/src/context.ts +103 -0
  39. package/dist/functions/templates/hono-typescript/src/index.ts +54 -0
  40. package/dist/functions/templates/hono-typescript/src/middleware/appwrite.ts +119 -0
  41. package/dist/functions/templates/hono-typescript/tsconfig.json +20 -0
  42. package/dist/functions/templates/typescript-node/README.md +32 -0
  43. package/dist/functions/templates/typescript-node/package.json +25 -0
  44. package/dist/functions/templates/typescript-node/src/context.ts +103 -0
  45. package/dist/functions/templates/typescript-node/src/index.ts +29 -0
  46. package/dist/functions/templates/typescript-node/tsconfig.json +28 -0
  47. package/dist/functions/templates/uv/README.md +31 -0
  48. package/dist/functions/templates/uv/pyproject.toml +30 -0
  49. package/dist/functions/templates/uv/src/__init__.py +0 -0
  50. package/dist/functions/templates/uv/src/context.py +125 -0
  51. package/dist/functions/templates/uv/src/index.py +46 -0
  52. package/dist/interactiveCLI.js +18 -15
  53. package/dist/main.js +219 -81
  54. package/dist/migrations/appwriteToX.d.ts +88 -23
  55. package/dist/migrations/comprehensiveTransfer.d.ts +2 -0
  56. package/dist/migrations/comprehensiveTransfer.js +83 -6
  57. package/dist/migrations/dataLoader.d.ts +227 -69
  58. package/dist/migrations/dataLoader.js +3 -3
  59. package/dist/migrations/importController.js +3 -3
  60. package/dist/migrations/relationships.d.ts +8 -2
  61. package/dist/migrations/services/ImportOrchestrator.js +3 -3
  62. package/dist/migrations/transfer.js +159 -37
  63. package/dist/shared/attributeMapper.d.ts +20 -0
  64. package/dist/shared/attributeMapper.js +203 -0
  65. package/dist/shared/selectionDialogs.d.ts +1 -1
  66. package/dist/shared/selectionDialogs.js +39 -11
  67. package/dist/storage/schemas.d.ts +354 -92
  68. package/dist/utils/configDiscovery.js +4 -3
  69. package/dist/utils/versionDetection.d.ts +0 -4
  70. package/dist/utils/versionDetection.js +41 -173
  71. package/dist/utils/yamlConverter.js +89 -16
  72. package/dist/utils/yamlLoader.d.ts +1 -1
  73. package/dist/utils/yamlLoader.js +6 -2
  74. package/dist/utilsController.d.ts +2 -1
  75. package/dist/utilsController.js +151 -22
  76. package/package.json +7 -5
  77. package/scripts/copy-templates.ts +23 -0
  78. package/src/adapters/AdapterFactory.ts +119 -143
  79. package/src/adapters/DatabaseAdapter.ts +18 -3
  80. package/src/adapters/LegacyAdapter.ts +236 -105
  81. package/src/adapters/TablesDBAdapter.ts +773 -643
  82. package/src/cli/commands/databaseCommands.ts +19 -19
  83. package/src/cli/commands/functionCommands.ts +23 -14
  84. package/src/collections/attributes.ts +2054 -1611
  85. package/src/collections/methods.ts +208 -293
  86. package/src/collections/tableOperations.ts +506 -0
  87. package/src/collections/transferOperations.ts +218 -144
  88. package/src/config/services/ConfigLoaderService.ts +62 -1
  89. package/src/examples/yamlTerminologyExample.ts +10 -5
  90. package/src/functions/deployments.ts +10 -35
  91. package/src/functions/fnConfigDiscovery.ts +103 -0
  92. package/src/functions/methods.ts +4 -2
  93. package/src/functions/pathResolution.ts +227 -0
  94. package/src/interactiveCLI.ts +25 -20
  95. package/src/main.ts +557 -202
  96. package/src/migrations/comprehensiveTransfer.ts +126 -50
  97. package/src/migrations/dataLoader.ts +3 -3
  98. package/src/migrations/importController.ts +3 -3
  99. package/src/migrations/services/ImportOrchestrator.ts +3 -3
  100. package/src/migrations/transfer.ts +148 -131
  101. package/src/shared/attributeMapper.ts +229 -0
  102. package/src/shared/selectionDialogs.ts +65 -32
  103. package/src/utils/configDiscovery.ts +9 -3
  104. package/src/utils/versionDetection.ts +74 -228
  105. package/src/utils/yamlConverter.ts +94 -17
  106. package/src/utils/yamlLoader.ts +11 -4
  107. package/src/utilsController.ts +202 -36
  108. package/dist/utils/schemaStrings.d.ts +0 -14
  109. package/dist/utils/schemaStrings.js +0 -428
  110. package/dist/utils/sessionPreservationExample.d.ts +0 -1666
  111. package/dist/utils/sessionPreservationExample.js +0 -101
@@ -1,101 +0,0 @@
1
- /**
2
- * @fileoverview Session Preservation Usage Examples
3
- *
4
- * This file demonstrates how to use the enhanced config loading functions
5
- * with session preservation capabilities.
6
- */
7
- import { loadConfig, loadConfigWithPath, createSessionPreservation } from './loadConfigs.js';
8
- /**
9
- * Example 1: Basic session preservation
10
- */
11
- export async function loadConfigWithSession(configDir, sessionCookie) {
12
- const config = await loadConfig(configDir, {
13
- validate: true,
14
- preserveAuth: {
15
- sessionCookie,
16
- authMethod: "session"
17
- }
18
- });
19
- console.log('Config loaded with session auth:', {
20
- authMethod: config.authMethod,
21
- hasSessionCookie: !!config.sessionCookie
22
- });
23
- return config;
24
- }
25
- /**
26
- * Example 2: Using the helper function for cleaner code
27
- */
28
- export async function loadConfigWithSessionHelper(configDir, sessionCookie, email, expiresAt) {
29
- const sessionPreservation = createSessionPreservation(sessionCookie, email, expiresAt);
30
- const result = await loadConfigWithPath(configDir, {
31
- validate: true,
32
- reportValidation: true,
33
- preserveAuth: sessionPreservation
34
- });
35
- console.log('Config loaded with session metadata:', {
36
- authMethod: result.config.authMethod,
37
- sessionMetadata: result.config.sessionMetadata,
38
- configPath: result.actualConfigPath
39
- });
40
- return result;
41
- }
42
- /**
43
- * Example 3: Preserving existing appwriteClient with session context
44
- */
45
- export async function loadConfigPreservingClient(configDir, existingClient, sessionCookie) {
46
- const config = await loadConfig(configDir, {
47
- preserveAuth: {
48
- sessionCookie,
49
- authMethod: "session"
50
- }
51
- });
52
- // Preserve existing client if it has session authentication
53
- if (existingClient && !config.appwriteClient) {
54
- config.appwriteClient = existingClient;
55
- }
56
- return config;
57
- }
58
- /**
59
- * Example 4: Auto-detection with fallback
60
- */
61
- export async function loadConfigWithAutoAuth(configDir, sessionCookie, apiKey) {
62
- let preserveAuth;
63
- if (sessionCookie) {
64
- preserveAuth = {
65
- sessionCookie,
66
- authMethod: "session"
67
- };
68
- }
69
- else if (apiKey) {
70
- preserveAuth = {
71
- authMethod: "apikey"
72
- };
73
- }
74
- else {
75
- preserveAuth = {
76
- authMethod: "auto"
77
- };
78
- }
79
- const config = await loadConfig(configDir, {
80
- validate: true,
81
- preserveAuth
82
- });
83
- console.log('Auto-detected auth method:', config.authMethod);
84
- return config;
85
- }
86
- /**
87
- * Example 5: Backward compatibility - no changes to existing calls
88
- */
89
- export async function existingUsageStillWorks(configDir) {
90
- // This should work exactly as before - no session preservation
91
- const config = await loadConfig(configDir, {
92
- validate: true,
93
- strictMode: false
94
- });
95
- // Should use default auth method (auto or apikey)
96
- console.log('Traditional loading still works:', {
97
- authMethod: config.authMethod,
98
- hasSession: !!config.sessionCookie
99
- });
100
- return config;
101
- }