instant-cli 1.0.33 → 1.0.34

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 (80) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/__tests__/multiSelect.test.ts +236 -0
  3. package/__tests__/select.test.ts +224 -0
  4. package/__tests__/webhooks.test.ts +728 -0
  5. package/dist/commands/webhooks/add.d.ts +9 -0
  6. package/dist/commands/webhooks/add.d.ts.map +1 -0
  7. package/dist/commands/webhooks/add.js +75 -0
  8. package/dist/commands/webhooks/add.js.map +1 -0
  9. package/dist/commands/webhooks/delete.d.ts +6 -0
  10. package/dist/commands/webhooks/delete.d.ts.map +1 -0
  11. package/dist/commands/webhooks/delete.js +17 -0
  12. package/dist/commands/webhooks/delete.js.map +1 -0
  13. package/dist/commands/webhooks/disable.d.ts +7 -0
  14. package/dist/commands/webhooks/disable.d.ts.map +1 -0
  15. package/dist/commands/webhooks/disable.js +18 -0
  16. package/dist/commands/webhooks/disable.js.map +1 -0
  17. package/dist/commands/webhooks/enable.d.ts +6 -0
  18. package/dist/commands/webhooks/enable.d.ts.map +1 -0
  19. package/dist/commands/webhooks/enable.js +18 -0
  20. package/dist/commands/webhooks/enable.js.map +1 -0
  21. package/dist/commands/webhooks/events/list.d.ts +7 -0
  22. package/dist/commands/webhooks/events/list.d.ts.map +1 -0
  23. package/dist/commands/webhooks/events/list.js +31 -0
  24. package/dist/commands/webhooks/events/list.js.map +1 -0
  25. package/dist/commands/webhooks/events/payload.d.ts +8 -0
  26. package/dist/commands/webhooks/events/payload.d.ts.map +1 -0
  27. package/dist/commands/webhooks/events/payload.js +39 -0
  28. package/dist/commands/webhooks/events/payload.js.map +1 -0
  29. package/dist/commands/webhooks/events/resend.d.ts +8 -0
  30. package/dist/commands/webhooks/events/resend.d.ts.map +1 -0
  31. package/dist/commands/webhooks/events/resend.js +43 -0
  32. package/dist/commands/webhooks/events/resend.js.map +1 -0
  33. package/dist/commands/webhooks/list.d.ts +8 -0
  34. package/dist/commands/webhooks/list.d.ts.map +1 -0
  35. package/dist/commands/webhooks/list.js +29 -0
  36. package/dist/commands/webhooks/list.js.map +1 -0
  37. package/dist/commands/webhooks/shared.d.ts +40 -0
  38. package/dist/commands/webhooks/shared.d.ts.map +1 -0
  39. package/dist/commands/webhooks/shared.js +248 -0
  40. package/dist/commands/webhooks/shared.js.map +1 -0
  41. package/dist/commands/webhooks/update.d.ts +10 -0
  42. package/dist/commands/webhooks/update.d.ts.map +1 -0
  43. package/dist/commands/webhooks/update.js +189 -0
  44. package/dist/commands/webhooks/update.js.map +1 -0
  45. package/dist/index.d.ts +45 -0
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js +141 -0
  48. package/dist/index.js.map +1 -1
  49. package/dist/layer.d.ts +2 -2
  50. package/dist/layer.d.ts.map +1 -1
  51. package/dist/layer.js +30 -1
  52. package/dist/layer.js.map +1 -1
  53. package/dist/lib/webhooks.d.ts +28 -0
  54. package/dist/lib/webhooks.d.ts.map +1 -0
  55. package/dist/lib/webhooks.js +102 -0
  56. package/dist/lib/webhooks.js.map +1 -0
  57. package/dist/ui/index.d.ts +39 -1
  58. package/dist/ui/index.d.ts.map +1 -1
  59. package/dist/ui/index.js +387 -25
  60. package/dist/ui/index.js.map +1 -1
  61. package/dist/ui/lib.d.ts +7 -0
  62. package/dist/ui/lib.d.ts.map +1 -1
  63. package/dist/ui/lib.js +40 -1
  64. package/dist/ui/lib.js.map +1 -1
  65. package/package.json +4 -4
  66. package/src/commands/webhooks/add.ts +111 -0
  67. package/src/commands/webhooks/delete.ts +23 -0
  68. package/src/commands/webhooks/disable.ts +24 -0
  69. package/src/commands/webhooks/enable.ts +24 -0
  70. package/src/commands/webhooks/events/list.ts +38 -0
  71. package/src/commands/webhooks/events/payload.ts +56 -0
  72. package/src/commands/webhooks/events/resend.ts +66 -0
  73. package/src/commands/webhooks/list.ts +41 -0
  74. package/src/commands/webhooks/shared.ts +339 -0
  75. package/src/commands/webhooks/update.ts +276 -0
  76. package/src/index.ts +242 -0
  77. package/src/layer.ts +33 -1
  78. package/src/lib/webhooks.ts +127 -0
  79. package/src/ui/index.ts +465 -32
  80. package/src/ui/lib.ts +41 -1
package/dist/index.js CHANGED
@@ -28,6 +28,15 @@ import { authOriginAddCmd } from "./commands/auth/origin/add.js";
28
28
  import { link } from "./logging.js";
29
29
  import { appListCommand } from "./commands/app/list.js";
30
30
  import { appDeleteCommand } from "./commands/app/delete.js";
31
+ import { webhooksListCmd } from "./commands/webhooks/list.js";
32
+ import { webhooksAddCmd } from "./commands/webhooks/add.js";
33
+ import { webhooksUpdateCmd } from "./commands/webhooks/update.js";
34
+ import { webhooksDeleteCmd } from "./commands/webhooks/delete.js";
35
+ import { webhooksEnableCmd } from "./commands/webhooks/enable.js";
36
+ import { webhooksDisableCmd } from "./commands/webhooks/disable.js";
37
+ import { webhooksEventsListCmd } from "./commands/webhooks/events/list.js";
38
+ import { webhooksEventsPayloadCmd } from "./commands/webhooks/events/payload.js";
39
+ import { webhooksEventsResendCmd } from "./commands/webhooks/events/resend.js";
31
40
  program
32
41
  .name('instant-cli')
33
42
  .addOption(globalOption('-t --token <token>', 'Auth token override'))
@@ -249,6 +258,138 @@ export const authOriginDeleteDef = authOrigin
249
258
  allowAdminToken: true,
250
259
  }))));
251
260
  });
