This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import crypto from 'crypto' | |
| const { INTEGRATION_SECRET, VERCEL_TEAM_ID, VERCEL_TOKEN } = process.env | |
| function sha1(data: Buffer, secret: string): string { | |
| return crypto.createHmac('sha1', secret).update(data).digest('hex') | |
| } | |
| export async function POST(request: Request) { | |
| if (typeof INTEGRATION_SECRET != 'string') { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import { Thenable } from "react"; | |
| export async function Await<T>({ | |
| promise, | |
| children, | |
| }: { | |
| promise: Thenable<T>; | |
| children: (value: T) => JSX.Element; | |
| }) { | |
| const data = await promise; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import { | |
| ElementRef, | |
| ForwardRefExoticComponent, | |
| createElement, | |
| forwardRef, | |
| } from "react"; | |
| import { cn } from "./utils"; | |
| export function extend<T extends { className?: string }>( | |
| Component: ForwardRefExoticComponent<T>, | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import type { SetStateAction } from 'react' | |
| import { useCallback } from 'react' | |
| import type { QueryFunction, UseQueryOptions } from 'react-query' | |
| import { useQuery, useQueryClient } from 'react-query' | |
| type IQueryMutator<T> = (value: SetStateAction<T>) => void | |
| type IOptions<T> = | |
| | Omit<UseQueryOptions<T, unknown, T, string[]>, 'queryKey' | 'queryFn'> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | Effect.flatMap(({ id }) => { | |
| const program = fetchFresh( | |
| pollSchema, | |
| `https://graph.facebook.com/${id}${objectToQueryString({ | |
| fields: 'status_code', | |
| access_token: FACEBOOK_PAGE_TOKEN, | |
| })}` | |
| ) | |
| return Effect.repeatUntilEffect(program, (props) => { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import type { FiberId, FiberRefs, HashMap, List } from 'effect' | |
| import { Cause, Effect, Logger, pipe } from 'effect' | |
| import type { AnnotationValue } from 'effect/Logger' | |
| import type { LogLevel } from 'effect/LoggerLevel' | |
| import type { LogSpan } from 'effect/LoggerSpan' | |
| import pino from 'pino' | |
| import type { WithRequired } from '@/types/helpers' | |
| const pinoLogger = pino() | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | const getAccessToken = fetchFresh<{ access_token: string }>( | |
| null, | |
| 'https://accounts.spotify.com/api/token', | |
| { | |
| method: 'POST', | |
| headers: { | |
| Authorization: `Basic ${Buffer.from( | |
| `${process.env.SPOTIFY_CLIENT_ID}:${process.env.SPOTIFY_CLIENT_SECRET}` | |
| ).toString('base64')}`, | |
| 'Content-Type': 'application/x-www-form-urlencoded', | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | async function getAccessToken() { | |
| return Effect.runPromise( | |
| fetchFresh<{ access_token: string }>( | |
| null, | |
| 'https://accounts.spotify.com/api/token', | |
| { | |
| method: 'POST', | |
| headers: { | |
| Authorization: `Basic ${Buffer.from( | |
| `${process.env.SPOTIFY_CLIENT_ID}:${process.env.SPOTIFY_CLIENT_SECRET}` | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import * as S from '@effect/schema/Schema' | |
| import { Context, Effect } from 'effect' | |
| export interface IFetcher { | |
| fetch: typeof fetch | |
| } | |
| export const TFetcher = Context.Tag<IFetcher>('IFetcher') | |
| class FreshFetcher implements IFetcher { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | { | |
| "version": 2, | |
| "builds": [ | |
| { | |
| "src": "src/app.js", | |
| "use": "@vercel/node" | |
| } | |
| ], | |
| "routes": [ | |
| { | 
NewerOlder