Skip to content

Commit

Permalink
Fix Build
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Sep 3, 2024
1 parent 0c6ce2f commit 9ebf20a
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 36 deletions.
2 changes: 1 addition & 1 deletion api/lib/api/mission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export const MissionDeleteInput = Type.Object({
})

export const GetInput = Type.Object({
password: Type.Optional(Type.Boolean()),
password: Type.Optional(Type.String()),
changes: Type.Optional(Type.Boolean()),
logs: Type.Optional(Type.Boolean()),
secago: Type.Optional(Type.Integer()),
Expand Down
19 changes: 10 additions & 9 deletions api/routes/marti-mission-layers.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Type } from '@sinclair/typebox'
import { Static, Type } from '@sinclair/typebox'
import { StandardResponse, GenericMartiResponse } from '../lib/types.js';
import Schema from '@openaddresses/batch-schema';
import Err from '@openaddresses/batch-error';
import Auth from '../lib/auth.js';
import Config from '../lib/config.js';
import { MissionOptions } from '../lib/api/mission.js';
import { MissionLayerType } from '../lib/api/mission-layer.js';
import TAKAPI, {
APIAuthCertificate,
Expand All @@ -25,8 +26,8 @@ export default async function router(schema: Schema, config: Config) {
const auth = (await config.models.Profile.from(user.email)).auth;
const api = await TAKAPI.init(new URL(String(config.server.api)), new APIAuthCertificate(auth.cert, auth.key));

const opts = req.headers['missionauthorization']
? { token: req.headers['missionauthorization'] }
const opts: Static<typeof MissionOptions> = req.headers['missionauthorization']
? { token: String(req.headers['missionauthorization']) }
: await config.conns.subscription(user.email, req.params.name)

const list = await api.MissionLayer.list(
Expand Down Expand Up @@ -62,8 +63,8 @@ export default async function router(schema: Schema, config: Config) {
const auth = (await config.models.Profile.from(user.email)).auth;
const api = await TAKAPI.init(new URL(String(config.server.api)), new APIAuthCertificate(auth.cert, auth.key));

const opts = req.headers['missionauthorization']
? { token: req.headers['missionauthorization'] }
const opts: Static<typeof MissionOptions> = req.headers['missionauthorization']
? { token: String(req.headers['missionauthorization']) }
: await config.conns.subscription(user.email, req.params.name)

const create = await api.MissionLayer.create(
Expand Down Expand Up @@ -101,8 +102,8 @@ export default async function router(schema: Schema, config: Config) {
const api = await TAKAPI.init(new URL(String(config.server.api)), new APIAuthCertificate(auth.cert, auth.key));

if (req.body.name) {
const opts = req.headers['missionauthorization']
? { token: req.headers['missionauthorization'] }
const opts: Static<typeof MissionOptions> = req.headers['missionauthorization']
? { token: String(req.headers['missionauthorization']) }
: await config.conns.subscription(user.email, req.params.name)

await api.MissionLayer.rename(
Expand Down Expand Up @@ -141,8 +142,8 @@ export default async function router(schema: Schema, config: Config) {
const auth = (await config.models.Profile.from(user.email)).auth;
const api = await TAKAPI.init(new URL(String(config.server.api)), new APIAuthCertificate(auth.cert, auth.key));

const opts = req.headers['missionauthorization']
? { token: req.headers['missionauthorization'] }
const opts: Static<typeof MissionOptions> = req.headers['missionauthorization']
? { token: String(req.headers['missionauthorization']) }
: await config.conns.subscription(user.email, req.params.name)

await api.MissionLayer.delete(
Expand Down
11 changes: 6 additions & 5 deletions api/routes/marti-mission-logs.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Type } from '@sinclair/typebox'
import { Static, Type } from '@sinclair/typebox'
import { StandardResponse, GenericMartiResponse } from '../lib/types.js';
import Schema from '@openaddresses/batch-schema';
import Err from '@openaddresses/batch-error';
import { MissionOptions } from '../lib/api/mission.js';
import Auth from '../lib/auth.js';
import Config from '../lib/config.js';
import TAKAPI, {
Expand All @@ -28,8 +29,8 @@ export default async function router(schema: Schema, config: Config) {
const creatorUid = user.email;
const api = await TAKAPI.init(new URL(String(config.server.api)), new APIAuthCertificate(auth.cert, auth.key));

const opts = req.headers['missionauthorization']
? { token: req.headers['missionauthorization'] }
const opts: Static<typeof MissionOptions> = req.headers['missionauthorization']
? { token: String(req.headers['missionauthorization']) }
: await config.conns.subscription(user.email, req.params.name)

const mission = await api.MissionLog.create(
Expand Down Expand Up @@ -63,8 +64,8 @@ export default async function router(schema: Schema, config: Config) {
const auth = (await config.models.Profile.from(user.email)).auth;
const api = await TAKAPI.init(new URL(String(config.server.api)), new APIAuthCertificate(auth.cert, auth.key));

const opts = req.headers['missionauthorization']
? { token: req.headers['missionauthorization'] }
const opts: Static<typeof MissionOptions> = req.headers['missionauthorization']
? { token: String(req.headers['missionauthorization']) }
: await config.conns.subscription(user.email, req.params.name)

await api.MissionLog.delete(
Expand Down
43 changes: 22 additions & 21 deletions api/routes/marti-mission.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Type } from '@sinclair/typebox'
import { Static, Type } from '@sinclair/typebox'
import Schema from '@openaddresses/batch-schema';
import Err from '@openaddresses/batch-error';
import Auth from '../lib/auth.js';
import Config from '../lib/config.js';
import { GenericMartiResponse } from '../lib/types.js';
import {
MissionOptions,
MissionRole,
Mission,
MissionChangesInput,
Expand Down Expand Up @@ -39,8 +40,8 @@ export default async function router(schema: Schema, config: Config) {
const auth = (await config.models.Profile.from(user.email)).auth;
const api = await TAKAPI.init(new URL(String(config.server.api)), new APIAuthCertificate(auth.cert, auth.key));

const opts = req.headers['missionauthorization']
? { token: req.headers['missionauthorization'] }
const opts: Static<typeof MissionOptions> = req.headers['missionauthorization']
? { token: String(req.headers['missionauthorization']) }
: await config.conns.subscription(user.email, req.params.name)

const mission = await api.Mission.get(
Expand Down Expand Up @@ -72,8 +73,8 @@ export default async function router(schema: Schema, config: Config) {
const auth = (await config.models.Profile.from(user.email)).auth;
const api = await TAKAPI.init(new URL(String(config.server.api)), new APIAuthCertificate(auth.cert, auth.key));

const opts = req.headers['missionauthorization']
? { token: req.headers['missionauthorization'] }
const opts: Static<typeof MissionOptions> = req.headers['missionauthorization']
? { token: String(req.headers['missionauthorization']) }
: await config.conns.subscription(user.email, req.params.name)

const features = await api.Mission.latestFeats(req.params.name, opts);
Expand All @@ -99,8 +100,8 @@ export default async function router(schema: Schema, config: Config) {
const auth = (await config.models.Profile.from(user.email)).auth;
const api = await TAKAPI.init(new URL(String(config.server.api)), new APIAuthCertificate(auth.cert, auth.key));

const opts = req.headers['missionauthorization']
? { token: req.headers['missionauthorization'] }
const opts: Static<typeof MissionOptions> = req.headers['missionauthorization']
? { token: String(req.headers['missionauthorization']) }
: await config.conns.subscription(user.email, req.params.name)

const changes = await api.Mission.changes(
Expand Down Expand Up @@ -130,8 +131,8 @@ export default async function router(schema: Schema, config: Config) {
const auth = (await config.models.Profile.from(user.email)).auth;
const api = await TAKAPI.init(new URL(String(config.server.api)), new APIAuthCertificate(auth.cert, auth.key));

const opts = req.headers['missionauthorization']
? { token: req.headers['missionauthorization'] }
const opts: Static<typeof MissionOptions> = req.headers['missionauthorization']
? { token: String(req.headers['missionauthorization']) }
: await config.conns.subscription(user.email, req.params.name)

const mission = await api.Mission.delete(
Expand Down Expand Up @@ -205,8 +206,8 @@ export default async function router(schema: Schema, config: Config) {
const auth = (await config.models.Profile.from(user.email)).auth;
const api = await TAKAPI.init(new URL(String(config.server.api)), new APIAuthCertificate(auth.cert, auth.key));

const opts = req.headers['missionauthorization']
? { token: req.headers['missionauthorization'] }
const opts: Static<typeof MissionOptions> = req.headers['missionauthorization']
? { token: String(req.headers['missionauthorization']) }
: await config.conns.subscription(user.email, req.params.name)

const role = await api.Mission.role(
Expand Down Expand Up @@ -234,8 +235,8 @@ export default async function router(schema: Schema, config: Config) {
const auth = (await config.models.Profile.from(user.email)).auth;
const api = await TAKAPI.init(new URL(String(config.server.api)), new APIAuthCertificate(auth.cert, auth.key));

const opts = req.headers['missionauthorization']
? { token: req.headers['missionauthorization'] }
const opts: Static<typeof MissionOptions> = req.headers['missionauthorization']
? { token: String(req.headers['missionauthorization']) }
: await config.conns.subscription(user.email, req.params.name)

const subs = await api.Mission.subscriptions(
Expand Down Expand Up @@ -263,8 +264,8 @@ export default async function router(schema: Schema, config: Config) {
const auth = (await config.models.Profile.from(user.email)).auth;
const api = await TAKAPI.init(new URL(String(config.server.api)), new APIAuthCertificate(auth.cert, auth.key));

const opts = req.headers['missionauthorization']
? { token: req.headers['missionauthorization'] }
const opts: Static<typeof MissionOptions> = req.headers['missionauthorization']
? { token: String(req.headers['missionauthorization']) }
: await config.conns.subscription(user.email, req.params.name)

const roles = await api.Mission.subscriptionRoles(
Expand Down Expand Up @@ -300,8 +301,8 @@ export default async function router(schema: Schema, config: Config) {
const auth = (await config.models.Profile.from(user.email)).auth;
const api = await TAKAPI.init(new URL(String(config.server.api)), new APIAuthCertificate(auth.cert, auth.key));

const opts = req.headers['missionauthorization']
? { token: req.headers['missionauthorization'] }
const opts: Static<typeof MissionOptions> = req.headers['missionauthorization']
? { token: String(req.headers['missionauthorization']) }
: await config.conns.subscription(user.email, req.params.name)

const missions = await api.Mission.contacts(
Expand Down Expand Up @@ -350,8 +351,8 @@ export default async function router(schema: Schema, config: Config) {
remoteAddress: req._remoteAddress
}

const opts = req.headers['missionauthorization']
? { token: req.headers['missionauthorization'] }
const opts: Static<typeof MissionOptions> = req.headers['missionauthorization']
? { token: String(req.headers['missionauthorization']) }
: await config.conns.subscription(user.email, req.params.name)

const missionContent = await api.Mission.attachContents(
Expand Down Expand Up @@ -385,8 +386,8 @@ export default async function router(schema: Schema, config: Config) {

const api = await TAKAPI.init(new URL(String(config.server.api)), new APIAuthCertificate(auth.cert, auth.key));

const opts = req.headers['missionauthorization']
? { token: req.headers['missionauthorization'] }
const opts: Static<typeof MissionOptions> = req.headers['missionauthorization']
? { token: String(req.headers['missionauthorization']) }
: await config.conns.subscription(user.email, req.params.name)

const missionContent = await api.Mission.detachContents(
Expand Down

0 comments on commit 9ebf20a

Please sign in to comment.