appwrite-utils-cli 1.7.8 → 1.7.9
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/cli/commands/databaseCommands.js +7 -8
- package/dist/config/services/ConfigLoaderService.d.ts +7 -0
- package/dist/config/services/ConfigLoaderService.js +47 -1
- package/dist/functions/deployments.js +5 -23
- package/dist/functions/methods.js +4 -2
- package/dist/functions/pathResolution.d.ts +37 -0
- package/dist/functions/pathResolution.js +185 -0
- package/dist/functions/templates/count-docs-in-collection/README.md +54 -0
- package/dist/functions/templates/count-docs-in-collection/package.json +25 -0
- package/dist/functions/templates/count-docs-in-collection/src/main.ts +159 -0
- package/dist/functions/templates/count-docs-in-collection/src/request.ts +9 -0
- package/dist/functions/templates/count-docs-in-collection/tsconfig.json +28 -0
- package/dist/functions/templates/hono-typescript/README.md +286 -0
- package/dist/functions/templates/hono-typescript/package.json +26 -0
- package/dist/functions/templates/hono-typescript/src/adapters/request.ts +74 -0
- package/dist/functions/templates/hono-typescript/src/adapters/response.ts +106 -0
- package/dist/functions/templates/hono-typescript/src/app.ts +180 -0
- package/dist/functions/templates/hono-typescript/src/context.ts +103 -0
- package/dist/functions/templates/hono-typescript/src/index.ts +54 -0
- package/dist/functions/templates/hono-typescript/src/middleware/appwrite.ts +119 -0
- package/dist/functions/templates/hono-typescript/tsconfig.json +20 -0
- package/dist/functions/templates/typescript-node/README.md +32 -0
- package/dist/functions/templates/typescript-node/package.json +25 -0
- package/dist/functions/templates/typescript-node/src/context.ts +103 -0
- package/dist/functions/templates/typescript-node/src/index.ts +29 -0
- package/dist/functions/templates/typescript-node/tsconfig.json +28 -0
- package/dist/functions/templates/uv/README.md +31 -0
- package/dist/functions/templates/uv/pyproject.toml +30 -0
- package/dist/functions/templates/uv/src/__init__.py +0 -0
- package/dist/functions/templates/uv/src/context.py +125 -0
- package/dist/functions/templates/uv/src/index.py +46 -0
- package/dist/main.js +8 -8
- package/dist/shared/selectionDialogs.d.ts +1 -1
- package/dist/shared/selectionDialogs.js +31 -7
- package/dist/utilsController.d.ts +2 -1
- package/dist/utilsController.js +111 -19
- package/package.json +4 -2
- package/scripts/copy-templates.ts +23 -0
- package/src/cli/commands/databaseCommands.ts +7 -8
- package/src/config/services/ConfigLoaderService.ts +62 -1
- package/src/functions/deployments.ts +10 -35
- package/src/functions/methods.ts +4 -2
- package/src/functions/pathResolution.ts +227 -0
- package/src/main.ts +8 -8
- package/src/shared/selectionDialogs.ts +36 -7
- package/src/utilsController.ts +138 -22
- package/dist/utils/schemaStrings.d.ts +0 -14
- package/dist/utils/schemaStrings.js +0 -428
- package/dist/utils/sessionPreservationExample.d.ts +0 -1666
- 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
|
-
}
|