@snorreks/firestack 0.0.1

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.
Files changed (48) hide show
  1. package/README.md +134 -0
  2. package/index.d.ts +8 -0
  3. package/index.d.ts.map +1 -0
  4. package/index.js +106 -0
  5. package/lib/constants/builders.d.ts +2 -0
  6. package/lib/constants/builders.d.ts.map +1 -0
  7. package/lib/constants/directories.d.ts +2 -0
  8. package/lib/constants/directories.d.ts.map +1 -0
  9. package/lib/constants/function-types.d.ts +8 -0
  10. package/lib/constants/function-types.d.ts.map +1 -0
  11. package/lib/constants/index.d.ts +4 -0
  12. package/lib/constants/index.d.ts.map +1 -0
  13. package/lib/helpers/auth.d.ts +31 -0
  14. package/lib/helpers/auth.d.ts.map +1 -0
  15. package/lib/helpers/database.d.ts +40 -0
  16. package/lib/helpers/database.d.ts.map +1 -0
  17. package/lib/helpers/firestore.d.ts +26 -0
  18. package/lib/helpers/firestore.d.ts.map +1 -0
  19. package/lib/helpers/https.d.ts +29 -0
  20. package/lib/helpers/https.d.ts.map +1 -0
  21. package/lib/helpers/scheduler.d.ts +4 -0
  22. package/lib/helpers/scheduler.d.ts.map +1 -0
  23. package/lib/helpers/storage.d.ts +50 -0
  24. package/lib/helpers/storage.d.ts.map +1 -0
  25. package/lib/types/build.d.ts +56 -0
  26. package/lib/types/build.d.ts.map +1 -0
  27. package/lib/types/checksum.d.ts +10 -0
  28. package/lib/types/checksum.d.ts.map +1 -0
  29. package/lib/types/core.d.ts +45 -0
  30. package/lib/types/core.d.ts.map +1 -0
  31. package/lib/types/deploy.d.ts +166 -0
  32. package/lib/types/deploy.d.ts.map +1 -0
  33. package/lib/types/firebase-auth-v2.d.ts +30 -0
  34. package/lib/types/firebase-auth-v2.d.ts.map +1 -0
  35. package/lib/types/function-types.d.ts +11 -0
  36. package/lib/types/function-types.d.ts.map +1 -0
  37. package/lib/types/functions-cache.d.ts +31 -0
  38. package/lib/types/functions-cache.d.ts.map +1 -0
  39. package/lib/types/helper-generics.d.ts +20 -0
  40. package/lib/types/helper-generics.d.ts.map +1 -0
  41. package/lib/types/helper-options.d.ts +81 -0
  42. package/lib/types/helper-options.d.ts.map +1 -0
  43. package/lib/types/index.d.ts +10 -0
  44. package/lib/types/index.d.ts.map +1 -0
  45. package/lib/types/script.d.ts +6 -0
  46. package/lib/types/script.d.ts.map +1 -0
  47. package/main.js +1661 -0
  48. package/package.json +28 -0
