@shushed/helpers 0.0.152 → 0.0.153-main-20250905115441
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +72 -11
- package/dist/index.js +12885 -75203
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { JSONSchemaType } from 'ajv';
|
|
2
2
|
import { DeepRedact } from '@hackylabs/deep-redact';
|
|
3
|
-
import { Firestore
|
|
3
|
+
import { Firestore } from '@google-cloud/firestore';
|
|
4
4
|
import { PubSub, Message as Message$1, Topic, Subscription } from '@google-cloud/pubsub';
|
|
5
5
|
import { Context } from 'co-body';
|
|
6
6
|
import * as _google_cloud_scheduler_build_protos_protos from '@google-cloud/scheduler/build/protos/protos';
|
|
7
7
|
import { CloudSchedulerClient } from '@google-cloud/scheduler';
|
|
8
|
-
import { SecretManagerServiceClient } from '@google-cloud/secret-manager';
|
|
9
8
|
import { BigQuery } from '@google-cloud/bigquery';
|
|
10
9
|
import { RedisClientType } from 'redis';
|
|
11
10
|
import { RateLimiterRedis } from 'rate-limiter-flexible';
|
|
@@ -33534,6 +33533,7 @@ declare class Runtime {
|
|
|
33534
33533
|
|
|
33535
33534
|
declare const isPubSubRequest: (headers: Record<string, string>) => boolean;
|
|
33536
33535
|
declare const isCronMessage: (headers: Record<string, string>) => boolean;
|
|
33536
|
+
declare const isRespectfulNudge: (headers: Record<string, string>) => boolean;
|
|
33537
33537
|
declare const isCloudTask: (headers: Record<string, string>) => boolean;
|
|
33538
33538
|
declare const validateGoogleAuth: (opts: Opts & {
|
|
33539
33539
|
serviceAccount?: string | null | false;
|
|
@@ -33551,21 +33551,78 @@ declare global {
|
|
|
33551
33551
|
declare function getFirestore(systemEnvName: string): Firestore;
|
|
33552
33552
|
type PromisifiedFn<F extends (...args: any[]) => any> = (...args: Parameters<F>) => Promise<Awaited<ReturnType<F>>>;
|
|
33553
33553
|
declare function createHandlerDecorator<TSettings, TRequiredO extends object = {}, TRequiredH extends object = {}>(decoratorFactory: <C, O, H extends TRequiredH, H2 extends H, R>(settings: TSettings) => (handler: (c: C, o: O & TRequiredO, h: H2) => R) => (c: C, o: O & TRequiredO, h: H2) => R | Promise<R>): <C, O, H extends TRequiredH, H2 extends H, R>(settings: TSettings) => (handler: (c: C, o: O & TRequiredO, h: H2) => R) => (c: C, o: O & TRequiredO, h: H2) => R | Promise<R>;
|
|
33554
|
+
declare function getSecret(runtime: Runtime, name: string, accessToken: string): Promise<string>;
|
|
33555
|
+
declare const getAccessToken: () => Promise<string>;
|
|
33554
33556
|
|
|
33555
33557
|
type Level = 'env' | 'workflow' | 'trigger';
|
|
33558
|
+
type SetOptions = {
|
|
33559
|
+
ephemeralMs?: number;
|
|
33560
|
+
ignoreStores?: Array<'redis'>;
|
|
33561
|
+
encrypted: boolean;
|
|
33562
|
+
encryptionKey?: string | undefined;
|
|
33563
|
+
};
|
|
33564
|
+
type GetOptions = {
|
|
33565
|
+
isEphemeral?: boolean;
|
|
33566
|
+
encrypted?: boolean;
|
|
33567
|
+
encryptionKey?: string | undefined;
|
|
33568
|
+
expirationMarginMs?: number;
|
|
33569
|
+
store?: 'inMemory' | 'global' | 'redis';
|
|
33570
|
+
};
|
|
33571
|
+
type ValueDetails = {
|
|
33572
|
+
createdAt: number;
|
|
33573
|
+
expiresAt: number;
|
|
33574
|
+
value: string;
|
|
33575
|
+
valid: boolean;
|
|
33576
|
+
fetch?: () => Promise<string>;
|
|
33577
|
+
};
|
|
33578
|
+
declare global {
|
|
33579
|
+
var IN_MEMORY_REF: undefined | {
|
|
33580
|
+
env: Record<string, Record<string, string>>;
|
|
33581
|
+
workflow: Record<string, Record<string, string>>;
|
|
33582
|
+
trigger: Record<string, Record<string, string>>;
|
|
33583
|
+
};
|
|
33584
|
+
}
|
|
33556
33585
|
declare class EnvEngine extends Runtime {
|
|
33557
|
-
|
|
33586
|
+
globalInMemoryRef: {
|
|
33587
|
+
env: Record<string, string>;
|
|
33588
|
+
workflow: Record<string, string>;
|
|
33589
|
+
trigger: Record<string, string>;
|
|
33590
|
+
};
|
|
33591
|
+
inMemoryRef: {
|
|
33592
|
+
env: Record<string, string>;
|
|
33593
|
+
workflow: Record<string, string>;
|
|
33594
|
+
trigger: Record<string, string>;
|
|
33595
|
+
};
|
|
33596
|
+
private docRef;
|
|
33558
33597
|
private store;
|
|
33559
|
-
|
|
33598
|
+
private _envCache;
|
|
33599
|
+
constructor(opts: Opts, firestore?: any);
|
|
33600
|
+
private initializeDocRef;
|
|
33601
|
+
set(envs: Array<{
|
|
33602
|
+
name: string;
|
|
33603
|
+
value: string;
|
|
33604
|
+
}>, level: Level, options?: SetOptions): Promise<void>;
|
|
33560
33605
|
set(envs: Array<{
|
|
33561
33606
|
name: string;
|
|
33562
33607
|
value: string;
|
|
33563
|
-
}>, level
|
|
33564
|
-
private
|
|
33608
|
+
}>, level: Level, encryptWithValue?: string): Promise<void>;
|
|
33609
|
+
private getFirestoreStore;
|
|
33610
|
+
get<T extends ReadonlyArray<string>>(keys: T, level?: Level, options?: GetOptions): Promise<{
|
|
33611
|
+
[K in T[number]]: string;
|
|
33612
|
+
}>;
|
|
33565
33613
|
get<T extends ReadonlyArray<string>>(keys: T, level?: Level, decryptWithValue?: string): Promise<{
|
|
33566
33614
|
[K in T[number]]: string;
|
|
33567
33615
|
}>;
|
|
33568
|
-
get(key:
|
|
33616
|
+
get<M extends string, T extends readonly [M] = [M]>(key: M, level?: Level, options?: GetOptions): Promise<string>;
|
|
33617
|
+
get<M extends string, T extends readonly [M] = [M]>(key: M, level?: Level, decryptWithValue?: string): Promise<string>;
|
|
33618
|
+
_get<T extends ReadonlyArray<string>>(keysParsed: T, level: Level | undefined, options: GetOptions): Promise<{
|
|
33619
|
+
[K in T[number]]: ValueDetails;
|
|
33620
|
+
}>;
|
|
33621
|
+
withGoogleAccessToken(): <T extends unknown>(fn: (value: string, requestCacheRefresh?: (() => void) | undefined) => T | Promise<T>) => Promise<T>;
|
|
33622
|
+
withSecret(key: string): <T extends unknown>(fn: (value: string, requestCacheRefresh?: (() => void) | undefined) => T | Promise<T>) => Promise<T>;
|
|
33623
|
+
with<M extends string>(key: M, level?: Level, options?: SetOptions & {
|
|
33624
|
+
fetch?: () => Promise<string>;
|
|
33625
|
+
}): <T extends any>(fn: (value: string, requestCacheRefresh?: () => void) => Promise<T> | T) => Promise<T>;
|
|
33569
33626
|
}
|
|
33570
33627
|
|
|
33571
33628
|
type Message = {
|
|
@@ -33781,8 +33838,7 @@ declare class SchedulerHelper extends Runtime {
|
|
|
33781
33838
|
}
|
|
33782
33839
|
|
|
33783
33840
|
declare class Secrets extends Runtime {
|
|
33784
|
-
|
|
33785
|
-
constructor(opts: Opts, secretsManagerClient: SecretManagerServiceClient);
|
|
33841
|
+
constructor(opts: Opts);
|
|
33786
33842
|
getSecret(name: string): Promise<string>;
|
|
33787
33843
|
}
|
|
33788
33844
|
|
|
@@ -34067,6 +34123,7 @@ interface ActionHelperOptions {
|
|
|
34067
34123
|
api?: {
|
|
34068
34124
|
matchByPartialQueryString?: string | RegExp;
|
|
34069
34125
|
havingApiKey?: boolean;
|
|
34126
|
+
roles: Array<string>;
|
|
34070
34127
|
};
|
|
34071
34128
|
pubsub?: {
|
|
34072
34129
|
matchByPubSubSubscriptionName?: string | RegExp;
|
|
@@ -34106,6 +34163,7 @@ type RequiredTriggerOptions = {
|
|
|
34106
34163
|
declare class ActionHelper<C extends Record<string, any>, O extends RequiredTriggerOptions, R> {
|
|
34107
34164
|
private onExecuteFunction;
|
|
34108
34165
|
actionOptions: ActionHelperOptions;
|
|
34166
|
+
flags: Record<string, boolean>;
|
|
34109
34167
|
opts: O | null;
|
|
34110
34168
|
config: C | null;
|
|
34111
34169
|
runtime: Runtime | null;
|
|
@@ -34131,7 +34189,7 @@ declare class ActionHelper<C extends Record<string, any>, O extends RequiredTrig
|
|
|
34131
34189
|
request: RateLimiterRedis;
|
|
34132
34190
|
};
|
|
34133
34191
|
protected preOnExecute(): Promise<void>;
|
|
34134
|
-
onExecute(config: C, opts: O, message: null | ReceivedMessage): Promise<Awaited<R>>;
|
|
34192
|
+
onExecute(config: C, opts: O, message: null | ReceivedMessage, flags?: Array<string>): Promise<Awaited<R>>;
|
|
34135
34193
|
static create<C extends Record<string, any>, O extends RequiredTriggerOptions, R>(options: ActionHelperOptions, onExecuteFunction: (config: C, opts: O, message: ReceivedMessage | null, actionHelper: ActionHelper<C, O, R>) => R): ActionHelper<C, O, R>;
|
|
34136
34194
|
}
|
|
34137
34195
|
|
|
@@ -34430,11 +34488,14 @@ declare const index_TriggerHelper: typeof TriggerHelper;
|
|
|
34430
34488
|
type index_TriggerOnCreateOptions = TriggerOnCreateOptions;
|
|
34431
34489
|
type index_TriggerOnExecuteOptions = TriggerOnExecuteOptions;
|
|
34432
34490
|
declare const index_createHandlerDecorator: typeof createHandlerDecorator;
|
|
34491
|
+
declare const index_getAccessToken: typeof getAccessToken;
|
|
34433
34492
|
declare const index_getEventTime: typeof getEventTime;
|
|
34434
34493
|
declare const index_getFirestore: typeof getFirestore;
|
|
34494
|
+
declare const index_getSecret: typeof getSecret;
|
|
34435
34495
|
declare const index_isCloudTask: typeof isCloudTask;
|
|
34436
34496
|
declare const index_isCronMessage: typeof isCronMessage;
|
|
34437
34497
|
declare const index_isPubSubRequest: typeof isPubSubRequest;
|
|
34498
|
+
declare const index_isRespectfulNudge: typeof isRespectfulNudge;
|
|
34438
34499
|
declare const index_parseDateOrDefault: typeof parseDateOrDefault;
|
|
34439
34500
|
declare const index_sanitize: typeof sanitize;
|
|
34440
34501
|
declare const index_sanitizeToString: typeof sanitizeToString;
|
|
@@ -34443,7 +34504,7 @@ declare const index_slugify: typeof slugify;
|
|
|
34443
34504
|
declare const index_validate: typeof validate;
|
|
34444
34505
|
declare const index_validateGoogleAuth: typeof validateGoogleAuth;
|
|
34445
34506
|
declare namespace index {
|
|
34446
|
-
export { index_ActionHelper as ActionHelper, type index_ActionHelperOptions as ActionHelperOptions, index_AirtableHelper as AirtableHelper, index_BigQueryHelper as BigQueryHelper, index_CloudTasksHelper as CloudTasksHelper, index_DatoHelper as DatoHelper, index_EnvEngine as EnvEngine, type index_ILogging as ILogging, index_JWKSHelper as JWKSHelper, index_Logging as Logging, type index_Message as Message, type index_NodeOptions as NodeOptions, type index_OnExecuteBasicTriggerOpts as OnExecuteBasicTriggerOpts, type index_PromisifiedFn as PromisifiedFn, index_PubSubHelper as PubSubHelper, index_RateLimit as RateLimit, type index_ReceivedMessage as ReceivedMessage, index_RedisConnectionError as RedisConnectionError, index_Runtime as Runtime, index_SchedulerHelper as SchedulerHelper, index_Secrets as Secrets, index_TriggerHelper as TriggerHelper, type index_TriggerOnCreateOptions as TriggerOnCreateOptions, type index_TriggerOnExecuteOptions as TriggerOnExecuteOptions, index_createHandlerDecorator as createHandlerDecorator, index_getEventTime as getEventTime, index_getFirestore as getFirestore, index_isCloudTask as isCloudTask, index_isCronMessage as isCronMessage, index_isPubSubRequest as isPubSubRequest, index_parseDateOrDefault as parseDateOrDefault, index_sanitize as sanitize, index_sanitizeToString as sanitizeToString, index_shortHash as shortHash, index_slugify as slugify, index_validate as validate, index_validateGoogleAuth as validateGoogleAuth };
|
|
34507
|
+
export { index_ActionHelper as ActionHelper, type index_ActionHelperOptions as ActionHelperOptions, index_AirtableHelper as AirtableHelper, index_BigQueryHelper as BigQueryHelper, index_CloudTasksHelper as CloudTasksHelper, index_DatoHelper as DatoHelper, index_EnvEngine as EnvEngine, type index_ILogging as ILogging, index_JWKSHelper as JWKSHelper, index_Logging as Logging, type index_Message as Message, type index_NodeOptions as NodeOptions, type index_OnExecuteBasicTriggerOpts as OnExecuteBasicTriggerOpts, type index_PromisifiedFn as PromisifiedFn, index_PubSubHelper as PubSubHelper, index_RateLimit as RateLimit, type index_ReceivedMessage as ReceivedMessage, index_RedisConnectionError as RedisConnectionError, index_Runtime as Runtime, index_SchedulerHelper as SchedulerHelper, index_Secrets as Secrets, index_TriggerHelper as TriggerHelper, type index_TriggerOnCreateOptions as TriggerOnCreateOptions, type index_TriggerOnExecuteOptions as TriggerOnExecuteOptions, index_createHandlerDecorator as createHandlerDecorator, index_getAccessToken as getAccessToken, index_getEventTime as getEventTime, index_getFirestore as getFirestore, index_getSecret as getSecret, index_isCloudTask as isCloudTask, index_isCronMessage as isCronMessage, index_isPubSubRequest as isPubSubRequest, index_isRespectfulNudge as isRespectfulNudge, index_parseDateOrDefault as parseDateOrDefault, index_sanitize as sanitize, index_sanitizeToString as sanitizeToString, index_shortHash as shortHash, index_slugify as slugify, index_validate as validate, index_validateGoogleAuth as validateGoogleAuth };
|
|
34447
34508
|
}
|
|
34448
34509
|
|
|
34449
34510
|
export { index as lib, index$9 as schema, index$1 as types };
|