@atlasauth/cli 0.10.0 → 0.12.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.
Files changed (145) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/args.d.ts +145 -0
  3. package/dist/args.js +53 -0
  4. package/dist/args.js.map +1 -1
  5. package/dist/commands/admin.d.ts +49 -0
  6. package/dist/commands/admin.js +353 -0
  7. package/dist/commands/admin.js.map +1 -0
  8. package/dist/commands/id-accounts.d.ts +13 -0
  9. package/dist/commands/id-accounts.js +195 -0
  10. package/dist/commands/id-accounts.js.map +1 -0
  11. package/dist/commands/init.js +13 -8
  12. package/dist/commands/init.js.map +1 -1
  13. package/dist/commands/migrate.d.ts +6 -2
  14. package/dist/commands/migrate.js +13 -3
  15. package/dist/commands/migrate.js.map +1 -1
  16. package/dist/config-http.d.ts +2 -0
  17. package/dist/config-http.js +1 -0
  18. package/dist/config-http.js.map +1 -1
  19. package/dist/config.d.ts +2 -0
  20. package/dist/config.js.map +1 -1
  21. package/dist/context.d.ts +1 -0
  22. package/dist/context.js +1 -1
  23. package/dist/context.js.map +1 -1
  24. package/dist/help.d.ts +1 -1
  25. package/dist/help.js +99 -0
  26. package/dist/help.js.map +1 -1
  27. package/dist/migrate/auth0/plugin.d.ts +2 -0
  28. package/dist/migrate/auth0/plugin.js +126 -0
  29. package/dist/migrate/auth0/plugin.js.map +1 -0
  30. package/dist/migrate/clerk/plugin.d.ts +2 -0
  31. package/dist/migrate/clerk/plugin.js +76 -0
  32. package/dist/migrate/clerk/plugin.js.map +1 -0
  33. package/dist/migrate/descope/plugin.d.ts +2 -0
  34. package/dist/migrate/descope/plugin.js +83 -0
  35. package/dist/migrate/descope/plugin.js.map +1 -0
  36. package/dist/migrate/export/auth0-config.d.ts +29 -0
  37. package/dist/migrate/export/auth0-config.js +249 -0
  38. package/dist/migrate/export/auth0-config.js.map +1 -0
  39. package/dist/migrate/export/auth0.d.ts +62 -0
  40. package/dist/migrate/export/auth0.js +575 -0
  41. package/dist/migrate/export/auth0.js.map +1 -0
  42. package/dist/migrate/export/clerk-config.d.ts +26 -0
  43. package/dist/migrate/export/clerk-config.js +227 -0
  44. package/dist/migrate/export/clerk-config.js.map +1 -0
  45. package/dist/migrate/export/clerk.d.ts +46 -0
  46. package/dist/migrate/export/clerk.js +486 -0
  47. package/dist/migrate/export/clerk.js.map +1 -0
  48. package/dist/migrate/export/descope.d.ts +35 -0
  49. package/dist/migrate/export/descope.js +208 -0
  50. package/dist/migrate/export/descope.js.map +1 -0
  51. package/dist/migrate/export/fake-vendor.test-helper.d.ts +27 -0
  52. package/dist/migrate/export/fake-vendor.test-helper.js +41 -0
  53. package/dist/migrate/export/fake-vendor.test-helper.js.map +1 -0
  54. package/dist/migrate/export/frameworks/app-users.d.ts +42 -0
  55. package/dist/migrate/export/frameworks/app-users.js +161 -0
  56. package/dist/migrate/export/frameworks/app-users.js.map +1 -0
  57. package/dist/migrate/export/frameworks/authjs.d.ts +41 -0
  58. package/dist/migrate/export/frameworks/authjs.js +146 -0
  59. package/dist/migrate/export/frameworks/authjs.js.map +1 -0
  60. package/dist/migrate/export/frameworks/devise.d.ts +39 -0
  61. package/dist/migrate/export/frameworks/devise.js +218 -0
  62. package/dist/migrate/export/frameworks/devise.js.map +1 -0
  63. package/dist/migrate/export/frameworks/django.d.ts +45 -0
  64. package/dist/migrate/export/frameworks/django.js +315 -0
  65. package/dist/migrate/export/frameworks/django.js.map +1 -0
  66. package/dist/migrate/export/frameworks/lucia.d.ts +42 -0
  67. package/dist/migrate/export/frameworks/lucia.js +263 -0
  68. package/dist/migrate/export/frameworks/lucia.js.map +1 -0
  69. package/dist/migrate/export/frameworks/tables.d.ts +90 -0
  70. package/dist/migrate/export/frameworks/tables.js +325 -0
  71. package/dist/migrate/export/frameworks/tables.js.map +1 -0
  72. package/dist/migrate/export/frameworks/webauthn.d.ts +25 -0
  73. package/dist/migrate/export/frameworks/webauthn.js +130 -0
  74. package/dist/migrate/export/frameworks/webauthn.js.map +1 -0
  75. package/dist/migrate/export/kinde-descope-config.d.ts +38 -0
  76. package/dist/migrate/export/kinde-descope-config.js +172 -0
  77. package/dist/migrate/export/kinde-descope-config.js.map +1 -0
  78. package/dist/migrate/export/kinde.d.ts +57 -0
  79. package/dist/migrate/export/kinde.js +333 -0
  80. package/dist/migrate/export/kinde.js.map +1 -0
  81. package/dist/migrate/export/okta-config.d.ts +30 -0
  82. package/dist/migrate/export/okta-config.js +205 -0
  83. package/dist/migrate/export/okta-config.js.map +1 -0
  84. package/dist/migrate/export/okta.d.ts +43 -0
  85. package/dist/migrate/export/okta.js +337 -0
  86. package/dist/migrate/export/okta.js.map +1 -0
  87. package/dist/migrate/export/plugin-kit.d.ts +25 -0
  88. package/dist/migrate/export/plugin-kit.js +82 -0
  89. package/dist/migrate/export/plugin-kit.js.map +1 -0
  90. package/dist/migrate/export/record-set.d.ts +44 -0
  91. package/dist/migrate/export/record-set.js +98 -0
  92. package/dist/migrate/export/record-set.js.map +1 -0
  93. package/dist/migrate/export/translate-kit.d.ts +46 -0
  94. package/dist/migrate/export/translate-kit.js +148 -0
  95. package/dist/migrate/export/translate-kit.js.map +1 -0
  96. package/dist/migrate/export/vendor-http.d.ts +46 -0
  97. package/dist/migrate/export/vendor-http.js +138 -0
  98. package/dist/migrate/export/vendor-http.js.map +1 -0
  99. package/dist/migrate/export/zip.d.ts +8 -0
  100. package/dist/migrate/export/zip.js +66 -0
  101. package/dist/migrate/export/zip.js.map +1 -0
  102. package/dist/migrate/framework/builtins.d.ts +2 -0
  103. package/dist/migrate/framework/builtins.js +23 -0
  104. package/dist/migrate/framework/builtins.js.map +1 -0
  105. package/dist/migrate/framework/commands.d.ts +20 -0
  106. package/dist/migrate/framework/commands.js +58 -0
  107. package/dist/migrate/framework/commands.js.map +1 -0
  108. package/dist/migrate/framework/custom.d.ts +12 -0
  109. package/dist/migrate/framework/custom.js +96 -0
  110. package/dist/migrate/framework/custom.js.map +1 -0
  111. package/dist/migrate/framework/orchestrator.d.ts +113 -0
  112. package/dist/migrate/framework/orchestrator.js +531 -0
  113. package/dist/migrate/framework/orchestrator.js.map +1 -0
  114. package/dist/migrate/framework/plugin.d.ts +165 -0
  115. package/dist/migrate/framework/plugin.js +3 -0
  116. package/dist/migrate/framework/plugin.js.map +1 -0
  117. package/dist/migrate/framework/registry.d.ts +11 -0
  118. package/dist/migrate/framework/registry.js +44 -0
  119. package/dist/migrate/framework/registry.js.map +1 -0
  120. package/dist/migrate/framework/report.d.ts +17 -0
  121. package/dist/migrate/framework/report.js +103 -0
  122. package/dist/migrate/framework/report.js.map +1 -0
  123. package/dist/migrate/frameworks/plugins.d.ts +29 -0
  124. package/dist/migrate/frameworks/plugins.js +402 -0
  125. package/dist/migrate/frameworks/plugins.js.map +1 -0
  126. package/dist/migrate/frameworks/report.d.ts +92 -0
  127. package/dist/migrate/frameworks/report.js +207 -0
  128. package/dist/migrate/frameworks/report.js.map +1 -0
  129. package/dist/migrate/frameworks/translate-js.d.ts +5 -0
  130. package/dist/migrate/frameworks/translate-js.js +503 -0
  131. package/dist/migrate/frameworks/translate-js.js.map +1 -0
  132. package/dist/migrate/frameworks/translate-rails-django.d.ts +3 -0
  133. package/dist/migrate/frameworks/translate-rails-django.js +1391 -0
  134. package/dist/migrate/frameworks/translate-rails-django.js.map +1 -0
  135. package/dist/migrate/kinde/plugin.d.ts +2 -0
  136. package/dist/migrate/kinde/plugin.js +105 -0
  137. package/dist/migrate/kinde/plugin.js.map +1 -0
  138. package/dist/migrate/okta/plugin.d.ts +2 -0
  139. package/dist/migrate/okta/plugin.js +105 -0
  140. package/dist/migrate/okta/plugin.js.map +1 -0
  141. package/dist/project.d.ts +1 -0
  142. package/dist/project.js.map +1 -1
  143. package/dist/run.js +4 -0
  144. package/dist/run.js.map +1 -1
  145. package/package.json +7 -6