@@ -0,0 +1,166 @@
1
+ import type { ExecutorBaseBuildOptions } from './core.js';
2
+ import type { DeployFunction, FunctionBuilder } from './function-types.js';
3
+ import type { FunctionOptions, NodeVersion } from './helper-options.js';
4
+ export type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'global';
5
+ interface SharedDeployExecutorBaseOptions extends ExecutorBaseBuildOptions {
6
+ /** The project flavor */
7
+ flavor?: string;
8
+ /** The default region is us-central1 */
9
+ region?: string;
10
+ /** Only build the function, don't deploy it */
11
+ dryRun?: boolean;
12
+ /** Force deploy all functions, even if no files changed */
13
+ force?: boolean;
14
+ /**
15
+ * The package manager to use when running firebase-tools.
16
+ *
17
+ * Set `global` to use the globally installed firebase-tools (`npm i -g
18
+ * firebase-tools`).
19
+ *
20
+ * @default 'pnpm'
21
+ */
22
+ packageManager: PackageManager;
23
+ /**
24
+ * Relative path to the directory where the functions will be deployed.
25
+ *
26
+ * @default 'src/controllers'
27
+ */
28
+ functionsDirectory?: string;
29
+ /**
30
+ * The name of the file in the root project that will be used to fetch and
31
+ * update the cloud cache.
32
+ *
33
+ * @default 'functions-cache.ts'
34
+ */
35
+ cloudCacheFileName: string;
36
+ ignoreMissingEnvironmentKey?: boolean;
37
+ pnpmFix?: boolean;
38
+ useLogger?: boolean;
39
+ }
40
+ export interface DeployExecutorOptions extends SharedDeployExecutorBaseOptions {
41
+ /**
42
+ * The output directory of the build
43
+ *
44
+ * @default `dist/<relative-path-to-project>`
45
+ */
46
+ outputDirectory?: string;
47
+ /** If true, will set the flavor as production */
48
+ production?: boolean;
49
+ /** If true, will set the flavor as development */
50
+ development?: boolean;
51
+ /** Don't log anything */
52
+ silent?: boolean;
53
+ /** Get verbose logs */
54
+ verbose?: boolean;
55
+ minify?: boolean;
56
+ /**
57
+ * The amount of functions to deploy in parallel
58
+ *
59
+ * @default 5
60
+ */
61
+ concurrency?: number;
62
+ /**
63
+ * The amount of functions to deploy in parallel when retrying
64
+ *
65
+ * @default 1
66
+ */
67
+ retryConcurrency?: number;
68
+ /**
69
+ * Stringify version of the environment. If this is set, .env files will be
70
+ * ignored.
71
+ *
72
+ * This is useful when you want to deploy using CI/CD and don't want to
73
+ * store the environment variables in a file.
74
+ *
75
+ * @default undefined
76
+ */
77
+ envString?: string;
78
+ debug?: boolean;
79
+ /** Only deploy the given function names, separated by a comma */
80
+ only?: string;
81
+ flavor?: string;
82
+ flavors: Record<string, string>;
83
+ envFiles?: Record<string, string>;
84
+ deploySentry?: boolean;
85
+ retryAmount?: number;
86
+ }
87
+ export type Environment = {
88
+ [key: string]: string | undefined;
89
+ };
90
+ export interface SentryLiteData {
91
+ /** The name of the project in sentry. */
92
+ project: string;
93
+ /** The organization name in sentry. */
94
+ organization: string;
95
+ /**
96
+ * The sentry auth token.
97
+ *
98
+ * @see {@link https://docs.sentry.io/product/cli/configuration/#auth-token}
99
+ */
100
+ token: string;
101
+ }
102
+ export interface SentryData extends SentryLiteData {
103
+ /** The name of the release. */
104
+ release: string;
105
+ }
106
+ export interface BaseDeployOptions extends SharedDeployExecutorBaseOptions {
107
+ firebaseProjectId: string;
108
+ projectRoot: string;
109
+ workspaceRoot: string;
110
+ outputDirectory: string;
111
+ defaultRegion: string;
112
+ temporaryDirectory: string;
113
+ flavor: string;
114
+ /** Stringified code of the environments */
115
+ environment?: Environment;
116
+ /**
117
+ * Relative path to the directory where the functions will be deployed from
118
+ * the project root.
119
+ */
120
+ functionsDirectory: string;
121
+ only?: string[];
122
+ currentTime: number;
123
+ /** If this is defined, upload the sourcemaps to sentry. */
124
+ sentry?: SentryLiteData;
125
+ pnpmFix?: boolean;
126
+ minify?: boolean;
127
+ }
128
+ export interface BuildFunctionLiteData<T extends FunctionBuilder = FunctionBuilder> extends BaseDeployOptions {
129
+ /**
130
+ * The type of the function.
131
+ *
132
+ * @see {@link DeployFunction}
133
+ */
134
+ deployFunction: DeployFunction;
135
+ rootFunctionBuilder: T;
136
+ /** The absolute path of the deploy file */
137
+ absolutePath: string;
138
+ relativeDeployFilePath: string;
139
+ }
140
+ export type BuildFunctionData<T extends FunctionBuilder = FunctionBuilder> = Omit<BuildFunctionLiteData<T>, 'sentry'> & FunctionOptions[T] & {
141
+ /**
142
+ * If the type is `onCreate`, `onUpdate`, or `onDelete`, this is
143
+ * required
144
+ */
145
+ path: T extends 'firestore' | 'database' ? string : undefined;
146
+ /** The name of the function. */
147
+ functionName: string;
148
+ outputRoot: string;
149
+ /**
150
+ * The region to deploy the function to. If not provided it will be
151
+ * the region set in project.json. If that is not provided it will
152
+ * be 'us-central1'
153
+ *
154
+ * @see https://firebase.google.com/docs/functions/locations
155
+ */
156
+ region: string | string[];
157
+ startTime: number;
158
+ hasLoggerFile?: boolean;
159
+ checksum?: string;
160
+ sentry?: SentryData;
161
+ flavor: string;
162
+ nodeVersion: NodeVersion;
163
+ };
164
+ export type DeployFunctionData<T extends FunctionBuilder = FunctionBuilder> = BuildFunctionData<T>;
165
+ export {};
166
+ //# sourceMappingURL=deploy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/lib/types/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAExE,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,GAAG,M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Y,EAAE,MAAM,CAAC;IAErB,sBAAsB,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,IAAI,IAAI,CAC/E,qBAAqB,CAAC,CAAC,CAAC,EACxB,QAAQ,CACT,GACC,eAAe,CAAC,CAAC,CAAC,GAAG;IACnB;;;OAGG;IACH,IAAI,EAAE,CAAC,SAAS,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,SAAS,CAAC;IAE9D,gCAAgC;IAChC,YAAY,EAAE,MAAM,CAAC;IAErB,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;;OAMG;IACH,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE1B,SAAS,EAAE,MAAM,CAAC;IAElB,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,MAAM,CAAC,EAAE,UAAU,CAAC;IAEpB,MAAM,EAAE,MAAM,CAAC;IAEf,WAAW,EAAE,WAAW,CAAC;CAC1B,CAAC;AAEJ,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,IAAI,iBAAiB,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type { AuthUserRecord } from 'firebase-functions/v2/identity';
2
+ export interface AuthEventContext {
3
+ eventId: string;
4
+ eventType: string;
5
+ resource: string;
6
+ timestamp: string;
7
+ params: {
8
+ [key: string]: string;
9
+ };
10
+ auth: {
11
+ token: object;
12
+ uid: string;
13
+ };
14
+ data: AuthUserRecord;
15
+ }
16
+ export interface BeforeCreateResponse {
17
+ customClaims?: object;
18
+ disabled?: boolean;
19
+ displayName?: string;
20
+ email?: string;
21
+ emailVerified?: boolean;
22
+ password?: string;
23
+ phoneNumber?: string;
24
+ photoURL?: string;
25
+ }
26
+ export interface BeforeSignInResponse {
27
+ customClaims?: object;
28
+ sessionClaims?: object;
29
+ }
30
+ //# sourceMappingURL=firebase-auth-v2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firebase-auth-v2.d.ts","sourceRoot":"","sources":["../../../src/lib/types/firebase-auth-v2.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAErE,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAClC,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IACF,IAAI,EAAE,cAAc,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
@@ -0,0 +1,11 @@
1
+ import type { databaseFunctions, deployDirectories, firestoreFunctions, functionBuilders, functions, httpsFunctions, schedulerFunctions, storageFunctions } from '../constants/index.js';
2
+ export type DatabaseFunction = (typeof databaseFunctions)[number];
3
+ export type FirestoreFunction = (typeof firestoreFunctions)[number];
4
+ export type StorageFunction = (typeof storageFunctions)[number];
5
+ export type SchedulerFunction = (typeof schedulerFunctions)[number];
6
+ export type Function = (typeof functions)[number];
7
+ export type HttpsFunction = (typeof httpsFunctions)[number];
8
+ export type DeployFunction = (typeof functions)[number];
9
+ export type FunctionBuilder = (typeof functionBuilders)[number];
10
+ export type DeployDirectory = (typeof deployDirectories)[number];
11
+ //# sourceMappingURL=function-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function-types.d.ts","sourceRoot":"","sources":["../../../src/lib/types/function-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAElD,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5D,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAExD,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1,31 @@
1
+ export interface FunctionsCache {
2
+ [functionName: string]: string;
3
+ }
4
+ /**
5
+ * Having a cloud-cache.ts file in the root of the project allows you to fetch
6
+ * and update the cloud cache.
7
+ *
8
+ * The name of the function has to be `fetch` and the return type has to be
9
+ * `FunctionsCache | undefined`.
10
+ *
11
+ * @example export const fetch: FunctionsCacheFetch = async () => {
12
+ *
13
+ * const doc = await db.doc('cloudCache').get();
14
+ *
15
+ * return doc.data() as FunctionsCache; };
16
+ */
17
+ export type FunctionsCacheFetch = (options: {
18
+ flavor: string;
19
+ }) => Promise<FunctionsCache | undefined>;
20
+ /**
21
+ * Having a cloud-cache.ts file in the root of the project allows you to fetch
22
+ * and update the cloud cache.
23
+ *
24
+ * The name of the function has to be `update` and the parameter type has to be
25
+ * `FunctionsCache`.
26
+ */
27
+ export type FunctionsCacheUpdate = (options: {
28
+ newFunctionsCache: FunctionsCache;
29
+ flavor: string;
30
+ }) => Promise<void>;
31
+ //# sourceMappingURL=functions-cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functions-cache.d.ts","sourceRoot":"","sources":["../../../src/lib/types/functions-cache.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;CAChC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE;IAC1C,MAAM,EAAE,MAAM,CAAC;CAChB,KAAK,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE;IAC3C,iBAAiB,EAAE,cAAc,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ export type CallableFunctions = {
2
+ [key: string]: [unknown, unknown];
3
+ };
4
+ export type RequestFunctions = {
5
+ [key: string]: [
6
+ {
7
+ [key: string]: unknown;
8
+ },
9
+ unknown
10
+ ];
11
+ };
12
+ export interface CoreData {
13
+ /**
14
+ * The document's ID
15
+ *
16
+ * @see https://firebase.google.com/docs/reference/node/firebase.firestore.DocumentSnapshot#id
17
+ */
18
+ id: string;
19
+ }
20
+ //# sourceMappingURL=helper-generics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helper-generics.d.ts","sourceRoot":"","sources":["../../../src/lib/types/helper-generics.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG;QACb;YACE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;SACxB;QACD,OAAO;KACR,CAAC;CACH,CAAC;AAEF,MAAM,WAAW,QAAQ;IACvB;;;;OAIG;IACH,EAAE,EAAE,MAAM,CAAC;CACZ"}
@@ -0,0 +1,81 @@
1
+ import type { ReferenceOptions as FBReferenceOptions } from 'firebase-functions/v2/database';
2
+ import type { DocumentOptions as FBDocumentOptions } from 'firebase-functions/v2/firestore';
3
+ import type { HttpsOptions as FirebaseHttpsOptions } from 'firebase-functions/v2/https';
4
+ import type { GlobalOptions } from 'firebase-functions/v2/options';
5
+ import type { ScheduleOptions as FBScheduleOptions } from 'firebase-functions/v2/scheduler';
6
+ import type { StorageOptions } from 'firebase-functions/v2/storage';
7
+ export type NodeVersion = '14' | '16' | '18' | '20' | '22';
8
+ export interface BaseFunctionOptions<T extends string = string> extends GlobalOptions {
9
+ /**
10
+ * The name of the function. If not provided, the name of the function is
11
+ * the path from the root of the {@link DeployDirectory} directory to the
12
+ * file. Replacing all `/` and `-` with `_`.
13
+ *
14
+ * example // api/stripe/webhook.ts => stripe_webhook
15
+ *
16
+ * example // callable/auth/check-email.ts => auth_check_email
17
+ */
18
+ functionName?: T;
19
+ /**
20
+ * Some packages needs to be installed as external dependencies.
21
+ *
22
+ * @example external: ['sharp'] // will npm i sharp in dist
23
+ */
24
+ external?: string[];
25
+ /**
26
+ * Documentation: https://esbuild.github.io/api/#keep-names
27
+ *
28
+ * @default true
29
+ */
30
+ keepNames?: boolean;
31
+ /**
32
+ * Path to the assets from the project root directory.
33
+ *
34
+ * NB this will be placed in the same directory as the function.
35
+ */
36
+ assets?: string[];
37
+ nodeVersion?: NodeVersion;
38
+ }
39
+ export interface HttpsOptions<T extends string | number | symbol = string> extends Omit<BaseFunctionOptions<Extract<T, string>>, 'region'>, FirebaseHttpsOptions {
40
+ }
41
+ export interface DocumentOptions extends Omit<BaseFunctionOptions, 'enforceAppCheck'>, Omit<FBDocumentOptions, 'document'> {
42
+ /**
43
+ * The document path where the function will listen for changed in firestore
44
+ *
45
+ * If not provided, the document path is the path from the root of the
46
+ * {@link DeployDirectory} to the file. Replacing all `/` and `-` with `_`.
47
+ * And replacing all `[]` with `{}`
48
+ *
49
+ * example // database/users/[uid]/created.ts => 'users/{uid}'
50
+ *
51
+ * example // database/users/[uid]/notifications/[notificationId] =>
52
+ * 'users/{uid}/notifications/{notificationId}'
53
+ */
54
+ document?: string;
55
+ }
56
+ export interface ReferenceOptions extends Omit<BaseFunctionOptions, 'enforceAppCheck'>, FBReferenceOptions {
57
+ ref: string;
58
+ }
59
+ export interface ScheduleOptions extends BaseFunctionOptions, FBScheduleOptions {
60
+ /**
61
+ * When to execute the function. If the function is a scheduled function,
62
+ * this property is required.
63
+ *
64
+ * @see https://firebase.google.com/docs/functions/schedule-functions
65
+ */
66
+ schedule: string;
67
+ /** The timezone to use when determining the function's execution time. */
68
+ timeZone?: string;
69
+ }
70
+ export interface ObjectTriggerOptions extends Omit<BaseFunctionOptions, 'region'>, StorageOptions {
71
+ }
72
+ export type AuthTriggerOptions = Omit<BaseFunctionOptions, 'region'>;
73
+ export type FunctionOptions = {
74
+ https: HttpsOptions;
75
+ firestore: DocumentOptions;
76
+ scheduler: ScheduleOptions;
77
+ storage: ObjectTriggerOptions;
78
+ database: ReferenceOptions;
79
+ auth: AuthTriggerOptions;
80
+ };
81
+ //# sourceMappingURL=helper-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helper-options.d.ts","sourceRoot":"","sources":["../../../src/lib/types/helper-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,IAAI,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAC7F,OAAO,KAAK,EAAE,eAAe,IAAI,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAC5F,OAAO,KAAK,EAAE,YAAY,IAAI,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAExF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,IAAI,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAC5F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3D,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,aAAa;IACnF;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,CAAC,CAAC;IAEjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAEpB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAElB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CACvE,SAAQ,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,EAC7D,oBAAoB;CAAG;AAE3B,MAAM,WAAW,eACf,SAAQ,IAAI,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,EAClD,IAAI,CAAC,iBAAiB,EAAE,UAAU,CAAC;IACrC;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,EAClD,kBAAkB;IACpB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,eAAgB,SAAQ,mBAAmB,EAAE,iBAAiB;IAC7E;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAC,EAAE,cAAc;CAAG;AAEpG,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;AAErE,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,YAAY,CAAC;IACpB,SAAS,EAAE,eAAe,CAAC;IAC3B,SAAS,EAAE,eAAe,CAAC;IAC3B,OAAO,EAAE,oBAAoB,CAAC;IAC9B,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,IAAI,EAAE,kBAAkB,CAAC;CAC1B,CAAC"}
@@ -0,0 +1,10 @@
1
+ export * from './build.js';
2
+ export * from './core.js';
3
+ export * from './deploy.js';
4
+ export * from './firebase-auth-v2.js';
5
+ export * from './function-types.js';
6
+ export * from './functions-cache.js';
7
+ export * from './helper-generics.js';
8
+ export * from './helper-options.js';
9
+ export * from './script.js';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC"}
@@ -0,0 +1,6 @@
1
+ export interface ScriptContext {
2
+ projectId: string;
3
+ flavor: string;
4
+ }
5
+ export type ScriptFunction = (context: ScriptContext) => Promise<unknown>;
6
+ //# sourceMappingURL=script.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"script.d.ts","sourceRoot":"","sources":["../../../src/lib/types/script.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC"}