@atlasauth/cli 0.12.0 → 0.14.0
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/CHANGELOG.md +9 -1
- package/dist/args.d.ts +18 -0
- package/dist/args.js +9 -0
- package/dist/args.js.map +1 -1
- package/dist/commands/config.js +72 -7
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/dev.d.ts +8 -0
- package/dist/commands/dev.js +84 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/fga.d.ts +10 -0
- package/dist/commands/fga.js +105 -0
- package/dist/commands/fga.js.map +1 -0
- package/dist/commands/pages.d.ts +14 -0
- package/dist/commands/pages.js +113 -0
- package/dist/commands/pages.js.map +1 -0
- package/dist/context.d.ts +1 -1
- package/dist/help.d.ts +1 -1
- package/dist/help.js +71 -2
- package/dist/help.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/migrate/appwrite/plugin.d.ts +2 -0
- package/dist/migrate/appwrite/plugin.js +103 -0
- package/dist/migrate/appwrite/plugin.js.map +1 -0
- package/dist/migrate/authentik/plugin.d.ts +2 -0
- package/dist/migrate/authentik/plugin.js +135 -0
- package/dist/migrate/authentik/plugin.js.map +1 -0
- package/dist/migrate/azure-ad-b2c/plugin.d.ts +8 -0
- package/dist/migrate/azure-ad-b2c/plugin.js +165 -0
- package/dist/migrate/azure-ad-b2c/plugin.js.map +1 -0
- package/dist/migrate/cognito/plugin.d.ts +5 -0
- package/dist/migrate/cognito/plugin.js +170 -0
- package/dist/migrate/cognito/plugin.js.map +1 -0
- package/dist/migrate/corbado/plugin.d.ts +2 -0
- package/dist/migrate/corbado/plugin.js +63 -0
- package/dist/migrate/corbado/plugin.js.map +1 -0
- package/dist/migrate/entra-external-id/plugin.d.ts +8 -0
- package/dist/migrate/entra-external-id/plugin.js +12 -0
- package/dist/migrate/entra-external-id/plugin.js.map +1 -0
- package/dist/migrate/export/appwrite-config.d.ts +28 -0
- package/dist/migrate/export/appwrite-config.js +170 -0
- package/dist/migrate/export/appwrite-config.js.map +1 -0
- package/dist/migrate/export/appwrite.d.ts +51 -0
- package/dist/migrate/export/appwrite.js +288 -0
- package/dist/migrate/export/appwrite.js.map +1 -0
- package/dist/migrate/export/authentik-config.d.ts +45 -0
- package/dist/migrate/export/authentik-config.js +357 -0
- package/dist/migrate/export/authentik-config.js.map +1 -0
- package/dist/migrate/export/authentik.d.ts +110 -0
- package/dist/migrate/export/authentik.js +838 -0
- package/dist/migrate/export/authentik.js.map +1 -0
- package/dist/migrate/export/azure-config.d.ts +58 -0
- package/dist/migrate/export/azure-config.js +344 -0
- package/dist/migrate/export/azure-config.js.map +1 -0
- package/dist/migrate/export/azure.d.ts +85 -0
- package/dist/migrate/export/azure.js +373 -0
- package/dist/migrate/export/azure.js.map +1 -0
- package/dist/migrate/export/cognito-config.d.ts +25 -0
- package/dist/migrate/export/cognito-config.js +273 -0
- package/dist/migrate/export/cognito-config.js.map +1 -0
- package/dist/migrate/export/cognito.d.ts +103 -0
- package/dist/migrate/export/cognito.js +441 -0
- package/dist/migrate/export/cognito.js.map +1 -0
- package/dist/migrate/export/corbado-config.d.ts +20 -0
- package/dist/migrate/export/corbado-config.js +63 -0
- package/dist/migrate/export/corbado-config.js.map +1 -0
- package/dist/migrate/export/corbado.d.ts +37 -0
- package/dist/migrate/export/corbado.js +132 -0
- package/dist/migrate/export/corbado.js.map +1 -0
- package/dist/migrate/export/firebase-config.d.ts +24 -0
- package/dist/migrate/export/firebase-config.js +215 -0
- package/dist/migrate/export/firebase-config.js.map +1 -0
- package/dist/migrate/export/firebase.d.ts +102 -0
- package/dist/migrate/export/firebase.js +464 -0
- package/dist/migrate/export/firebase.js.map +1 -0
- package/dist/migrate/export/frontegg-config.d.ts +29 -0
- package/dist/migrate/export/frontegg-config.js +238 -0
- package/dist/migrate/export/frontegg-config.js.map +1 -0
- package/dist/migrate/export/frontegg.d.ts +67 -0
- package/dist/migrate/export/frontegg.js +410 -0
- package/dist/migrate/export/frontegg.js.map +1 -0
- package/dist/migrate/export/fusionauth-config.d.ts +26 -0
- package/dist/migrate/export/fusionauth-config.js +226 -0
- package/dist/migrate/export/fusionauth-config.js.map +1 -0
- package/dist/migrate/export/fusionauth.d.ts +99 -0
- package/dist/migrate/export/fusionauth.js +642 -0
- package/dist/migrate/export/fusionauth.js.map +1 -0
- package/dist/migrate/export/hanko-config.d.ts +27 -0
- package/dist/migrate/export/hanko-config.js +265 -0
- package/dist/migrate/export/hanko-config.js.map +1 -0
- package/dist/migrate/export/hanko.d.ts +52 -0
- package/dist/migrate/export/hanko.js +605 -0
- package/dist/migrate/export/hanko.js.map +1 -0
- package/dist/migrate/export/keycloak-config.d.ts +19 -0
- package/dist/migrate/export/keycloak-config.js +219 -0
- package/dist/migrate/export/keycloak-config.js.map +1 -0
- package/dist/migrate/export/keycloak.d.ts +155 -0
- package/dist/migrate/export/keycloak.js +878 -0
- package/dist/migrate/export/keycloak.js.map +1 -0
- package/dist/migrate/export/ldap.d.ts +53 -0
- package/dist/migrate/export/ldap.js +277 -0
- package/dist/migrate/export/ldap.js.map +1 -0
- package/dist/migrate/export/logto-config.d.ts +27 -0
- package/dist/migrate/export/logto-config.js +264 -0
- package/dist/migrate/export/logto-config.js.map +1 -0
- package/dist/migrate/export/logto.d.ts +150 -0
- package/dist/migrate/export/logto.js +809 -0
- package/dist/migrate/export/logto.js.map +1 -0
- package/dist/migrate/export/magic-config.d.ts +14 -0
- package/dist/migrate/export/magic-config.js +28 -0
- package/dist/migrate/export/magic-config.js.map +1 -0
- package/dist/migrate/export/magic.d.ts +31 -0
- package/dist/migrate/export/magic.js +93 -0
- package/dist/migrate/export/magic.js.map +1 -0
- package/dist/migrate/export/mini-yaml.d.ts +19 -0
- package/dist/migrate/export/mini-yaml.js +581 -0
- package/dist/migrate/export/mini-yaml.js.map +1 -0
- package/dist/migrate/export/nhost-config.d.ts +26 -0
- package/dist/migrate/export/nhost-config.js +360 -0
- package/dist/migrate/export/nhost-config.js.map +1 -0
- package/dist/migrate/export/nhost.d.ts +64 -0
- package/dist/migrate/export/nhost.js +304 -0
- package/dist/migrate/export/nhost.js.map +1 -0
- package/dist/migrate/export/onelogin.d.ts +22 -0
- package/dist/migrate/export/onelogin.js +123 -0
- package/dist/migrate/export/onelogin.js.map +1 -0
- package/dist/migrate/export/ory-config.d.ts +58 -0
- package/dist/migrate/export/ory-config.js +451 -0
- package/dist/migrate/export/ory-config.js.map +1 -0
- package/dist/migrate/export/ory.d.ts +81 -0
- package/dist/migrate/export/ory.js +555 -0
- package/dist/migrate/export/ory.js.map +1 -0
- package/dist/migrate/export/password-detect.d.ts +29 -0
- package/dist/migrate/export/password-detect.js +81 -0
- package/dist/migrate/export/password-detect.js.map +1 -0
- package/dist/migrate/export/pingone.d.ts +36 -0
- package/dist/migrate/export/pingone.js +218 -0
- package/dist/migrate/export/pingone.js.map +1 -0
- package/dist/migrate/export/pocketbase-config.d.ts +28 -0
- package/dist/migrate/export/pocketbase-config.js +180 -0
- package/dist/migrate/export/pocketbase-config.js.map +1 -0
- package/dist/migrate/export/pocketbase.d.ts +52 -0
- package/dist/migrate/export/pocketbase.js +243 -0
- package/dist/migrate/export/pocketbase.js.map +1 -0
- package/dist/migrate/export/project-files.d.ts +15 -0
- package/dist/migrate/export/project-files.js +43 -0
- package/dist/migrate/export/project-files.js.map +1 -0
- package/dist/migrate/export/propelauth-config.d.ts +18 -0
- package/dist/migrate/export/propelauth-config.js +58 -0
- package/dist/migrate/export/propelauth-config.js.map +1 -0
- package/dist/migrate/export/propelauth-harness.test-helper.d.ts +62 -0
- package/dist/migrate/export/propelauth-harness.test-helper.js +109 -0
- package/dist/migrate/export/propelauth-harness.test-helper.js.map +1 -0
- package/dist/migrate/export/propelauth.d.ts +48 -0
- package/dist/migrate/export/propelauth.js +255 -0
- package/dist/migrate/export/propelauth.js.map +1 -0
- package/dist/migrate/export/source-lines.d.ts +17 -0
- package/dist/migrate/export/source-lines.js +43 -0
- package/dist/migrate/export/source-lines.js.map +1 -0
- package/dist/migrate/export/sso-metadata.d.ts +47 -0
- package/dist/migrate/export/sso-metadata.js +180 -0
- package/dist/migrate/export/sso-metadata.js.map +1 -0
- package/dist/migrate/export/stytch-config.d.ts +22 -0
- package/dist/migrate/export/stytch-config.js +102 -0
- package/dist/migrate/export/stytch-config.js.map +1 -0
- package/dist/migrate/export/stytch.d.ts +68 -0
- package/dist/migrate/export/stytch.js +510 -0
- package/dist/migrate/export/stytch.js.map +1 -0
- package/dist/migrate/export/supabase-config.d.ts +48 -0
- package/dist/migrate/export/supabase-config.js +408 -0
- package/dist/migrate/export/supabase-config.js.map +1 -0
- package/dist/migrate/export/supabase.d.ts +86 -0
- package/dist/migrate/export/supabase.js +524 -0
- package/dist/migrate/export/supabase.js.map +1 -0
- package/dist/migrate/export/supertokens-config.d.ts +20 -0
- package/dist/migrate/export/supertokens-config.js +150 -0
- package/dist/migrate/export/supertokens-config.js.map +1 -0
- package/dist/migrate/export/supertokens.d.ts +125 -0
- package/dist/migrate/export/supertokens.js +464 -0
- package/dist/migrate/export/supertokens.js.map +1 -0
- package/dist/migrate/export/table.d.ts +35 -0
- package/dist/migrate/export/table.js +248 -0
- package/dist/migrate/export/table.js.map +1 -0
- package/dist/migrate/export/userfront-config.d.ts +15 -0
- package/dist/migrate/export/userfront-config.js +49 -0
- package/dist/migrate/export/userfront-config.js.map +1 -0
- package/dist/migrate/export/userfront.d.ts +38 -0
- package/dist/migrate/export/userfront.js +189 -0
- package/dist/migrate/export/userfront.js.map +1 -0
- package/dist/migrate/export/workos-config.d.ts +23 -0
- package/dist/migrate/export/workos-config.js +125 -0
- package/dist/migrate/export/workos-config.js.map +1 -0
- package/dist/migrate/export/workos.d.ts +46 -0
- package/dist/migrate/export/workos.js +272 -0
- package/dist/migrate/export/workos.js.map +1 -0
- package/dist/migrate/export/zitadel-config.d.ts +37 -0
- package/dist/migrate/export/zitadel-config.js +279 -0
- package/dist/migrate/export/zitadel-config.js.map +1 -0
- package/dist/migrate/export/zitadel.d.ts +82 -0
- package/dist/migrate/export/zitadel.js +447 -0
- package/dist/migrate/export/zitadel.js.map +1 -0
- package/dist/migrate/firebase/plugin.d.ts +2 -0
- package/dist/migrate/firebase/plugin.js +152 -0
- package/dist/migrate/firebase/plugin.js.map +1 -0
- package/dist/migrate/framework/builtins.js +35 -6
- package/dist/migrate/framework/builtins.js.map +1 -1
- package/dist/migrate/framework/orchestrator.js +3 -2
- package/dist/migrate/framework/orchestrator.js.map +1 -1
- package/dist/migrate/framework/plugin.d.ts +2 -0
- package/dist/migrate/frontegg/plugin.d.ts +2 -0
- package/dist/migrate/frontegg/plugin.js +78 -0
- package/dist/migrate/frontegg/plugin.js.map +1 -0
- package/dist/migrate/fusionauth/plugin.d.ts +2 -0
- package/dist/migrate/fusionauth/plugin.js +109 -0
- package/dist/migrate/fusionauth/plugin.js.map +1 -0
- package/dist/migrate/hanko/plugin.d.ts +2 -0
- package/dist/migrate/hanko/plugin.js +100 -0
- package/dist/migrate/hanko/plugin.js.map +1 -0
- package/dist/migrate/keycloak/plugin.d.ts +2 -0
- package/dist/migrate/keycloak/plugin.js +148 -0
- package/dist/migrate/keycloak/plugin.js.map +1 -0
- package/dist/migrate/ldap/plugin.d.ts +2 -0
- package/dist/migrate/ldap/plugin.js +73 -0
- package/dist/migrate/ldap/plugin.js.map +1 -0
- package/dist/migrate/logto/plugin.d.ts +2 -0
- package/dist/migrate/logto/plugin.js +131 -0
- package/dist/migrate/logto/plugin.js.map +1 -0
- package/dist/migrate/magic/plugin.d.ts +2 -0
- package/dist/migrate/magic/plugin.js +56 -0
- package/dist/migrate/magic/plugin.js.map +1 -0
- package/dist/migrate/nhost/plugin.d.ts +2 -0
- package/dist/migrate/nhost/plugin.js +115 -0
- package/dist/migrate/nhost/plugin.js.map +1 -0
- package/dist/migrate/oidc/plugin.d.ts +2 -0
- package/dist/migrate/oidc/plugin.js +73 -0
- package/dist/migrate/oidc/plugin.js.map +1 -0
- package/dist/migrate/onelogin/plugin.d.ts +2 -0
- package/dist/migrate/onelogin/plugin.js +61 -0
- package/dist/migrate/onelogin/plugin.js.map +1 -0
- package/dist/migrate/ory/plugin.d.ts +2 -0
- package/dist/migrate/ory/plugin.js +186 -0
- package/dist/migrate/ory/plugin.js.map +1 -0
- package/dist/migrate/ping-identity/plugin.d.ts +2 -0
- package/dist/migrate/ping-identity/plugin.js +100 -0
- package/dist/migrate/ping-identity/plugin.js.map +1 -0
- package/dist/migrate/pocketbase/plugin.d.ts +2 -0
- package/dist/migrate/pocketbase/plugin.js +99 -0
- package/dist/migrate/pocketbase/plugin.js.map +1 -0
- package/dist/migrate/propelauth/plugin.d.ts +2 -0
- package/dist/migrate/propelauth/plugin.js +65 -0
- package/dist/migrate/propelauth/plugin.js.map +1 -0
- package/dist/migrate/saml/plugin.d.ts +2 -0
- package/dist/migrate/saml/plugin.js +79 -0
- package/dist/migrate/saml/plugin.js.map +1 -0
- package/dist/migrate/stytch/plugin.d.ts +2 -0
- package/dist/migrate/stytch/plugin.js +97 -0
- package/dist/migrate/stytch/plugin.js.map +1 -0
- package/dist/migrate/supabase/plugin.d.ts +2 -0
- package/dist/migrate/supabase/plugin.js +149 -0
- package/dist/migrate/supabase/plugin.js.map +1 -0
- package/dist/migrate/supertokens/plugin.d.ts +2 -0
- package/dist/migrate/supertokens/plugin.js +114 -0
- package/dist/migrate/supertokens/plugin.js.map +1 -0
- package/dist/migrate/user-table/plugin.d.ts +2 -0
- package/dist/migrate/user-table/plugin.js +62 -0
- package/dist/migrate/user-table/plugin.js.map +1 -0
- package/dist/migrate/userfront/plugin.d.ts +2 -0
- package/dist/migrate/userfront/plugin.js +60 -0
- package/dist/migrate/userfront/plugin.js.map +1 -0
- package/dist/migrate/workos/plugin.d.ts +2 -0
- package/dist/migrate/workos/plugin.js +81 -0
- package/dist/migrate/workos/plugin.js.map +1 -0
- package/dist/migrate/zitadel/plugin.d.ts +2 -0
- package/dist/migrate/zitadel/plugin.js +114 -0
- package/dist/migrate/zitadel/plugin.js.map +1 -0
- package/dist/run.js +6 -0
- package/dist/run.js.map +1 -1
- package/github-action/fga-test/action.yml +43 -0
- package/package.json +9 -6
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.entraExternalIdPlugin = void 0;
|
|
4
|
+
const plugin_1 = require("../azure-ad-b2c/plugin");
|
|
5
|
+
/**
|
|
6
|
+
* `atlas migrate entra-external-id` — Microsoft Entra External ID (external
|
|
7
|
+
* tenants). Same Graph exporter and translator as Azure AD B2C; lazy
|
|
8
|
+
* migration through the native authentication API (external tenants have no
|
|
9
|
+
* ROPC) and the bridge matching on the `oid` claim.
|
|
10
|
+
*/
|
|
11
|
+
exports.entraExternalIdPlugin = (0, plugin_1.azurePlugin)('entra');
|
|
12
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/migrate/entra-external-id/plugin.ts"],"names":[],"mappings":";;;AAAA,mDAAqD;AAGrD;;;;;GAKG;AACU,QAAA,qBAAqB,GAAoB,IAAA,oBAAW,EAAC,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { TranslationResult } from '../framework/plugin';
|
|
2
|
+
import { type Obj } from './record-set';
|
|
3
|
+
/**
|
|
4
|
+
* `atlas migrate appwrite config` — an Appwrite project's auth settings →
|
|
5
|
+
* Atlas config.
|
|
6
|
+
*
|
|
7
|
+
* Two local sources, either or both (Appwrite's Projects API is console-only,
|
|
8
|
+
* so no project key can read it — the owner's own CLI can):
|
|
9
|
+
* - `appwrite.json` (or `appwrite.config.json`) after `appwrite pull
|
|
10
|
+
* settings`: `settings.auth.methods` and `settings.auth.security`, read
|
|
11
|
+
* with file:line;
|
|
12
|
+
* - the project document (`appwrite projects get --project-id <id> --json`,
|
|
13
|
+
* Appwrite 1.x model: `authDuration`, `authLimit`, … and `oAuthProviders`),
|
|
14
|
+
* the only place the OAuth providers are listed.
|
|
15
|
+
*/
|
|
16
|
+
export interface AppwriteConfigSnapshot {
|
|
17
|
+
/** The CLI config file, as text, with its path for the report. */
|
|
18
|
+
file?: {
|
|
19
|
+
path: string;
|
|
20
|
+
text: string;
|
|
21
|
+
};
|
|
22
|
+
/** The project document (Projects API / `appwrite projects get --json`). */
|
|
23
|
+
project?: Obj;
|
|
24
|
+
endpoint?: string;
|
|
25
|
+
projectId?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function parseAppwriteConfigFile(text: string): Obj;
|
|
28
|
+
export declare function translateAppwriteConfig(snap: AppwriteConfigSnapshot): TranslationResult;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseAppwriteConfigFile = parseAppwriteConfigFile;
|
|
4
|
+
exports.translateAppwriteConfig = translateAppwriteConfig;
|
|
5
|
+
const record_set_1 = require("./record-set");
|
|
6
|
+
const source_lines_1 = require("./source-lines");
|
|
7
|
+
const translate_kit_1 = require("./translate-kit");
|
|
8
|
+
/** Appwrite auth method ids (`settings.auth.methods` keys) → Atlas strategy. */
|
|
9
|
+
const METHODS = {
|
|
10
|
+
'email-password': { atlas: 'strategies.password', note: 'Email + password sign-in. Imported Appwrite hashes verify as they are and are upgraded to Argon2id.' },
|
|
11
|
+
'magic-url': { atlas: 'strategies.emailLink', note: 'Magic URL sign-in becomes Atlas email links.' },
|
|
12
|
+
'email-otp': { atlas: 'strategies.emailCode', note: 'Email OTP becomes Atlas email codes.' },
|
|
13
|
+
phone: { atlas: 'strategies.phoneCode', note: 'Phone (SMS) OTP becomes Atlas SMS codes, sent through your Atlas SMS settings.' },
|
|
14
|
+
anonymous: { atlas: 'strategies.anonymous', note: 'Anonymous sessions become Atlas anonymous users.' },
|
|
15
|
+
};
|
|
16
|
+
/** The 1.x project model's method flags, in `settings.auth.methods` terms. */
|
|
17
|
+
const PROJECT_METHODS = {
|
|
18
|
+
authEmailPassword: 'email-password',
|
|
19
|
+
authUsersAuthMagicURL: 'magic-url',
|
|
20
|
+
authEmailOtp: 'email-otp',
|
|
21
|
+
authPhone: 'phone',
|
|
22
|
+
authAnonymous: 'anonymous',
|
|
23
|
+
authInvites: 'invites',
|
|
24
|
+
authJWT: 'jwt',
|
|
25
|
+
};
|
|
26
|
+
const PROJECT_SECURITY = {
|
|
27
|
+
authDuration: 'duration',
|
|
28
|
+
authLimit: 'limit',
|
|
29
|
+
authSessionsLimit: 'sessionsLimit',
|
|
30
|
+
authPasswordHistory: 'passwordHistory',
|
|
31
|
+
authPasswordDictionary: 'passwordDictionary',
|
|
32
|
+
authPersonalDataCheck: 'personalDataCheck',
|
|
33
|
+
authSessionAlerts: 'sessionAlerts',
|
|
34
|
+
authMockNumbers: 'mockNumbers',
|
|
35
|
+
};
|
|
36
|
+
function parseAppwriteConfigFile(text) {
|
|
37
|
+
const parsed = JSON.parse(text);
|
|
38
|
+
if (!(0, record_set_1.isObj)(parsed))
|
|
39
|
+
throw new Error('appwrite.json is not a JSON object.');
|
|
40
|
+
return parsed;
|
|
41
|
+
}
|
|
42
|
+
function translateAppwriteConfig(snap) {
|
|
43
|
+
const b = new translate_kit_1.ConfigBuilder();
|
|
44
|
+
const fileDoc = snap.file ? parseAppwriteConfigFile(snap.file.text) : undefined;
|
|
45
|
+
const settings = (0, record_set_1.isObj)(fileDoc?.settings) ? fileDoc.settings : {};
|
|
46
|
+
const auth = (0, record_set_1.isObj)(settings.auth) ? settings.auth : {};
|
|
47
|
+
const project = snap.project ?? {};
|
|
48
|
+
const projectId = snap.projectId ?? (0, record_set_1.str)(fileDoc?.projectId) ?? (0, record_set_1.str)(project.$id);
|
|
49
|
+
const filePath = snap.file?.path;
|
|
50
|
+
// One view of methods and security, from the file (with lines) or the project document.
|
|
51
|
+
const methods = {};
|
|
52
|
+
const fileMethods = (0, record_set_1.isObj)(auth.methods) ? auth.methods : {};
|
|
53
|
+
for (const [k, v] of Object.entries(fileMethods)) {
|
|
54
|
+
if (typeof v === 'boolean')
|
|
55
|
+
methods[k] = { on: v, line: (0, source_lines_1.jsonKeyLine)(snap.file.text, ['settings', 'auth', 'methods', k]), from: `settings.auth.methods.${k}` };
|
|
56
|
+
}
|
|
57
|
+
for (const [flag, k] of Object.entries(PROJECT_METHODS)) {
|
|
58
|
+
if (methods[k] || typeof project[flag] !== 'boolean')
|
|
59
|
+
continue;
|
|
60
|
+
methods[k] = { on: project[flag], from: flag };
|
|
61
|
+
}
|
|
62
|
+
for (const m of (0, record_set_1.objs)(project.authMethods)) {
|
|
63
|
+
const id = (0, record_set_1.str)(m.$id);
|
|
64
|
+
if (id && !methods[id] && typeof m.enabled === 'boolean')
|
|
65
|
+
methods[id] = { on: m.enabled, from: `authMethods.${id}` };
|
|
66
|
+
}
|
|
67
|
+
const security = {};
|
|
68
|
+
const fileSecurity = (0, record_set_1.isObj)(auth.security) ? auth.security : {};
|
|
69
|
+
for (const [k, v] of Object.entries(fileSecurity))
|
|
70
|
+
security[k] = { value: v, line: (0, source_lines_1.jsonKeyLine)(snap.file.text, ['settings', 'auth', 'security', k]), from: `settings.auth.security.${k}` };
|
|
71
|
+
for (const [flag, k] of Object.entries(PROJECT_SECURITY))
|
|
72
|
+
if (!security[k] && project[flag] !== undefined)
|
|
73
|
+
security[k] = { value: project[flag], from: flag };
|
|
74
|
+
const at = (line) => (line ? filePath : undefined);
|
|
75
|
+
// ── sign-in methods ──
|
|
76
|
+
for (const [id, m] of Object.entries(methods)) {
|
|
77
|
+
const known = METHODS[id];
|
|
78
|
+
if (known) {
|
|
79
|
+
b.set(known.atlas, m.on);
|
|
80
|
+
if (m.on)
|
|
81
|
+
(0, source_lines_1.addAt)(b, at(m.line), m.line, 'mapped', 'auth methods', m.from, known.note, `auth_config.${known.atlas}`);
|
|
82
|
+
}
|
|
83
|
+
else if (id === 'invites' && m.on) {
|
|
84
|
+
(0, source_lines_1.addAt)(b, at(m.line), m.line, 'mapped', 'auth methods', m.from, 'Team invites become Atlas organization invitations (pending ones are imported).', 'organizations');
|
|
85
|
+
}
|
|
86
|
+
else if (id === 'jwt' && m.on) {
|
|
87
|
+
(0, source_lines_1.addAt)(b, at(m.line), m.line, 'differs', 'auth methods', m.from, 'Appwrite JWTs (account.createJWT) are replaced by Atlas session tokens (getToken()); your backend verifies them with Atlas\'s JWKS instead of calling Appwrite.', 'session tokens');
|
|
88
|
+
}
|
|
89
|
+
else if (m.on) {
|
|
90
|
+
(0, source_lines_1.addAt)(b, at(m.line), m.line, 'manual', 'auth methods', m.from, `The Appwrite method "${id}" has no direct Atlas setting: review it.`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (methods['email-password']?.on) {
|
|
94
|
+
b.set('passwordPolicy.minLength', 8);
|
|
95
|
+
b.add('mapped', 'auth methods', 'password minimum length', 'Appwrite requires 8 characters; so does Atlas.', 'auth_config.passwordPolicy.minLength');
|
|
96
|
+
}
|
|
97
|
+
// ── security ──
|
|
98
|
+
const sec = (k) => security[k];
|
|
99
|
+
const duration = sec('duration');
|
|
100
|
+
if (duration && typeof duration.value === 'number' && duration.value > 0) {
|
|
101
|
+
const ms = (0, translate_kit_1.clampSessionMs)(duration.value * 1000);
|
|
102
|
+
b.set('session.absoluteMs', ms);
|
|
103
|
+
(0, source_lines_1.addAt)(b, at(duration.line), duration.line, ms === duration.value * 1000 ? 'mapped' : 'differs', 'security', duration.from, `${duration.value} s sessions${ms !== duration.value * 1000 ? ' (Appwrite defaults to one year; Atlas allows at most 90 days)' : ''}.`, 'auth_config.session.absoluteMs');
|
|
104
|
+
}
|
|
105
|
+
const sessions = sec('sessionsLimit');
|
|
106
|
+
if (sessions && typeof sessions.value === 'number' && sessions.value > 0) {
|
|
107
|
+
b.set('session.maxConcurrentSessions', sessions.value);
|
|
108
|
+
(0, source_lines_1.addAt)(b, at(sessions.line), sessions.line, 'mapped', 'security', sessions.from, `At most ${sessions.value} sessions per user (the oldest is signed out).`, 'auth_config.session.maxConcurrentSessions');
|
|
109
|
+
}
|
|
110
|
+
const limit = sec('limit');
|
|
111
|
+
if (limit && typeof limit.value === 'number' && limit.value > 0) {
|
|
112
|
+
(0, source_lines_1.addAt)(b, at(limit.line), limit.line, 'manual', 'security', limit.from, `Appwrite caps the project at ${limit.value} users; Atlas has no user cap. Close sign-up (signUpMode "restricted") if that cap was a gate.`, 'auth_config.signUpMode');
|
|
113
|
+
}
|
|
114
|
+
const history = sec('passwordHistory');
|
|
115
|
+
if (history && typeof history.value === 'number' && history.value > 0) {
|
|
116
|
+
b.set('passwordPolicy.historyCount', history.value);
|
|
117
|
+
(0, source_lines_1.addAt)(b, at(history.line), history.line, 'mapped', 'security', history.from, `New passwords may not repeat the last ${history.value}. Atlas starts the history at the first password set in Atlas.`, 'auth_config.passwordPolicy.historyCount');
|
|
118
|
+
}
|
|
119
|
+
const dict = sec('passwordDictionary');
|
|
120
|
+
if (dict?.value === true) {
|
|
121
|
+
b.set('passwordPolicy.checkBreaches', true);
|
|
122
|
+
(0, source_lines_1.addAt)(b, at(dict.line), dict.line, 'differs', 'security', dict.from, 'Appwrite rejects the 10,000 most common passwords; Atlas rejects passwords found in breach corpora, a superset.', 'auth_config.passwordPolicy.checkBreaches');
|
|
123
|
+
}
|
|
124
|
+
const personal = sec('personalDataCheck');
|
|
125
|
+
if (personal?.value === true) {
|
|
126
|
+
b.set('passwordPolicy.rejectIdentifierSubstring', true);
|
|
127
|
+
(0, source_lines_1.addAt)(b, at(personal.line), personal.line, 'mapped', 'security', personal.from, 'Passwords may not contain the user\'s name, email or phone.', 'auth_config.passwordPolicy.rejectIdentifierSubstring');
|
|
128
|
+
}
|
|
129
|
+
const alerts = sec('sessionAlerts');
|
|
130
|
+
if (alerts?.value === true)
|
|
131
|
+
(0, source_lines_1.addAt)(b, at(alerts.line), alerts.line, 'manual', 'security', alerts.from, 'New-session email alerts: enable Atlas\'s new sign-in notification email in the dashboard (Emails).');
|
|
132
|
+
const mock = sec('mockNumbers');
|
|
133
|
+
if (mock && Array.isArray(mock.value) && mock.value.length) {
|
|
134
|
+
(0, source_lines_1.addAt)(b, at(mock.line), mock.line, 'manual', 'security', mock.from, `${mock.value.length} mock phone number(s) with fixed OTPs: use Atlas development-instance test numbers instead; they are not copied.`);
|
|
135
|
+
}
|
|
136
|
+
for (const k of ['membershipsUserName', 'membershipsUserEmail', 'membershipsMfa']) {
|
|
137
|
+
const flag = `auth${k[0].toUpperCase()}${k.slice(1)}`;
|
|
138
|
+
if (project[flag] === false)
|
|
139
|
+
b.add('manual', 'memberships privacy', flag, 'Appwrite hides this member field from team members; Atlas shows members\' names and emails to their organization. Restrict with organization permissions if needed.');
|
|
140
|
+
}
|
|
141
|
+
// ── OAuth providers ──
|
|
142
|
+
for (const p of (0, record_set_1.objs)(project.oAuthProviders)) {
|
|
143
|
+
const key = (0, record_set_1.str)(p.key);
|
|
144
|
+
if (!key || p.enabled !== true)
|
|
145
|
+
continue;
|
|
146
|
+
const atlas = (0, translate_kit_1.socialKey)(key);
|
|
147
|
+
const appId = (0, record_set_1.str)(p.appId);
|
|
148
|
+
if (atlas) {
|
|
149
|
+
b.socialProvider({ atlasKey: atlas, vendorName: key, area: 'oauth providers', setting: `oAuthProviders.${key}`, clientId: appId });
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
b.add('manual', 'oauth providers', `oAuthProviders.${key}`, `"${key}" is not an Atlas built-in provider: add it as a custom OAuth/OIDC provider (custom_oauth_providers) with the same client id${appId ? ` (${appId})` : ''}.`, 'custom_oauth_providers');
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (!snap.project && snap.file) {
|
|
156
|
+
b.add('manual', 'oauth providers', 'oAuthProviders', 'appwrite.json does not list OAuth providers: pass the project document (appwrite projects get --json) to translate them, or add them in the Atlas dashboard with the same client ids.');
|
|
157
|
+
}
|
|
158
|
+
// ── always ──
|
|
159
|
+
b.add('differs', 'sessions', 'a_session_<project> cookie', 'Appwrite sessions live on the Appwrite domain and are stored hashed: the appwrite bridge preset asks Appwrite about each live session once and swaps it for an Atlas session.', 'migrations bridge appwrite');
|
|
160
|
+
b.add('differs', 'multi-factor', 'TOTP authenticators', 'Appwrite cannot export TOTP secrets: those users enrol an authenticator app again (recovery codes can be exported).', 'auth_config.mfa.factors.totp');
|
|
161
|
+
const endpoint = snap.endpoint ?? (0, record_set_1.str)(fileDoc?.endpoint);
|
|
162
|
+
const base = endpoint?.replace(/\/+$/, '');
|
|
163
|
+
const ids = projectId ? { project_id: projectId } : {};
|
|
164
|
+
// The bridge preset names the endpoint `endpoint_url`, the lazy preset `endpoint`.
|
|
165
|
+
return b.result(filePath ?? `appwrite project ${projectId ?? ''}`.trim(), {
|
|
166
|
+
bridge: { preset: 'appwrite', vars: { ...ids, ...(base ? { endpoint_url: base } : {}) } },
|
|
167
|
+
lazy: { preset: 'appwrite', config: { ...ids, ...(base ? { endpoint: base } : {}) } },
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=appwrite-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appwrite-config.js","sourceRoot":"","sources":["../../../src/migrate/export/appwrite-config.ts"],"names":[],"mappings":";;AA0DA,0DAIC;AAED,0DAwHC;AAvLD,6CAA0D;AAC1D,iDAAoD;AACpD,mDAA2E;AAwB3E,gFAAgF;AAChF,MAAM,OAAO,GAAoD;IAC/D,gBAAgB,EAAE,EAAE,KAAK,EAAE,qBAAqB,EAAE,IAAI,EAAE,qGAAqG,EAAE;IAC/J,WAAW,EAAE,EAAE,KAAK,EAAE,sBAAsB,EAAE,IAAI,EAAE,8CAA8C,EAAE;IACpG,WAAW,EAAE,EAAE,KAAK,EAAE,sBAAsB,EAAE,IAAI,EAAE,sCAAsC,EAAE;IAC5F,KAAK,EAAE,EAAE,KAAK,EAAE,sBAAsB,EAAE,IAAI,EAA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AAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACzF,IAAI,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,GAAG,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;KACtF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { PasswordHash } from '@atlasauth/migrate';
|
|
2
|
+
import { RecordSet, type Obj } from './record-set';
|
|
3
|
+
/**
|
|
4
|
+
* `atlas migrate export appwrite` — an Appwrite project (Cloud or self-hosted,
|
|
5
|
+
* 1.5 and later) through the Server API, with an API key the owner creates
|
|
6
|
+
* (scopes `users.read`, `teams.read`; `users.write` too for recovery codes on
|
|
7
|
+
* 2.x). The key is used on this machine only.
|
|
8
|
+
*
|
|
9
|
+
* Appwrite's Users API returns every user's hash with its algorithm and
|
|
10
|
+
* options (`password`, `hash`, `hashOptions`), so passwords move as they are:
|
|
11
|
+
* Argon2 and bcrypt are self-describing, MD5 and the eleven SHA variants are
|
|
12
|
+
* unsalted hex, phpass keeps its `$P$`/`$H$` digest, plain scrypt carries its
|
|
13
|
+
* literal N / r / p and string salt, and `scryptMod` is Firebase's modified
|
|
14
|
+
* scrypt with Appwrite's fixed N=2^14, r=8.
|
|
15
|
+
*
|
|
16
|
+
* Teams become organizations (confirmed memberships with their roles,
|
|
17
|
+
* unconfirmed ones as pending invitations), labels become app roles, prefs
|
|
18
|
+
* become public metadata (list queries use the JSON syntax of 1.5+). MFA
|
|
19
|
+
* recovery codes are readable (opt in); TOTP secrets are encrypted at rest
|
|
20
|
+
* with no read route, so those users enrol again. Sessions are stored as hashes and cannot leave: the `appwrite` bridge
|
|
21
|
+
* preset asks Appwrite about a live session instead.
|
|
22
|
+
*/
|
|
23
|
+
export interface AppwriteExportOptions {
|
|
24
|
+
/** The API endpoint including /v1 (default https://cloud.appwrite.io/v1). */
|
|
25
|
+
endpoint?: string;
|
|
26
|
+
projectId: string;
|
|
27
|
+
apiKey: string;
|
|
28
|
+
/** Read each MFA user's recovery codes (`GET /users/{id}/mfa/recovery-codes`). */
|
|
29
|
+
recoveryCodes?: boolean;
|
|
30
|
+
/** Skip teams and memberships. */
|
|
31
|
+
skipTeams?: boolean;
|
|
32
|
+
fetchImpl?: typeof fetch;
|
|
33
|
+
sleep?: (ms: number) => Promise<void>;
|
|
34
|
+
onProgress?: (message: string) => void;
|
|
35
|
+
}
|
|
36
|
+
export declare const APPWRITE_CLOUD = "https://cloud.appwrite.io/v1";
|
|
37
|
+
export declare function exportAppwrite(opts: AppwriteExportOptions): Promise<RecordSet>;
|
|
38
|
+
/** Appwrite team roles → one Atlas membership role: `owner` is the org admin, else the first custom role. */
|
|
39
|
+
export declare function appwriteTeamRole(roles: string[]): string;
|
|
40
|
+
/**
|
|
41
|
+
* One Appwrite user's hash in the bundle's terms (see the module comment).
|
|
42
|
+
* `guessed` marks a SHA hash stored without a version; `problem` is a warning
|
|
43
|
+
* for a hash that cannot be carried.
|
|
44
|
+
*/
|
|
45
|
+
export declare function appwritePasswordHash(u: Obj): {
|
|
46
|
+
hash?: PasswordHash;
|
|
47
|
+
guessed?: boolean;
|
|
48
|
+
problem?: string;
|
|
49
|
+
};
|
|
50
|
+
/** An Appwrite 1.5+ query (JSON form) for the `queries[]` parameter. */
|
|
51
|
+
export declare function appwriteQuery(method: string, values: unknown[]): string;
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.APPWRITE_CLOUD = void 0;
|
|
4
|
+
exports.exportAppwrite = exportAppwrite;
|
|
5
|
+
exports.appwriteTeamRole = appwriteTeamRole;
|
|
6
|
+
exports.appwritePasswordHash = appwritePasswordHash;
|
|
7
|
+
exports.appwriteQuery = appwriteQuery;
|
|
8
|
+
const record_set_1 = require("./record-set");
|
|
9
|
+
const translate_kit_1 = require("./translate-kit");
|
|
10
|
+
const vendor_http_1 = require("./vendor-http");
|
|
11
|
+
exports.APPWRITE_CLOUD = 'https://cloud.appwrite.io/v1';
|
|
12
|
+
const PAGE = 100;
|
|
13
|
+
async function exportAppwrite(opts) {
|
|
14
|
+
const set = new record_set_1.RecordSet();
|
|
15
|
+
const endpoint = (opts.endpoint ?? exports.APPWRITE_CLOUD).replace(/\/+$/, '');
|
|
16
|
+
const http = new vendor_http_1.VendorHttp({
|
|
17
|
+
vendor: 'Appwrite',
|
|
18
|
+
baseUrl: endpoint,
|
|
19
|
+
headers: { 'x-appwrite-project': opts.projectId, 'x-appwrite-key': opts.apiKey },
|
|
20
|
+
fetchImpl: opts.fetchImpl,
|
|
21
|
+
sleep: opts.sleep,
|
|
22
|
+
});
|
|
23
|
+
const progress = opts.onProgress ?? (() => undefined);
|
|
24
|
+
progress('users');
|
|
25
|
+
const users = await listAll(http, '/users', 'users');
|
|
26
|
+
const ids = new Set();
|
|
27
|
+
const labels = new Set();
|
|
28
|
+
let shaGuessed = 0;
|
|
29
|
+
for (const u of users) {
|
|
30
|
+
const id = (0, record_set_1.str)(u.$id);
|
|
31
|
+
if (!id)
|
|
32
|
+
continue;
|
|
33
|
+
ids.add(id);
|
|
34
|
+
const user = mapUser(u);
|
|
35
|
+
const pw = appwritePasswordHash(u);
|
|
36
|
+
if (pw.hash)
|
|
37
|
+
user.password = pw.hash;
|
|
38
|
+
if (pw.guessed)
|
|
39
|
+
shaGuessed++;
|
|
40
|
+
if (pw.problem)
|
|
41
|
+
set.warn(pw.problem);
|
|
42
|
+
for (const l of user.roles ?? [])
|
|
43
|
+
labels.add(l);
|
|
44
|
+
set.add('user', (0, record_set_1.compact)(user));
|
|
45
|
+
}
|
|
46
|
+
for (const l of [...labels].sort())
|
|
47
|
+
set.add('role', { key: l, name: l, scope: 'app' }, `app:${l}`);
|
|
48
|
+
if (shaGuessed) {
|
|
49
|
+
set.warn(`${shaGuessed} SHA hash(es) were imported without a version: Appwrite 1.x checks those as SHA3-512 and 2.x as SHA-256. The export picked by digest length; a user whose hash still fails signs in through lazy migration or a reset.`);
|
|
50
|
+
}
|
|
51
|
+
progress('identities');
|
|
52
|
+
try {
|
|
53
|
+
for (const i of await listAll(http, '/users/identities', 'identities')) {
|
|
54
|
+
const userId = (0, record_set_1.str)(i.userId);
|
|
55
|
+
const provider = (0, record_set_1.str)(i.provider);
|
|
56
|
+
const providerUid = (0, record_set_1.str)(i.providerUid);
|
|
57
|
+
if (!userId || !provider || !providerUid || !ids.has(userId))
|
|
58
|
+
continue;
|
|
59
|
+
set.add('identity', (0, record_set_1.compact)({ id: (0, record_set_1.str)(i.$id), user_id: userId, provider, provider_user_id: providerUid, kind: 'oauth', email: (0, record_set_1.str)(i.providerEmail)?.toLowerCase() }), `${provider}:${providerUid}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
// `GET /users/identities` exists from 1.5; older servers only list per user.
|
|
64
|
+
if (!(err instanceof vendor_http_1.VendorApiError && [404, 400].includes(err.status)))
|
|
65
|
+
throw err;
|
|
66
|
+
set.warn('This Appwrite server has no identities listing (before 1.5): OAuth links are not exported; users relink by email on first social sign-in.');
|
|
67
|
+
}
|
|
68
|
+
progress('two-factor');
|
|
69
|
+
let totp = 0;
|
|
70
|
+
for (const u of users) {
|
|
71
|
+
const id = (0, record_set_1.str)(u.$id);
|
|
72
|
+
if (!id || u.mfa !== true)
|
|
73
|
+
continue;
|
|
74
|
+
const factors = await optionalGet(http, `/users/${id}/mfa/factors`);
|
|
75
|
+
if (!factors)
|
|
76
|
+
continue;
|
|
77
|
+
if (factors.totp === true)
|
|
78
|
+
totp++;
|
|
79
|
+
const phone = (0, record_set_1.e164)(u.phone);
|
|
80
|
+
if (factors.phone === true && phone)
|
|
81
|
+
set.add('mfa_factor', { user_id: id, type: 'phone', phone, verified: u.phoneVerification === true });
|
|
82
|
+
if (factors.email === true && (0, record_set_1.str)(u.email))
|
|
83
|
+
set.add('mfa_factor', { user_id: id, type: 'email', verified: u.emailVerification === true });
|
|
84
|
+
if (factors.recoveryCode === true && opts.recoveryCodes) {
|
|
85
|
+
const codes = await optionalGet(http, `/users/${id}/mfa/recovery-codes`);
|
|
86
|
+
const list = (0, record_set_1.strs)(codes?.recoveryCodes);
|
|
87
|
+
if (list.length)
|
|
88
|
+
set.add('mfa_factor', { user_id: id, type: 'backup_codes', backup_codes: list, verified: true });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (totp)
|
|
92
|
+
set.omit('mfa_factor', 'Appwrite keeps TOTP secrets encrypted with no API to read them: those users enrol an authenticator app again', totp);
|
|
93
|
+
if (!opts.recoveryCodes && users.some((u) => u.mfa === true)) {
|
|
94
|
+
set.warn('Recovery codes were not read: pass --set appwrite-recovery-codes=true (the API key needs users.read, or users.write on Appwrite 2.x).');
|
|
95
|
+
}
|
|
96
|
+
if (!opts.skipTeams) {
|
|
97
|
+
progress('teams');
|
|
98
|
+
const teams = await optionalList(http, '/teams', 'teams');
|
|
99
|
+
const orgRoles = new Set();
|
|
100
|
+
for (const t of teams) {
|
|
101
|
+
const teamId = (0, record_set_1.str)(t.$id);
|
|
102
|
+
const name = (0, record_set_1.str)(t.name);
|
|
103
|
+
if (!teamId || !name)
|
|
104
|
+
continue;
|
|
105
|
+
set.add('organization', (0, record_set_1.compact)({ id: teamId, name, public_metadata: (0, record_set_1.bag)(t.prefs), created_at: (0, record_set_1.str)(t.$createdAt) }));
|
|
106
|
+
for (const m of await optionalList(http, `/teams/${teamId}/memberships`, 'memberships')) {
|
|
107
|
+
const role = appwriteTeamRole((0, record_set_1.strs)(m.roles));
|
|
108
|
+
orgRoles.add(role);
|
|
109
|
+
const userId = (0, record_set_1.str)(m.userId);
|
|
110
|
+
if (m.confirm === true && userId && ids.has(userId)) {
|
|
111
|
+
set.add('membership', (0, record_set_1.compact)({ id: (0, record_set_1.str)(m.$id), organization_id: teamId, user_id: userId, role, created_at: (0, record_set_1.str)(m.joined) ?? (0, record_set_1.str)(m.$createdAt) }), `${teamId}:${userId}`);
|
|
112
|
+
}
|
|
113
|
+
else if (m.confirm !== true) {
|
|
114
|
+
const email = (0, record_set_1.str)(m.userEmail);
|
|
115
|
+
const id = (0, record_set_1.str)(m.$id);
|
|
116
|
+
if (!email || !id) {
|
|
117
|
+
set.omit('invitation', 'unconfirmed membership whose email is hidden by the project\'s membership privacy settings');
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
set.add('invitation', (0, record_set_1.compact)({ id, organization_id: teamId, email: email.toLowerCase(), role, status: 'pending', created_at: (0, record_set_1.str)(m.invited) }));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
for (const r of [...orgRoles].sort())
|
|
125
|
+
if (r !== 'admin' && r !== 'member')
|
|
126
|
+
set.add('role', { key: r, name: r, scope: 'organization' }, `org:${r}`);
|
|
127
|
+
}
|
|
128
|
+
const providers = new Set(set.list('identity').map((i) => i.provider));
|
|
129
|
+
set.manifest = { ...set.manifest, origin: `${endpoint} project ${opts.projectId}`, providers: [...providers].sort() };
|
|
130
|
+
set.warn('Appwrite sessions are stored as hashes and cannot be exported: enable the appwrite bridge preset so signed-in users move without a new sign-in.');
|
|
131
|
+
return set;
|
|
132
|
+
}
|
|
133
|
+
// ── users ───────────────────────────────────────────────────────────────────
|
|
134
|
+
function mapUser(u) {
|
|
135
|
+
const email = (0, record_set_1.str)(u.email)?.toLowerCase();
|
|
136
|
+
const phone = (0, record_set_1.e164)(u.phone);
|
|
137
|
+
const labels = (0, record_set_1.strs)(u.labels).map(translate_kit_1.keyOf);
|
|
138
|
+
const user = {
|
|
139
|
+
id: (0, record_set_1.str)(u.$id),
|
|
140
|
+
emails: email ? [{ email, verified: u.emailVerification === true, primary: true }] : undefined,
|
|
141
|
+
phones: phone ? [{ phone, verified: u.phoneVerification === true, primary: !email }] : undefined,
|
|
142
|
+
name: (0, record_set_1.str)(u.name),
|
|
143
|
+
roles: labels.length ? labels : undefined,
|
|
144
|
+
banned: u.status === false ? true : undefined,
|
|
145
|
+
public_metadata: (0, record_set_1.bag)(u.prefs),
|
|
146
|
+
created_at: (0, record_set_1.str)(u.registration) ?? (0, record_set_1.str)(u.$createdAt),
|
|
147
|
+
last_sign_in_at: (0, record_set_1.str)(u.accessedAt),
|
|
148
|
+
};
|
|
149
|
+
if (!email && !phone)
|
|
150
|
+
user.anonymous = true;
|
|
151
|
+
return user;
|
|
152
|
+
}
|
|
153
|
+
/** Appwrite team roles → one Atlas membership role: `owner` is the org admin, else the first custom role. */
|
|
154
|
+
function appwriteTeamRole(roles) {
|
|
155
|
+
if (roles.includes('owner'))
|
|
156
|
+
return 'admin';
|
|
157
|
+
const first = roles.find((r) => r.trim());
|
|
158
|
+
return first ? (0, translate_kit_1.keyOf)(first) : 'member';
|
|
159
|
+
}
|
|
160
|
+
const SHA_VERSIONS = {
|
|
161
|
+
sha1: 'sha1',
|
|
162
|
+
sha224: 'sha224',
|
|
163
|
+
sha256: 'sha256',
|
|
164
|
+
sha384: 'sha384',
|
|
165
|
+
sha512: 'sha512',
|
|
166
|
+
'sha512/224': 'sha512_224',
|
|
167
|
+
'sha512/256': 'sha512_256',
|
|
168
|
+
'sha3-224': 'sha3_224',
|
|
169
|
+
'sha3-256': 'sha3_256',
|
|
170
|
+
'sha3-384': 'sha3_384',
|
|
171
|
+
'sha3-512': 'sha3_512',
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* One Appwrite user's hash in the bundle's terms (see the module comment).
|
|
175
|
+
* `guessed` marks a SHA hash stored without a version; `problem` is a warning
|
|
176
|
+
* for a hash that cannot be carried.
|
|
177
|
+
*/
|
|
178
|
+
function appwritePasswordHash(u) {
|
|
179
|
+
const digest = (0, record_set_1.str)(u.password);
|
|
180
|
+
if (!digest)
|
|
181
|
+
return {};
|
|
182
|
+
const options = (0, record_set_1.isObj)(u.hashOptions) ? u.hashOptions : {};
|
|
183
|
+
const type = ((0, record_set_1.str)(u.hash) ?? (0, record_set_1.str)(options.type) ?? '').toLowerCase();
|
|
184
|
+
switch (type) {
|
|
185
|
+
case 'argon2':
|
|
186
|
+
case 'bcrypt':
|
|
187
|
+
return { hash: { algorithm: 'auto', hash: digest } };
|
|
188
|
+
case 'md5':
|
|
189
|
+
return { hash: { algorithm: 'md5', hash: digest.toLowerCase(), params: { encoding: 'hex' } } };
|
|
190
|
+
case 'sha': {
|
|
191
|
+
const version = (0, record_set_1.str)(options.version)?.toLowerCase();
|
|
192
|
+
if (version) {
|
|
193
|
+
const algorithm = SHA_VERSIONS[version];
|
|
194
|
+
return algorithm
|
|
195
|
+
? { hash: { algorithm, hash: digest.toLowerCase(), params: { encoding: 'hex' } } }
|
|
196
|
+
: { problem: `A SHA hash with the unknown version "${version}" was left out.` };
|
|
197
|
+
}
|
|
198
|
+
// No version: 1.x defaults to sha3-512 (128 hex), 2.x to sha256 (64 hex).
|
|
199
|
+
if (digest.length === 128)
|
|
200
|
+
return { hash: { algorithm: 'sha3_512', hash: digest.toLowerCase(), params: { encoding: 'hex' } }, guessed: true };
|
|
201
|
+
if (digest.length === 64)
|
|
202
|
+
return { hash: { algorithm: 'sha256', hash: digest.toLowerCase(), params: { encoding: 'hex' } }, guessed: true };
|
|
203
|
+
return { problem: 'A SHA hash without a version and of an unexpected length was left out.' };
|
|
204
|
+
}
|
|
205
|
+
case 'phpass':
|
|
206
|
+
// Appwrite's phpass falls back to crypt() for bcrypt-style digests.
|
|
207
|
+
return { hash: { algorithm: /^\$2[aby]\$/.test(digest) ? 'auto' : 'phpass', hash: digest } };
|
|
208
|
+
case 'scrypt': {
|
|
209
|
+
const salt = (0, record_set_1.str)(options.salt);
|
|
210
|
+
if (salt === undefined)
|
|
211
|
+
return { problem: 'A scrypt hash came back without its salt (the server did not return hashOptions.salt) and was left out; those users move by lazy migration.' };
|
|
212
|
+
return {
|
|
213
|
+
hash: {
|
|
214
|
+
algorithm: 'scrypt',
|
|
215
|
+
hash: digest.toLowerCase(),
|
|
216
|
+
salt,
|
|
217
|
+
params: {
|
|
218
|
+
// php-scrypt: N is the literal cost (not log2), the salt string is used as is, the output is hex.
|
|
219
|
+
n: num(options.costCpu, 8),
|
|
220
|
+
r: num(options.costMemory, 14),
|
|
221
|
+
p: num(options.costParallel, 1),
|
|
222
|
+
key_length: num(options.length, 64),
|
|
223
|
+
salt_encoding: 'utf8',
|
|
224
|
+
encoding: 'hex',
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
case 'scryptmod': {
|
|
230
|
+
const signer = (0, record_set_1.str)(options.signerKey);
|
|
231
|
+
if (!signer)
|
|
232
|
+
return { problem: 'A scryptMod hash came back without its signer key and was left out.' };
|
|
233
|
+
return {
|
|
234
|
+
hash: {
|
|
235
|
+
algorithm: 'scrypt_firebase',
|
|
236
|
+
hash: digest,
|
|
237
|
+
salt: (0, record_set_1.str)(options.salt) ?? '',
|
|
238
|
+
// Appwrite hard-codes N=16384 (mem_cost 14), r=8, p=1.
|
|
239
|
+
params: { signer_key: signer, salt_separator: (0, record_set_1.str)(options.saltSeparator) ?? '', rounds: 8, mem_cost: 14 },
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
default:
|
|
244
|
+
return { problem: `A password hash of the unknown type "${type || 'none'}" was left out.` };
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
const num = (v, fallback) => (typeof v === 'number' && Number.isFinite(v) ? v : typeof v === 'string' && v.trim() && Number.isFinite(Number(v)) ? Number(v) : fallback);
|
|
248
|
+
// ── paging ──────────────────────────────────────────────────────────────────
|
|
249
|
+
/** An Appwrite 1.5+ query (JSON form) for the `queries[]` parameter. */
|
|
250
|
+
function appwriteQuery(method, values) {
|
|
251
|
+
return `queries[]=${encodeURIComponent(JSON.stringify({ method, values }))}`;
|
|
252
|
+
}
|
|
253
|
+
/** Every row of a list endpoint, by cursor (`cursorAfter` the last `$id`, ordered by `$id`). */
|
|
254
|
+
async function listAll(http, path, key) {
|
|
255
|
+
const out = [];
|
|
256
|
+
let cursor;
|
|
257
|
+
for (;;) {
|
|
258
|
+
const q = [appwriteQuery('limit', [PAGE]), ...(cursor ? [appwriteQuery('cursorAfter', [cursor])] : [])].join('&');
|
|
259
|
+
const { body } = await http.get(`${path}${path.includes('?') ? '&' : '?'}${q}`);
|
|
260
|
+
const rows = (0, record_set_1.isObj)(body) ? (0, record_set_1.objs)(body[key]) : [];
|
|
261
|
+
out.push(...rows);
|
|
262
|
+
const last = rows.length ? (0, record_set_1.str)(rows[rows.length - 1].$id) : undefined;
|
|
263
|
+
if (rows.length < PAGE || !last)
|
|
264
|
+
return out;
|
|
265
|
+
cursor = last;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
async function optionalList(http, path, key) {
|
|
269
|
+
try {
|
|
270
|
+
return await listAll(http, path, key);
|
|
271
|
+
}
|
|
272
|
+
catch (err) {
|
|
273
|
+
if (err instanceof vendor_http_1.VendorApiError && [401, 403, 404].includes(err.status))
|
|
274
|
+
return [];
|
|
275
|
+
throw err;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
async function optionalGet(http, path) {
|
|
279
|
+
try {
|
|
280
|
+
return (await http.get(path)).body;
|
|
281
|
+
}
|
|
282
|
+
catch (err) {
|
|
283
|
+
if (err instanceof vendor_http_1.VendorApiError && [400, 401, 403, 404].includes(err.status))
|
|
284
|
+
return null;
|
|
285
|
+
throw err;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
//# sourceMappingURL=appwrite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appwrite.js","sourceRoot":"","sources":["../../../src/migrate/export/appwrite.ts"],"names":[],"mappings":";;;AA2CA,wCA0GC;AAwBD,4CAIC;AAqBD,oDA+DC;A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