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
name: 🔄 Increment Version | |
description: Increment the repository version number | |
inputs: | |
namespace: | |
description: "Use to create a named sub-version. This value will be prepended to tags created for this version." | |
required: false | |
channel: | |
description: "Denote the channel or pre-release version, i.e. alpha, beta, rc, etc." | |
required: false |
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 { | |
DataStore, | |
PersistentModel, | |
PersistentModelConstructor, | |
ProducerModelPredicate, | |
SortPredicate, | |
ProducerPaginationInput | |
} from '@aws-amplify/datastore' | |
import { useCallback, useEffect, useState } from 'react' |
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
export type SemaphoreFunction = (done: () => void) => void; | |
/** | |
* Based on https://www.derpturkey.com/simple-semaphore-in-nodejs/ | |
*/ | |
export default class Semaphore { | |
readonly max: number; | |
private _fns: Array<SemaphoreFunction>; | |
private _active: number; |
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
/** | |
* Wrap async handler functions for use with `onPress` and similar React callbacks, which are typically | |
* not safe to use with promises. `useAsyncFunc` gracefully handles any promise errors. | |
* | |
* Note that this hook, unlike `useCallback`, does not memoize the callback function itself. To create | |
* a memoized function wrap it with `useCallback` instead. | |
* @example | |
* ```tsx |
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 Intl from "intl"; | |
import React, { useMemo } from "react"; | |
import useLocalization from "./useLocalization"; | |
export interface NumberFormatProps { | |
/** The value to format */ | |
value: number; | |
/** Override system locale (not recommended) */ | |
locale?: 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 Intl from "intl"; | |
import React, { useMemo } from "react"; | |
import useLocalization from "./useLocalization"; | |
export interface DateTimeFormatProps { | |
/** The value to format */ | |
value: Date | string | number; | |
/** Override system locale (not recommended) */ | |
locale?: 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 { useCallback, useRef, useState } from "react"; | |
export type Dispatch<TState> = (action: ThunkAction<TState>) => Promise<void> | |
/** A thunk action that can be dispatched by the {@link useThunkReducer}. */ | |
export type ThunkAction<TState> = ( | |
dispatch: Dispatch<TState>, | |
getState: () => Readonly<TState>, | |
) => Promise<TState | undefined | void> | TState | undefined | void; |
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 produce, { Draft } from "immer"; | |
import { useCallback, useRef, useState } from "react"; | |
export type GetStateFunc<T> = () => Readonly<T>; | |
export type SetStateFunc<T> = (callback: T | ((draft: Draft<T>) => void)) => void; | |
/** | |
* | |
* @param initialValue | |
*/ |
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
/** | |
* Simple, opinionated Logger for use with Node.js and Web Browsers with no | |
* additional dependencies. | |
* | |
* The logger supports and auto-detects the following environments: | |
* - Node.js (with and without JSDOM) | |
* = Browser | |
* - Electron | |
* - React Native - Logs to console or browser window depending on whether a debugger is connected | |
* - Unit Test & CI/CD - Logs are disabled by default |
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 { Dispatch, useState } from "react"; | |
// Type definitions based on original React `Reducer<S, A>` | |
export type AsyncReducer<S, A> = (prevState: S, action: A) => Promise<S> | S; | |
export type AsyncReducerState<R extends AsyncReducer<any, any>> = R extends AsyncReducer<infer S, any> ? S : never; | |
export type AsyncReducerAction<R extends AsyncReducer<any, any>> = R extends AsyncReducer<any, infer A> ? A : never; | |
export const useAsyncReducer = <R extends AsyncReducer<any, any>>( | |
reducer: R, | |
initialState: AsyncReducerState<R>, |
NewerOlder