@open-workspace/create 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/import/directory/command.ts +10 -1
- package/import/directory/google.ts +1 -1
- package/import/idp/command.ts +6 -0
- package/import/idp/okta.ts +3 -1
- package/import/mbox.ts +7 -7
- package/package.json +1 -1
- package/templates.ts +1 -1
|
@@ -190,7 +190,16 @@ async function applyAction(action: Action, context: ApplyContext) {
|
|
|
190
190
|
// The invitation may be saved with its answer lost (the request
|
|
191
191
|
// tried again then finds the address taken): someone here under
|
|
192
192
|
// the address, still invited, gets a new link in its place.
|
|
193
|
-
|
|
193
|
+
// A failed lookup clears the marker too, or every later invitation
|
|
194
|
+
// in this run would find it; a rerun asks again.
|
|
195
|
+
let saved: Awaited<ReturnType<typeof savedInvitationLink>>;
|
|
196
|
+
|
|
197
|
+
try {
|
|
198
|
+
saved = await savedInvitationLink(workspace, action.email);
|
|
199
|
+
} catch (lookupError) {
|
|
200
|
+
invites.clear();
|
|
201
|
+
throw lookupError;
|
|
202
|
+
}
|
|
194
203
|
|
|
195
204
|
if (!saved) {
|
|
196
205
|
invites.clear();
|
|
@@ -229,7 +229,7 @@ export function googleAccessToken(options: GoogleCredentialsOptions) {
|
|
|
229
229
|
|
|
230
230
|
return Promise.reject(
|
|
231
231
|
new Error(
|
|
232
|
-
"The Google credentials are neither a service account key nor a Desktop app OAuth client (see https://openworkspace.dev/docs/migration)"
|
|
232
|
+
"The Google credentials are neither a service account key nor a Desktop app OAuth client (see https://openworkspace.dev/docs/migration-google)"
|
|
233
233
|
)
|
|
234
234
|
);
|
|
235
235
|
}
|
package/import/idp/command.ts
CHANGED
|
@@ -19,6 +19,10 @@ const HELP = `bunx @open-workspace/create import idp <source> --workspace <url>
|
|
|
19
19
|
csv --file <directory.csv> (header: type,name,email,groups)
|
|
20
20
|
saml --file <service provider metadata XML>
|
|
21
21
|
|
|
22
|
+
--groups <list|inbox> What groups with an address become (default list)
|
|
23
|
+
--include-suspended Also import suspended or disabled users
|
|
24
|
+
--invites <file.csv> Where invitation links go (default openworkspace-invitations.csv)
|
|
25
|
+
|
|
22
26
|
Invites people, creates teams and imports supported SSO apps disabled. Existing apps are skipped.
|
|
23
27
|
See https://openworkspace.dev/docs/migration for source permissions and the SSO cutover.`;
|
|
24
28
|
|
|
@@ -40,6 +44,8 @@ export async function idpCommand(args: string[], deps: CliDeps) {
|
|
|
40
44
|
tenant: { type: "string" },
|
|
41
45
|
"client-id": { type: "string" },
|
|
42
46
|
invites: { type: "string" },
|
|
47
|
+
groups: { type: "string" },
|
|
48
|
+
"include-suspended": { type: "boolean" },
|
|
43
49
|
},
|
|
44
50
|
});
|
|
45
51
|
|
package/import/idp/okta.ts
CHANGED
|
@@ -92,7 +92,9 @@ export async function readOkta(org: string, token: string, fetchImpl: Fetch) {
|
|
|
92
92
|
person(
|
|
93
93
|
u.profile.email,
|
|
94
94
|
[u.profile.firstName, u.profile.lastName].filter(Boolean).join(" "),
|
|
95
|
-
|
|
95
|
+
// Locked out, a password expired or being recovered: still people
|
|
96
|
+
// who work here.
|
|
97
|
+
["SUSPENDED", "DEPROVISIONED"].includes(u.status)
|
|
96
98
|
)
|
|
97
99
|
);
|
|
98
100
|
}
|
package/import/mbox.ts
CHANGED
|
@@ -163,7 +163,8 @@ const MONTHS = [
|
|
|
163
163
|
/**
|
|
164
164
|
* The date on an mbox "From " line, in ms: Gmail's Takeout writes when the
|
|
165
165
|
* message arrived there ("From 1781…@xxx Tue Mar 03 10:00:00 +0000 2026").
|
|
166
|
-
*
|
|
166
|
+
* A classic ctime date has no zone and, from Thunderbird, is when the
|
|
167
|
+
* message was copied there: undefined, so the Date header counts instead.
|
|
167
168
|
*/
|
|
168
169
|
export function fromLineDate(fromLine: string) {
|
|
169
170
|
const match =
|
|
@@ -171,7 +172,7 @@ export function fromLineDate(fromLine: string) {
|
|
|
171
172
|
fromLine
|
|
172
173
|
);
|
|
173
174
|
|
|
174
|
-
if (!match) return undefined;
|
|
175
|
+
if (!match?.[6]) return undefined;
|
|
175
176
|
const [, monthName = ""] = match;
|
|
176
177
|
const month = MONTHS.indexOf(monthName.toLowerCase());
|
|
177
178
|
|
|
@@ -188,11 +189,10 @@ export function fromLineDate(fromLine: string) {
|
|
|
188
189
|
|
|
189
190
|
const zone = match[6];
|
|
190
191
|
|
|
191
|
-
const offset =
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
: 0;
|
|
192
|
+
const offset =
|
|
193
|
+
(zone[0] === "-" ? -1 : 1) *
|
|
194
|
+
(Number(zone.slice(1, 3)) * 60 + Number(zone.slice(3, 5))) *
|
|
195
|
+
60_000;
|
|
196
196
|
|
|
197
197
|
return utc - offset;
|
|
198
198
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-workspace/create",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Create an OpenWorkspace deployment (`bun create @open-workspace`), and import people, teams, SSO apps and mail.",
|
|
5
5
|
"homepage": "https://openworkspace.dev",
|
|
6
6
|
"license": "Apache-2.0",
|