← Public packages
@kody/doordash-driver
Request DoorDash Drive (Dasher) deliveries with JWT auth from Developer Portal access keys.
src/adapt.ts
89 lines · 2.4 KB · TypeScript/**
* After a community fork, call this first.
* Returns owner-specific settings and the swap steps for your DoorDash Drive app.
*
* ```ts
* import adapt from 'kody:@you/doordash-driver/adapt'
* const guide = await adapt()
* ```
*/
import {
API_HOST,
DEFAULT_SIGNING_SECRET,
DEVELOPER_PORTAL_URL,
SETTINGS_DEVELOPER_ID,
SETTINGS_KEY_ID,
signingSecretSetupUrl,
} from './core.ts'
import { readDriveSettings } from './settings.ts'
export default async function adapt() {
const settings = await readDriveSettings()
return {
purpose:
'Point this forked DoorDash Drive package at your own Developer Portal access key, then publish your copy.',
ownerSettings: {
developerId: {
storageName: SETTINGS_DEVELOPER_ID,
resolved: settings.developerId,
source: settings.developerId ? 'package-storage' : 'unset',
needsSwap: !settings.developerId,
},
keyId: {
storageName: SETTINGS_KEY_ID,
resolved: settings.keyId,
source: settings.keyId ? 'package-storage' : 'unset',
needsSwap: !settings.keyId,
},
signingSecret: {
secretName: DEFAULT_SIGNING_SECRET,
setupUrl: signingSecretSetupUrl(),
approveHost: API_HOST,
},
},
steps: [
{
id: 'intent',
title: 'Rewrite README ## Intent',
detail:
'Describe the forking user’s Drive use case. Keep the section short.',
},
{
id: 'portal',
title: 'Create a DoorDash Drive access key',
detail:
'Open ' +
DEVELOPER_PORTAL_URL +
' and create an access key. Copy developer_id, key_id, and signing_secret from the JSON.',
},
{
id: 'settings',
title: 'Save developer_id and key_id in package storage',
detail:
'import settings from "kody:@you/doordash-driver/settings"; await settings({ developerId, keyId })',
},
{
id: 'secret',
title: 'Save signing_secret as a Kody secret',
detail:
'Send the owner this URL (never paste the value in chat): ' +
signingSecretSetupUrl() +
'. Approve host ' +
API_HOST +
' on that secret.',
},
{
id: 'smoke',
title: 'Run smoke-test',
detail: 'import smokeTest from "kody:@you/doordash-driver/smoke-test"; await smokeTest()',
},
{
id: 'publish',
title: 'Publish your fork',
detail: 'Publish (and optionally community-publish) after the README Intent matches this copy.',
},
],
share: 'https://kody.codes/@kody/doordash-driver',
}
}