261
+ const webhooks = program
262
+ .command('webhook')
263
+ .description('Manage webhooks for an app');
264
+ export const webhooksListDef = webhooks
265
+ .command('list')
266
+ .description('List webhooks for an app')
267
+ .option('-a --app <app-id>', 'App ID to list webhooks for. Defaults to *_INSTANT_APP_ID in .env')
268
+ .option('--json', 'Enable JSON output')
269
+ .action((opts) => {
270
+ return runCommandEffect(webhooksListCmd(opts).pipe(Effect.provide(WithAppLayer({
271
+ coerce: false,
272
+ coerceAuth: false,
273
+ appId: opts.app,
274
+ allowAdminToken: false,
275
+ }).pipe(Layer.annotateLogs('silent', !!opts.json)))));
276
+ });
277
+ export const webhooksAddDef = webhooks
278
+ .command('add')
279
+ .description('Add a webhook to an app')
280
+ .option('--url <url>', 'HTTPS endpoint to deliver events to')
281
+ .option('--namespaces <e1,e2>', 'Comma-separated list of namespaces to listen on')
282
+ .option('--actions <a1,a2>', 'Comma-separated list of actions (create, update, delete)')
283
+ .option('-a --app <app-id>', 'App ID to add a webhook to. Defaults to *_INSTANT_APP_ID in .env')
284
+ .action((opts) => {
285
+ return runCommandEffect(webhooksAddCmd(opts).pipe(Effect.provide(WithAppLayer({
286
+ coerce: false,
287
+ coerceAuth: false,
288
+ appId: opts.app,
289
+ allowAdminToken: false,
290
+ }))));
291
+ });
292
+ export const webhooksUpdateDef = webhooks
293
+ .command('update')
294
+ .description('Update a webhook')
295
+ .option('--id <webhook-id>', 'Webhook ID to update')
296
+ .option('--url <url>', 'New HTTPS endpoint')
297
+ .option('--namespaces <e1,e2>', 'New comma-separated namespaces')
298
+ .option('--actions <a1,a2>', 'New comma-separated actions (create, update, delete)')
299
+ .option('-a --app <app-id>', 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env')
300
+ .action((opts) => {
301
+ return runCommandEffect(webhooksUpdateCmd(opts).pipe(Effect.provide(WithAppLayer({
302
+ coerce: false,
303
+ coerceAuth: false,
304
+ appId: opts.app,
305
+ allowAdminToken: false,
306
+ }))));
307
+ });
308
+ export const webhooksDeleteDef = webhooks
309
+ .command('delete')
310
+ .description('Delete a webhook')
311
+ .option('--id <webhook-id>', 'Webhook ID to delete')
312
+ .option('-a --app <app-id>', 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env')
313
+ .action((opts) => {
314
+ return runCommandEffect(webhooksDeleteCmd(opts).pipe(Effect.provide(WithAppLayer({
315
+ coerce: false,
316
+ coerceAuth: false,
317
+ appId: opts.app,
318
+ allowAdminToken: false,
319
+ }))));
320
+ });
321
+ export const webhooksEnableDef = webhooks
322
+ .command('enable')
323
+ .description('Re-enable a disabled webhook')
324
+ .option('--id <webhook-id>', 'Webhook ID to enable')
325
+ .option('-a --app <app-id>', 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env')
326
+ .action((opts) => {
327
+ return runCommandEffect(webhooksEnableCmd(opts).pipe(Effect.provide(WithAppLayer({
328
+ coerce: false,
329
+ coerceAuth: false,
330
+ appId: opts.app,
331
+ allowAdminToken: false,
332
+ }))));
333
+ });
334
+ export const webhooksDisableDef = webhooks
335
+ .command('disable')
336
+ .description('Disable an active webhook')
337
+ .option('--id <webhook-id>', 'Webhook ID to disable')
338
+ .option('--reason <reason>', 'Human-readable reason stored on the webhook')
339
+ .option('-a --app <app-id>', 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env')
340
+ .action((opts) => {
341
+ return runCommandEffect(webhooksDisableCmd(opts).pipe(Effect.provide(WithAppLayer({
342
+ coerce: false,
343
+ coerceAuth: false,
344
+ appId: opts.app,
345
+ allowAdminToken: false,
346
+ }))));
347
+ });
348
+ const webhooksEvents = webhooks
349
+ .command('event')
350
+ .description('Inspect and resend webhook events');
351
+ export const webhooksEventsListDef = webhooksEvents
352
+ .command('list')
353
+ .description('List recent events for a webhook (up to 100, newest first)')
354
+ .option('--webhook-id <webhook-id>', 'Webhook ID to inspect')
355
+ .option('--json', 'Enable JSON output')
356
+ .option('-a --app <app-id>', 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env')
357
+ .action((opts) => {
358
+ return runCommandEffect(webhooksEventsListCmd(opts).pipe(Effect.provide(WithAppLayer({
359
+ coerce: false,
360
+ coerceAuth: false,
361
+ appId: opts.app,
362
+ allowAdminToken: false,
363
+ }).pipe(Layer.annotateLogs('silent', !!opts.json)))));
364
+ });
365
+ export const webhooksEventsResendDef = webhooksEvents
366
+ .command('resend')
367
+ .description('Re-queue a webhook event for delivery')
368
+ .option('--webhook-id <webhook-id>', 'Webhook ID the event belongs to')
369
+ .option('--isn <isn>', 'Event ISN to resend')
370
+ .option('-a --app <app-id>', 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env')
371
+ .action((opts) => {
372
+ return runCommandEffect(webhooksEventsResendCmd(opts).pipe(Effect.provide(WithAppLayer({
373
+ coerce: false,
374
+ coerceAuth: false,
375
+ appId: opts.app,
376
+ allowAdminToken: false,
377
+ }))));
378
+ });
379
+ export const webhooksEventsPayloadDef = webhooksEvents
380
+ .command('payload')
381
+ .description('Print the JSON payload for a webhook event')
382
+ .option('--webhook-id <webhook-id>', 'Webhook ID the event belongs to')
383
+ .option('--isn <isn>', 'Event ISN to fetch')
384
+ .option('-a --app <app-id>', 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env')
385
+ .action((opts) => {
386
+ return runCommandEffect(webhooksEventsPayloadCmd(opts).pipe(Effect.provide(WithAppLayer({
387
+ coerce: false,
388
+ coerceAuth: false,
389
+ appId: opts.app,
390
+ allowAdminToken: false,
391
+ }))));
392
+ });
252
393
  export const initWithoutFilesDef = program
253
394
  .command('init-without-files')
254
395
  .description('Generate a new app id and admin token pair without any files.')
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,CAAC;AAEV,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACL,aAAa,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,CAAC;IACH,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3B,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;YACrB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC;YAC1B,UAAU,CAAC,WAAW,CAAC;YACvB,EAAE;SACH,CAAC,CAAC;IACL,CAAC;IAED,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC3B,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC,MAAW,EAAE,EAAE;YAChE,OAAO,UAAU,CACf,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,EACzB,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CACjC,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;gBACrB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC;gBAChC,UAAU,CAAC,gBAAgB,CAAC;gBAC5B,EAAE;aACH,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,OAAO,CAAC,aAAa,CAAC;IACpB,iBAAiB,EAAE,IAAI;IACvB,UAAU;CACX,CAAC,CAAC;AAEH,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import { loadEnv } from './util/loadEnv.ts';\n\nloadEnv();\n\nimport minimist from 'minimist';\nimport { Command, Option } from '@commander-js/extra-typings';\nimport chalk from 'chalk';\nimport { Effect, Layer } from 'effect';\nimport version from './version.js';\nimport { initCommand } from './commands/init.ts';\nimport { initWithoutFilesCommand } from './commands/initWithoutFiles.ts';\nimport { loginCommand } from './commands/login.ts';\nimport { logoutCommand } from './commands/logout.ts';\nimport {\n AuthLayerLive,\n BaseLayerLive,\n runCommandEffect,\n WithAppLayer,\n} from './layer.ts';\nimport { infoCommand } from './commands/info.ts';\nimport { pullCommand } from './commands/pull.ts';\nimport type { SchemaPermsOrBoth } from './commands/pull.ts';\nimport { claimCommand } from './commands/claim.ts';\nimport { pushCommand } from './commands/push.ts';\nimport { explorerCmd } from './commands/explorer.ts';\nimport { queryCmd } from './commands/query.ts';\nimport { program } from './program.ts';\nimport { PACKAGE_ALIAS_AND_FULL_NAMES } from './context/projectInfo.ts';\nimport { authClientAddCmd } from './commands/auth/client/add.ts';\nimport { authClientListCmd } from './commands/auth/client/list.ts';\nimport { authClientDeleteCmd } from './commands/auth/client/delete.ts';\nimport { authClientUpdateCmd } from './commands/auth/client/update.ts';\nimport { authOriginListCmd } from './commands/auth/origin/list.ts';\nimport { authOriginDeleteCmd } from './commands/auth/origin/delete.ts';\nimport { authOriginAddCmd } from './commands/auth/origin/add.ts';\nimport { link } from './logging.ts';\nimport { appListCommand } from './commands/app/list.ts';\nimport { appDeleteCommand } from './commands/app/delete.ts';\n\nexport type OptsFromCommand<C> =\n C extends Command<any, infer R, any> ? R : never;\n\nprogram\n .name('instant-cli')\n .addOption(globalOption('-t --token <token>', 'Auth token override'))\n .addOption(globalOption('-y --yes', \"Answer 'yes' to all prompts\"))\n .addOption(globalOption('--env <file>', 'Use a specific .env file'))\n .addOption(\n globalOption('-v --version', 'Print the version number', () => {\n console.log(version);\n process.exit(0);\n }),\n )\n .addHelpOption(globalOption('-h --help', 'Print the help text for a command'))\n .usage(`<command> ${chalk.dim('[options] [args]')}`);\n\n// Command List\nexport const initDef = program\n .command('init')\n .description('Set up a new project.')\n .option(\n '-a --app <app-id>',\n 'If you have an existing app ID, we can pull schema and perms from there.',\n )\n .option(\n '-p --package <react|react-native|core|admin|solid|svelte>',\n 'Which package to automatically install if there is not one installed already.',\n )\n .option('--title <title>', 'Title for the created app')\n .option(\n '--temp',\n 'Create a temporary app which will automatically delete itself after >24 hours.',\n )\n .action((options) => {\n return runCommandEffect(\n initCommand(options).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: true,\n coerceAuth: true,\n title: options.title,\n appId: options.app,\n packageName: options.package as any,\n applyEnv: true,\n temp: options.temp,\n }),\n ),\n ),\n );\n });\n\nconst auth = program\n .command('auth')\n .description('Manage authentication for your app');\nconst app = program\n .command('app')\n .description('Manage individual InstantDB apps');\n\nexport const appListDef = app\n .command('list')\n .description('List apps on your Instant account')\n .option('--json', 'Output apps as JSON')\n .action(async (opts) => {\n return runCommandEffect(\n appListCommand(opts).pipe(\n Effect.provide(\n AuthLayerLive({\n coerce: false,\n allowAdminToken: false,\n }).pipe(Layer.annotateLogs('silent', !!opts.json)),\n ),\n ),\n );\n });\n\nexport const appDeleteDef = app\n .command('delete')\n .description('Delete an app from your Instant account')\n .option(\n '-a --app <app-id>',\n 'App ID to delete. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action(async (opts) => {\n return runCommandEffect(\n appDeleteCommand(opts).pipe(\n Effect.provide(\n AuthLayerLive({\n coerce: false,\n allowAdminToken: false,\n }),\n ),\n ),\n );\n });\n\nconst authClient = auth.command('client');\nexport const authClientAddDef = authClient\n .command('add')\n .allowExcessArguments(true)\n .allowUnknownOption(true)\n .option(\n '--type <google|github|apple|linkedin>',\n 'Type of oauth client to add',\n )\n .option(\n '--name <client name>',\n 'Custom name to identify the OAuth client (ex: google-web)',\n )\n .option(\n '-a --app <app-id>',\n 'App ID to modify. Defaults to *_INSTANT_APP_ID in .env',\n )\n .addHelpText(\n 'after',\n `\nProvider Specific Options:\n Google:\n --app-type web|ios|android|button-for-web\n --dev-credentials (optional, web only)\n --client-id (required unless using dev credentials)\n --client-secret (web only, unless using dev credentials)\n --custom-redirect-uri (optional, web only)\n GitHub:\n --client-id\n --client-secret\n --custom-redirect-uri (optional)\n Apple:\n --services-id (Services ID from ${link('https://developer.apple.com', 'developer.apple.com')})\n --team-id (optional, required for web redirect flow)\n --key-id (optional, required for web redirect flow)\n --private-key-file (optional, path to .p8 PEM; required for web redirect flow)\n --custom-redirect-uri (optional, web redirect flow only)\n LinkedIn:\n --client-id\n --client-secret\n --custom-redirect-uri (optional)\n Clerk:\n --publishable-key (Publishable Key from ${link('https://dashboard.clerk.com', 'dashboard.clerk.com')})\n Firebase:\n --project-id (Project ID from ${link('https://console.firebase.google.com', 'console.firebase.google.com')})\n`,\n )\n .action((opts) => {\n opts = {\n ...opts,\n ...minimist(process.argv),\n };\n return runCommandEffect(\n authClientAddCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\nexport const authClientListDef = authClient\n .command('list')\n .option(\n '-a --app <app-id>',\n 'App ID to list clients for. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option('--json', 'Enable JSON output')\n .allowUnknownOption(true)\n .action((opts) => {\n return runCommandEffect(\n authClientListCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: true,\n // Silence \"searching for instant sdk.. logs for json output\"\n }).pipe(Layer.annotateLogs('silent', !!opts.json)),\n ),\n ),\n );\n });\n\nexport const authClientDeleteDef = authClient\n .command('delete')\n .option('--id <client-id>', 'Client ID to delete')\n .option('--name <client-name>', 'Client name to delete')\n .option(\n '-a --app <app-id>',\n 'App ID to delete a client from. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n authClientDeleteCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\n\nexport const authClientUpdateDef = authClient\n .command('update')\n .description('Update an OAuth client')\n .allowExcessArguments(true)\n .allowUnknownOption(true)\n .option('--id <client-id>', 'Client ID to update')\n .option('--name <client-name>', 'Client name to update')\n .option(\n '-a --app <app-id>',\n 'App ID to update a client in. Defaults to *_INSTANT_APP_ID in .env',\n )\n .addHelpText(\n 'after',\n `\nProvider Specific Options:\n Google:\n --dev-credentials (web only)\n --client-id\n --client-secret (web only)\n --custom-redirect-uri (optional, web only)\n GitHub:\n --client-id\n --client-secret\n --custom-redirect-uri (optional)\n Apple:\n --services-id\n --team-id (web redirect flow)\n --key-id (web redirect flow)\n --private-key-file (web redirect flow)\n --custom-redirect-uri (optional, web redirect flow only)\n LinkedIn:\n --client-id\n --client-secret\n --custom-redirect-uri (optional)\n Clerk:\n --publishable-key\n Firebase:\n --project-id\n`,\n )\n .action((opts) => {\n opts = {\n ...opts,\n ...minimist(process.argv),\n };\n\n return runCommandEffect(\n authClientUpdateCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\n\nconst authOrigin = auth.command('origin');\nexport const authOriginListDef = authOrigin\n .command('list')\n .option(\n '-a --app <app-id>',\n 'App ID to list origins for. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option('--json', 'Enable JSON output')\n .action((opts) => {\n return runCommandEffect(\n authOriginListCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: true,\n }).pipe(Layer.annotateLogs('silent', !!opts.json)),\n ),\n ),\n );\n });\n\nexport const authOriginAddDef = authOrigin\n .command('add')\n .option(\n '--type <website|vercel|netlify|custom-scheme>',\n 'Type of origin to add.',\n )\n .option('--url <url>', 'Website URL (for website type, e.g. example.com)')\n .option(\n '--project <name>',\n 'Vercel project name (for vercel type, e.g. my-project)',\n )\n .option('--site <name>', 'Netlify site name (for netlify type, e.g. my-site)')\n .option(\n '--scheme <scheme>',\n 'App scheme (for custom-scheme type, e.g. myapp://)',\n )\n .option(\n '-a --app <app-id>',\n 'App ID to add an origin to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .addHelpText(\n 'after',\n `\nOrigin Types:\n website A standard website origin (e.g. example.com)\n vercel Vercel preview deployments (project name)\n netlify Netlify preview deployments (site name)\n custom-scheme Native app scheme (e.g. your-app-scheme://)\n`,\n )\n .action((opts) => {\n return runCommandEffect(\n authOriginAddCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\n\nexport const authOriginDeleteDef = authOrigin\n .command('delete')\n .option('--id <origin-id>', 'Origin ID to delete')\n .option(\n '-a --app <app-id>',\n 'App ID to delete an origin from. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n authOriginDeleteCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\n\nexport const initWithoutFilesDef = program\n .command('init-without-files')\n .description('Generate a new app id and admin token pair without any files.')\n .option('--title <title>', 'Title for the created app.')\n .option(\n '--org-id <org-id>',\n 'Organization id for app. Cannot be used with --temp flag.',\n )\n .option(\n '--temp',\n 'Create a temporary app which will automatically delete itself after >24 hours.',\n )\n .action((opts) => {\n return runCommandEffect(\n initWithoutFilesCommand(opts).pipe(Effect.provide(BaseLayerLive)),\n );\n });\n\nexport const loginDef = program\n .command('login')\n .description('Log into your account')\n .option('-p --print', 'Prints the auth token into the console.')\n .option(\n '--headless',\n 'Print the login URL instead of trying to open the browser',\n )\n .action(async (opts) => {\n await runCommandEffect(\n loginCommand(opts).pipe(Effect.provide(BaseLayerLive)),\n );\n });\n\nprogram\n .command('logout')\n .description('Log out of your Instant account')\n .action(async () => {\n return runCommandEffect(\n logoutCommand().pipe(Effect.provide(BaseLayerLive)),\n );\n });\n\nexport const infoDef = program\n .command('info')\n .description('Display CLI version and login status')\n .action(async () => {\n const authLayer = AuthLayerLive({\n coerce: false,\n allowAdminToken: false,\n });\n\n return runCommandEffect(\n infoCommand().pipe(\n Effect.provide(\n Layer.mergeAll(\n BaseLayerLive,\n authLayer.pipe(Layer.catchAll(() => Layer.empty)),\n WithAppLayer({ coerce: false, allowAdminToken: true }).pipe(\n Layer.annotateLogs('silent', true),\n Layer.catchAll(() => Layer.empty),\n ),\n ),\n ),\n ),\n );\n });\n\nexport const explorerDef = program\n .command('explorer')\n .description('Opens the Explorer in your browser')\n .option(\n '-a --app <app-id>',\n 'App ID to open the explorer to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action(async (opts) => {\n return runCommandEffect(\n explorerCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: true,\n coerceAuth: true,\n appId: opts.app,\n }),\n ),\n ),\n );\n });\n\nexport const queryDef = program\n .command('query')\n .argument('<query>', 'InstaQL query as JSON/JSON5')\n .option(\n '-a --app <app-id>',\n 'App ID to query. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option('--admin', 'Run the query as admin (bypasses permissions)')\n .option('--as-email <email>', 'Run the query as a specific user by email')\n .option('--as-guest', 'Run the query as an unauthenticated guest')\n .option(\n '--as-token <refresh-token>',\n 'Run the query as a user identified by refresh token',\n )\n .description('Run an InstaQL query against your app.')\n .action(async function (queryArg, opts) {\n return runCommandEffect(queryCmd(queryArg, opts));\n });\n\nexport const pullDef = program\n .command('pull')\n .argument(\n '[schema|perms|all]',\n 'Which configuration to pull. Defaults to `all`',\n )\n .option(\n '-a --app <app-id>',\n 'App ID to pull to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option(\n '-p --package <react|react-native|core|admin|solid|svelte>',\n 'Which package to automatically install if there is not one installed already.',\n )\n .option(\n '--experimental-type-preservation',\n \"[Experimental] Preserve manual type changes like `status: i.json<'online' | 'offline'>()` when doing `instant-cli pull schema`\",\n )\n .description('Pull schema and perm files from production.')\n .addHelpText(\n 'after',\n `\nEnvironment Variables:\n INSTANT_SCHEMA_FILE_PATH Override schema file location (default: instant.schema.ts)\n INSTANT_PERMS_FILE_PATH Override perms file location (default: instant.perms.ts)\n`,\n )\n .action(async function (arg, inputOpts) {\n return runCommandEffect(\n pullCommand(arg as SchemaPermsOrBoth, inputOpts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: true,\n packageName: inputOpts.package as\n | 'react'\n | 'react-native'\n | 'core'\n | 'admin'\n | undefined,\n appId: inputOpts.app,\n }),\n ),\n ),\n );\n });\n\nexport const pushDef = program\n .command('push')\n .argument(\n '[schema|perms|all]',\n 'Which configuration to push. Defaults to `all`',\n )\n .option(\n '-a --app <app-id>',\n 'App ID to push to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option(\n '--skip-check-types',\n \"Don't check types on the server when pushing schema\",\n )\n .option(\n '--rename [renames...]',\n 'List of full attribute names separated by a \":\"\\n Example:`push --rename posts.author:posts.creator stores.owner:stores.manager`',\n )\n .option(\n '-p --package <react|react-native|core|admin|solid|svelte>',\n 'Which package to automatically install if there is not one installed already.',\n )\n .description('Push schema and perm files to production.')\n .addHelpText(\n 'after',\n `\nEnvironment Variables:\n INSTANT_SCHEMA_FILE_PATH Override schema file location (default: instant.schema.ts)\n INSTANT_PERMS_FILE_PATH Override perms file location (default: instant.perms.ts)\n`,\n )\n .action(async function (arg, inputOpts) {\n return runCommandEffect(\n pushCommand(arg, inputOpts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n appId: inputOpts.app,\n coerceLibraryInstall: true,\n coerceAuth: false,\n allowAdminToken: true,\n applyEnv: true,\n packageName:\n inputOpts.package as keyof typeof PACKAGE_ALIAS_AND_FULL_NAMES,\n }),\n ),\n ),\n );\n });\n\nexport const claimDef = program\n .command('claim')\n .description('Transfer a temporary app into your Instant account')\n .option(\n '-a --app <app-id>',\n 'App to claim. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action(async function (opts) {\n return runCommandEffect(\n claimCommand.pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n allowAdminToken: false,\n appId: opts.app,\n applyEnv: false,\n }),\n ),\n ),\n );\n });\n//// Program setup /////\n\nfunction globalOption(\n flags: string,\n description?: string,\n argParser?: (value: string, prev?: unknown) => unknown,\n) {\n const opt = new Option(flags, description);\n if (argParser) {\n opt.argParser(argParser);\n }\n // @ts-ignore\n // __global does not exist on `Option`,\n // but we use it in `getLocalAndGlobalOptions`, to produce\n // our own custom list of local and global options.\n // For more info, see the original PR:\n // https://github.com/instantdb/instant/pull/505\n opt.__global = true;\n return opt;\n}\n\nfunction getLocalAndGlobalOptions(cmd: any, helper: any) {\n const mixOfLocalAndGlobal = helper.visibleOptions(cmd);\n const localOptionsFromMix = mixOfLocalAndGlobal.filter(\n (option: any) => !option.__global,\n );\n const globalOptionsFromMix = mixOfLocalAndGlobal.filter(\n (option: any) => option.__global,\n );\n const globalOptions = helper.visibleGlobalOptions(cmd);\n\n return [localOptionsFromMix, globalOptionsFromMix.concat(globalOptions)];\n}\n\nfunction formatHelp(\n this: { showGlobalOptions: boolean },\n cmd: any,\n helper: any,\n) {\n const termWidth = helper.padWidth(cmd, helper);\n const helpWidth = helper.helpWidth || 80;\n const itemIndentWidth = 2;\n const itemSeparatorWidth = 2; // between term and description\n function formatItem(term: string, description: string | undefined) {\n if (description) {\n const fullText = `${term.padEnd(termWidth + itemSeparatorWidth)}${description}`;\n return helper.boxWrap(\n fullText,\n helpWidth - itemIndentWidth,\n termWidth + itemSeparatorWidth,\n );\n }\n return term;\n }\n function formatList(textArray: string[]) {\n return textArray.join('\\n').replace(/^/gm, ' '.repeat(itemIndentWidth));\n }\n\n // Usage\n let output = [`${helper.commandUsage(cmd)}`, ''];\n\n // Description\n const commandDescription = helper.commandDescription(cmd);\n if (commandDescription.length > 0) {\n output = output.concat([\n helper.boxWrap(commandDescription, helpWidth, 0),\n '',\n ]);\n }\n\n // Arguments\n const argumentList = helper.visibleArguments(cmd).map((argument: any) => {\n return formatItem(\n helper.argumentTerm(argument),\n helper.argumentDescription(argument),\n );\n });\n if (argumentList.length > 0) {\n output = output.concat([\n chalk.dim.bold('Arguments'),\n formatList(argumentList),\n '',\n ]);\n }\n const [visibleOptions, visibleGlobalOptions] = getLocalAndGlobalOptions(\n cmd,\n helper,\n );\n\n // Options\n const optionList = visibleOptions.map((option: any) => {\n return formatItem(\n helper.optionTerm(option),\n helper.optionDescription(option),\n );\n });\n if (optionList.length > 0) {\n output = output.concat([\n chalk.dim.bold('Options'),\n formatList(optionList),\n '',\n ]);\n }\n // Commands\n const commandList = helper.visibleCommands(cmd).map((cmd: any) => {\n return formatItem(\n helper.subcommandTerm(cmd),\n helper.subcommandDescription(cmd),\n );\n });\n if (commandList.length > 0) {\n output = output.concat([\n chalk.dim.bold('Commands'),\n formatList(commandList),\n '',\n ]);\n }\n\n if (this.showGlobalOptions) {\n const globalOptionList = visibleGlobalOptions.map((option: any) => {\n return formatItem(\n helper.optionTerm(option),\n helper.optionDescription(option),\n );\n });\n if (globalOptionList.length > 0) {\n output = output.concat([\n chalk.dim.bold('Global Options'),\n formatList(globalOptionList),\n '',\n ]);\n }\n }\n\n return output.join('\\n');\n}\n\nprogram.configureHelp({\n showGlobalOptions: true,\n formatHelp,\n});\n\nprogram.parse(process.argv);\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,CAAC;AAEV,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACL,aAAa,EACb,aAAa,EACb,gBAA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GAAG,CAAC,CAAC,MAAW,EAAE,EAAE;YAChE,OAAO,UAAU,CACf,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,EACzB,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CACjC,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;gBACrB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC;gBAChC,UAAU,CAAC,gBAAgB,CAAC;gBAC5B,EAAE;aACH,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,OAAO,CAAC,aAAa,CAAC;IACpB,iBAAiB,EAAE,IAAI;IACvB,UAAU;CACX,CAAC,CAAC;AAEH,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import { loadEnv } from './util/loadEnv.ts';\n\nloadEnv();\n\nimport minimist from 'minimist';\nimport { Command, Option } from '@commander-js/extra-typings';\nimport chalk from 'chalk';\nimport { Effect, Layer } from 'effect';\nimport version from './version.js';\nimport { initCommand } from './commands/init.ts';\nimport { initWithoutFilesCommand } from './commands/initWithoutFiles.ts';\nimport { loginCommand } from './commands/login.ts';\nimport { logoutCommand } from './commands/logout.ts';\nimport {\n AuthLayerLive,\n BaseLayerLive,\n runCommandEffect,\n WithAppLayer,\n} from './layer.ts';\nimport { infoCommand } from './commands/info.ts';\nimport { pullCommand } from './commands/pull.ts';\nimport type { SchemaPermsOrBoth } from './commands/pull.ts';\nimport { claimCommand } from './commands/claim.ts';\nimport { pushCommand } from './commands/push.ts';\nimport { explorerCmd } from './commands/explorer.ts';\nimport { queryCmd } from './commands/query.ts';\nimport { program } from './program.ts';\nimport { PACKAGE_ALIAS_AND_FULL_NAMES } from './context/projectInfo.ts';\nimport { authClientAddCmd } from './commands/auth/client/add.ts';\nimport { authClientListCmd } from './commands/auth/client/list.ts';\nimport { authClientDeleteCmd } from './commands/auth/client/delete.ts';\nimport { authClientUpdateCmd } from './commands/auth/client/update.ts';\nimport { authOriginListCmd } from './commands/auth/origin/list.ts';\nimport { authOriginDeleteCmd } from './commands/auth/origin/delete.ts';\nimport { authOriginAddCmd } from './commands/auth/origin/add.ts';\nimport { link } from './logging.ts';\nimport { appListCommand } from './commands/app/list.ts';\nimport { appDeleteCommand } from './commands/app/delete.ts';\nimport { webhooksListCmd } from './commands/webhooks/list.ts';\nimport { webhooksAddCmd } from './commands/webhooks/add.ts';\nimport { webhooksUpdateCmd } from './commands/webhooks/update.ts';\nimport { webhooksDeleteCmd } from './commands/webhooks/delete.ts';\nimport { webhooksEnableCmd } from './commands/webhooks/enable.ts';\nimport { webhooksDisableCmd } from './commands/webhooks/disable.ts';\nimport { webhooksEventsListCmd } from './commands/webhooks/events/list.ts';\nimport { webhooksEventsPayloadCmd } from './commands/webhooks/events/payload.ts';\nimport { webhooksEventsResendCmd } from './commands/webhooks/events/resend.ts';\n\nexport type OptsFromCommand<C> =\n C extends Command<any, infer R, any> ? R : never;\n\nprogram\n .name('instant-cli')\n .addOption(globalOption('-t --token <token>', 'Auth token override'))\n .addOption(globalOption('-y --yes', \"Answer 'yes' to all prompts\"))\n .addOption(globalOption('--env <file>', 'Use a specific .env file'))\n .addOption(\n globalOption('-v --version', 'Print the version number', () => {\n console.log(version);\n process.exit(0);\n }),\n )\n .addHelpOption(globalOption('-h --help', 'Print the help text for a command'))\n .usage(`<command> ${chalk.dim('[options] [args]')}`);\n\n// Command List\nexport const initDef = program\n .command('init')\n .description('Set up a new project.')\n .option(\n '-a --app <app-id>',\n 'If you have an existing app ID, we can pull schema and perms from there.',\n )\n .option(\n '-p --package <react|react-native|core|admin|solid|svelte>',\n 'Which package to automatically install if there is not one installed already.',\n )\n .option('--title <title>', 'Title for the created app')\n .option(\n '--temp',\n 'Create a temporary app which will automatically delete itself after >24 hours.',\n )\n .action((options) => {\n return runCommandEffect(\n initCommand(options).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: true,\n coerceAuth: true,\n title: options.title,\n appId: options.app,\n packageName: options.package as any,\n applyEnv: true,\n temp: options.temp,\n }),\n ),\n ),\n );\n });\n\nconst auth = program\n .command('auth')\n .description('Manage authentication for your app');\nconst app = program\n .command('app')\n .description('Manage individual InstantDB apps');\n\nexport const appListDef = app\n .command('list')\n .description('List apps on your Instant account')\n .option('--json', 'Output apps as JSON')\n .action(async (opts) => {\n return runCommandEffect(\n appListCommand(opts).pipe(\n Effect.provide(\n AuthLayerLive({\n coerce: false,\n allowAdminToken: false,\n }).pipe(Layer.annotateLogs('silent', !!opts.json)),\n ),\n ),\n );\n });\n\nexport const appDeleteDef = app\n .command('delete')\n .description('Delete an app from your Instant account')\n .option(\n '-a --app <app-id>',\n 'App ID to delete. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action(async (opts) => {\n return runCommandEffect(\n appDeleteCommand(opts).pipe(\n Effect.provide(\n AuthLayerLive({\n coerce: false,\n allowAdminToken: false,\n }),\n ),\n ),\n );\n });\n\nconst authClient = auth.command('client');\nexport const authClientAddDef = authClient\n .command('add')\n .allowExcessArguments(true)\n .allowUnknownOption(true)\n .option(\n '--type <google|github|apple|linkedin>',\n 'Type of oauth client to add',\n )\n .option(\n '--name <client name>',\n 'Custom name to identify the OAuth client (ex: google-web)',\n )\n .option(\n '-a --app <app-id>',\n 'App ID to modify. Defaults to *_INSTANT_APP_ID in .env',\n )\n .addHelpText(\n 'after',\n `\nProvider Specific Options:\n Google:\n --app-type web|ios|android|button-for-web\n --dev-credentials (optional, web only)\n --client-id (required unless using dev credentials)\n --client-secret (web only, unless using dev credentials)\n --custom-redirect-uri (optional, web only)\n GitHub:\n --client-id\n --client-secret\n --custom-redirect-uri (optional)\n Apple:\n --services-id (Services ID from ${link('https://developer.apple.com', 'developer.apple.com')})\n --team-id (optional, required for web redirect flow)\n --key-id (optional, required for web redirect flow)\n --private-key-file (optional, path to .p8 PEM; required for web redirect flow)\n --custom-redirect-uri (optional, web redirect flow only)\n LinkedIn:\n --client-id\n --client-secret\n --custom-redirect-uri (optional)\n Clerk:\n --publishable-key (Publishable Key from ${link('https://dashboard.clerk.com', 'dashboard.clerk.com')})\n Firebase:\n --project-id (Project ID from ${link('https://console.firebase.google.com', 'console.firebase.google.com')})\n`,\n )\n .action((opts) => {\n opts = {\n ...opts,\n ...minimist(process.argv),\n };\n return runCommandEffect(\n authClientAddCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\nexport const authClientListDef = authClient\n .command('list')\n .option(\n '-a --app <app-id>',\n 'App ID to list clients for. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option('--json', 'Enable JSON output')\n .allowUnknownOption(true)\n .action((opts) => {\n return runCommandEffect(\n authClientListCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: true,\n // Silence \"searching for instant sdk.. logs for json output\"\n }).pipe(Layer.annotateLogs('silent', !!opts.json)),\n ),\n ),\n );\n });\n\nexport const authClientDeleteDef = authClient\n .command('delete')\n .option('--id <client-id>', 'Client ID to delete')\n .option('--name <client-name>', 'Client name to delete')\n .option(\n '-a --app <app-id>',\n 'App ID to delete a client from. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n authClientDeleteCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\n\nexport const authClientUpdateDef = authClient\n .command('update')\n .description('Update an OAuth client')\n .allowExcessArguments(true)\n .allowUnknownOption(true)\n .option('--id <client-id>', 'Client ID to update')\n .option('--name <client-name>', 'Client name to update')\n .option(\n '-a --app <app-id>',\n 'App ID to update a client in. Defaults to *_INSTANT_APP_ID in .env',\n )\n .addHelpText(\n 'after',\n `\nProvider Specific Options:\n Google:\n --dev-credentials (web only)\n --client-id\n --client-secret (web only)\n --custom-redirect-uri (optional, web only)\n GitHub:\n --client-id\n --client-secret\n --custom-redirect-uri (optional)\n Apple:\n --services-id\n --team-id (web redirect flow)\n --key-id (web redirect flow)\n --private-key-file (web redirect flow)\n --custom-redirect-uri (optional, web redirect flow only)\n LinkedIn:\n --client-id\n --client-secret\n --custom-redirect-uri (optional)\n Clerk:\n --publishable-key\n Firebase:\n --project-id\n`,\n )\n .action((opts) => {\n opts = {\n ...opts,\n ...minimist(process.argv),\n };\n\n return runCommandEffect(\n authClientUpdateCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\n\nconst authOrigin = auth.command('origin');\nexport const authOriginListDef = authOrigin\n .command('list')\n .option(\n '-a --app <app-id>',\n 'App ID to list origins for. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option('--json', 'Enable JSON output')\n .action((opts) => {\n return runCommandEffect(\n authOriginListCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: true,\n }).pipe(Layer.annotateLogs('silent', !!opts.json)),\n ),\n ),\n );\n });\n\nexport const authOriginAddDef = authOrigin\n .command('add')\n .option(\n '--type <website|vercel|netlify|custom-scheme>',\n 'Type of origin to add.',\n )\n .option('--url <url>', 'Website URL (for website type, e.g. example.com)')\n .option(\n '--project <name>',\n 'Vercel project name (for vercel type, e.g. my-project)',\n )\n .option('--site <name>', 'Netlify site name (for netlify type, e.g. my-site)')\n .option(\n '--scheme <scheme>',\n 'App scheme (for custom-scheme type, e.g. myapp://)',\n )\n .option(\n '-a --app <app-id>',\n 'App ID to add an origin to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .addHelpText(\n 'after',\n `\nOrigin Types:\n website A standard website origin (e.g. example.com)\n vercel Vercel preview deployments (project name)\n netlify Netlify preview deployments (site name)\n custom-scheme Native app scheme (e.g. your-app-scheme://)\n`,\n )\n .action((opts) => {\n return runCommandEffect(\n authOriginAddCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\n\nexport const authOriginDeleteDef = authOrigin\n .command('delete')\n .option('--id <origin-id>', 'Origin ID to delete')\n .option(\n '-a --app <app-id>',\n 'App ID to delete an origin from. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n authOriginDeleteCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n appId: opts.app,\n allowAdminToken: true,\n }),\n ),\n ),\n );\n });\n\nconst webhooks = program\n .command('webhook')\n .description('Manage webhooks for an app');\n\nexport const webhooksListDef = webhooks\n .command('list')\n .description('List webhooks for an app')\n .option(\n '-a --app <app-id>',\n 'App ID to list webhooks for. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option('--json', 'Enable JSON output')\n .action((opts) => {\n return runCommandEffect(\n webhooksListCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }).pipe(Layer.annotateLogs('silent', !!opts.json)),\n ),\n ),\n );\n });\n\nexport const webhooksAddDef = webhooks\n .command('add')\n .description('Add a webhook to an app')\n .option('--url <url>', 'HTTPS endpoint to deliver events to')\n .option(\n '--namespaces <e1,e2>',\n 'Comma-separated list of namespaces to listen on',\n )\n .option(\n '--actions <a1,a2>',\n 'Comma-separated list of actions (create, update, delete)',\n )\n .option(\n '-a --app <app-id>',\n 'App ID to add a webhook to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n webhooksAddCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }),\n ),\n ),\n );\n });\n\nexport const webhooksUpdateDef = webhooks\n .command('update')\n .description('Update a webhook')\n .option('--id <webhook-id>', 'Webhook ID to update')\n .option('--url <url>', 'New HTTPS endpoint')\n .option('--namespaces <e1,e2>', 'New comma-separated namespaces')\n .option(\n '--actions <a1,a2>',\n 'New comma-separated actions (create, update, delete)',\n )\n .option(\n '-a --app <app-id>',\n 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n webhooksUpdateCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }),\n ),\n ),\n );\n });\n\nexport const webhooksDeleteDef = webhooks\n .command('delete')\n .description('Delete a webhook')\n .option('--id <webhook-id>', 'Webhook ID to delete')\n .option(\n '-a --app <app-id>',\n 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n webhooksDeleteCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }),\n ),\n ),\n );\n });\n\nexport const webhooksEnableDef = webhooks\n .command('enable')\n .description('Re-enable a disabled webhook')\n .option('--id <webhook-id>', 'Webhook ID to enable')\n .option(\n '-a --app <app-id>',\n 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n webhooksEnableCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }),\n ),\n ),\n );\n });\n\nexport const webhooksDisableDef = webhooks\n .command('disable')\n .description('Disable an active webhook')\n .option('--id <webhook-id>', 'Webhook ID to disable')\n .option('--reason <reason>', 'Human-readable reason stored on the webhook')\n .option(\n '-a --app <app-id>',\n 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n webhooksDisableCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }),\n ),\n ),\n );\n });\n\nconst webhooksEvents = webhooks\n .command('event')\n .description('Inspect and resend webhook events');\n\nexport const webhooksEventsListDef = webhooksEvents\n .command('list')\n .description('List recent events for a webhook (up to 100, newest first)')\n .option('--webhook-id <webhook-id>', 'Webhook ID to inspect')\n .option('--json', 'Enable JSON output')\n .option(\n '-a --app <app-id>',\n 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n webhooksEventsListCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }).pipe(Layer.annotateLogs('silent', !!opts.json)),\n ),\n ),\n );\n });\n\nexport const webhooksEventsResendDef = webhooksEvents\n .command('resend')\n .description('Re-queue a webhook event for delivery')\n .option('--webhook-id <webhook-id>', 'Webhook ID the event belongs to')\n .option('--isn <isn>', 'Event ISN to resend')\n .option(\n '-a --app <app-id>',\n 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n webhooksEventsResendCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }),\n ),\n ),\n );\n });\n\nexport const webhooksEventsPayloadDef = webhooksEvents\n .command('payload')\n .description('Print the JSON payload for a webhook event')\n .option('--webhook-id <webhook-id>', 'Webhook ID the event belongs to')\n .option('--isn <isn>', 'Event ISN to fetch')\n .option(\n '-a --app <app-id>',\n 'App ID the webhook belongs to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action((opts) => {\n return runCommandEffect(\n webhooksEventsPayloadCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n coerceAuth: false,\n appId: opts.app,\n allowAdminToken: false,\n }),\n ),\n ),\n );\n });\n\nexport const initWithoutFilesDef = program\n .command('init-without-files')\n .description('Generate a new app id and admin token pair without any files.')\n .option('--title <title>', 'Title for the created app.')\n .option(\n '--org-id <org-id>',\n 'Organization id for app. Cannot be used with --temp flag.',\n )\n .option(\n '--temp',\n 'Create a temporary app which will automatically delete itself after >24 hours.',\n )\n .action((opts) => {\n return runCommandEffect(\n initWithoutFilesCommand(opts).pipe(Effect.provide(BaseLayerLive)),\n );\n });\n\nexport const loginDef = program\n .command('login')\n .description('Log into your account')\n .option('-p --print', 'Prints the auth token into the console.')\n .option(\n '--headless',\n 'Print the login URL instead of trying to open the browser',\n )\n .action(async (opts) => {\n await runCommandEffect(\n loginCommand(opts).pipe(Effect.provide(BaseLayerLive)),\n );\n });\n\nprogram\n .command('logout')\n .description('Log out of your Instant account')\n .action(async () => {\n return runCommandEffect(\n logoutCommand().pipe(Effect.provide(BaseLayerLive)),\n );\n });\n\nexport const infoDef = program\n .command('info')\n .description('Display CLI version and login status')\n .action(async () => {\n const authLayer = AuthLayerLive({\n coerce: false,\n allowAdminToken: false,\n });\n\n return runCommandEffect(\n infoCommand().pipe(\n Effect.provide(\n Layer.mergeAll(\n BaseLayerLive,\n authLayer.pipe(Layer.catchAll(() => Layer.empty)),\n WithAppLayer({ coerce: false, allowAdminToken: true }).pipe(\n Layer.annotateLogs('silent', true),\n Layer.catchAll(() => Layer.empty),\n ),\n ),\n ),\n ),\n );\n });\n\nexport const explorerDef = program\n .command('explorer')\n .description('Opens the Explorer in your browser')\n .option(\n '-a --app <app-id>',\n 'App ID to open the explorer to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action(async (opts) => {\n return runCommandEffect(\n explorerCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: true,\n coerceAuth: true,\n appId: opts.app,\n }),\n ),\n ),\n );\n });\n\nexport const queryDef = program\n .command('query')\n .argument('<query>', 'InstaQL query as JSON/JSON5')\n .option(\n '-a --app <app-id>',\n 'App ID to query. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option('--admin', 'Run the query as admin (bypasses permissions)')\n .option('--as-email <email>', 'Run the query as a specific user by email')\n .option('--as-guest', 'Run the query as an unauthenticated guest')\n .option(\n '--as-token <refresh-token>',\n 'Run the query as a user identified by refresh token',\n )\n .description('Run an InstaQL query against your app.')\n .action(async function (queryArg, opts) {\n return runCommandEffect(queryCmd(queryArg, opts));\n });\n\nexport const pullDef = program\n .command('pull')\n .argument(\n '[schema|perms|all]',\n 'Which configuration to pull. Defaults to `all`',\n )\n .option(\n '-a --app <app-id>',\n 'App ID to pull to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option(\n '-p --package <react|react-native|core|admin|solid|svelte>',\n 'Which package to automatically install if there is not one installed already.',\n )\n .option(\n '--experimental-type-preservation',\n \"[Experimental] Preserve manual type changes like `status: i.json<'online' | 'offline'>()` when doing `instant-cli pull schema`\",\n )\n .description('Pull schema and perm files from production.')\n .addHelpText(\n 'after',\n `\nEnvironment Variables:\n INSTANT_SCHEMA_FILE_PATH Override schema file location (default: instant.schema.ts)\n INSTANT_PERMS_FILE_PATH Override perms file location (default: instant.perms.ts)\n`,\n )\n .action(async function (arg, inputOpts) {\n return runCommandEffect(\n pullCommand(arg as SchemaPermsOrBoth, inputOpts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: true,\n packageName: inputOpts.package as\n | 'react'\n | 'react-native'\n | 'core'\n | 'admin'\n | undefined,\n appId: inputOpts.app,\n }),\n ),\n ),\n );\n });\n\nexport const pushDef = program\n .command('push')\n .argument(\n '[schema|perms|all]',\n 'Which configuration to push. Defaults to `all`',\n )\n .option(\n '-a --app <app-id>',\n 'App ID to push to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option(\n '--skip-check-types',\n \"Don't check types on the server when pushing schema\",\n )\n .option(\n '--rename [renames...]',\n 'List of full attribute names separated by a \":\"\\n Example:`push --rename posts.author:posts.creator stores.owner:stores.manager`',\n )\n .option(\n '-p --package <react|react-native|core|admin|solid|svelte>',\n 'Which package to automatically install if there is not one installed already.',\n )\n .description('Push schema and perm files to production.')\n .addHelpText(\n 'after',\n `\nEnvironment Variables:\n INSTANT_SCHEMA_FILE_PATH Override schema file location (default: instant.schema.ts)\n INSTANT_PERMS_FILE_PATH Override perms file location (default: instant.perms.ts)\n`,\n )\n .action(async function (arg, inputOpts) {\n return runCommandEffect(\n pushCommand(arg, inputOpts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n appId: inputOpts.app,\n coerceLibraryInstall: true,\n coerceAuth: false,\n allowAdminToken: true,\n applyEnv: true,\n packageName:\n inputOpts.package as keyof typeof PACKAGE_ALIAS_AND_FULL_NAMES,\n }),\n ),\n ),\n );\n });\n\nexport const claimDef = program\n .command('claim')\n .description('Transfer a temporary app into your Instant account')\n .option(\n '-a --app <app-id>',\n 'App to claim. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action(async function (opts) {\n return runCommandEffect(\n claimCommand.pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n allowAdminToken: false,\n appId: opts.app,\n applyEnv: false,\n }),\n ),\n ),\n );\n });\n//// Program setup /////\n\nfunction globalOption(\n flags: string,\n description?: string,\n argParser?: (value: string, prev?: unknown) => unknown,\n) {\n const opt = new Option(flags, description);\n if (argParser) {\n opt.argParser(argParser);\n }\n // @ts-ignore\n // __global does not exist on `Option`,\n // but we use it in `getLocalAndGlobalOptions`, to produce\n // our own custom list of local and global options.\n // For more info, see the original PR:\n // https://github.com/instantdb/instant/pull/505\n opt.__global = true;\n return opt;\n}\n\nfunction getLocalAndGlobalOptions(cmd: any, helper: any) {\n const mixOfLocalAndGlobal = helper.visibleOptions(cmd);\n const localOptionsFromMix = mixOfLocalAndGlobal.filter(\n (option: any) => !option.__global,\n );\n const globalOptionsFromMix = mixOfLocalAndGlobal.filter(\n (option: any) => option.__global,\n );\n const globalOptions = helper.visibleGlobalOptions(cmd);\n\n return [localOptionsFromMix, globalOptionsFromMix.concat(globalOptions)];\n}\n\nfunction formatHelp(\n this: { showGlobalOptions: boolean },\n cmd: any,\n helper: any,\n) {\n const termWidth = helper.padWidth(cmd, helper);\n const helpWidth = helper.helpWidth || 80;\n const itemIndentWidth = 2;\n const itemSeparatorWidth = 2; // between term and description\n function formatItem(term: string, description: string | undefined) {\n if (description) {\n const fullText = `${term.padEnd(termWidth + itemSeparatorWidth)}${description}`;\n return helper.boxWrap(\n fullText,\n helpWidth - itemIndentWidth,\n termWidth + itemSeparatorWidth,\n );\n }\n return term;\n }\n function formatList(textArray: string[]) {\n return textArray.join('\\n').replace(/^/gm, ' '.repeat(itemIndentWidth));\n }\n\n // Usage\n let output = [`${helper.commandUsage(cmd)}`, ''];\n\n // Description\n const commandDescription = helper.commandDescription(cmd);\n if (commandDescription.length > 0) {\n output = output.concat([\n helper.boxWrap(commandDescription, helpWidth, 0),\n '',\n ]);\n }\n\n // Arguments\n const argumentList = helper.visibleArguments(cmd).map((argument: any) => {\n return formatItem(\n helper.argumentTerm(argument),\n helper.argumentDescription(argument),\n );\n });\n if (argumentList.length > 0) {\n output = output.concat([\n chalk.dim.bold('Arguments'),\n formatList(argumentList),\n '',\n ]);\n }\n const [visibleOptions, visibleGlobalOptions] = getLocalAndGlobalOptions(\n cmd,\n helper,\n );\n\n // Options\n const optionList = visibleOptions.map((option: any) => {\n return formatItem(\n helper.optionTerm(option),\n helper.optionDescription(option),\n );\n });\n if (optionList.length > 0) {\n output = output.concat([\n chalk.dim.bold('Options'),\n formatList(optionList),\n '',\n ]);\n }\n // Commands\n const commandList = helper.visibleCommands(cmd).map((cmd: any) => {\n return formatItem(\n helper.subcommandTerm(cmd),\n helper.subcommandDescription(cmd),\n );\n });\n if (commandList.length > 0) {\n output = output.concat([\n chalk.dim.bold('Commands'),\n formatList(commandList),\n '',\n ]);\n }\n\n if (this.showGlobalOptions) {\n const globalOptionList = visibleGlobalOptions.map((option: any) => {\n return formatItem(\n helper.optionTerm(option),\n helper.optionDescription(option),\n );\n });\n if (globalOptionList.length > 0) {\n output = output.concat([\n chalk.dim.bold('Global Options'),\n formatList(globalOptionList),\n '',\n ]);\n }\n }\n\n return output.join('\\n');\n}\n\nprogram.configureHelp({\n showGlobalOptions: true,\n formatHelp,\n});\n\nprogram.parse(process.argv);\n"]}
package/dist/layer.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as NodeContext from '@effect/platform-node/NodeContext';
2
2
  import { Cause, Effect, Layer } from 'effect';
3
- import { PlatformApi } from './context/platformApi.ts';
3
+ import { PlatformApi, PlatformApiError } from './context/platformApi.ts';
4
4
  import { PACKAGE_ALIAS_AND_FULL_NAMES } from './context/projectInfo.ts';
5
5
  import { InstantHttpError } from './lib/http.ts';
6
6
  import { RequestError } from '@effect/platform/HttpClientError';
@@ -21,5 +21,5 @@ export declare const WithAppLayer: (args: {
21
21
  allowAdminToken?: boolean;
22
22
  applyEnv?: boolean;
23
23
  temp?: boolean;
24
- }) => Layer.Layer<import("./context/globalOpts.ts").GlobalOpts | import("./context/projectInfo.ts").ProjectInfo | import("./lib/http.ts").InstantHttp | import("./context/authToken.ts").AuthToken | import("./lib/http.ts").InstantHttpAuthed | PlatformApi | import("./context/currentApp.ts").CurrentApp | NodeContext.NodeContext, import("./errors.ts").BadArgsError | import("./lib/ui.ts").UIError | Cause.UnknownException | import("./context/projectInfo.ts").ProjectInfoError | InstantHttpError | Cause.TimeoutException | RequestError | import("effect/ParseResult").ParseError | import("@effect/platform/HttpClientError").ResponseError | import("@effect/platform/Error").PlatformError | import("effect/ConfigError").ConfigError | import("./context/authToken.ts").NotAuthedError | import("./context/platformApi.ts").PlatformApiError | import("./context/currentApp.ts").CurrentAppContextError | import("./context/currentApp.ts").AppNotFoundError | import("@effect/platform/HttpBody").HttpBodyError, never>;
24
+ }) => Layer.Layer<import("./context/globalOpts.ts").GlobalOpts | import("./context/projectInfo.ts").ProjectInfo | import("./lib/http.ts").InstantHttp | import("./context/authToken.ts").AuthToken | import("./lib/http.ts").InstantHttpAuthed | PlatformApi | import("./context/currentApp.ts").CurrentApp | NodeContext.NodeContext, import("./errors.ts").BadArgsError | import("./lib/ui.ts").UIError | Cause.UnknownException | import("./context/projectInfo.ts").ProjectInfoError | InstantHttpError | Cause.TimeoutException | RequestError | import("effect/ParseResult").ParseError | import("@effect/platform/HttpClientError").ResponseError | import("@effect/platform/Error").PlatformError | import("effect/ConfigError").ConfigError | import("./context/authToken.ts").NotAuthedError | PlatformApiError | import("./context/currentApp.ts").CurrentAppContextError | import("./context/currentApp.ts").AppNotFoundError | import("@effect/platform/HttpBody").HttpBodyError, never>;
25
25
  //# sourceMappingURL=layer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"layer.d.ts","sourceRoot":"","sources":["../src/layer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,mCAAmC,CAAC;AAEjE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAkB,MAAM,QAAQ,CAAC;AAM9D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EACL,4BAA4B,EAE7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEL,gBAAgB,EAEjB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAIhE,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,KAAK,EACpD,QAAQ,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAC7B,OAAO,CAAC,CAAC,CAA2D,CAAC;AAExE,eAAO,MAAM,cAAc,yFAqE1B,CAAC;AAwBF,eAAO,MAAM,aAAa,0LAGzB,CAAC;AAGF,eAAO,MAAM,aAAa,GAAI,8BAG3B;IACD,eAAe,EAAE,OAAO,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;CACjB,kjBAUE,CAAC;AAEJ,eAAO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CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,OAAO,4BAA4B,CAAC;IACxD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,o8BAwBE,CAAC"}
package/dist/layer.js CHANGED
@@ -2,16 +2,31 @@ import * as NodeContext from '@effect/platform-node/NodeContext';
2
2
  import * as NodeHttpClient from '@effect/platform-node/NodeHttpClient';
3
3
  import { Cause, Effect, Layer, ManagedRuntime } from 'effect';
4
4
  import { UnknownException } from 'effect/Cause';
5
+ import { inspect } from 'node:util';
5
6
  import chalk from 'chalk';
6
7
  import { AuthTokenLive } from "./context/authToken.js";
7
8
  import { CurrentAppLive } from "./context/currentApp.js";
8
9
  import { GlobalOptsLive } from "./context/globalOpts.js";
9
- import { PlatformApi } from "./context/platformApi.js";
10
+ import { PlatformApi, PlatformApiError } from "./context/platformApi.js";
10
11
  import { PACKAGE_ALIAS_AND_FULL_NAMES, ProjectInfoLive, } from "./context/projectInfo.js";
11
12
  import { InstantHttpAuthedLive, InstantHttpError, InstantHttpLive, } from "./lib/http.js";
12
13
  import { SimpleLogLayer } from "./logging.js";
13
14
  import { RequestError } from '@effect/platform/HttpClientError';
14
15
  const runtime = ManagedRuntime.make(SimpleLogLayer);
16
+ // Best-effort stringification for unknown error causes. Tries JSON first
17
+ // (compact, readable) and falls back to util.inspect for circular refs or
18
+ // values JSON can't serialize (functions, BigInt, etc.).
19
+ function serializeCause(cause) {
20
+ try {
21
+ const json = JSON.stringify(cause);
22
+ if (json !== undefined)
23
+ return json;
24
+ }
25
+ catch {
26
+ // fall through
27
+ }
28
+ return inspect(cause, { depth: 2, breakLength: Infinity });
29
+ }
15
30
  export const runCommandEffect = (effect) => runtime.runPromise(effect.pipe(printRedErrors));
16
31
  export const printRedErrors = Effect.catchAllCause((cause) => Effect.gen(function* () {
17
32
  const failure = Cause.failureOption(cause);
@@ -30,6 +45,20 @@ export const printRedErrors = Effect.catchAllCause((cause) => Effect.gen(functio
30
45
  yield* Effect.logError(theError.toString());
31
46
  return process.exit(1);
32
47
  }
48
+ // Surface server-side validation messages instead of dumping a stack with
49
+ // the useful detail buried in [cause].
50
+ if (theError instanceof PlatformApiError) {
51
+ const cause = theError.cause;
52
+ const causeMessage = cause instanceof Error
53
+ ? cause.message
54
+ : cause != null
55
+ ? serializeCause(cause)
56
+ : '';
57
+ yield* Effect.logError(causeMessage
58
+ ? `${theError.message}: ${causeMessage}`
59
+ : theError.message);
60
+ return process.exit(1);
61
+ }
33
62
  // Special error handling for specific error types
34
63
  if (theError instanceof InstantHttpError) {
35
64
  if (theError?.message) {
package/dist/layer.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"layer.js","sourceRoot":"","sources":["../src/layer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,mCAAmC,CAAC;AACjE,OAAO,KAAK,cAAc,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EACL,4BAA4B,EAC5B,eAAe,GAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,qBAA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AE,IAAI,CAAC,KAAK;IACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;IACvB,IAAI,EAAE,IAAI,CAAC,IAAI;CAChB,CAAC,CACH,CAAC,IAAI,CACJ,KAAK,CAAC,YAAY,CAChB,aAAa,CAAC;IACZ,eAAe,EACb,IAAI,CAAC,eAAe,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI;IAClE,MAAM,EAAE,IAAI,CAAC,UAAU,IAAI,KAAK;CACjC,CAAC,CACH,EACD,KAAK,CAAC,YAAY,CAChB,eAAe,CACb,IAAI,CAAC,oBAAoB,IAAI,IAAI,CAAC,MAAM,EACxC,IAAI,CAAC,WAAW,CACjB,CACF,EACD,KAAK,CAAC,YAAY,CAAC,aAAa,CAAC,CAClC,CAAC","sourcesContent":["import * as NodeContext from '@effect/platform-node/NodeContext';\nimport * as NodeHttpClient from '@effect/platform-node/NodeHttpClient';\nimport { Cause, Effect, Layer, ManagedRuntime } from 'effect';\nimport { UnknownException } from 'effect/Cause';\nimport chalk from 'chalk';\nimport { AuthTokenLive } from './context/authToken.ts';\nimport { CurrentAppLive } from './context/currentApp.ts';\nimport { GlobalOptsLive } from './context/globalOpts.ts';\nimport { PlatformApi } from './context/platformApi.ts';\nimport {\n PACKAGE_ALIAS_AND_FULL_NAMES,\n ProjectInfoLive,\n} from './context/projectInfo.ts';\nimport {\n InstantHttpAuthedLive,\n InstantHttpError,\n InstantHttpLive,\n} from './lib/http.ts';\nimport { SimpleLogLayer } from './logging.ts';\nimport { RequestError } from '@effect/platform/HttpClientError';\n\nconst runtime = ManagedRuntime.make(SimpleLogLayer);\n\nexport const runCommandEffect = <A, E, R extends never>(\n effect: Effect.Effect<A, E, R>,\n): Promise<A> => runtime.runPromise(effect.pipe(printRedErrors) as any);\n\nexport const printRedErrors = Effect.catchAllCause((cause) =>\n Effect.gen(function* () {\n const failure = Cause.failureOption(cause);\n\n // This should never happen because the catchAllCause should only fire when there IS a failure\n if (failure._tag !== 'Some') {\n return;\n }\n\n // Unwrap Effect.tryPromise's UnknownException so instanceof checks below\n // match regardless of whether the error was Effect.fail'd or thrown from a Promise.\n const theError =\n failure.value instanceof UnknownException\n ? failure.value.error\n : failure.value;\n\n // Simplify \"can't connect to url errors\" instead of printing\n // crazy stack trace\n if (theError instanceof RequestError) {\n yield* Effect.logError(theError.toString());\n return process.exit(1);\n }\n\n // Special error handling for specific error types\n if (theError instanceof InstantHttpError) {\n if (theError?.message) {\n yield* Effect.logError(\n 'Error making request to Instant API: ' + theError.message,\n );\n }\n if (Array.isArray(theError?.hint?.errors)) {\n for (const err of theError.hint.errors) {\n if (err) {\n if (typeof err === 'string') {\n yield* Effect.logError(err);\n } else {\n yield* Effect.logError(\n `${err.in ? err.in.join('->') + ': ' : ''}${err.message}`,\n );\n }\n }\n }\n }\n return process.exit(1);\n }\n\n // Print just the message if the error has a message attribute and no cause\n if (\n typeof theError === 'object' &&\n theError !== null &&\n 'message' in theError &&\n typeof theError.message === 'string' &&\n !('cause' in theError)\n ) {\n return yield* Effect.logError(theError.message).pipe(\n Effect.tap(() => {\n process.exit(1);\n }),\n );\n }\n\n return yield* Effect.logError(\n Cause.pretty(cause, { renderErrorCause: true }),\n ).pipe(\n Effect.tap(() => {\n process.exit(1);\n }),\n );\n }),\n);\n\n/**\n * Note:\n Avoid Duplicate Layer Creation\n\n Layers are memoized using reference equality. Therefore, if you have a layer that is created by calling a function like f(), you should only call that f once and re-use the resulting layer so that you are always using the same instance.\n */\n\n// TODO: make coerce param work for auth too\n\n// Base layers\nconst AuthTokenLayer = ({\n allowAdminToken = true,\n coerce = false,\n}: {\n allowAdminToken: boolean;\n coerce: boolean;\n}) =>\n Layer.provide(AuthTokenLive({ allowAdminToken, coerce }), NodeContext.layer);\n\nconst InstantHttpLayer = Layer.provide(InstantHttpLive, NodeHttpClient.layer);\n\n// Unauthenticated layer with InstantHttp + PlatformApi + GlobalOpts + NodeContext\nexport const BaseLayerLive = Layer.provideMerge(\n Layer.mergeAll(InstantHttpLayer, PlatformApi.Default, GlobalOptsLive),\n NodeContext.layer,\n);\n\n// Authenticated layer extends BaseLayerLive with InstantHttpAuthed\nexport const AuthLayerLive = ({\n allowAdminToken = true,\n coerce = false,\n}: {\n allowAdminToken: boolean;\n coerce: boolean;\n}) =>\n Layer.provideMerge(\n Layer.provideMerge(\n InstantHttpAuthedLive,\n Layer.merge(\n AuthTokenLayer({ allowAdminToken, coerce }),\n InstantHttpLayer,\n ),\n ),\n BaseLayerLive,\n );\n\nexport const WithAppLayer = (args: {\n appId?: string;\n title?: string;\n coerce: boolean;\n coerceAuth?: boolean;\n coerceLibraryInstall?: boolean;\n packageName?: keyof typeof PACKAGE_ALIAS_AND_FULL_NAMES;\n allowAdminToken?: boolean;\n applyEnv?: boolean;\n temp?: boolean;\n}) =>\n Layer.mergeAll(\n CurrentAppLive({\n coerce: args.coerce,\n appId: args.appId,\n title: args.title,\n applyEnv: args.applyEnv,\n temp: args.temp,\n }),\n ).pipe(\n Layer.provideMerge(\n AuthLayerLive({\n allowAdminToken:\n args.allowAdminToken !== undefined ? args.allowAdminToken : true,\n coerce: args.coerceAuth ?? false,\n }),\n ),\n Layer.provideMerge(\n ProjectInfoLive(\n args.coerceLibraryInstall ?? args.coerce,\n args.packageName,\n ),\n ),\n Layer.provideMerge(BaseLayerLive),\n );\n"]}
1
+ {"version":3,"file":"layer.js","sourceRoot":"","sources":["../src/layer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,mCAAmC,CAAC;AACjE,OAAO,KAAK,cAAc,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B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,KAAK;IACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;IACvB,IAAI,EAAE,IAAI,CAAC,IAAI;CAChB,CAAC,CACH,CAAC,IAAI,CACJ,KAAK,CAAC,YAAY,CAChB,aAAa,CAAC;IACZ,eAAe,EACb,IAAI,CAAC,eAAe,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI;IAClE,MAAM,EAAE,IAAI,CAAC,UAAU,IAAI,KAAK;CACjC,CAAC,CACH,EACD,KAAK,CAAC,YAAY,CAChB,eAAe,CACb,IAAI,CAAC,oBAAoB,IAAI,IAAI,CAAC,MAAM,EACxC,IAAI,CAAC,WAAW,CACjB,CACF,EACD,KAAK,CAAC,YAAY,CAAC,aAAa,CAAC,CAClC,CAAC","sourcesContent":["import * as NodeContext from '@effect/platform-node/NodeContext';\nimport * as NodeHttpClient from '@effect/platform-node/NodeHttpClient';\nimport { Cause, Effect, Layer, ManagedRuntime } from 'effect';\nimport { UnknownException } from 'effect/Cause';\nimport { inspect } from 'node:util';\nimport chalk from 'chalk';\nimport { AuthTokenLive } from './context/authToken.ts';\nimport { CurrentAppLive } from './context/currentApp.ts';\nimport { GlobalOptsLive } from './context/globalOpts.ts';\nimport { PlatformApi, PlatformApiError } from './context/platformApi.ts';\nimport {\n PACKAGE_ALIAS_AND_FULL_NAMES,\n ProjectInfoLive,\n} from './context/projectInfo.ts';\nimport {\n InstantHttpAuthedLive,\n InstantHttpError,\n InstantHttpLive,\n} from './lib/http.ts';\nimport { SimpleLogLayer } from './logging.ts';\nimport { RequestError } from '@effect/platform/HttpClientError';\n\nconst runtime = ManagedRuntime.make(SimpleLogLayer);\n\n// Best-effort stringification for unknown error causes. Tries JSON first\n// (compact, readable) and falls back to util.inspect for circular refs or\n// values JSON can't serialize (functions, BigInt, etc.).\nfunction serializeCause(cause: unknown): string {\n try {\n const json = JSON.stringify(cause);\n if (json !== undefined) return json;\n } catch {\n // fall through\n }\n return inspect(cause, { depth: 2, breakLength: Infinity });\n}\n\nexport const runCommandEffect = <A, E, R extends never>(\n effect: Effect.Effect<A, E, R>,\n): Promise<A> => runtime.runPromise(effect.pipe(printRedErrors) as any);\n\nexport const printRedErrors = Effect.catchAllCause((cause) =>\n Effect.gen(function* () {\n const failure = Cause.failureOption(cause);\n\n // This should never happen because the catchAllCause should only fire when there IS a failure\n if (failure._tag !== 'Some') {\n return;\n }\n\n // Unwrap Effect.tryPromise's UnknownException so instanceof checks below\n // match regardless of whether the error was Effect.fail'd or thrown from a Promise.\n const theError =\n failure.value instanceof UnknownException\n ? failure.value.error\n : failure.value;\n\n // Simplify \"can't connect to url errors\" instead of printing\n // crazy stack trace\n if (theError instanceof RequestError) {\n yield* Effect.logError(theError.toString());\n return process.exit(1);\n }\n\n // Surface server-side validation messages instead of dumping a stack with\n // the useful detail buried in [cause].\n if (theError instanceof PlatformApiError) {\n const cause = theError.cause;\n const causeMessage =\n cause instanceof Error\n ? cause.message\n : cause != null\n ? serializeCause(cause)\n : '';\n yield* Effect.logError(\n causeMessage\n ? `${theError.message}: ${causeMessage}`\n : theError.message,\n );\n return process.exit(1);\n }\n\n // Special error handling for specific error types\n if (theError instanceof InstantHttpError) {\n if (theError?.message) {\n yield* Effect.logError(\n 'Error making request to Instant API: ' + theError.message,\n );\n }\n if (Array.isArray(theError?.hint?.errors)) {\n for (const err of theError.hint.errors) {\n if (err) {\n if (typeof err === 'string') {\n yield* Effect.logError(err);\n } else {\n yield* Effect.logError(\n `${err.in ? err.in.join('->') + ': ' : ''}${err.message}`,\n );\n }\n }\n }\n }\n return process.exit(1);\n }\n\n // Print just the message if the error has a message attribute and no cause\n if (\n typeof theError === 'object' &&\n theError !== null &&\n 'message' in theError &&\n typeof theError.message === 'string' &&\n !('cause' in theError)\n ) {\n return yield* Effect.logError(theError.message).pipe(\n Effect.tap(() => {\n process.exit(1);\n }),\n );\n }\n\n return yield* Effect.logError(\n Cause.pretty(cause, { renderErrorCause: true }),\n ).pipe(\n Effect.tap(() => {\n process.exit(1);\n }),\n );\n }),\n);\n\n/**\n * Note:\n Avoid Duplicate Layer Creation\n\n Layers are memoized using reference equality. Therefore, if you have a layer that is created by calling a function like f(), you should only call that f once and re-use the resulting layer so that you are always using the same instance.\n */\n\n// TODO: make coerce param work for auth too\n\n// Base layers\nconst AuthTokenLayer = ({\n allowAdminToken = true,\n coerce = false,\n}: {\n allowAdminToken: boolean;\n coerce: boolean;\n}) =>\n Layer.provide(AuthTokenLive({ allowAdminToken, coerce }), NodeContext.layer);\n\nconst InstantHttpLayer = Layer.provide(InstantHttpLive, NodeHttpClient.layer);\n\n// Unauthenticated layer with InstantHttp + PlatformApi + GlobalOpts + NodeContext\nexport const BaseLayerLive = Layer.provideMerge(\n Layer.mergeAll(InstantHttpLayer, PlatformApi.Default, GlobalOptsLive),\n NodeContext.layer,\n);\n\n// Authenticated layer extends BaseLayerLive with InstantHttpAuthed\nexport const AuthLayerLive = ({\n allowAdminToken = true,\n coerce = false,\n}: {\n allowAdminToken: boolean;\n coerce: boolean;\n}) =>\n Layer.provideMerge(\n Layer.provideMerge(\n InstantHttpAuthedLive,\n Layer.merge(\n AuthTokenLayer({ allowAdminToken, coerce }),\n InstantHttpLayer,\n ),\n ),\n BaseLayerLive,\n );\n\nexport const WithAppLayer = (args: {\n appId?: string;\n title?: string;\n coerce: boolean;\n coerceAuth?: boolean;\n coerceLibraryInstall?: boolean;\n packageName?: keyof typeof PACKAGE_ALIAS_AND_FULL_NAMES;\n allowAdminToken?: boolean;\n applyEnv?: boolean;\n temp?: boolean;\n}) =>\n Layer.mergeAll(\n CurrentAppLive({\n coerce: args.coerce,\n appId: args.appId,\n title: args.title,\n applyEnv: args.applyEnv,\n temp: args.temp,\n }),\n ).pipe(\n Layer.provideMerge(\n AuthLayerLive({\n allowAdminToken:\n args.allowAdminToken !== undefined ? args.allowAdminToken : true,\n coerce: args.coerceAuth ?? false,\n }),\n ),\n Layer.provideMerge(\n ProjectInfoLive(\n args.coerceLibraryInstall ?? args.coerce,\n args.packageName,\n ),\n ),\n Layer.provideMerge(BaseLayerLive),\n );\n"]}
@@ -0,0 +1,28 @@
1
+ import { Effect } from 'effect';
2
+ import { type WebhookAction, type WebhookEventInfo, type WebhooksManager } from '@instantdb/platform';
3
+ import { AuthToken } from '../context/authToken.ts';
4
+ import { CurrentApp } from '../context/currentApp.ts';
5
+ import { PlatformApiError } from '../context/platformApi.ts';
6
+ import { BadArgsError } from '../errors.ts';
7
+ export declare const WEBHOOK_ACTIONS: readonly WebhookAction[];
8
+ export declare const useWebhooksManager: <R>(fun: (manager: WebhooksManager<any>) => Promise<R>, errorMessage?: string) => Effect.Effect<R, import("effect/ConfigError").ConfigError | PlatformApiError, AuthToken | CurrentApp>;
9
+ /**
10
+ * Yields a `WebhooksManager` instance scoped to the current app. Use when you
11
+ * need to hold on to the manager outside an Effect (e.g. to call from inside
12
+ * an async UI callback).
13
+ */
14
+ export declare const buildWebhooksManager: Effect.Effect<WebhooksManager<import("@instantdb/core").InstantUnknownSchemaDef>, import("effect/ConfigError").ConfigError, AuthToken | CurrentApp>;
15
+ /**
16
+ * Fetches the app's schema and returns the sorted list of namespace names. Returns
17
+ * `null` if the schema can't be fetched (network, auth, missing app, etc.) so
18
+ * callers can fall back to a plain text prompt.
19
+ */
20
+ export declare const getRemoteNamespaces: Effect.Effect<string[] | null, import("effect/ConfigError").ConfigError, AuthToken | CurrentApp>;
21
+ /**
22
+ * Pages through `manager.listEvents` until we have `limit` events or the server
23
+ * runs out. Returns the events in their natural (newest-first) order.
24
+ */
25
+ export declare const fetchRecentEvents: (webhookId: string, limit: number) => Effect.Effect<WebhookEventInfo[], import("effect/ConfigError").ConfigError | PlatformApiError, AuthToken | CurrentApp>;
26
+ export declare const parseNamespaces: (raw: string | undefined) => Effect.Effect<string[] | undefined, BadArgsError, never>;
27
+ export declare const parseActions: (raw: string | undefined) => Effect.Effect<WebhookAction[] | undefined, BadArgsError, never>;
28
+ //# sourceMappingURL=webhooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../src/lib/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAU5C,eAAO,MAAM,eAAe,EAAE,SAAS,aAAa,EAI1C,CAAC;AAEX,eAAO,MAAM,kBAAkB,GAAI,CAAC,EAClC,KAAK,CAAC,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,EAClD,eAAe,MAAM,0GAanB,CAAC;AAEL;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,qJAI/B,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,kGAS9B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,WAAW,MAAM,EAAE,OAAO,MAAM,2HAc9D,CAAC;AAQL,eAAO,MAAM,eAAe,GAAI,KAAK,MAAM,GAAG,SAAS,6DAUnD,CAAC;AAEL,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,GAAG,SAAS,oEAkBhD,CAAC"}