@donotdev/functions 0.0.15 → 0.0.16
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/lib/firebase/index.js +1532 -575
- package/lib/firebase/index.js.map +4 -4
- package/lib/shared/index.js +333 -163
- package/lib/shared/index.js.map +4 -4
- package/lib/vercel/api/index.js +325 -190
- package/lib/vercel/api/index.js.map +4 -4
- package/package.json +2 -2
- package/src/firebase/baseFunction.ts +15 -4
- package/src/firebase/crud/create.ts +6 -1
- package/src/firebase/crud/delete.ts +7 -0
- package/src/firebase/crud/list.ts +17 -6
- package/src/firebase/crud/update.ts +2 -1
- package/src/shared/billing/helpers/updateUserSubscription.ts +9 -0
- package/src/shared/billing/idempotency.ts +3 -3
- package/src/shared/billing/webhookHandler.ts +18 -1
- package/src/shared/utils/internal/auth.ts +2 -1
- package/src/shared/utils/internal/validation.ts +10 -3
- package/src/shared/utils.ts +6 -6
- package/src/supabase/baseFunction.ts +21 -2
- package/src/supabase/crud/create.ts +8 -3
- package/src/supabase/crud/delete.ts +7 -0
- package/src/supabase/crud/list.ts +24 -1
- package/src/supabase/crud/update.ts +3 -0
- package/src/supabase/utils/rateLimiter.ts +17 -6
- package/src/vercel/api/crud/get.ts +7 -2
- package/src/vercel/baseFunction.ts +7 -0
package/lib/vercel/api/index.js
CHANGED
|
@@ -21,6 +21,13 @@ var init_createMetadata = __esm({
|
|
|
21
21
|
},
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
+
// ../core/utils/src/common/currencyFormat.ts
|
|
25
|
+
var init_currencyFormat = __esm({
|
|
26
|
+
'../core/utils/src/common/currencyFormat.ts'() {
|
|
27
|
+
'use strict';
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
24
31
|
// ../core/utils/src/common/dateUtils.ts
|
|
25
32
|
var init_dateUtils = __esm({
|
|
26
33
|
'../core/utils/src/common/dateUtils.ts'() {
|
|
@@ -426,6 +433,26 @@ function boolean(message$1) {
|
|
|
426
433
|
};
|
|
427
434
|
}
|
|
428
435
|
// @__NO_SIDE_EFFECTS__
|
|
436
|
+
function custom(check$1, message$1) {
|
|
437
|
+
return {
|
|
438
|
+
kind: 'schema',
|
|
439
|
+
type: 'custom',
|
|
440
|
+
reference: custom,
|
|
441
|
+
expects: 'unknown',
|
|
442
|
+
async: false,
|
|
443
|
+
check: check$1,
|
|
444
|
+
message: message$1,
|
|
445
|
+
get '~standard'() {
|
|
446
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
447
|
+
},
|
|
448
|
+
'~run'(dataset, config$1) {
|
|
449
|
+
if (this.check(dataset.value)) dataset.typed = true;
|
|
450
|
+
else _addIssue(this, 'type', dataset, config$1);
|
|
451
|
+
return dataset;
|
|
452
|
+
},
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
// @__NO_SIDE_EFFECTS__
|
|
429
456
|
function literal(literal_, message$1) {
|
|
430
457
|
return {
|
|
431
458
|
kind: 'schema',
|
|
@@ -582,6 +609,32 @@ function nullable(wrapped, default_) {
|
|
|
582
609
|
};
|
|
583
610
|
}
|
|
584
611
|
// @__NO_SIDE_EFFECTS__
|
|
612
|
+
function nullish(wrapped, default_) {
|
|
613
|
+
return {
|
|
614
|
+
kind: 'schema',
|
|
615
|
+
type: 'nullish',
|
|
616
|
+
reference: nullish,
|
|
617
|
+
expects: `(${wrapped.expects} | null | undefined)`,
|
|
618
|
+
async: false,
|
|
619
|
+
wrapped,
|
|
620
|
+
default: default_,
|
|
621
|
+
get '~standard'() {
|
|
622
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
623
|
+
},
|
|
624
|
+
'~run'(dataset, config$1) {
|
|
625
|
+
if (dataset.value === null || dataset.value === void 0) {
|
|
626
|
+
if (this.default !== void 0)
|
|
627
|
+
dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
|
|
628
|
+
if (dataset.value === null || dataset.value === void 0) {
|
|
629
|
+
dataset.typed = true;
|
|
630
|
+
return dataset;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
return this.wrapped['~run'](dataset, config$1);
|
|
634
|
+
},
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
// @__NO_SIDE_EFFECTS__
|
|
585
638
|
function number(message$1) {
|
|
586
639
|
return {
|
|
587
640
|
kind: 'schema',
|
|
@@ -1104,10 +1157,12 @@ var init_dist = __esm({
|
|
|
1104
1157
|
__name(any, 'any');
|
|
1105
1158
|
__name(array, 'array');
|
|
1106
1159
|
__name(boolean, 'boolean');
|
|
1160
|
+
__name(custom, 'custom');
|
|
1107
1161
|
__name(literal, 'literal');
|
|
1108
1162
|
__name(looseObject, 'looseObject');
|
|
1109
1163
|
__name(never, 'never');
|
|
1110
1164
|
__name(nullable, 'nullable');
|
|
1165
|
+
__name(nullish, 'nullish');
|
|
1111
1166
|
__name(number, 'number');
|
|
1112
1167
|
__name(object, 'object');
|
|
1113
1168
|
__name(optional, 'optional');
|
|
@@ -1427,6 +1482,13 @@ var init_aggregate = __esm({
|
|
|
1427
1482
|
},
|
|
1428
1483
|
});
|
|
1429
1484
|
|
|
1485
|
+
// ../core/types/src/crud/components.ts
|
|
1486
|
+
var init_components = __esm({
|
|
1487
|
+
'../core/types/src/crud/components.ts'() {
|
|
1488
|
+
'use strict';
|
|
1489
|
+
},
|
|
1490
|
+
});
|
|
1491
|
+
|
|
1430
1492
|
// ../core/types/src/crud/constants.ts
|
|
1431
1493
|
var init_constants3 = __esm({
|
|
1432
1494
|
'../core/types/src/crud/constants.ts'() {
|
|
@@ -1507,6 +1569,7 @@ var init_crud = __esm({
|
|
|
1507
1569
|
'../core/types/src/crud/index.ts'() {
|
|
1508
1570
|
'use strict';
|
|
1509
1571
|
init_aggregate();
|
|
1572
|
+
init_components();
|
|
1510
1573
|
init_schemas3();
|
|
1511
1574
|
init_types3();
|
|
1512
1575
|
},
|
|
@@ -2843,6 +2906,13 @@ var init_errors2 = __esm({
|
|
|
2843
2906
|
},
|
|
2844
2907
|
});
|
|
2845
2908
|
|
|
2909
|
+
// ../core/utils/src/common/generateFirestoreRuleCondition.ts
|
|
2910
|
+
var init_generateFirestoreRuleCondition = __esm({
|
|
2911
|
+
'../core/utils/src/common/generateFirestoreRuleCondition.ts'() {
|
|
2912
|
+
'use strict';
|
|
2913
|
+
},
|
|
2914
|
+
});
|
|
2915
|
+
|
|
2846
2916
|
// ../core/utils/src/common/maybeTranslate.ts
|
|
2847
2917
|
var init_maybeTranslate = __esm({
|
|
2848
2918
|
'../core/utils/src/common/maybeTranslate.ts'() {
|
|
@@ -2965,8 +3035,10 @@ var init_common2 = __esm({
|
|
|
2965
3035
|
'use strict';
|
|
2966
3036
|
init_arrayTranslations();
|
|
2967
3037
|
init_createMetadata();
|
|
3038
|
+
init_currencyFormat();
|
|
2968
3039
|
init_dateUtils();
|
|
2969
3040
|
init_errors2();
|
|
3041
|
+
init_generateFirestoreRuleCondition();
|
|
2970
3042
|
init_maybeTranslate();
|
|
2971
3043
|
init_pkce();
|
|
2972
3044
|
init_gracefulInit();
|
|
@@ -3010,17 +3082,13 @@ var init_server = __esm({
|
|
|
3010
3082
|
},
|
|
3011
3083
|
});
|
|
3012
3084
|
|
|
3013
|
-
// ../core/schemas/src/common/validation/enhanceSchema.ts
|
|
3014
|
-
var init_enhanceSchema = __esm({
|
|
3015
|
-
'../core/schemas/src/common/validation/enhanceSchema.ts'() {
|
|
3016
|
-
'use strict';
|
|
3017
|
-
},
|
|
3018
|
-
});
|
|
3019
|
-
|
|
3020
3085
|
// ../core/schemas/src/common/validation/getSchemaType.ts
|
|
3021
3086
|
function registerSchemaGenerator(type, generator) {
|
|
3022
3087
|
schemaRegistry.set(type, generator);
|
|
3023
3088
|
}
|
|
3089
|
+
function applyRequired(schema, required) {
|
|
3090
|
+
return required ? schema : nullish(schema);
|
|
3091
|
+
}
|
|
3024
3092
|
function registerBuiltinSchemas() {
|
|
3025
3093
|
registerSchemaGenerator('text', textSchema);
|
|
3026
3094
|
registerSchemaGenerator('textarea', textSchema);
|
|
@@ -3030,10 +3098,17 @@ function registerBuiltinSchemas() {
|
|
|
3030
3098
|
registerSchemaGenerator('password', passwordSchema);
|
|
3031
3099
|
registerSchemaGenerator('url', urlSchema);
|
|
3032
3100
|
registerSchemaGenerator('tel', telSchema);
|
|
3101
|
+
registerSchemaGenerator('iban', ibanSchema);
|
|
3033
3102
|
registerSchemaGenerator('number', numberSchema);
|
|
3103
|
+
registerSchemaGenerator('currency', numberSchema);
|
|
3104
|
+
registerSchemaGenerator('price', priceSchema);
|
|
3034
3105
|
registerSchemaGenerator('range', numberSchema);
|
|
3106
|
+
registerSchemaGenerator('year', numberSchema);
|
|
3107
|
+
registerSchemaGenerator('rating', numberSchema);
|
|
3108
|
+
registerSchemaGenerator('duration', numberSchema);
|
|
3035
3109
|
registerSchemaGenerator('boolean', booleanSchema);
|
|
3036
3110
|
registerSchemaGenerator('checkbox', booleanSchema);
|
|
3111
|
+
registerSchemaGenerator('gdprConsent', gdprConsentSchema);
|
|
3037
3112
|
registerSchemaGenerator('date', dateSchema);
|
|
3038
3113
|
registerSchemaGenerator('datetime-local', dateSchema);
|
|
3039
3114
|
registerSchemaGenerator('time', dateSchema);
|
|
@@ -3053,6 +3128,8 @@ function registerBuiltinSchemas() {
|
|
|
3053
3128
|
registerSchemaGenerator('select', selectSchema);
|
|
3054
3129
|
registerSchemaGenerator('multiselect', multiselectSchema);
|
|
3055
3130
|
registerSchemaGenerator('radio', selectSchema);
|
|
3131
|
+
registerSchemaGenerator('combobox', selectSchema);
|
|
3132
|
+
registerSchemaGenerator('switch', switchSchema);
|
|
3056
3133
|
registerSchemaGenerator('reference', referenceSchema);
|
|
3057
3134
|
registerSchemaGenerator('hidden', stringSchema);
|
|
3058
3135
|
registerSchemaGenerator('avatar', stringSchema);
|
|
@@ -3083,7 +3160,11 @@ var schemaRegistry,
|
|
|
3083
3160
|
referenceSchema,
|
|
3084
3161
|
stringSchema,
|
|
3085
3162
|
telSchema,
|
|
3086
|
-
|
|
3163
|
+
ibanSchema,
|
|
3164
|
+
neverSchema,
|
|
3165
|
+
switchSchema,
|
|
3166
|
+
gdprConsentSchema,
|
|
3167
|
+
priceSchema;
|
|
3087
3168
|
var init_getSchemaType = __esm({
|
|
3088
3169
|
'../core/schemas/src/common/validation/getSchemaType.ts'() {
|
|
3089
3170
|
'use strict';
|
|
@@ -3091,6 +3172,7 @@ var init_getSchemaType = __esm({
|
|
|
3091
3172
|
init_src();
|
|
3092
3173
|
schemaRegistry = /* @__PURE__ */ new Map();
|
|
3093
3174
|
__name(registerSchemaGenerator, 'registerSchemaGenerator');
|
|
3175
|
+
__name(applyRequired, 'applyRequired');
|
|
3094
3176
|
textSchema = /* @__PURE__ */ __name((field) => {
|
|
3095
3177
|
const validations = [];
|
|
3096
3178
|
if (field.validation?.minLength !== void 0) {
|
|
@@ -3116,11 +3198,11 @@ var init_getSchemaType = __esm({
|
|
|
3116
3198
|
}
|
|
3117
3199
|
const schema =
|
|
3118
3200
|
validations.length > 0 ? pipe(string(), ...validations) : string();
|
|
3119
|
-
return field.validation?.required
|
|
3201
|
+
return applyRequired(schema, field.validation?.required);
|
|
3120
3202
|
}, 'textSchema');
|
|
3121
3203
|
emailSchema = /* @__PURE__ */ __name((field) => {
|
|
3122
3204
|
const schema = pipe(string(), email('Invalid email address'));
|
|
3123
|
-
return field.validation?.required
|
|
3205
|
+
return applyRequired(schema, field.validation?.required);
|
|
3124
3206
|
}, 'emailSchema');
|
|
3125
3207
|
passwordSchema = /* @__PURE__ */ __name((field) => {
|
|
3126
3208
|
const schema =
|
|
@@ -3133,11 +3215,11 @@ var init_getSchemaType = __esm({
|
|
|
3133
3215
|
)
|
|
3134
3216
|
)
|
|
3135
3217
|
: string();
|
|
3136
|
-
return field.validation?.required
|
|
3218
|
+
return applyRequired(schema, field.validation?.required);
|
|
3137
3219
|
}, 'passwordSchema');
|
|
3138
3220
|
urlSchema = /* @__PURE__ */ __name((field) => {
|
|
3139
3221
|
const schema = pipe(string(), url('Invalid URL'));
|
|
3140
|
-
return field.validation?.required
|
|
3222
|
+
return applyRequired(schema, field.validation?.required);
|
|
3141
3223
|
}, 'urlSchema');
|
|
3142
3224
|
numberSchema = /* @__PURE__ */ __name((field) => {
|
|
3143
3225
|
const validations = [];
|
|
@@ -3159,30 +3241,30 @@ var init_getSchemaType = __esm({
|
|
|
3159
3241
|
}
|
|
3160
3242
|
const schema =
|
|
3161
3243
|
validations.length > 0 ? pipe(number(), ...validations) : number();
|
|
3162
|
-
return field.validation?.required
|
|
3244
|
+
return applyRequired(schema, field.validation?.required);
|
|
3163
3245
|
}, 'numberSchema');
|
|
3164
3246
|
booleanSchema = /* @__PURE__ */ __name((field) => {
|
|
3165
3247
|
const schema = boolean();
|
|
3166
|
-
return field.validation?.required
|
|
3248
|
+
return applyRequired(schema, field.validation?.required);
|
|
3167
3249
|
}, 'booleanSchema');
|
|
3168
3250
|
dateSchema = /* @__PURE__ */ __name((field) => {
|
|
3169
3251
|
const schema = pipe(string(), isoTimestamp('Invalid date format'));
|
|
3170
|
-
return field.validation?.required
|
|
3252
|
+
return applyRequired(schema, field.validation?.required);
|
|
3171
3253
|
}, 'dateSchema');
|
|
3172
3254
|
fileAssetObjectSchema = object({
|
|
3173
3255
|
url: string(),
|
|
3174
3256
|
filename: string(),
|
|
3175
3257
|
size: number(),
|
|
3176
|
-
mimeType:
|
|
3177
|
-
uploadedAt:
|
|
3258
|
+
mimeType: nullish(string()),
|
|
3259
|
+
uploadedAt: nullish(string()),
|
|
3178
3260
|
});
|
|
3179
3261
|
fileSchema = /* @__PURE__ */ __name((field) => {
|
|
3180
3262
|
const schema = nullable(fileAssetObjectSchema);
|
|
3181
|
-
return field.validation?.required
|
|
3263
|
+
return applyRequired(schema, field.validation?.required);
|
|
3182
3264
|
}, 'fileSchema');
|
|
3183
3265
|
filesSchema = /* @__PURE__ */ __name((field) => {
|
|
3184
3266
|
const schema = array(fileAssetObjectSchema);
|
|
3185
|
-
return field.validation?.required
|
|
3267
|
+
return applyRequired(schema, field.validation?.required);
|
|
3186
3268
|
}, 'filesSchema');
|
|
3187
3269
|
pictureObjectSchema = object({
|
|
3188
3270
|
fullUrl: string(),
|
|
@@ -3190,125 +3272,148 @@ var init_getSchemaType = __esm({
|
|
|
3190
3272
|
});
|
|
3191
3273
|
pictureSchema = /* @__PURE__ */ __name((field) => {
|
|
3192
3274
|
const schema = pictureObjectSchema;
|
|
3193
|
-
return field.validation?.required
|
|
3275
|
+
return applyRequired(schema, field.validation?.required);
|
|
3194
3276
|
}, 'pictureSchema');
|
|
3195
3277
|
picturesSchema = /* @__PURE__ */ __name((field) => {
|
|
3196
3278
|
const schema = array(pictureObjectSchema);
|
|
3197
|
-
return field.validation?.required
|
|
3279
|
+
return applyRequired(schema, field.validation?.required);
|
|
3198
3280
|
}, 'picturesSchema');
|
|
3199
3281
|
geopointSchema = /* @__PURE__ */ __name((field) => {
|
|
3200
3282
|
const schema = object({ lat: number(), lng: number() });
|
|
3201
|
-
return field.validation?.required
|
|
3283
|
+
return applyRequired(schema, field.validation?.required);
|
|
3202
3284
|
}, 'geopointSchema');
|
|
3203
3285
|
addressSchema = /* @__PURE__ */ __name((field) => {
|
|
3204
3286
|
const schema = object({
|
|
3205
3287
|
formatted_address: string(),
|
|
3206
3288
|
latitude: number(),
|
|
3207
3289
|
longitude: number(),
|
|
3208
|
-
street_number:
|
|
3209
|
-
route:
|
|
3210
|
-
locality:
|
|
3211
|
-
administrative_area_level_1:
|
|
3212
|
-
administrative_area_level_2:
|
|
3213
|
-
country:
|
|
3214
|
-
postal_code:
|
|
3290
|
+
street_number: nullish(string()),
|
|
3291
|
+
route: nullish(string()),
|
|
3292
|
+
locality: nullish(string()),
|
|
3293
|
+
administrative_area_level_1: nullish(string()),
|
|
3294
|
+
administrative_area_level_2: nullish(string()),
|
|
3295
|
+
country: nullish(string()),
|
|
3296
|
+
postal_code: nullish(string()),
|
|
3215
3297
|
});
|
|
3216
|
-
return field.validation?.required
|
|
3298
|
+
return applyRequired(schema, field.validation?.required);
|
|
3217
3299
|
}, 'addressSchema');
|
|
3218
3300
|
mapSchema = /* @__PURE__ */ __name((field) => {
|
|
3219
3301
|
const schema = record(string(), unknown());
|
|
3220
|
-
return field.validation?.required
|
|
3302
|
+
return applyRequired(schema, field.validation?.required);
|
|
3221
3303
|
}, 'mapSchema');
|
|
3222
3304
|
arraySchema = /* @__PURE__ */ __name((field) => {
|
|
3223
3305
|
const schema = array(unknown());
|
|
3224
|
-
return field.validation?.required
|
|
3306
|
+
return applyRequired(schema, field.validation?.required);
|
|
3225
3307
|
}, 'arraySchema');
|
|
3226
3308
|
selectSchema = /* @__PURE__ */ __name((field) => {
|
|
3227
3309
|
const options = field.validation?.options;
|
|
3228
3310
|
if (Array.isArray(options) && options.length > 0) {
|
|
3229
3311
|
const values = options.map((opt) => opt.value);
|
|
3230
3312
|
const schema2 = picklist(values);
|
|
3231
|
-
return field.validation?.required
|
|
3313
|
+
return applyRequired(schema2, field.validation?.required);
|
|
3232
3314
|
}
|
|
3233
|
-
const schema = string();
|
|
3234
|
-
return field.validation?.required
|
|
3315
|
+
const schema = union([string(), number()]);
|
|
3316
|
+
return applyRequired(schema, field.validation?.required);
|
|
3235
3317
|
}, 'selectSchema');
|
|
3236
3318
|
multiselectSchema = /* @__PURE__ */ __name((field) => {
|
|
3237
3319
|
const options = field.validation?.options;
|
|
3238
3320
|
if (Array.isArray(options) && options.length > 0) {
|
|
3239
3321
|
const values = options.map((opt) => opt.value);
|
|
3240
3322
|
const schema2 = array(picklist(values));
|
|
3241
|
-
return field.validation?.required
|
|
3323
|
+
return applyRequired(schema2, field.validation?.required);
|
|
3242
3324
|
}
|
|
3243
3325
|
const schema = array(string());
|
|
3244
|
-
return field.validation?.required
|
|
3326
|
+
return applyRequired(schema, field.validation?.required);
|
|
3245
3327
|
}, 'multiselectSchema');
|
|
3246
3328
|
referenceSchema = /* @__PURE__ */ __name((field) => {
|
|
3247
3329
|
const schema = pipe(
|
|
3248
3330
|
string(),
|
|
3249
3331
|
regex(FIRESTORE_ID_PATTERN, 'Invalid ID format')
|
|
3250
3332
|
);
|
|
3251
|
-
return field.validation?.required
|
|
3333
|
+
return applyRequired(schema, field.validation?.required);
|
|
3252
3334
|
}, 'referenceSchema');
|
|
3253
3335
|
stringSchema = /* @__PURE__ */ __name((field) => {
|
|
3254
3336
|
const schema = string();
|
|
3255
|
-
return field.validation?.required
|
|
3337
|
+
return applyRequired(schema, field.validation?.required);
|
|
3256
3338
|
}, 'stringSchema');
|
|
3257
3339
|
telSchema = /* @__PURE__ */ __name((field) => {
|
|
3258
3340
|
const schema = string();
|
|
3259
|
-
return field.validation?.required
|
|
3341
|
+
return applyRequired(schema, field.validation?.required);
|
|
3260
3342
|
}, 'telSchema');
|
|
3343
|
+
ibanSchema = /* @__PURE__ */ __name((field) => {
|
|
3344
|
+
const minLength2 = field.validation?.minLength ?? 15;
|
|
3345
|
+
const maxLength2 = field.validation?.maxLength ?? 34;
|
|
3346
|
+
const pattern =
|
|
3347
|
+
field.validation?.pattern ?? '^[A-Z]{2}[0-9]{2}[A-Z0-9]{4,34}$';
|
|
3348
|
+
const validations = [];
|
|
3349
|
+
if (minLength2 !== void 0) {
|
|
3350
|
+
validations.push(
|
|
3351
|
+
minLength(
|
|
3352
|
+
minLength2,
|
|
3353
|
+
`IBAN must be at least ${minLength2} characters`
|
|
3354
|
+
)
|
|
3355
|
+
);
|
|
3356
|
+
}
|
|
3357
|
+
if (maxLength2 !== void 0) {
|
|
3358
|
+
validations.push(
|
|
3359
|
+
maxLength(maxLength2, `IBAN must not exceed ${maxLength2} characters`)
|
|
3360
|
+
);
|
|
3361
|
+
}
|
|
3362
|
+
if (pattern) {
|
|
3363
|
+
const regex2 =
|
|
3364
|
+
typeof pattern === 'string' ? new RegExp(pattern) : pattern;
|
|
3365
|
+
validations.push(regex(regex2, 'Invalid IBAN format'));
|
|
3366
|
+
}
|
|
3367
|
+
const schema =
|
|
3368
|
+
validations.length > 0 ? pipe(string(), ...validations) : string();
|
|
3369
|
+
return applyRequired(schema, field.validation?.required);
|
|
3370
|
+
}, 'ibanSchema');
|
|
3261
3371
|
neverSchema = /* @__PURE__ */ __name(() => never(), 'neverSchema');
|
|
3372
|
+
switchSchema = /* @__PURE__ */ __name((field) => {
|
|
3373
|
+
const fieldSpecific = field.options?.fieldSpecific;
|
|
3374
|
+
if (fieldSpecific?.checkedValue && fieldSpecific?.uncheckedValue) {
|
|
3375
|
+
const values = [
|
|
3376
|
+
fieldSpecific.checkedValue,
|
|
3377
|
+
fieldSpecific.uncheckedValue,
|
|
3378
|
+
];
|
|
3379
|
+
const schema2 = picklist(values);
|
|
3380
|
+
return applyRequired(schema2, field.validation?.required);
|
|
3381
|
+
}
|
|
3382
|
+
const schema = boolean();
|
|
3383
|
+
return applyRequired(schema, field.validation?.required);
|
|
3384
|
+
}, 'switchSchema');
|
|
3385
|
+
gdprConsentSchema = /* @__PURE__ */ __name((field) => {
|
|
3386
|
+
const baseSchema = custom((input) => {
|
|
3387
|
+
if (field.validation?.required) {
|
|
3388
|
+
if (typeof input === 'object' && input !== null) {
|
|
3389
|
+
return input.gdprConsent === true;
|
|
3390
|
+
}
|
|
3391
|
+
return false;
|
|
3392
|
+
}
|
|
3393
|
+
if (input === false || input === null || input === void 0) {
|
|
3394
|
+
return true;
|
|
3395
|
+
}
|
|
3396
|
+
if (typeof input === 'object' && input !== null) {
|
|
3397
|
+
return input.gdprConsent === true;
|
|
3398
|
+
}
|
|
3399
|
+
return false;
|
|
3400
|
+
}, 'GDPR consent must be given');
|
|
3401
|
+
return baseSchema;
|
|
3402
|
+
}, 'gdprConsentSchema');
|
|
3403
|
+
priceSchema = /* @__PURE__ */ __name((field) => {
|
|
3404
|
+
const schema = object({
|
|
3405
|
+
amount: number(),
|
|
3406
|
+
currency: optional(string()),
|
|
3407
|
+
vatIncluded: optional(boolean()),
|
|
3408
|
+
discountPercent: optional(pipe(number(), minValue(0), maxValue(100))),
|
|
3409
|
+
});
|
|
3410
|
+
return applyRequired(schema, field.validation?.required);
|
|
3411
|
+
}, 'priceSchema');
|
|
3262
3412
|
__name(registerBuiltinSchemas, 'registerBuiltinSchemas');
|
|
3263
3413
|
registerBuiltinSchemas();
|
|
3264
3414
|
},
|
|
3265
3415
|
});
|
|
3266
3416
|
|
|
3267
|
-
// ../core/schemas/src/common/validation/validateDates.ts
|
|
3268
|
-
var init_validateDates = __esm({
|
|
3269
|
-
'../core/schemas/src/common/validation/validateDates.ts'() {
|
|
3270
|
-
'use strict';
|
|
3271
|
-
init_server();
|
|
3272
|
-
},
|
|
3273
|
-
});
|
|
3274
|
-
|
|
3275
|
-
// ../core/schemas/src/common/validation/validateUniqueFields.ts
|
|
3276
|
-
var init_validateUniqueFields = __esm({
|
|
3277
|
-
'../core/schemas/src/common/validation/validateUniqueFields.ts'() {
|
|
3278
|
-
'use strict';
|
|
3279
|
-
init_server();
|
|
3280
|
-
},
|
|
3281
|
-
});
|
|
3282
|
-
|
|
3283
|
-
// ../core/schemas/src/common/validation/validateDocument.ts
|
|
3284
|
-
var init_validateDocument = __esm({
|
|
3285
|
-
'../core/schemas/src/common/validation/validateDocument.ts'() {
|
|
3286
|
-
'use strict';
|
|
3287
|
-
init_validateDates();
|
|
3288
|
-
init_validateUniqueFields();
|
|
3289
|
-
},
|
|
3290
|
-
});
|
|
3291
|
-
|
|
3292
|
-
// ../core/schemas/src/common/validation/index.ts
|
|
3293
|
-
var init_validation2 = __esm({
|
|
3294
|
-
'../core/schemas/src/common/validation/index.ts'() {
|
|
3295
|
-
'use strict';
|
|
3296
|
-
init_enhanceSchema();
|
|
3297
|
-
init_getSchemaType();
|
|
3298
|
-
init_validateDates();
|
|
3299
|
-
init_validateDocument();
|
|
3300
|
-
init_validateUniqueFields();
|
|
3301
|
-
},
|
|
3302
|
-
});
|
|
3303
|
-
|
|
3304
|
-
// ../core/schemas/src/common/utils.ts
|
|
3305
|
-
var init_utils2 = __esm({
|
|
3306
|
-
'../core/schemas/src/common/utils.ts'() {
|
|
3307
|
-
'use strict';
|
|
3308
|
-
init_server();
|
|
3309
|
-
},
|
|
3310
|
-
});
|
|
3311
|
-
|
|
3312
3417
|
// ../core/schemas/src/common/visibility.ts
|
|
3313
3418
|
var DEFAULT_STATUS_OPTIONS,
|
|
3314
3419
|
BACKEND_GENERATED_FIELD_NAMES,
|
|
@@ -3319,9 +3424,9 @@ var init_visibility = __esm({
|
|
|
3319
3424
|
'use strict';
|
|
3320
3425
|
init_src();
|
|
3321
3426
|
DEFAULT_STATUS_OPTIONS = [
|
|
3322
|
-
{ value: 'draft', label: '
|
|
3323
|
-
{ value: 'available', label: '
|
|
3324
|
-
{ value: 'deleted', label: '
|
|
3427
|
+
{ value: 'draft', label: 'crud:status.draft' },
|
|
3428
|
+
{ value: 'available', label: 'crud:status.available' },
|
|
3429
|
+
{ value: 'deleted', label: 'crud:status.deleted' },
|
|
3325
3430
|
];
|
|
3326
3431
|
BACKEND_GENERATED_FIELD_NAMES = [
|
|
3327
3432
|
'id',
|
|
@@ -3341,64 +3446,151 @@ var init_visibility = __esm({
|
|
|
3341
3446
|
// Framework-enforced, user-settable (NOT backend-generated)
|
|
3342
3447
|
];
|
|
3343
3448
|
baseFields = {
|
|
3449
|
+
status: {
|
|
3450
|
+
name: 'status',
|
|
3451
|
+
type: 'select',
|
|
3452
|
+
visibility: 'admin',
|
|
3453
|
+
label: 'crud:fields.status',
|
|
3454
|
+
editable: 'admin',
|
|
3455
|
+
// REQUIRED: Status must be editable to be included in forms
|
|
3456
|
+
validation: {
|
|
3457
|
+
required: true,
|
|
3458
|
+
options: [...DEFAULT_STATUS_OPTIONS],
|
|
3459
|
+
},
|
|
3460
|
+
},
|
|
3344
3461
|
id: {
|
|
3462
|
+
name: 'id',
|
|
3345
3463
|
type: 'text',
|
|
3346
|
-
visibility: '
|
|
3464
|
+
visibility: 'hidden',
|
|
3465
|
+
label: 'crud:fields.id',
|
|
3347
3466
|
validation: {
|
|
3348
3467
|
required: true,
|
|
3349
3468
|
pattern: FIRESTORE_ID_PATTERN.source,
|
|
3350
3469
|
},
|
|
3351
3470
|
},
|
|
3352
3471
|
createdAt: {
|
|
3472
|
+
name: '_createdAt',
|
|
3353
3473
|
type: 'timestamp',
|
|
3354
3474
|
visibility: 'technical',
|
|
3475
|
+
label: 'crud:fields._createdAt',
|
|
3355
3476
|
validation: { required: true },
|
|
3356
3477
|
},
|
|
3357
3478
|
updatedAt: {
|
|
3479
|
+
name: '_updatedAt',
|
|
3358
3480
|
type: 'timestamp',
|
|
3359
3481
|
visibility: 'technical',
|
|
3482
|
+
label: 'crud:fields._updatedAt',
|
|
3360
3483
|
validation: { required: true },
|
|
3361
3484
|
},
|
|
3362
3485
|
createdById: {
|
|
3486
|
+
name: '_createdById',
|
|
3363
3487
|
type: 'reference',
|
|
3364
3488
|
visibility: 'technical',
|
|
3489
|
+
label: 'crud:fields._createdById',
|
|
3365
3490
|
validation: { required: true },
|
|
3366
3491
|
},
|
|
3367
3492
|
updatedById: {
|
|
3493
|
+
name: '_updatedById',
|
|
3368
3494
|
type: 'reference',
|
|
3369
3495
|
visibility: 'technical',
|
|
3496
|
+
label: 'crud:fields._updatedById',
|
|
3370
3497
|
validation: { required: true },
|
|
3371
3498
|
},
|
|
3372
|
-
status: {
|
|
3373
|
-
type: 'select',
|
|
3374
|
-
visibility: 'admin',
|
|
3375
|
-
editable: 'admin',
|
|
3376
|
-
// REQUIRED: Status must be editable to be included in forms
|
|
3377
|
-
validation: {
|
|
3378
|
-
required: true,
|
|
3379
|
-
options: [...DEFAULT_STATUS_OPTIONS],
|
|
3380
|
-
},
|
|
3381
|
-
},
|
|
3382
3499
|
};
|
|
3383
3500
|
},
|
|
3384
3501
|
});
|
|
3385
3502
|
|
|
3503
|
+
// ../core/schemas/src/common/createSchema.ts
|
|
3504
|
+
var init_createSchema = __esm({
|
|
3505
|
+
'../core/schemas/src/common/createSchema.ts'() {
|
|
3506
|
+
'use strict';
|
|
3507
|
+
init_src();
|
|
3508
|
+
init_getSchemaType();
|
|
3509
|
+
init_visibility();
|
|
3510
|
+
},
|
|
3511
|
+
});
|
|
3512
|
+
|
|
3513
|
+
// ../core/schemas/src/client/index.ts
|
|
3514
|
+
var init_client = __esm({
|
|
3515
|
+
'../core/schemas/src/client/index.ts'() {
|
|
3516
|
+
'use strict';
|
|
3517
|
+
init_createSchema();
|
|
3518
|
+
},
|
|
3519
|
+
});
|
|
3520
|
+
|
|
3521
|
+
// ../core/schemas/src/common/validation/enhanceSchema.ts
|
|
3522
|
+
var init_enhanceSchema = __esm({
|
|
3523
|
+
'../core/schemas/src/common/validation/enhanceSchema.ts'() {
|
|
3524
|
+
'use strict';
|
|
3525
|
+
},
|
|
3526
|
+
});
|
|
3527
|
+
|
|
3528
|
+
// ../core/schemas/src/common/validation/validateDates.ts
|
|
3529
|
+
var init_validateDates = __esm({
|
|
3530
|
+
'../core/schemas/src/common/validation/validateDates.ts'() {
|
|
3531
|
+
'use strict';
|
|
3532
|
+
init_server();
|
|
3533
|
+
},
|
|
3534
|
+
});
|
|
3535
|
+
|
|
3536
|
+
// ../core/schemas/src/common/validation/validateUniqueFields.ts
|
|
3537
|
+
var init_validateUniqueFields = __esm({
|
|
3538
|
+
'../core/schemas/src/common/validation/validateUniqueFields.ts'() {
|
|
3539
|
+
'use strict';
|
|
3540
|
+
init_server();
|
|
3541
|
+
},
|
|
3542
|
+
});
|
|
3543
|
+
|
|
3544
|
+
// ../core/schemas/src/common/validation/validateDocument.ts
|
|
3545
|
+
var init_validateDocument = __esm({
|
|
3546
|
+
'../core/schemas/src/common/validation/validateDocument.ts'() {
|
|
3547
|
+
'use strict';
|
|
3548
|
+
init_validateDates();
|
|
3549
|
+
init_validateUniqueFields();
|
|
3550
|
+
},
|
|
3551
|
+
});
|
|
3552
|
+
|
|
3553
|
+
// ../core/schemas/src/common/validation/index.ts
|
|
3554
|
+
var init_validation2 = __esm({
|
|
3555
|
+
'../core/schemas/src/common/validation/index.ts'() {
|
|
3556
|
+
'use strict';
|
|
3557
|
+
init_enhanceSchema();
|
|
3558
|
+
init_getSchemaType();
|
|
3559
|
+
init_validateDates();
|
|
3560
|
+
init_validateDocument();
|
|
3561
|
+
init_validateUniqueFields();
|
|
3562
|
+
},
|
|
3563
|
+
});
|
|
3564
|
+
|
|
3565
|
+
// ../core/schemas/src/common/utils.ts
|
|
3566
|
+
var init_utils2 = __esm({
|
|
3567
|
+
'../core/schemas/src/common/utils.ts'() {
|
|
3568
|
+
'use strict';
|
|
3569
|
+
init_server();
|
|
3570
|
+
},
|
|
3571
|
+
});
|
|
3572
|
+
|
|
3386
3573
|
// ../core/schemas/src/common/defineEntity.ts
|
|
3387
3574
|
var init_defineEntity = __esm({
|
|
3388
3575
|
'../core/schemas/src/common/defineEntity.ts'() {
|
|
3389
3576
|
'use strict';
|
|
3577
|
+
init_src();
|
|
3390
3578
|
init_server();
|
|
3391
3579
|
init_visibility();
|
|
3392
3580
|
},
|
|
3393
3581
|
});
|
|
3394
3582
|
|
|
3395
|
-
// ../core/schemas/src/common/
|
|
3396
|
-
var
|
|
3397
|
-
'../core/schemas/src/common/
|
|
3583
|
+
// ../core/schemas/src/common/optionHelpers.ts
|
|
3584
|
+
var init_optionHelpers = __esm({
|
|
3585
|
+
'../core/schemas/src/common/optionHelpers.ts'() {
|
|
3586
|
+
'use strict';
|
|
3587
|
+
},
|
|
3588
|
+
});
|
|
3589
|
+
|
|
3590
|
+
// ../core/schemas/src/common/scopeProvider.ts
|
|
3591
|
+
var init_scopeProvider = __esm({
|
|
3592
|
+
'../core/schemas/src/common/scopeProvider.ts'() {
|
|
3398
3593
|
'use strict';
|
|
3399
|
-
init_src();
|
|
3400
|
-
init_getSchemaType();
|
|
3401
|
-
init_visibility();
|
|
3402
3594
|
},
|
|
3403
3595
|
});
|
|
3404
3596
|
|
|
@@ -3411,22 +3603,26 @@ var init_common3 = __esm({
|
|
|
3411
3603
|
init_visibility();
|
|
3412
3604
|
init_defineEntity();
|
|
3413
3605
|
init_createSchema();
|
|
3606
|
+
init_optionHelpers();
|
|
3607
|
+
init_scopeProvider();
|
|
3414
3608
|
},
|
|
3415
3609
|
});
|
|
3416
3610
|
|
|
3417
|
-
// ../core/schemas/src/
|
|
3418
|
-
var
|
|
3419
|
-
'../core/schemas/src/
|
|
3611
|
+
// ../core/schemas/src/index.ts
|
|
3612
|
+
var init_src2 = __esm({
|
|
3613
|
+
'../core/schemas/src/index.ts'() {
|
|
3614
|
+
'use strict';
|
|
3615
|
+
init_client();
|
|
3420
3616
|
init_common3();
|
|
3421
3617
|
},
|
|
3422
3618
|
});
|
|
3423
3619
|
|
|
3424
3620
|
// ../core/server.ts
|
|
3425
|
-
var
|
|
3621
|
+
var init_server2 = __esm({
|
|
3426
3622
|
'../core/server.ts'() {
|
|
3427
3623
|
init_server();
|
|
3428
3624
|
init_src();
|
|
3429
|
-
|
|
3625
|
+
init_src2();
|
|
3430
3626
|
init_server();
|
|
3431
3627
|
},
|
|
3432
3628
|
});
|
|
@@ -3497,7 +3693,7 @@ var getFirebaseAdminServices;
|
|
|
3497
3693
|
var init_init = __esm({
|
|
3498
3694
|
'../providers/firebase/src/server/init.ts'() {
|
|
3499
3695
|
'use strict';
|
|
3500
|
-
|
|
3696
|
+
init_server2();
|
|
3501
3697
|
__name(initializeFirebaseAdminServices, 'initializeFirebaseAdminServices');
|
|
3502
3698
|
getFirebaseAdminServices = createSingleton(initializeFirebaseAdminServices);
|
|
3503
3699
|
__name(getFirebaseAdminApp, 'getFirebaseAdminApp');
|
|
@@ -3511,7 +3707,7 @@ var serverImplementations, getServerAdmin, getServerFirestore, generateServerId;
|
|
|
3511
3707
|
var init_utils3 = __esm({
|
|
3512
3708
|
'../providers/firebase/src/server/utils.ts'() {
|
|
3513
3709
|
'use strict';
|
|
3514
|
-
|
|
3710
|
+
init_server2();
|
|
3515
3711
|
serverImplementations = {
|
|
3516
3712
|
async getServerAdmin() {
|
|
3517
3713
|
try {
|
|
@@ -3541,51 +3737,6 @@ var init_utils3 = __esm({
|
|
|
3541
3737
|
});
|
|
3542
3738
|
|
|
3543
3739
|
// ../providers/firebase/src/shared/transform.ts
|
|
3544
|
-
function createTimestamp(date) {
|
|
3545
|
-
return {
|
|
3546
|
-
seconds: Math.floor(date.getTime() / 1e3),
|
|
3547
|
-
nanoseconds: (date.getTime() % 1e3) * 1e6,
|
|
3548
|
-
toDate: /* @__PURE__ */ __name(() => new Date(date), 'toDate'),
|
|
3549
|
-
toMillis: /* @__PURE__ */ __name(() => date.getTime(), 'toMillis'),
|
|
3550
|
-
isEqual: /* @__PURE__ */ __name(
|
|
3551
|
-
(other) =>
|
|
3552
|
-
other.seconds === Math.floor(date.getTime() / 1e3) &&
|
|
3553
|
-
other.nanoseconds === (date.getTime() % 1e3) * 1e6,
|
|
3554
|
-
'isEqual'
|
|
3555
|
-
),
|
|
3556
|
-
valueOf: /* @__PURE__ */ __name(
|
|
3557
|
-
() =>
|
|
3558
|
-
`Timestamp(seconds=${Math.floor(date.getTime() / 1e3)}, nanoseconds=${(date.getTime() % 1e3) * 1e6})`,
|
|
3559
|
-
'valueOf'
|
|
3560
|
-
),
|
|
3561
|
-
};
|
|
3562
|
-
}
|
|
3563
|
-
function toTimestamp(date) {
|
|
3564
|
-
try {
|
|
3565
|
-
if (typeof date === 'string') {
|
|
3566
|
-
const parsed = new Date(date);
|
|
3567
|
-
if (isNaN(parsed.getTime())) {
|
|
3568
|
-
throw handleError(new Error('Invalid date string format'), {
|
|
3569
|
-
context: { value: date },
|
|
3570
|
-
});
|
|
3571
|
-
}
|
|
3572
|
-
return createTimestamp(parsed);
|
|
3573
|
-
}
|
|
3574
|
-
if (date instanceof Date) {
|
|
3575
|
-
if (isNaN(date.getTime())) {
|
|
3576
|
-
throw handleError(new Error('Invalid Date object'), {
|
|
3577
|
-
context: { value: date },
|
|
3578
|
-
});
|
|
3579
|
-
}
|
|
3580
|
-
return createTimestamp(date);
|
|
3581
|
-
}
|
|
3582
|
-
throw handleError(new Error('Invalid date value type'), {
|
|
3583
|
-
context: { valueType: typeof date },
|
|
3584
|
-
});
|
|
3585
|
-
} catch (error) {
|
|
3586
|
-
throw handleError(error, 'Failed to convert to Timestamp');
|
|
3587
|
-
}
|
|
3588
|
-
}
|
|
3589
3740
|
function firestoreToISOString(date) {
|
|
3590
3741
|
try {
|
|
3591
3742
|
if (date instanceof Date) {
|
|
@@ -3668,22 +3819,8 @@ function prepareForFirestore(data, removeFields = []) {
|
|
|
3668
3819
|
if (Array.isArray(data)) {
|
|
3669
3820
|
return data.map((item) => prepareForFirestore(item, removeFields));
|
|
3670
3821
|
}
|
|
3671
|
-
if (
|
|
3672
|
-
typeof data === 'string' &&
|
|
3673
|
-
/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z$/.test(data)
|
|
3674
|
-
) {
|
|
3675
|
-
try {
|
|
3676
|
-
return toTimestamp(data);
|
|
3677
|
-
} catch (error) {
|
|
3678
|
-
return data;
|
|
3679
|
-
}
|
|
3680
|
-
}
|
|
3681
3822
|
if (data instanceof Date) {
|
|
3682
|
-
|
|
3683
|
-
return toTimestamp(data);
|
|
3684
|
-
} catch (error) {
|
|
3685
|
-
return data;
|
|
3686
|
-
}
|
|
3823
|
+
return data.toISOString();
|
|
3687
3824
|
}
|
|
3688
3825
|
if (typeof data === 'object' && data !== null) {
|
|
3689
3826
|
const prepared = {};
|
|
@@ -3703,9 +3840,7 @@ function prepareForFirestore(data, removeFields = []) {
|
|
|
3703
3840
|
var init_transform = __esm({
|
|
3704
3841
|
'../providers/firebase/src/shared/transform.ts'() {
|
|
3705
3842
|
'use strict';
|
|
3706
|
-
|
|
3707
|
-
__name(createTimestamp, 'createTimestamp');
|
|
3708
|
-
__name(toTimestamp, 'toTimestamp');
|
|
3843
|
+
init_server2();
|
|
3709
3844
|
__name(firestoreToISOString, 'firestoreToISOString');
|
|
3710
3845
|
__name(isTimestamp, 'isTimestamp');
|
|
3711
3846
|
__name(transformFirestoreData, 'transformFirestoreData');
|
|
@@ -3727,7 +3862,7 @@ var init_batch = __esm({
|
|
|
3727
3862
|
'../providers/firebase/src/server/batch.ts'() {
|
|
3728
3863
|
'use strict';
|
|
3729
3864
|
init_dist();
|
|
3730
|
-
|
|
3865
|
+
init_server2();
|
|
3731
3866
|
init_utils3();
|
|
3732
3867
|
init_transform();
|
|
3733
3868
|
isClient = typeof window !== 'undefined';
|
|
@@ -4000,7 +4135,7 @@ var isClient2, notAvailableInBrowser2, admin, getAdminFirestore, generateId;
|
|
|
4000
4135
|
var init_utils4 = __esm({
|
|
4001
4136
|
'../providers/firebase/src/shared/utils.ts'() {
|
|
4002
4137
|
'use strict';
|
|
4003
|
-
|
|
4138
|
+
init_server2();
|
|
4004
4139
|
isClient2 = typeof window !== 'undefined';
|
|
4005
4140
|
notAvailableInBrowser2 = /* @__PURE__ */ __name(
|
|
4006
4141
|
(fnName) => () => {
|
|
@@ -4030,7 +4165,7 @@ var init_utils4 = __esm({
|
|
|
4030
4165
|
var init_subscription = __esm({
|
|
4031
4166
|
'../providers/firebase/src/server/subscription.ts'() {
|
|
4032
4167
|
'use strict';
|
|
4033
|
-
|
|
4168
|
+
init_server2();
|
|
4034
4169
|
init_utils3();
|
|
4035
4170
|
init_transform();
|
|
4036
4171
|
init_utils4();
|
|
@@ -4041,7 +4176,7 @@ var init_subscription = __esm({
|
|
|
4041
4176
|
var init_uniqueness = __esm({
|
|
4042
4177
|
'../providers/firebase/src/server/uniqueness.ts'() {
|
|
4043
4178
|
'use strict';
|
|
4044
|
-
|
|
4179
|
+
init_server2();
|
|
4045
4180
|
init_utils3();
|
|
4046
4181
|
},
|
|
4047
4182
|
});
|
|
@@ -4050,7 +4185,7 @@ var init_uniqueness = __esm({
|
|
|
4050
4185
|
var init_validation3 = __esm({
|
|
4051
4186
|
'../providers/firebase/src/server/validation.ts'() {
|
|
4052
4187
|
'use strict';
|
|
4053
|
-
|
|
4188
|
+
init_server2();
|
|
4054
4189
|
init_uniqueness();
|
|
4055
4190
|
init_uniqueness();
|
|
4056
4191
|
},
|
|
@@ -4058,7 +4193,7 @@ var init_validation3 = __esm({
|
|
|
4058
4193
|
|
|
4059
4194
|
// ../providers/firebase/src/server/index.ts
|
|
4060
4195
|
import { FieldValue, Query, Timestamp } from 'firebase-admin/firestore';
|
|
4061
|
-
var
|
|
4196
|
+
var init_server3 = __esm({
|
|
4062
4197
|
'../providers/firebase/src/server/index.ts'() {
|
|
4063
4198
|
'use strict';
|
|
4064
4199
|
init_init();
|
|
@@ -4072,8 +4207,8 @@ var init_server4 = __esm({
|
|
|
4072
4207
|
});
|
|
4073
4208
|
|
|
4074
4209
|
// src/shared/errorHandling.ts
|
|
4075
|
-
init_server3();
|
|
4076
4210
|
import { HttpsError } from 'firebase-functions/v2/https';
|
|
4211
|
+
init_server2();
|
|
4077
4212
|
var DoNotDevError3 = class _DoNotDevError extends Error {
|
|
4078
4213
|
static {
|
|
4079
4214
|
__name(this, 'DoNotDevError');
|
|
@@ -4203,8 +4338,8 @@ function throwVercelError(code, message, details) {
|
|
|
4203
4338
|
__name(throwVercelError, 'throwVercelError');
|
|
4204
4339
|
|
|
4205
4340
|
// src/shared/utils.ts
|
|
4341
|
+
init_server2();
|
|
4206
4342
|
init_server3();
|
|
4207
|
-
init_server4();
|
|
4208
4343
|
import Stripe from 'stripe';
|
|
4209
4344
|
var _stripe = null;
|
|
4210
4345
|
function initStripe(apiKey) {
|
|
@@ -4257,7 +4392,7 @@ __name(validateStripeEnvironment, 'validateStripeEnvironment');
|
|
|
4257
4392
|
init_dist();
|
|
4258
4393
|
|
|
4259
4394
|
// src/shared/utils/internal/monitoring.ts
|
|
4260
|
-
|
|
4395
|
+
init_server3();
|
|
4261
4396
|
import { logger } from 'firebase-functions/v2';
|
|
4262
4397
|
async function recordPaymentMetrics(metrics) {
|
|
4263
4398
|
try {
|
|
@@ -4282,7 +4417,7 @@ async function recordPaymentMetrics(metrics) {
|
|
|
4282
4417
|
__name(recordPaymentMetrics, 'recordPaymentMetrics');
|
|
4283
4418
|
|
|
4284
4419
|
// src/shared/utils/internal/rateLimiter.ts
|
|
4285
|
-
|
|
4420
|
+
init_server3();
|
|
4286
4421
|
import { logger as logger2 } from 'firebase-functions/v2';
|
|
4287
4422
|
async function checkRateLimitWithFirestore(key, config) {
|
|
4288
4423
|
const db = getFirebaseAdminFirestore();
|
|
@@ -4510,11 +4645,11 @@ async function updateUserSubscription(userId, subscriptionData, authProvider) {
|
|
|
4510
4645
|
__name(updateUserSubscription, 'updateUserSubscription');
|
|
4511
4646
|
|
|
4512
4647
|
// src/vercel/api/billing/cancel.ts
|
|
4513
|
-
init_server4();
|
|
4514
4648
|
init_dist();
|
|
4649
|
+
init_server3();
|
|
4515
4650
|
|
|
4516
4651
|
// src/shared/billing/helpers/subscriptionManagement.ts
|
|
4517
|
-
|
|
4652
|
+
init_server2();
|
|
4518
4653
|
import 'stripe';
|
|
4519
4654
|
async function cancelUserSubscription(userId, authProvider) {
|
|
4520
4655
|
validateStripeEnvironment();
|
|
@@ -4597,8 +4732,8 @@ var cancelSubscription = /* @__PURE__ */ __name(() => {
|
|
|
4597
4732
|
var cancel_default = cancelSubscription;
|
|
4598
4733
|
|
|
4599
4734
|
// src/vercel/api/billing/change-plan.ts
|
|
4600
|
-
init_server4();
|
|
4601
4735
|
init_dist();
|
|
4736
|
+
init_server3();
|
|
4602
4737
|
import 'stripe';
|
|
4603
4738
|
var changePlanSchema = object({
|
|
4604
4739
|
userId: string(),
|
|
@@ -4678,8 +4813,8 @@ var changePlan = /* @__PURE__ */ __name((billingConfig) => {
|
|
|
4678
4813
|
var change_plan_default = changePlan;
|
|
4679
4814
|
|
|
4680
4815
|
// src/vercel/api/billing/customer-portal.ts
|
|
4681
|
-
init_server4();
|
|
4682
4816
|
init_dist();
|
|
4817
|
+
init_server3();
|
|
4683
4818
|
var customerPortalSchema = object({
|
|
4684
4819
|
userId: string(),
|
|
4685
4820
|
returnUrl: optional(pipe(string(), url())),
|
|
@@ -4764,7 +4899,7 @@ var validateEnvironment = /* @__PURE__ */ __name(() => {
|
|
|
4764
4899
|
}, 'validateEnvironment');
|
|
4765
4900
|
|
|
4766
4901
|
// src/vercel/api/config/firebase-admin.ts
|
|
4767
|
-
|
|
4902
|
+
init_server3();
|
|
4768
4903
|
async function initializeFirebaseAdmin() {
|
|
4769
4904
|
return await getFirebaseAdminApp();
|
|
4770
4905
|
}
|