instant-cli 1.0.21-branch-cli-codex.25190871505.1 → 1.0.21-branch-cli-codex-update.25190875900.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/.turbo/turbo-build.log +1 -1
- package/__tests__/authClientAddGoogle.test.ts +1 -2
- package/__tests__/authClientUpdate.test.ts +442 -0
- package/dist/commands/auth/client/add.d.ts.map +1 -1
- package/dist/commands/auth/client/add.js +2 -1
- package/dist/commands/auth/client/add.js.map +1 -1
- package/dist/commands/auth/client/update.d.ts +10 -0
- package/dist/commands/auth/client/update.d.ts.map +1 -0
- package/dist/commands/auth/client/update.js +587 -0
- package/dist/commands/auth/client/update.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/oauth.d.ts +63 -0
- package/dist/lib/oauth.d.ts.map +1 -1
- package/dist/lib/oauth.js +40 -0
- package/dist/lib/oauth.js.map +1 -1
- package/package.json +4 -4
- package/src/commands/auth/client/add.ts +2 -1
- package/src/commands/auth/client/update.ts +806 -0
- package/src/index.ts +63 -0
- package/src/lib/oauth.ts +60 -0
package/src/index.ts
CHANGED
|
@@ -29,6 +29,7 @@ import { PACKAGE_ALIAS_AND_FULL_NAMES } from './context/projectInfo.ts';
|
|
|
29
29
|
import { authClientAddCmd } from './commands/auth/client/add.ts';
|
|
30
30
|
import { authClientListCmd } from './commands/auth/client/list.ts';
|
|
31
31
|
import { authClientDeleteCmd } from './commands/auth/client/delete.ts';
|
|
32
|
+
import { authClientUpdateCmd } from './commands/auth/client/update.ts';
|
|
32
33
|
import { authOriginListCmd } from './commands/auth/origin/list.ts';
|
|
33
34
|
import { authOriginDeleteCmd } from './commands/auth/origin/delete.ts';
|
|
34
35
|
import { authOriginAddCmd } from './commands/auth/origin/add.ts';
|
|
@@ -198,6 +199,68 @@ export const authClientDeleteDef = authClient
|
|
|
198
199
|
);
|
|
199
200
|
});
|
|
200
201
|
|
|
202
|
+
export const authClientUpdateDef = authClient
|
|
203
|
+
.command('update')
|
|
204
|
+
.description('Update an OAuth client')
|
|
205
|
+
.allowExcessArguments(true)
|
|
206
|
+
.allowUnknownOption(true)
|
|
207
|
+
.option('--id <client-id>', 'Client ID to update')
|
|
208
|
+
.option('--name <client-name>', 'Client name to update')
|
|
209
|
+
.option(
|
|
210
|
+
'-a --app <app-id>',
|
|
211
|
+
'App ID to update a client in. Defaults to *_INSTANT_APP_ID in .env',
|
|
212
|
+
)
|
|
213
|
+
.option(
|
|
214
|
+
'--dev-credentials',
|
|
215
|
+
'Switch a Google web client to Instant dev credentials.',
|
|
216
|
+
)
|
|
217
|
+
.addHelpText(
|
|
218
|
+
'after',
|
|
219
|
+
`
|
|
220
|
+
Provider Specific Options:
|
|
221
|
+
Google:
|
|
222
|
+
--dev-credentials (web only)
|
|
223
|
+
--client-id
|
|
224
|
+
--client-secret (web only)
|
|
225
|
+
--custom-redirect-uri (optional, web only)
|
|
226
|
+
GitHub:
|
|
227
|
+
--client-id
|
|
228
|
+
--client-secret
|
|
229
|
+
--custom-redirect-uri (optional)
|
|
230
|
+
Apple:
|
|
231
|
+
--services-id
|
|
232
|
+
--team-id (web redirect flow)
|
|
233
|
+
--key-id (web redirect flow)
|
|
234
|
+
--private-key-file (web redirect flow)
|
|
235
|
+
--custom-redirect-uri (optional, web redirect flow only)
|
|
236
|
+
LinkedIn:
|
|
237
|
+
--client-id
|
|
238
|
+
--client-secret
|
|
239
|
+
--custom-redirect-uri (optional)
|
|
240
|
+
Clerk:
|
|
241
|
+
--publishable-key
|
|
242
|
+
Firebase:
|
|
243
|
+
--project-id
|
|
244
|
+
`,
|
|
245
|
+
)
|
|
246
|
+
.action((opts) => {
|
|
247
|
+
opts = {
|
|
248
|
+
...opts,
|
|
249
|
+
...minimist(process.argv),
|
|
250
|
+
};
|
|
251
|
+
return runCommandEffect(
|
|
252
|
+
authClientUpdateCmd(opts).pipe(
|
|
253
|
+
Effect.provide(
|
|
254
|
+
WithAppLayer({
|
|
255
|
+
coerce: false,
|
|
256
|
+
appId: opts.app,
|
|
257
|
+
allowAdminToken: true,
|
|
258
|
+
}),
|
|
259
|
+
),
|
|
260
|
+
),
|
|
261
|
+
);
|
|
262
|
+
});
|
|
263
|
+
|
|
201
264
|
const authOrigin = auth.command('origin');
|
|
202
265
|
export const authOriginListDef = authOrigin
|
|
203
266
|
.command('list')
|
package/src/lib/oauth.ts
CHANGED
|
@@ -143,6 +143,35 @@ export const addOAuthClient = Effect.fn(function* (params: {
|
|
|
143
143
|
);
|
|
144
144
|
});
|
|
145
145
|
|
|
146
|
+
export const updateOAuthClient = Effect.fn(function* (params: {
|
|
147
|
+
appId?: string;
|
|
148
|
+
oauthClientId: string;
|
|
149
|
+
clientId?: string;
|
|
150
|
+
clientSecret?: string;
|
|
151
|
+
discoveryEndpoint?: string;
|
|
152
|
+
redirectTo?: string | null;
|
|
153
|
+
meta?: unknown;
|
|
154
|
+
useSharedCredentials?: boolean;
|
|
155
|
+
}) {
|
|
156
|
+
const http = (yield* InstantHttpAuthed).pipe(withCommand('auth'));
|
|
157
|
+
const targetAppId = params.appId ?? (yield* CurrentApp).appId;
|
|
158
|
+
|
|
159
|
+
return yield* http
|
|
160
|
+
.post(`/dash/apps/${targetAppId}/oauth_clients/${params.oauthClientId}`, {
|
|
161
|
+
body: HttpBody.unsafeJson({
|
|
162
|
+
client_id: params.clientId,
|
|
163
|
+
client_secret: params.clientSecret,
|
|
164
|
+
discovery_endpoint: params.discoveryEndpoint,
|
|
165
|
+
redirect_to: params.redirectTo,
|
|
166
|
+
meta: params.meta,
|
|
167
|
+
use_shared_credentials: params.useSharedCredentials,
|
|
168
|
+
}),
|
|
169
|
+
})
|
|
170
|
+
.pipe(
|
|
171
|
+
Effect.flatMap(HttpClientResponse.schemaBodyJson(AddOAuthClientResponse)),
|
|
172
|
+
);
|
|
173
|
+
});
|
|
174
|
+
|
|
146
175
|
// Due to the long prompt text, we use modifiers to manually create the prompt so we can
|
|
147
176
|
// change it after submission.
|
|
148
177
|
export const promptForRedirectURI = Effect.fn(function* (
|
|
@@ -245,6 +274,37 @@ export const getClientNameAndProvider = Effect.fn(function* (
|
|
|
245
274
|
return { provider, clientName };
|
|
246
275
|
});
|
|
247
276
|
|
|
277
|
+
export const findClientByIdOrName = Effect.fn(function* (params: {
|
|
278
|
+
id?: string;
|
|
279
|
+
name?: string;
|
|
280
|
+
}) {
|
|
281
|
+
if (params.id && params.name) {
|
|
282
|
+
return yield* BadArgsError.make({
|
|
283
|
+
message: 'Cannot specify both --id and --name',
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
if (!params.id && !params.name) {
|
|
287
|
+
return yield* BadArgsError.make({
|
|
288
|
+
message: 'Must specify --id or --name',
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
const auth = yield* getAppsAuth();
|
|
293
|
+
const clients = auth.oauth_clients ?? [];
|
|
294
|
+
const client = params.id
|
|
295
|
+
? clients.find((entry) => entry.id === params.id)
|
|
296
|
+
: clients.find((entry) => entry.client_name === params.name);
|
|
297
|
+
|
|
298
|
+
if (!client) {
|
|
299
|
+
const lookup = params.id ? `id ${params.id}` : `name ${params.name}`;
|
|
300
|
+
return yield* BadArgsError.make({
|
|
301
|
+
message: `OAuth client not found: ${lookup}`,
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
return { auth, client };
|
|
306
|
+
});
|
|
307
|
+
|
|
248
308
|
export const removeAuthorizedOrigin = Effect.fn(function* (originId: string) {
|
|
249
309
|
const http = (yield* InstantHttpAuthed).pipe(
|
|
250
310
|
withCommand('auth origin delete'),
|