Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x | import { z } from 'zod';
import { defineOption } from '../../lib/define-option.js';
import { OAUTH_RIGHTS } from '../../models/oauth-consumer.js';
export const descriptionOption = defineOption({
name: 'description',
schema: z.string().trim().min(1).optional(),
description: 'Consumer description',
aliases: ['d'],
placeholder: 'description',
});
export const urlOption = defineOption({
name: 'url',
schema: z.string().url().optional(),
description: 'Application home URL',
placeholder: 'url',
});
export const pictureOption = defineOption({
name: 'picture',
schema: z.string().url().optional(),
description: 'Application logo URL',
placeholder: 'url',
});
export const baseUrlOption = defineOption({
name: 'base-url',
schema: z.string().url().optional(),
description: 'OAuth callback base URL',
placeholder: 'url',
});
/** @type {[string, ...string[]]} */
const OAUTH_RIGHTS_WITH_ALL = [...Object.values(OAUTH_RIGHTS), 'all'];
const rightsSchema = z
.string()
.transform((s) => s.split(',').map((r) => r.trim()))
.pipe(z.array(z.enum(OAUTH_RIGHTS_WITH_ALL)))
.optional();
export const rightsOption = defineOption({
name: 'rights',
schema: rightsSchema,
description: `Comma-separated list of rights (${OAUTH_RIGHTS_WITH_ALL.join(', ')})`,
placeholder: 'rights',
});
|