@@ -0,0 +1,46 @@
1
+ import type { ReportStatus, TranslationReportEntry, TranslationResult } from '../framework/plugin';
2
+ import type { Json } from '../../serialize';
3
+ /**
4
+ * Shared machinery for the vendor CONFIG translators (`atlas migrate <vendor>
5
+ * config`): build the Atlas config-as-code documents (`instance` with its
6
+ * `auth_config`, `oauth_providers`, `roles`, `permissions`, …) and the report
7
+ * line by line, every line naming the vendor setting it came from.
8
+ *
9
+ * Secrets are never copied: a vendor client secret becomes a `${NAME}`
10
+ * placeholder the operator sets before `atlas config import`.
11
+ */
12
+ export declare class ConfigBuilder {
13
+ readonly auth: Record<string, Json>;
14
+ readonly instance: Record<string, Json>;
15
+ readonly collections: Record<string, Json[]>;
16
+ readonly report: TranslationReportEntry[];
17
+ private readonly env;
18
+ readonly providers: Record<string, string>;
19
+ readonly roles: Record<string, string>;
20
+ /** Set `auth_config.<path>` (dotted). */
21
+ set(path: string, value: Json): void;
22
+ add(status: ReportStatus, area: string, setting: string, note: string, atlas?: string): void;
23
+ /** A `${NAME}` placeholder the import interpolates from the environment. */
24
+ placeholder(name: string, purpose: string): string;
25
+ push(collection: keyof ConfigBuilder['collections'] | string, value: Json): void;
26
+ /** An `oauth_providers` entry for a built-in Atlas provider, credentials as placeholders. */
27
+ socialProvider(o: {
28
+ atlasKey: string;
29
+ vendorName: string;
30
+ area: string;
31
+ setting: string;
32
+ clientId?: string;
33
+ scopes?: string[];
34
+ enabled?: boolean;
35
+ allowSignUp?: boolean;
36
+ }): void;
37
+ result(origin: string, extra?: Pick<TranslationResult, 'bridge' | 'lazy'>): TranslationResult;
38
+ }
39
+ /** Social provider names vendors use → Atlas built-in provider keys. */
40
+ export declare const SOCIAL_KEYS: Record<string, string>;
41
+ /** The Atlas key for a vendor's provider name (`oauth_google`, `oauth2:google`, `GOOGLE`, `google-oauth2`), or null. */
42
+ export declare function socialKey(raw: string): string | null;
43
+ /** `Billing Admin` → `billing_admin`. */
44
+ export declare function keyOf(name: string): string;
45
+ /** Atlas's session window: 5 minutes to 90 days. */
46
+ export declare function clampSessionMs(ms: number): number;
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SOCIAL_KEYS = exports.ConfigBuilder = void 0;
4
+ exports.socialKey = socialKey;
5
+ exports.keyOf = keyOf;
6
+ exports.clampSessionMs = clampSessionMs;
7
+ /**
8
+ * Shared machinery for the vendor CONFIG translators (`atlas migrate <vendor>
9
+ * config`): build the Atlas config-as-code documents (`instance` with its
10
+ * `auth_config`, `oauth_providers`, `roles`, `permissions`, …) and the report
11
+ * line by line, every line naming the vendor setting it came from.
12
+ *
13
+ * Secrets are never copied: a vendor client secret becomes a `${NAME}`
14
+ * placeholder the operator sets before `atlas config import`.
15
+ */
16
+ class ConfigBuilder {
17
+ auth = {};
18
+ instance = {};
19
+ collections = {
20
+ oauth_providers: [],
21
+ custom_oauth_providers: [],
22
+ permissions: [],
23
+ roles: [],
24
+ oauth_clients: [],
25
+ resource_servers: [],
26
+ redirect_urls: [],
27
+ jwt_templates: [],
28
+ };
29
+ report = [];
30
+ env = new Map();
31
+ providers = {};
32
+ roles = {};
33
+ /** Set `auth_config.<path>` (dotted). */
34
+ set(path, value) {
35
+ const keys = path.split('.');
36
+ let node = this.auth;
37
+ for (const k of keys.slice(0, -1)) {
38
+ const next = node[k];
39
+ if (!next || typeof next !== 'object' || Array.isArray(next))
40
+ node[k] = {};
41
+ node = node[k];
42
+ }
43
+ node[keys[keys.length - 1]] = value;
44
+ }
45
+ add(status, area, setting, note, atlas) {
46
+ this.report.push({ status, area, setting, note, ...(atlas ? { atlas } : {}) });
47
+ }
48
+ /** A `${NAME}` placeholder the import interpolates from the environment. */
49
+ placeholder(name, purpose) {
50
+ this.env.set(name, purpose);
51
+ return `\${${name}}`;
52
+ }
53
+ push(collection, value) {
54
+ (this.collections[collection] ??= []).push(value);
55
+ }
56
+ /** An `oauth_providers` entry for a built-in Atlas provider, credentials as placeholders. */
57
+ socialProvider(o) {
58
+ const upper = o.atlasKey.toUpperCase().replace(/[^A-Z0-9]+/g, '_');
59
+ if (this.collections.oauth_providers.some((p) => p.provider === o.atlasKey))
60
+ return;
61
+ const entry = {
62
+ provider: o.atlasKey,
63
+ enabled: o.enabled !== false,
64
+ allow_sign_in: true,
65
+ allow_sign_up: o.allowSignUp !== false,
66
+ client_id: o.clientId ?? this.placeholder(`${upper}_CLIENT_ID`, `${o.vendorName} client id`),
67
+ client_secret: this.placeholder(`${upper}_CLIENT_SECRET`, `${o.vendorName} client secret`),
68
+ };
69
+ if (o.scopes?.length)
70
+ entry.scopes = o.scopes;
71
+ this.push('oauth_providers', entry);
72
+ this.providers[o.vendorName] = o.atlasKey;
73
+ this.add(o.clientId ? 'differs' : 'manual', o.area, o.setting, `${o.vendorName} sign-in becomes Atlas's built-in "${o.atlasKey}" provider. Keep the same OAuth app so imported accounts relink by provider user id; add Atlas's callback URL to it${o.clientId ? '' : ', and set the client id'} and set ${upper}_CLIENT_SECRET (secrets are never copied).`, `oauth_providers ${o.atlasKey}`);
74
+ }
75
+ result(origin, extra = {}) {
76
+ const documents = {};
77
+ const instance = { ...this.instance };
78
+ if (Object.keys(this.auth).length)
79
+ instance.auth_config = this.auth;
80
+ if (Object.keys(instance).length)
81
+ documents.instance = instance;
82
+ for (const [type, list] of Object.entries(this.collections))
83
+ if (list.length)
84
+ documents[type] = list;
85
+ return {
86
+ origin,
87
+ documents,
88
+ report: this.report,
89
+ env: [...this.env.entries()].map(([name, purpose]) => ({ name, for: purpose })),
90
+ mappings: { providers: this.providers, roles: this.roles },
91
+ ...extra,
92
+ };
93
+ }
94
+ }
95
+ exports.ConfigBuilder = ConfigBuilder;
96
+ /** Social provider names vendors use → Atlas built-in provider keys. */
97
+ exports.SOCIAL_KEYS = {
98
+ google: 'google',
99
+ 'google-oauth2': 'google',
100
+ github: 'github',
101
+ gitlab: 'gitlab',
102
+ facebook: 'facebook',
103
+ apple: 'apple',
104
+ microsoft: 'microsoft',
105
+ windowslive: 'microsoft',
106
+ 'microsoft-account': 'microsoft',
107
+ azure_ad: 'microsoft',
108
+ linkedin: 'linkedin',
109
+ linkedin_oidc: 'linkedin',
110
+ twitter: 'x',
111
+ x: 'x',
112
+ discord: 'discord',
113
+ slack: 'slack',
114
+ spotify: 'spotify',
115
+ twitch: 'twitch',
116
+ bitbucket: 'bitbucket',
117
+ dropbox: 'dropbox',
118
+ notion: 'notion',
119
+ salesforce: 'salesforce',
120
+ paypal: 'paypal',
121
+ amazon: 'amazon',
122
+ tiktok: 'tiktok',
123
+ line: 'line',
124
+ zoom: 'zoom',
125
+ figma: 'figma',
126
+ hubspot: 'hubspot',
127
+ atlassian: 'atlassian',
128
+ coinbase: 'coinbase',
129
+ box: 'box',
130
+ yahoo: 'yahoo',
131
+ roblox: 'roblox',
132
+ reddit: 'reddit',
133
+ };
134
+ /** The Atlas key for a vendor's provider name (`oauth_google`, `oauth2:google`, `GOOGLE`, `google-oauth2`), or null. */
135
+ function socialKey(raw) {
136
+ const k = raw.toLowerCase().replace(/^oauth2?[_:]/, '').replace(/^oauth_/, '');
137
+ return exports.SOCIAL_KEYS[k] ?? null;
138
+ }
139
+ /** `Billing Admin` → `billing_admin`. */
140
+ function keyOf(name) {
141
+ return name.trim().toLowerCase().replace(/[^a-z0-9:]+/g, '_').replace(/^_+|_+$/g, '') || 'role';
142
+ }
143
+ const MIN = 60_000;
144
+ /** Atlas's session window: 5 minutes to 90 days. */
145
+ function clampSessionMs(ms) {
146
+ return Math.min(Math.max(ms, 5 * MIN), 90 * 24 * 60 * MIN);
147
+ }
148
+ //# sourceMappingURL=translate-kit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translate-kit.js","sourceRoot":"","sources":["../../../src/migrate/export/translate-kit.ts"],"names":[],"mappings":";;;AAkJA,8BAGC;AAGD,sBAEC;AAID,wCAEC;AA7JD;;;;;;;;GAQG;AACH,MAAa,aAAa;IACf,IAAI,GAAyB,EAAE,CAAC;IAChC,QAAQ,GAAyB,EAAE,CAAC;IACpC,WAAW,GAA2B;QAC7C,eAAe,EAAE,EAAE;QACnB,sBAAsB,EAAE,EAAE;QAC1B,W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SAAS,EAAE,EAAE,CAAC,CAAC;IAC/E,OAAO,mBAAW,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AAChC,CAAC;AAED,yCAAyC;AACzC,SAAgB,KAAK,CAAC,IAAY;IAChC,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC;AAClG,CAAC;AAED,MAAM,GAAG,GAAG,MAAM,CAAC;AACnB,oDAAoD;AACpD,SAAgB,cAAc,CAAC,EAAU;IACvC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * The HTTP side of `atlas migrate export <vendor>`: calls the OLD vendor's
3
+ * management API from the owner's machine, with the owner's vendor
4
+ * credentials. Nothing here talks to Atlas, and no vendor credential is ever
5
+ * written into a bundle or sent anywhere but the vendor.
6
+ *
7
+ * Shared by every vendor exporter: JSON requests, a bounded retry on 429 and
8
+ * 5xx that honours `Retry-After` (and the `X-RateLimit-Reset` epoch some
9
+ * vendors send instead), and errors that name the call without echoing a
10
+ * credential.
11
+ */
12
+ export declare class VendorApiError extends Error {
13
+ readonly vendor: string;
14
+ readonly status: number;
15
+ readonly path: string;
16
+ constructor(vendor: string, status: number, path: string, detail: string);
17
+ }
18
+ export interface VendorHttpOptions {
19
+ vendor: string;
20
+ baseUrl: string;
21
+ /** Headers on every call (the authorization header lives here, never in a URL). */
22
+ headers?: Record<string, string> | (() => Promise<Record<string, string>> | Record<string, string>);
23
+ fetchImpl?: typeof fetch;
24
+ sleep?: (ms: number) => Promise<void>;
25
+ /** Attempts per call on 429/5xx, the first included. */
26
+ attempts?: number;
27
+ now?: () => number;
28
+ }
29
+ export interface VendorResponse<T> {
30
+ status: number;
31
+ body: T;
32
+ headers: Headers;
33
+ }
34
+ export declare class VendorHttp {
35
+ private readonly o;
36
+ constructor(o: VendorHttpOptions);
37
+ get vendor(): string;
38
+ url(path: string): string;
39
+ get<T>(path: string): Promise<VendorResponse<T>>;
40
+ post<T>(path: string, body: unknown): Promise<VendorResponse<T>>;
41
+ request<T>(method: string, path: string, body?: unknown): Promise<VendorResponse<T>>;
42
+ private waitFor;
43
+ private now;
44
+ }
45
+ /** The `rel="next"` URL of an RFC 8288 `Link` header (Okta's pagination). */
46
+ export declare function nextLink(header: string | null): string | null;
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+ /**
3
+ * The HTTP side of `atlas migrate export <vendor>`: calls the OLD vendor's
4
+ * management API from the owner's machine, with the owner's vendor
5
+ * credentials. Nothing here talks to Atlas, and no vendor credential is ever
6
+ * written into a bundle or sent anywhere but the vendor.
7
+ *
8
+ * Shared by every vendor exporter: JSON requests, a bounded retry on 429 and
9
+ * 5xx that honours `Retry-After` (and the `X-RateLimit-Reset` epoch some
10
+ * vendors send instead), and errors that name the call without echoing a
11
+ * credential.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.VendorHttp = exports.VendorApiError = void 0;
15
+ exports.nextLink = nextLink;
16
+ class VendorApiError extends Error {
17
+ vendor;
18
+ status;
19
+ path;
20
+ constructor(vendor, status, path, detail) {
21
+ super(`${vendor} API ${status} on ${path}${detail ? `: ${detail}` : ''}`);
22
+ this.vendor = vendor;
23
+ this.status = status;
24
+ this.path = path;
25
+ }
26
+ }
27
+ exports.VendorApiError = VendorApiError;
28
+ const MAX_WAIT_MS = 60_000;
29
+ class VendorHttp {
30
+ o;
31
+ constructor(o) {
32
+ this.o = o;
33
+ }
34
+ get vendor() {
35
+ return this.o.vendor;
36
+ }
37
+ url(path) {
38
+ return /^https:\/\//.test(path) ? path : `${this.o.baseUrl.replace(/\/+$/, '')}${path.startsWith('/') ? '' : '/'}${path}`;
39
+ }
40
+ async get(path) {
41
+ return this.request('GET', path);
42
+ }
43
+ async post(path, body) {
44
+ return this.request('POST', path, body);
45
+ }
46
+ async request(method, path, body) {
47
+ const fetchImpl = this.o.fetchImpl ?? fetch;
48
+ const sleep = this.o.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
49
+ const attempts = Math.max(1, this.o.attempts ?? 5);
50
+ const display = path.split('?')[0].replace(/^https:\/\/[^/]+/, '');
51
+ for (let attempt = 1;; attempt++) {
52
+ const extra = typeof this.o.headers === 'function' ? await this.o.headers() : this.o.headers;
53
+ const headers = { accept: 'application/json', ...extra };
54
+ if (body !== undefined)
55
+ headers['content-type'] = 'application/json';
56
+ let res;
57
+ try {
58
+ res = await fetchImpl(this.url(path), {
59
+ method,
60
+ headers,
61
+ body: body === undefined ? undefined : JSON.stringify(body),
62
+ });
63
+ }
64
+ catch (err) {
65
+ if (attempt < attempts) {
66
+ await sleep(backoff(attempt));
67
+ continue;
68
+ }
69
+ throw new VendorApiError(this.o.vendor, 0, display, err instanceof Error ? err.message : String(err));
70
+ }
71
+ if ((res.status === 429 || res.status >= 500) && attempt < attempts) {
72
+ await sleep(this.waitFor(res, attempt));
73
+ continue;
74
+ }
75
+ const text = await res.text();
76
+ let parsed = null;
77
+ if (text) {
78
+ try {
79
+ parsed = JSON.parse(text);
80
+ }
81
+ catch {
82
+ parsed = text;
83
+ }
84
+ }
85
+ if (res.status < 200 || res.status >= 300) {
86
+ throw new VendorApiError(this.o.vendor, res.status, display, errorDetail(parsed));
87
+ }
88
+ return { status: res.status, body: parsed, headers: res.headers };
89
+ }
90
+ }
91
+ waitFor(res, attempt) {
92
+ const retryAfter = res.headers.get('retry-after');
93
+ if (retryAfter) {
94
+ const secs = Number(retryAfter);
95
+ if (Number.isFinite(secs))
96
+ return Math.min(Math.max(secs * 1000, 0), MAX_WAIT_MS);
97
+ const at = Date.parse(retryAfter);
98
+ if (Number.isFinite(at))
99
+ return Math.min(Math.max(at - this.now(), 0), MAX_WAIT_MS);
100
+ }
101
+ const reset = Number(res.headers.get('x-ratelimit-reset'));
102
+ if (Number.isFinite(reset) && reset > 1e9) {
103
+ return Math.min(Math.max(reset * 1000 - this.now(), 250), MAX_WAIT_MS);
104
+ }
105
+ return backoff(attempt);
106
+ }
107
+ now() {
108
+ return (this.o.now ?? Date.now)();
109
+ }
110
+ }
111
+ exports.VendorHttp = VendorHttp;
112
+ function backoff(attempt) {
113
+ return Math.min(500 * 2 ** (attempt - 1), MAX_WAIT_MS);
114
+ }
115
+ /** A short, credential-free description of a vendor error body. */
116
+ function errorDetail(body) {
117
+ if (typeof body === 'string')
118
+ return body.slice(0, 200);
119
+ if (!body || typeof body !== 'object')
120
+ return '';
121
+ const b = body;
122
+ const first = Array.isArray(b.errors) ? b.errors[0] : undefined;
123
+ const pick = [b.message, b.error_description, b.errorSummary, b.errorDescription, first?.long_message, first?.message, b.error, b.errorCode];
124
+ const found = pick.find((v) => typeof v === 'string' && v);
125
+ return typeof found === 'string' ? found.slice(0, 200) : '';
126
+ }
127
+ /** The `rel="next"` URL of an RFC 8288 `Link` header (Okta's pagination). */
128
+ function nextLink(header) {
129
+ if (!header)
130
+ return null;
131
+ for (const part of header.split(',')) {
132
+ const m = /<([^>]+)>\s*;\s*rel="?next"?/.exec(part.trim());
133
+ if (m)
134
+ return m[1];
135
+ }
136
+ return null;
137
+ }
138
+ //# sourceMappingURL=vendor-http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vendor-http.js","sourceRoot":"","sources":["../../../src/migrate/export/vendor-http.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAmIH,4BAOC;AAxID,MAAa,cAAe,SAAQ,KAAK;IAE5B;IACA;IACA;IAHX,YACW,MAAc,EACd,MAAc,EACd,IAAY,EACrB,MAAc;QAEd,KAAK,CAAC,GAAG,MAAM,QAAQ,MAAM,OAAO,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,M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0 +1,8 @@
1
+ /**
2
+ * Read the files of a ZIP archive held in memory (stored or deflated entries,
3
+ * via the central directory). Enough for a vendor's data-export archive; no
4
+ * dependency. Refuses ZIP64, encryption and sizes past `maxBytes` per entry.
5
+ */
6
+ export declare function readZip(buf: Buffer, maxBytes?: number): Map<string, Buffer>;
7
+ /** A file in the archive by its base name (exports often nest files in a folder). */
8
+ export declare function zipFile(files: Map<string, Buffer>, baseName: string): Buffer | undefined;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.readZip = readZip;
4
+ exports.zipFile = zipFile;
5
+ const node_zlib_1 = require("node:zlib");
6
+ /**
7
+ * Read the files of a ZIP archive held in memory (stored or deflated entries,
8
+ * via the central directory). Enough for a vendor's data-export archive; no
9
+ * dependency. Refuses ZIP64, encryption and sizes past `maxBytes` per entry.
10
+ */
11
+ function readZip(buf, maxBytes = 2 * 1024 ** 3) {
12
+ const out = new Map();
13
+ // End of central directory: signature 0x06054b50, within the last 64 KiB + 22.
14
+ let eocd = -1;
15
+ for (let i = buf.length - 22; i >= Math.max(0, buf.length - 65_557); i--) {
16
+ if (buf.readUInt32LE(i) === 0x06054b50) {
17
+ eocd = i;
18
+ break;
19
+ }
20
+ }
21
+ if (eocd < 0)
22
+ throw new Error('Not a ZIP archive (no end-of-central-directory record).');
23
+ const entries = buf.readUInt16LE(eocd + 10);
24
+ let p = buf.readUInt32LE(eocd + 16);
25
+ if (p === 0xffffffff)
26
+ throw new Error('ZIP64 archives are not supported; extract the files and pass them directly.');
27
+ for (let n = 0; n < entries; n++) {
28
+ if (buf.readUInt32LE(p) !== 0x02014b50)
29
+ throw new Error('Corrupt ZIP central directory.');
30
+ const flags = buf.readUInt16LE(p + 8);
31
+ const method = buf.readUInt16LE(p + 10);
32
+ const compressed = buf.readUInt32LE(p + 20);
33
+ const size = buf.readUInt32LE(p + 24);
34
+ const nameLen = buf.readUInt16LE(p + 28);
35
+ const extraLen = buf.readUInt16LE(p + 30);
36
+ const commentLen = buf.readUInt16LE(p + 32);
37
+ const local = buf.readUInt32LE(p + 42);
38
+ const name = buf.subarray(p + 46, p + 46 + nameLen).toString('utf8');
39
+ p += 46 + nameLen + extraLen + commentLen;
40
+ if (name.endsWith('/'))
41
+ continue;
42
+ if (flags & 0x1)
43
+ throw new Error(`ZIP entry ${name} is encrypted.`);
44
+ if (size > maxBytes)
45
+ throw new Error(`ZIP entry ${name} is too large.`);
46
+ if (buf.readUInt32LE(local) !== 0x04034b50)
47
+ throw new Error('Corrupt ZIP local header.');
48
+ const start = local + 30 + buf.readUInt16LE(local + 26) + buf.readUInt16LE(local + 28);
49
+ const data = buf.subarray(start, start + compressed);
50
+ if (method === 0)
51
+ out.set(name, Buffer.from(data));
52
+ else if (method === 8)
53
+ out.set(name, (0, node_zlib_1.inflateRawSync)(data, { maxOutputLength: Math.max(size, 1) }));
54
+ else
55
+ throw new Error(`ZIP entry ${name} uses compression method ${method}, which is not supported.`);
56
+ }
57
+ return out;
58
+ }
59
+ /** A file in the archive by its base name (exports often nest files in a folder). */
60
+ function zipFile(files, baseName) {
61
+ for (const [name, data] of files)
62
+ if (name === baseName || name.endsWith(`/${baseName}`))
63
+ return data;
64
+ return undefined;
65
+ }
66
+ //# sourceMappingURL=zip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zip.js","sourceRoot":"","sources":["../../../src/migrate/export/zip.ts"],"names":[],"mappings":";;AAOA,0BAqCC;AAGD,0BAGC;AAlDD,yCAA2C;AAE3C;;;;GAIG;AACH,SAAgB,OAAO,CAAC,GAAW,EAAE,QAAQ,GAAG,CAAC,GAAG,IAAI,IAAI,CAAC;IAC3D,MAAM,GAAG,GAAG,IAAI,GAAG,EAAkB,CAAC;IACtC,+EAA+E;IAC/E,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC;IACd,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,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IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;;YAC9F,MAAM,IAAI,KAAK,CAAC,aAAa,IAAI,4BAA4B,MAAM,2BAA2B,CAAC,CAAC;IACvG,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,qFAAqF;AACrF,SAAgB,OAAO,CAAC,KAA0B,EAAE,QAAgB;IAClE,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,KAAK;QAAE,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,QAAQ,EAAE,CAAC;YAAE,OAAO,IAAI,CAAC;IACtG,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,2 @@
1
+ /** Register the built-in plugins (idempotent: an already registered vendor is left as it is). */
2
+ export declare function registerBuiltInPlugins(): void;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerBuiltInPlugins = registerBuiltInPlugins;
4
+ const plugin_1 = require("../auth0/plugin");
5
+ const plugin_2 = require("../clerk/plugin");
6
+ const plugin_3 = require("../descope/plugin");
7
+ const plugin_4 = require("../kinde/plugin");
8
+ const plugin_5 = require("../okta/plugin");
9
+ const plugins_1 = require("../frameworks/plugins");
10
+ const custom_1 = require("./custom");
11
+ const registry_1 = require("./registry");
12
+ /**
13
+ * The plugins `atlas migrate <vendor>` ships with. A vendor track adds one
14
+ * line here (its plugin module lives under src/migrate/<vendor>/).
15
+ */
16
+ const BUILT_IN_PLUGINS = [custom_1.customPlugin, plugin_2.clerkPlugin, plugin_1.auth0Plugin, plugin_5.oktaPlugin, plugin_4.kindePlugin, plugin_3.descopePlugin, ...plugins_1.FRAMEWORK_PLUGINS];
17
+ /** Register the built-in plugins (idempotent: an already registered vendor is left as it is). */
18
+ function registerBuiltInPlugins() {
19
+ for (const plugin of BUILT_IN_PLUGINS)
20
+ if (!(0, registry_1.hasMigrationPlugin)(plugin.vendor))
21
+ (0, registry_1.registerMigrationPlugin)(plugin);
22
+ }
23
+ //# sourceMappingURL=builtins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtins.js","sourceRoot":"","sources":["../../../src/migrate/framework/builtins.ts"],"names":[],"mappings":";;AAgBA,wDAEC;AAlBD,4CAA8C;AAC9C,4CAA8C;AAC9C,8CAAkD;AAClD,4CAA8C;AAC9C,2CAA4C;AAC5C,mDAA0D;AAC1D,qCAAwC;AACxC,yCAAyE;AAEzE;;;GAGG;AACH,MAAM,gBAAgB,GAAG,CAAC,qBAAY,EAAE,oBAAW,EAAE,oBAAW,EAAE,mBAAU,EAAE,oBAAW,EAAE,sBAAa,EAAE,GAAG,2BAAiB,CAAC,CAAC;AAEhI,iGAAiG;AACjG,SAAgB,sBAAsB;IACpC,KAAK,MAAM,MAAM,IAAI,gBAAgB;QAAE,IAAI,CAAC,IAAA,6BAAkB,EAAC,MAAM,CAAC,MAAM,CAAC;YAAE,IAAA,kCAAuB,EAAC,MAAM,CAAC,CAAC;AACjH,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { ParsedArgs } from '../../args';
2
+ import type { RunContext } from '../../context';
3
+ /**
4
+ * `atlas migrate <vendor> [step] [path]` and `atlas migrate export <vendor> [path]`
5
+ * for every vendor with a plugin. With no step the whole program runs (see
6
+ * orchestrator.ts); a step runs on its own, reading and updating the same
7
+ * state file, so `export` today and `import` tomorrow work.
8
+ */
9
+ /** Steps a user can run on their own. */
10
+ export declare const SINGLE_STEPS: readonly ["config", "export", "import", "bridge", "lazy", "verify"];
11
+ export declare function knownVendors(): string[];
12
+ /** True when `vendor` names a registered plugin. */
13
+ export declare function hasPlugin(vendor: string | undefined): boolean;
14
+ /**
15
+ * Dispatch `atlas migrate <vendor> …`. `positionals` are the words after
16
+ * `migrate` (`[vendor, step?, path?]`); a word that is not a step is the path.
17
+ */
18
+ export declare function migrateWithPlugin(ctx: RunContext, args: ParsedArgs, vendor: string, rest: string[]): Promise<number>;
19
+ /** `atlas migrate export <vendor> [path]` — an alias of `atlas migrate <vendor> export [path]`. */
20
+ export declare function migrateExportAlias(ctx: RunContext, args: ParsedArgs, rest: string[]): Promise<number>;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SINGLE_STEPS = void 0;
4
+ exports.knownVendors = knownVendors;
5
+ exports.hasPlugin = hasPlugin;
6
+ exports.migrateWithPlugin = migrateWithPlugin;
7
+ exports.migrateExportAlias = migrateExportAlias;
8
+ const errors_1 = require("../../errors");
9
+ const builtins_1 = require("./builtins");
10
+ const orchestrator_1 = require("./orchestrator");
11
+ const registry_1 = require("./registry");
12
+ /**
13
+ * `atlas migrate <vendor> [step] [path]` and `atlas migrate export <vendor> [path]`
14
+ * for every vendor with a plugin. With no step the whole program runs (see
15
+ * orchestrator.ts); a step runs on its own, reading and updating the same
16
+ * state file, so `export` today and `import` tomorrow work.
17
+ */
18
+ /** Steps a user can run on their own. */
19
+ exports.SINGLE_STEPS = ['config', 'export', 'import', 'bridge', 'lazy', 'verify'];
20
+ function knownVendors() {
21
+ (0, builtins_1.registerBuiltInPlugins)();
22
+ return (0, registry_1.migrationPlugins)().map((p) => p.vendor);
23
+ }
24
+ /** True when `vendor` names a registered plugin. */
25
+ function hasPlugin(vendor) {
26
+ (0, builtins_1.registerBuiltInPlugins)();
27
+ return !!vendor && !!(0, registry_1.migrationPlugin)(vendor);
28
+ }
29
+ /**
30
+ * Dispatch `atlas migrate <vendor> …`. `positionals` are the words after
31
+ * `migrate` (`[vendor, step?, path?]`); a word that is not a step is the path.
32
+ */
33
+ async function migrateWithPlugin(ctx, args, vendor, rest) {
34
+ (0, builtins_1.registerBuiltInPlugins)();
35
+ const plugin = (0, registry_1.migrationPlugin)(vendor);
36
+ if (!plugin)
37
+ throw new errors_1.CliError(`No migration plugin for '${vendor}'. Vendors: ${knownVendors().join(', ')}, better-auth.`);
38
+ const [first, second] = rest;
39
+ const step = first && exports.SINGLE_STEPS.includes(first) ? first : undefined;
40
+ const path = step ? second : first;
41
+ if (step === 'config' && !plugin.config)
42
+ throw new errors_1.CliError(`${plugin.label} has no configuration translator yet.`);
43
+ if ((step === 'export' || step === 'import') && !plugin.export)
44
+ throw new errors_1.CliError(`${plugin.label} has no exporter yet.`);
45
+ if (step === 'bridge' && !plugin.bridge)
46
+ throw new errors_1.CliError(`${plugin.label} has no session bridge preset.`);
47
+ if (step === 'lazy' && !plugin.lazy)
48
+ throw new errors_1.CliError(`${plugin.label} has no lazy-migration preset.`);
49
+ return (0, orchestrator_1.migrateVendor)(ctx, args, plugin, path, step);
50
+ }
51
+ /** `atlas migrate export <vendor> [path]` — an alias of `atlas migrate <vendor> export [path]`. */
52
+ async function migrateExportAlias(ctx, args, rest) {
53
+ const [vendor, path] = rest;
54
+ if (!vendor)
55
+ throw new errors_1.CliError(`migrate export needs a vendor: ${knownVendors().join(', ')}.`);
56
+ return migrateWithPlugin(ctx, args, vendor, path ? ['export', path] : ['export']);
57
+ }
58
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../src/migrate/framework/commands.ts"],"names":[],"mappings":";;;AAiBA,oCAGC;AAGD,8BAGC;AAMD,8CAYC;AAGD,gDAIC;AAjDD,yCAAwC;AACxC,yCAAoD;AACpD,iDAAkE;AAClE,yCAA+D;AAE/D;;;;;GAKG;AAEH,yCAAyC;AAC5B,QAAA,YAAY,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAU,CAAC;AAEhG,SAAgB,YAAY;IAC1B,IAAA,iCAAsB,GAAE,CAAC;IACzB,OAAO,IAAA,2BAAgB,GAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AACjD,CAAC;AAED,oDAAoD;AACpD,SAAgB,SAAS,CAAC,M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,MAAM,CAAC,IAAI;QAAE,MAAM,IAAI,iBAAQ,CAAC,GAAG,MAAM,CAAC,KAAK,gCAAgC,CAAC,CAAC;IACzG,OAAO,IAAA,4BAAa,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACtD,CAAC;AAED,mGAAmG;AAC5F,KAAK,UAAU,kBAAkB,CAAC,GAAe,EAAE,IAAgB,EAAE,IAAc;IACxF,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC;IAC5B,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,iBAAQ,CAAC,kCAAkC,YAAY,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChG,OAAO,iBAAiB,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;AACpF,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { type CanonicalModel } from '@atlasauth/migrate';
2
+ import type { MigrationPlugin } from './plugin';
3
+ export interface CanonicalFileRecord {
4
+ model: CanonicalModel;
5
+ data: Record<string, unknown>;
6
+ }
7
+ /** Parse NDJSON or a JSON array of `{ model, data }`. Unknown models are returned in `unknown`. */
8
+ export declare function parseCanonicalRecords(text: string): {
9
+ records: CanonicalFileRecord[];
10
+ unknown: Record<string, number>;
11
+ };
12
+ export declare const customPlugin: MigrationPlugin;