@donotdev/functions 0.0.16 → 0.0.17
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 +558 -1515
- package/lib/firebase/index.js.map +4 -4
- package/lib/shared/index.js +163 -333
- package/lib/shared/index.js.map +4 -4
- package/lib/vercel/api/index.js +190 -325
- package/lib/vercel/api/index.js.map +4 -4
- package/package.json +4 -4
- package/src/firebase/baseFunction.ts +3 -4
- package/src/firebase/billing/createCheckoutSession.ts +4 -4
- package/src/firebase/crud/create.ts +15 -5
- package/src/firebase/crud/delete.ts +0 -6
- package/src/firebase/crud/list.ts +10 -7
- package/src/firebase/oauth/exchangeToken.ts +7 -2
- package/src/firebase/oauth/getConnections.ts +2 -1
- package/src/shared/billing/createCheckout.ts +2 -2
- package/src/shared/billing/idempotency.ts +39 -0
- package/src/shared/billing/webhookHandler.ts +18 -15
- package/src/shared/utils/internal/idempotency.ts +4 -72
- package/src/shared/utils/internal/validation.ts +4 -1
- package/src/shared/validation.ts +1 -1
- package/src/supabase/baseFunction.ts +4 -3
- package/src/supabase/crud/create.ts +4 -1
- package/src/supabase/crud/list.ts +1 -1
- package/src/supabase/utils/rateLimiter.ts +2 -1
- package/src/vercel/api/crud/list.ts +2 -2
package/lib/shared/index.js
CHANGED
|
@@ -377,26 +377,6 @@ function boolean(message$1) {
|
|
|
377
377
|
};
|
|
378
378
|
}
|
|
379
379
|
// @__NO_SIDE_EFFECTS__
|
|
380
|
-
function custom(check$1, message$1) {
|
|
381
|
-
return {
|
|
382
|
-
kind: 'schema',
|
|
383
|
-
type: 'custom',
|
|
384
|
-
reference: custom,
|
|
385
|
-
expects: 'unknown',
|
|
386
|
-
async: false,
|
|
387
|
-
check: check$1,
|
|
388
|
-
message: message$1,
|
|
389
|
-
get '~standard'() {
|
|
390
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
391
|
-
},
|
|
392
|
-
'~run'(dataset, config$1) {
|
|
393
|
-
if (this.check(dataset.value)) dataset.typed = true;
|
|
394
|
-
else _addIssue(this, 'type', dataset, config$1);
|
|
395
|
-
return dataset;
|
|
396
|
-
},
|
|
397
|
-
};
|
|
398
|
-
}
|
|
399
|
-
// @__NO_SIDE_EFFECTS__
|
|
400
380
|
function literal(literal_, message$1) {
|
|
401
381
|
return {
|
|
402
382
|
kind: 'schema',
|
|
@@ -553,32 +533,6 @@ function nullable(wrapped, default_) {
|
|
|
553
533
|
};
|
|
554
534
|
}
|
|
555
535
|
// @__NO_SIDE_EFFECTS__
|
|
556
|
-
function nullish(wrapped, default_) {
|
|
557
|
-
return {
|
|
558
|
-
kind: 'schema',
|
|
559
|
-
type: 'nullish',
|
|
560
|
-
reference: nullish,
|
|
561
|
-
expects: `(${wrapped.expects} | null | undefined)`,
|
|
562
|
-
async: false,
|
|
563
|
-
wrapped,
|
|
564
|
-
default: default_,
|
|
565
|
-
get '~standard'() {
|
|
566
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
567
|
-
},
|
|
568
|
-
'~run'(dataset, config$1) {
|
|
569
|
-
if (dataset.value === null || dataset.value === void 0) {
|
|
570
|
-
if (this.default !== void 0)
|
|
571
|
-
dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
|
|
572
|
-
if (dataset.value === null || dataset.value === void 0) {
|
|
573
|
-
dataset.typed = true;
|
|
574
|
-
return dataset;
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
return this.wrapped['~run'](dataset, config$1);
|
|
578
|
-
},
|
|
579
|
-
};
|
|
580
|
-
}
|
|
581
|
-
// @__NO_SIDE_EFFECTS__
|
|
582
536
|
function number(message$1) {
|
|
583
537
|
return {
|
|
584
538
|
kind: 'schema',
|
|
@@ -1101,12 +1055,10 @@ var init_dist = __esm({
|
|
|
1101
1055
|
__name(any, 'any');
|
|
1102
1056
|
__name(array, 'array');
|
|
1103
1057
|
__name(boolean, 'boolean');
|
|
1104
|
-
__name(custom, 'custom');
|
|
1105
1058
|
__name(literal, 'literal');
|
|
1106
1059
|
__name(looseObject, 'looseObject');
|
|
1107
1060
|
__name(never, 'never');
|
|
1108
1061
|
__name(nullable, 'nullable');
|
|
1109
|
-
__name(nullish, 'nullish');
|
|
1110
1062
|
__name(number, 'number');
|
|
1111
1063
|
__name(object, 'object');
|
|
1112
1064
|
__name(optional, 'optional');
|
|
@@ -1137,13 +1089,6 @@ var init_createMetadata = __esm({
|
|
|
1137
1089
|
},
|
|
1138
1090
|
});
|
|
1139
1091
|
|
|
1140
|
-
// ../core/utils/src/common/currencyFormat.ts
|
|
1141
|
-
var init_currencyFormat = __esm({
|
|
1142
|
-
'../core/utils/src/common/currencyFormat.ts'() {
|
|
1143
|
-
'use strict';
|
|
1144
|
-
},
|
|
1145
|
-
});
|
|
1146
|
-
|
|
1147
1092
|
// ../core/utils/src/common/dateUtils.ts
|
|
1148
1093
|
var init_dateUtils = __esm({
|
|
1149
1094
|
'../core/utils/src/common/dateUtils.ts'() {
|
|
@@ -1490,13 +1435,6 @@ var init_aggregate = __esm({
|
|
|
1490
1435
|
},
|
|
1491
1436
|
});
|
|
1492
1437
|
|
|
1493
|
-
// ../core/types/src/crud/components.ts
|
|
1494
|
-
var init_components = __esm({
|
|
1495
|
-
'../core/types/src/crud/components.ts'() {
|
|
1496
|
-
'use strict';
|
|
1497
|
-
},
|
|
1498
|
-
});
|
|
1499
|
-
|
|
1500
1438
|
// ../core/types/src/crud/constants.ts
|
|
1501
1439
|
var init_constants3 = __esm({
|
|
1502
1440
|
'../core/types/src/crud/constants.ts'() {
|
|
@@ -1577,7 +1515,6 @@ var init_crud = __esm({
|
|
|
1577
1515
|
'../core/types/src/crud/index.ts'() {
|
|
1578
1516
|
'use strict';
|
|
1579
1517
|
init_aggregate();
|
|
1580
|
-
init_components();
|
|
1581
1518
|
init_schemas3();
|
|
1582
1519
|
init_types3();
|
|
1583
1520
|
},
|
|
@@ -2914,13 +2851,6 @@ var init_errors2 = __esm({
|
|
|
2914
2851
|
},
|
|
2915
2852
|
});
|
|
2916
2853
|
|
|
2917
|
-
// ../core/utils/src/common/generateFirestoreRuleCondition.ts
|
|
2918
|
-
var init_generateFirestoreRuleCondition = __esm({
|
|
2919
|
-
'../core/utils/src/common/generateFirestoreRuleCondition.ts'() {
|
|
2920
|
-
'use strict';
|
|
2921
|
-
},
|
|
2922
|
-
});
|
|
2923
|
-
|
|
2924
2854
|
// ../core/utils/src/common/maybeTranslate.ts
|
|
2925
2855
|
var init_maybeTranslate = __esm({
|
|
2926
2856
|
'../core/utils/src/common/maybeTranslate.ts'() {
|
|
@@ -3043,10 +2973,8 @@ var init_common2 = __esm({
|
|
|
3043
2973
|
'use strict';
|
|
3044
2974
|
init_arrayTranslations();
|
|
3045
2975
|
init_createMetadata();
|
|
3046
|
-
init_currencyFormat();
|
|
3047
2976
|
init_dateUtils();
|
|
3048
2977
|
init_errors2();
|
|
3049
|
-
init_generateFirestoreRuleCondition();
|
|
3050
2978
|
init_maybeTranslate();
|
|
3051
2979
|
init_pkce();
|
|
3052
2980
|
init_gracefulInit();
|
|
@@ -3090,13 +3018,17 @@ var init_server = __esm({
|
|
|
3090
3018
|
},
|
|
3091
3019
|
});
|
|
3092
3020
|
|
|
3021
|
+
// ../core/schemas/src/common/validation/enhanceSchema.ts
|
|
3022
|
+
var init_enhanceSchema = __esm({
|
|
3023
|
+
'../core/schemas/src/common/validation/enhanceSchema.ts'() {
|
|
3024
|
+
'use strict';
|
|
3025
|
+
},
|
|
3026
|
+
});
|
|
3027
|
+
|
|
3093
3028
|
// ../core/schemas/src/common/validation/getSchemaType.ts
|
|
3094
3029
|
function registerSchemaGenerator(type, generator) {
|
|
3095
3030
|
schemaRegistry.set(type, generator);
|
|
3096
3031
|
}
|
|
3097
|
-
function applyRequired(schema, required) {
|
|
3098
|
-
return required ? schema : nullish(schema);
|
|
3099
|
-
}
|
|
3100
3032
|
function registerBuiltinSchemas() {
|
|
3101
3033
|
registerSchemaGenerator('text', textSchema);
|
|
3102
3034
|
registerSchemaGenerator('textarea', textSchema);
|
|
@@ -3106,17 +3038,10 @@ function registerBuiltinSchemas() {
|
|
|
3106
3038
|
registerSchemaGenerator('password', passwordSchema);
|
|
3107
3039
|
registerSchemaGenerator('url', urlSchema);
|
|
3108
3040
|
registerSchemaGenerator('tel', telSchema);
|
|
3109
|
-
registerSchemaGenerator('iban', ibanSchema);
|
|
3110
3041
|
registerSchemaGenerator('number', numberSchema);
|
|
3111
|
-
registerSchemaGenerator('currency', numberSchema);
|
|
3112
|
-
registerSchemaGenerator('price', priceSchema);
|
|
3113
3042
|
registerSchemaGenerator('range', numberSchema);
|
|
3114
|
-
registerSchemaGenerator('year', numberSchema);
|
|
3115
|
-
registerSchemaGenerator('rating', numberSchema);
|
|
3116
|
-
registerSchemaGenerator('duration', numberSchema);
|
|
3117
3043
|
registerSchemaGenerator('boolean', booleanSchema);
|
|
3118
3044
|
registerSchemaGenerator('checkbox', booleanSchema);
|
|
3119
|
-
registerSchemaGenerator('gdprConsent', gdprConsentSchema);
|
|
3120
3045
|
registerSchemaGenerator('date', dateSchema);
|
|
3121
3046
|
registerSchemaGenerator('datetime-local', dateSchema);
|
|
3122
3047
|
registerSchemaGenerator('time', dateSchema);
|
|
@@ -3136,8 +3061,6 @@ function registerBuiltinSchemas() {
|
|
|
3136
3061
|
registerSchemaGenerator('select', selectSchema);
|
|
3137
3062
|
registerSchemaGenerator('multiselect', multiselectSchema);
|
|
3138
3063
|
registerSchemaGenerator('radio', selectSchema);
|
|
3139
|
-
registerSchemaGenerator('combobox', selectSchema);
|
|
3140
|
-
registerSchemaGenerator('switch', switchSchema);
|
|
3141
3064
|
registerSchemaGenerator('reference', referenceSchema);
|
|
3142
3065
|
registerSchemaGenerator('hidden', stringSchema);
|
|
3143
3066
|
registerSchemaGenerator('avatar', stringSchema);
|
|
@@ -3168,11 +3091,7 @@ var schemaRegistry,
|
|
|
3168
3091
|
referenceSchema,
|
|
3169
3092
|
stringSchema,
|
|
3170
3093
|
telSchema,
|
|
3171
|
-
|
|
3172
|
-
neverSchema,
|
|
3173
|
-
switchSchema,
|
|
3174
|
-
gdprConsentSchema,
|
|
3175
|
-
priceSchema;
|
|
3094
|
+
neverSchema;
|
|
3176
3095
|
var init_getSchemaType = __esm({
|
|
3177
3096
|
'../core/schemas/src/common/validation/getSchemaType.ts'() {
|
|
3178
3097
|
'use strict';
|
|
@@ -3180,7 +3099,6 @@ var init_getSchemaType = __esm({
|
|
|
3180
3099
|
init_src();
|
|
3181
3100
|
schemaRegistry = /* @__PURE__ */ new Map();
|
|
3182
3101
|
__name(registerSchemaGenerator, 'registerSchemaGenerator');
|
|
3183
|
-
__name(applyRequired, 'applyRequired');
|
|
3184
3102
|
textSchema = /* @__PURE__ */ __name((field) => {
|
|
3185
3103
|
const validations = [];
|
|
3186
3104
|
if (field.validation?.minLength !== void 0) {
|
|
@@ -3206,11 +3124,11 @@ var init_getSchemaType = __esm({
|
|
|
3206
3124
|
}
|
|
3207
3125
|
const schema =
|
|
3208
3126
|
validations.length > 0 ? pipe(string(), ...validations) : string();
|
|
3209
|
-
return
|
|
3127
|
+
return field.validation?.required ? schema : optional(schema);
|
|
3210
3128
|
}, 'textSchema');
|
|
3211
3129
|
emailSchema = /* @__PURE__ */ __name((field) => {
|
|
3212
3130
|
const schema = pipe(string(), email('Invalid email address'));
|
|
3213
|
-
return
|
|
3131
|
+
return field.validation?.required ? schema : optional(schema);
|
|
3214
3132
|
}, 'emailSchema');
|
|
3215
3133
|
passwordSchema = /* @__PURE__ */ __name((field) => {
|
|
3216
3134
|
const schema =
|
|
@@ -3223,11 +3141,11 @@ var init_getSchemaType = __esm({
|
|
|
3223
3141
|
)
|
|
3224
3142
|
)
|
|
3225
3143
|
: string();
|
|
3226
|
-
return
|
|
3144
|
+
return field.validation?.required ? schema : optional(schema);
|
|
3227
3145
|
}, 'passwordSchema');
|
|
3228
3146
|
urlSchema = /* @__PURE__ */ __name((field) => {
|
|
3229
3147
|
const schema = pipe(string(), url('Invalid URL'));
|
|
3230
|
-
return
|
|
3148
|
+
return field.validation?.required ? schema : optional(schema);
|
|
3231
3149
|
}, 'urlSchema');
|
|
3232
3150
|
numberSchema = /* @__PURE__ */ __name((field) => {
|
|
3233
3151
|
const validations = [];
|
|
@@ -3249,30 +3167,30 @@ var init_getSchemaType = __esm({
|
|
|
3249
3167
|
}
|
|
3250
3168
|
const schema =
|
|
3251
3169
|
validations.length > 0 ? pipe(number(), ...validations) : number();
|
|
3252
|
-
return
|
|
3170
|
+
return field.validation?.required ? schema : optional(schema);
|
|
3253
3171
|
}, 'numberSchema');
|
|
3254
3172
|
booleanSchema = /* @__PURE__ */ __name((field) => {
|
|
3255
3173
|
const schema = boolean();
|
|
3256
|
-
return
|
|
3174
|
+
return field.validation?.required ? schema : optional(schema);
|
|
3257
3175
|
}, 'booleanSchema');
|
|
3258
3176
|
dateSchema = /* @__PURE__ */ __name((field) => {
|
|
3259
3177
|
const schema = pipe(string(), isoTimestamp('Invalid date format'));
|
|
3260
|
-
return
|
|
3178
|
+
return field.validation?.required ? schema : optional(schema);
|
|
3261
3179
|
}, 'dateSchema');
|
|
3262
3180
|
fileAssetObjectSchema = object({
|
|
3263
3181
|
url: string(),
|
|
3264
3182
|
filename: string(),
|
|
3265
3183
|
size: number(),
|
|
3266
|
-
mimeType:
|
|
3267
|
-
uploadedAt:
|
|
3184
|
+
mimeType: optional(string()),
|
|
3185
|
+
uploadedAt: optional(string()),
|
|
3268
3186
|
});
|
|
3269
3187
|
fileSchema = /* @__PURE__ */ __name((field) => {
|
|
3270
3188
|
const schema = nullable(fileAssetObjectSchema);
|
|
3271
|
-
return
|
|
3189
|
+
return field.validation?.required ? schema : optional(schema);
|
|
3272
3190
|
}, 'fileSchema');
|
|
3273
3191
|
filesSchema = /* @__PURE__ */ __name((field) => {
|
|
3274
3192
|
const schema = array(fileAssetObjectSchema);
|
|
3275
|
-
return
|
|
3193
|
+
return field.validation?.required ? schema : optional(schema);
|
|
3276
3194
|
}, 'filesSchema');
|
|
3277
3195
|
pictureObjectSchema = object({
|
|
3278
3196
|
fullUrl: string(),
|
|
@@ -3280,148 +3198,125 @@ var init_getSchemaType = __esm({
|
|
|
3280
3198
|
});
|
|
3281
3199
|
pictureSchema = /* @__PURE__ */ __name((field) => {
|
|
3282
3200
|
const schema = pictureObjectSchema;
|
|
3283
|
-
return
|
|
3201
|
+
return field.validation?.required ? schema : optional(schema);
|
|
3284
3202
|
}, 'pictureSchema');
|
|
3285
3203
|
picturesSchema = /* @__PURE__ */ __name((field) => {
|
|
3286
3204
|
const schema = array(pictureObjectSchema);
|
|
3287
|
-
return
|
|
3205
|
+
return field.validation?.required ? schema : optional(schema);
|
|
3288
3206
|
}, 'picturesSchema');
|
|
3289
3207
|
geopointSchema = /* @__PURE__ */ __name((field) => {
|
|
3290
3208
|
const schema = object({ lat: number(), lng: number() });
|
|
3291
|
-
return
|
|
3209
|
+
return field.validation?.required ? schema : optional(schema);
|
|
3292
3210
|
}, 'geopointSchema');
|
|
3293
3211
|
addressSchema = /* @__PURE__ */ __name((field) => {
|
|
3294
3212
|
const schema = object({
|
|
3295
3213
|
formatted_address: string(),
|
|
3296
3214
|
latitude: number(),
|
|
3297
3215
|
longitude: number(),
|
|
3298
|
-
street_number:
|
|
3299
|
-
route:
|
|
3300
|
-
locality:
|
|
3301
|
-
administrative_area_level_1:
|
|
3302
|
-
administrative_area_level_2:
|
|
3303
|
-
country:
|
|
3304
|
-
postal_code:
|
|
3216
|
+
street_number: optional(string()),
|
|
3217
|
+
route: optional(string()),
|
|
3218
|
+
locality: optional(string()),
|
|
3219
|
+
administrative_area_level_1: optional(string()),
|
|
3220
|
+
administrative_area_level_2: optional(string()),
|
|
3221
|
+
country: optional(string()),
|
|
3222
|
+
postal_code: optional(string()),
|
|
3305
3223
|
});
|
|
3306
|
-
return
|
|
3224
|
+
return field.validation?.required ? schema : optional(schema);
|
|
3307
3225
|
}, 'addressSchema');
|
|
3308
3226
|
mapSchema = /* @__PURE__ */ __name((field) => {
|
|
3309
3227
|
const schema = record(string(), unknown());
|
|
3310
|
-
return
|
|
3228
|
+
return field.validation?.required ? schema : optional(schema);
|
|
3311
3229
|
}, 'mapSchema');
|
|
3312
3230
|
arraySchema = /* @__PURE__ */ __name((field) => {
|
|
3313
3231
|
const schema = array(unknown());
|
|
3314
|
-
return
|
|
3232
|
+
return field.validation?.required ? schema : optional(schema);
|
|
3315
3233
|
}, 'arraySchema');
|
|
3316
3234
|
selectSchema = /* @__PURE__ */ __name((field) => {
|
|
3317
3235
|
const options = field.validation?.options;
|
|
3318
3236
|
if (Array.isArray(options) && options.length > 0) {
|
|
3319
3237
|
const values = options.map((opt) => opt.value);
|
|
3320
3238
|
const schema2 = picklist(values);
|
|
3321
|
-
return
|
|
3239
|
+
return field.validation?.required ? schema2 : optional(schema2);
|
|
3322
3240
|
}
|
|
3323
|
-
const schema =
|
|
3324
|
-
return
|
|
3241
|
+
const schema = string();
|
|
3242
|
+
return field.validation?.required ? schema : optional(schema);
|
|
3325
3243
|
}, 'selectSchema');
|
|
3326
3244
|
multiselectSchema = /* @__PURE__ */ __name((field) => {
|
|
3327
3245
|
const options = field.validation?.options;
|
|
3328
3246
|
if (Array.isArray(options) && options.length > 0) {
|
|
3329
3247
|
const values = options.map((opt) => opt.value);
|
|
3330
3248
|
const schema2 = array(picklist(values));
|
|
3331
|
-
return
|
|
3249
|
+
return field.validation?.required ? schema2 : optional(schema2);
|
|
3332
3250
|
}
|
|
3333
3251
|
const schema = array(string());
|
|
3334
|
-
return
|
|
3252
|
+
return field.validation?.required ? schema : optional(schema);
|
|
3335
3253
|
}, 'multiselectSchema');
|
|
3336
3254
|
referenceSchema = /* @__PURE__ */ __name((field) => {
|
|
3337
3255
|
const schema = pipe(
|
|
3338
3256
|
string(),
|
|
3339
3257
|
regex(FIRESTORE_ID_PATTERN, 'Invalid ID format')
|
|
3340
3258
|
);
|
|
3341
|
-
return
|
|
3259
|
+
return field.validation?.required ? schema : optional(schema);
|
|
3342
3260
|
}, 'referenceSchema');
|
|
3343
3261
|
stringSchema = /* @__PURE__ */ __name((field) => {
|
|
3344
3262
|
const schema = string();
|
|
3345
|
-
return
|
|
3263
|
+
return field.validation?.required ? schema : optional(schema);
|
|
3346
3264
|
}, 'stringSchema');
|
|
3347
3265
|
telSchema = /* @__PURE__ */ __name((field) => {
|
|
3348
3266
|
const schema = string();
|
|
3349
|
-
return
|
|
3267
|
+
return field.validation?.required ? schema : optional(schema);
|
|
3350
3268
|
}, 'telSchema');
|
|
3351
|
-
ibanSchema = /* @__PURE__ */ __name((field) => {
|
|
3352
|
-
const minLength2 = field.validation?.minLength ?? 15;
|
|
3353
|
-
const maxLength2 = field.validation?.maxLength ?? 34;
|
|
3354
|
-
const pattern =
|
|
3355
|
-
field.validation?.pattern ?? '^[A-Z]{2}[0-9]{2}[A-Z0-9]{4,34}$';
|
|
3356
|
-
const validations = [];
|
|
3357
|
-
if (minLength2 !== void 0) {
|
|
3358
|
-
validations.push(
|
|
3359
|
-
minLength(
|
|
3360
|
-
minLength2,
|
|
3361
|
-
`IBAN must be at least ${minLength2} characters`
|
|
3362
|
-
)
|
|
3363
|
-
);
|
|
3364
|
-
}
|
|
3365
|
-
if (maxLength2 !== void 0) {
|
|
3366
|
-
validations.push(
|
|
3367
|
-
maxLength(maxLength2, `IBAN must not exceed ${maxLength2} characters`)
|
|
3368
|
-
);
|
|
3369
|
-
}
|
|
3370
|
-
if (pattern) {
|
|
3371
|
-
const regex2 =
|
|
3372
|
-
typeof pattern === 'string' ? new RegExp(pattern) : pattern;
|
|
3373
|
-
validations.push(regex(regex2, 'Invalid IBAN format'));
|
|
3374
|
-
}
|
|
3375
|
-
const schema =
|
|
3376
|
-
validations.length > 0 ? pipe(string(), ...validations) : string();
|
|
3377
|
-
return applyRequired(schema, field.validation?.required);
|
|
3378
|
-
}, 'ibanSchema');
|
|
3379
3269
|
neverSchema = /* @__PURE__ */ __name(() => never(), 'neverSchema');
|
|
3380
|
-
switchSchema = /* @__PURE__ */ __name((field) => {
|
|
3381
|
-
const fieldSpecific = field.options?.fieldSpecific;
|
|
3382
|
-
if (fieldSpecific?.checkedValue && fieldSpecific?.uncheckedValue) {
|
|
3383
|
-
const values = [
|
|
3384
|
-
fieldSpecific.checkedValue,
|
|
3385
|
-
fieldSpecific.uncheckedValue,
|
|
3386
|
-
];
|
|
3387
|
-
const schema2 = picklist(values);
|
|
3388
|
-
return applyRequired(schema2, field.validation?.required);
|
|
3389
|
-
}
|
|
3390
|
-
const schema = boolean();
|
|
3391
|
-
return applyRequired(schema, field.validation?.required);
|
|
3392
|
-
}, 'switchSchema');
|
|
3393
|
-
gdprConsentSchema = /* @__PURE__ */ __name((field) => {
|
|
3394
|
-
const baseSchema = custom((input) => {
|
|
3395
|
-
if (field.validation?.required) {
|
|
3396
|
-
if (typeof input === 'object' && input !== null) {
|
|
3397
|
-
return input.gdprConsent === true;
|
|
3398
|
-
}
|
|
3399
|
-
return false;
|
|
3400
|
-
}
|
|
3401
|
-
if (input === false || input === null || input === void 0) {
|
|
3402
|
-
return true;
|
|
3403
|
-
}
|
|
3404
|
-
if (typeof input === 'object' && input !== null) {
|
|
3405
|
-
return input.gdprConsent === true;
|
|
3406
|
-
}
|
|
3407
|
-
return false;
|
|
3408
|
-
}, 'GDPR consent must be given');
|
|
3409
|
-
return baseSchema;
|
|
3410
|
-
}, 'gdprConsentSchema');
|
|
3411
|
-
priceSchema = /* @__PURE__ */ __name((field) => {
|
|
3412
|
-
const schema = object({
|
|
3413
|
-
amount: number(),
|
|
3414
|
-
currency: optional(string()),
|
|
3415
|
-
vatIncluded: optional(boolean()),
|
|
3416
|
-
discountPercent: optional(pipe(number(), minValue(0), maxValue(100))),
|
|
3417
|
-
});
|
|
3418
|
-
return applyRequired(schema, field.validation?.required);
|
|
3419
|
-
}, 'priceSchema');
|
|
3420
3270
|
__name(registerBuiltinSchemas, 'registerBuiltinSchemas');
|
|
3421
3271
|
registerBuiltinSchemas();
|
|
3422
3272
|
},
|
|
3423
3273
|
});
|
|
3424
3274
|
|
|
3275
|
+
// ../core/schemas/src/common/validation/validateDates.ts
|
|
3276
|
+
var init_validateDates = __esm({
|
|
3277
|
+
'../core/schemas/src/common/validation/validateDates.ts'() {
|
|
3278
|
+
'use strict';
|
|
3279
|
+
init_server();
|
|
3280
|
+
},
|
|
3281
|
+
});
|
|
3282
|
+
|
|
3283
|
+
// ../core/schemas/src/common/validation/validateUniqueFields.ts
|
|
3284
|
+
var init_validateUniqueFields = __esm({
|
|
3285
|
+
'../core/schemas/src/common/validation/validateUniqueFields.ts'() {
|
|
3286
|
+
'use strict';
|
|
3287
|
+
init_server();
|
|
3288
|
+
},
|
|
3289
|
+
});
|
|
3290
|
+
|
|
3291
|
+
// ../core/schemas/src/common/validation/validateDocument.ts
|
|
3292
|
+
var init_validateDocument = __esm({
|
|
3293
|
+
'../core/schemas/src/common/validation/validateDocument.ts'() {
|
|
3294
|
+
'use strict';
|
|
3295
|
+
init_validateDates();
|
|
3296
|
+
init_validateUniqueFields();
|
|
3297
|
+
},
|
|
3298
|
+
});
|
|
3299
|
+
|
|
3300
|
+
// ../core/schemas/src/common/validation/index.ts
|
|
3301
|
+
var init_validation2 = __esm({
|
|
3302
|
+
'../core/schemas/src/common/validation/index.ts'() {
|
|
3303
|
+
'use strict';
|
|
3304
|
+
init_enhanceSchema();
|
|
3305
|
+
init_getSchemaType();
|
|
3306
|
+
init_validateDates();
|
|
3307
|
+
init_validateDocument();
|
|
3308
|
+
init_validateUniqueFields();
|
|
3309
|
+
},
|
|
3310
|
+
});
|
|
3311
|
+
|
|
3312
|
+
// ../core/schemas/src/common/utils.ts
|
|
3313
|
+
var init_utils2 = __esm({
|
|
3314
|
+
'../core/schemas/src/common/utils.ts'() {
|
|
3315
|
+
'use strict';
|
|
3316
|
+
init_server();
|
|
3317
|
+
},
|
|
3318
|
+
});
|
|
3319
|
+
|
|
3425
3320
|
// ../core/schemas/src/common/visibility.ts
|
|
3426
3321
|
var DEFAULT_STATUS_OPTIONS,
|
|
3427
3322
|
BACKEND_GENERATED_FIELD_NAMES,
|
|
@@ -3432,9 +3327,9 @@ var init_visibility = __esm({
|
|
|
3432
3327
|
'use strict';
|
|
3433
3328
|
init_src();
|
|
3434
3329
|
DEFAULT_STATUS_OPTIONS = [
|
|
3435
|
-
{ value: 'draft', label: '
|
|
3436
|
-
{ value: 'available', label: '
|
|
3437
|
-
{ value: 'deleted', label: '
|
|
3330
|
+
{ value: 'draft', label: 'dndev:status.draft' },
|
|
3331
|
+
{ value: 'available', label: 'dndev:status.available' },
|
|
3332
|
+
{ value: 'deleted', label: 'dndev:status.deleted' },
|
|
3438
3333
|
];
|
|
3439
3334
|
BACKEND_GENERATED_FIELD_NAMES = [
|
|
3440
3335
|
'id',
|
|
@@ -3454,151 +3349,64 @@ var init_visibility = __esm({
|
|
|
3454
3349
|
// Framework-enforced, user-settable (NOT backend-generated)
|
|
3455
3350
|
];
|
|
3456
3351
|
baseFields = {
|
|
3457
|
-
status: {
|
|
3458
|
-
name: 'status',
|
|
3459
|
-
type: 'select',
|
|
3460
|
-
visibility: 'admin',
|
|
3461
|
-
label: 'crud:fields.status',
|
|
3462
|
-
editable: 'admin',
|
|
3463
|
-
// REQUIRED: Status must be editable to be included in forms
|
|
3464
|
-
validation: {
|
|
3465
|
-
required: true,
|
|
3466
|
-
options: [...DEFAULT_STATUS_OPTIONS],
|
|
3467
|
-
},
|
|
3468
|
-
},
|
|
3469
3352
|
id: {
|
|
3470
|
-
name: 'id',
|
|
3471
3353
|
type: 'text',
|
|
3472
|
-
visibility: '
|
|
3473
|
-
label: 'crud:fields.id',
|
|
3354
|
+
visibility: 'technical',
|
|
3474
3355
|
validation: {
|
|
3475
3356
|
required: true,
|
|
3476
3357
|
pattern: FIRESTORE_ID_PATTERN.source,
|
|
3477
3358
|
},
|
|
3478
3359
|
},
|
|
3479
3360
|
createdAt: {
|
|
3480
|
-
name: '_createdAt',
|
|
3481
3361
|
type: 'timestamp',
|
|
3482
3362
|
visibility: 'technical',
|
|
3483
|
-
label: 'crud:fields._createdAt',
|
|
3484
3363
|
validation: { required: true },
|
|
3485
3364
|
},
|
|
3486
3365
|
updatedAt: {
|
|
3487
|
-
name: '_updatedAt',
|
|
3488
3366
|
type: 'timestamp',
|
|
3489
3367
|
visibility: 'technical',
|
|
3490
|
-
label: 'crud:fields._updatedAt',
|
|
3491
3368
|
validation: { required: true },
|
|
3492
3369
|
},
|
|
3493
3370
|
createdById: {
|
|
3494
|
-
name: '_createdById',
|
|
3495
3371
|
type: 'reference',
|
|
3496
3372
|
visibility: 'technical',
|
|
3497
|
-
label: 'crud:fields._createdById',
|
|
3498
3373
|
validation: { required: true },
|
|
3499
3374
|
},
|
|
3500
3375
|
updatedById: {
|
|
3501
|
-
name: '_updatedById',
|
|
3502
3376
|
type: 'reference',
|
|
3503
3377
|
visibility: 'technical',
|
|
3504
|
-
label: 'crud:fields._updatedById',
|
|
3505
3378
|
validation: { required: true },
|
|
3506
3379
|
},
|
|
3380
|
+
status: {
|
|
3381
|
+
type: 'select',
|
|
3382
|
+
visibility: 'admin',
|
|
3383
|
+
editable: 'admin',
|
|
3384
|
+
// REQUIRED: Status must be editable to be included in forms
|
|
3385
|
+
validation: {
|
|
3386
|
+
required: true,
|
|
3387
|
+
options: [...DEFAULT_STATUS_OPTIONS],
|
|
3388
|
+
},
|
|
3389
|
+
},
|
|
3507
3390
|
};
|
|
3508
3391
|
},
|
|
3509
3392
|
});
|
|
3510
3393
|
|
|
3511
|
-
// ../core/schemas/src/common/createSchema.ts
|
|
3512
|
-
var init_createSchema = __esm({
|
|
3513
|
-
'../core/schemas/src/common/createSchema.ts'() {
|
|
3514
|
-
'use strict';
|
|
3515
|
-
init_src();
|
|
3516
|
-
init_getSchemaType();
|
|
3517
|
-
init_visibility();
|
|
3518
|
-
},
|
|
3519
|
-
});
|
|
3520
|
-
|
|
3521
|
-
// ../core/schemas/src/client/index.ts
|
|
3522
|
-
var init_client = __esm({
|
|
3523
|
-
'../core/schemas/src/client/index.ts'() {
|
|
3524
|
-
'use strict';
|
|
3525
|
-
init_createSchema();
|
|
3526
|
-
},
|
|
3527
|
-
});
|
|
3528
|
-
|
|
3529
|
-
// ../core/schemas/src/common/validation/enhanceSchema.ts
|
|
3530
|
-
var init_enhanceSchema = __esm({
|
|
3531
|
-
'../core/schemas/src/common/validation/enhanceSchema.ts'() {
|
|
3532
|
-
'use strict';
|
|
3533
|
-
},
|
|
3534
|
-
});
|
|
3535
|
-
|
|
3536
|
-
// ../core/schemas/src/common/validation/validateDates.ts
|
|
3537
|
-
var init_validateDates = __esm({
|
|
3538
|
-
'../core/schemas/src/common/validation/validateDates.ts'() {
|
|
3539
|
-
'use strict';
|
|
3540
|
-
init_server();
|
|
3541
|
-
},
|
|
3542
|
-
});
|
|
3543
|
-
|
|
3544
|
-
// ../core/schemas/src/common/validation/validateUniqueFields.ts
|
|
3545
|
-
var init_validateUniqueFields = __esm({
|
|
3546
|
-
'../core/schemas/src/common/validation/validateUniqueFields.ts'() {
|
|
3547
|
-
'use strict';
|
|
3548
|
-
init_server();
|
|
3549
|
-
},
|
|
3550
|
-
});
|
|
3551
|
-
|
|
3552
|
-
// ../core/schemas/src/common/validation/validateDocument.ts
|
|
3553
|
-
var init_validateDocument = __esm({
|
|
3554
|
-
'../core/schemas/src/common/validation/validateDocument.ts'() {
|
|
3555
|
-
'use strict';
|
|
3556
|
-
init_validateDates();
|
|
3557
|
-
init_validateUniqueFields();
|
|
3558
|
-
},
|
|
3559
|
-
});
|
|
3560
|
-
|
|
3561
|
-
// ../core/schemas/src/common/validation/index.ts
|
|
3562
|
-
var init_validation2 = __esm({
|
|
3563
|
-
'../core/schemas/src/common/validation/index.ts'() {
|
|
3564
|
-
'use strict';
|
|
3565
|
-
init_enhanceSchema();
|
|
3566
|
-
init_getSchemaType();
|
|
3567
|
-
init_validateDates();
|
|
3568
|
-
init_validateDocument();
|
|
3569
|
-
init_validateUniqueFields();
|
|
3570
|
-
},
|
|
3571
|
-
});
|
|
3572
|
-
|
|
3573
|
-
// ../core/schemas/src/common/utils.ts
|
|
3574
|
-
var init_utils2 = __esm({
|
|
3575
|
-
'../core/schemas/src/common/utils.ts'() {
|
|
3576
|
-
'use strict';
|
|
3577
|
-
init_server();
|
|
3578
|
-
},
|
|
3579
|
-
});
|
|
3580
|
-
|
|
3581
3394
|
// ../core/schemas/src/common/defineEntity.ts
|
|
3582
3395
|
var init_defineEntity = __esm({
|
|
3583
3396
|
'../core/schemas/src/common/defineEntity.ts'() {
|
|
3584
3397
|
'use strict';
|
|
3585
|
-
init_src();
|
|
3586
3398
|
init_server();
|
|
3587
3399
|
init_visibility();
|
|
3588
3400
|
},
|
|
3589
3401
|
});
|
|
3590
3402
|
|
|
3591
|
-
// ../core/schemas/src/common/
|
|
3592
|
-
var
|
|
3593
|
-
'../core/schemas/src/common/
|
|
3594
|
-
'use strict';
|
|
3595
|
-
},
|
|
3596
|
-
});
|
|
3597
|
-
|
|
3598
|
-
// ../core/schemas/src/common/scopeProvider.ts
|
|
3599
|
-
var init_scopeProvider = __esm({
|
|
3600
|
-
'../core/schemas/src/common/scopeProvider.ts'() {
|
|
3403
|
+
// ../core/schemas/src/common/createSchema.ts
|
|
3404
|
+
var init_createSchema = __esm({
|
|
3405
|
+
'../core/schemas/src/common/createSchema.ts'() {
|
|
3601
3406
|
'use strict';
|
|
3407
|
+
init_src();
|
|
3408
|
+
init_getSchemaType();
|
|
3409
|
+
init_visibility();
|
|
3602
3410
|
},
|
|
3603
3411
|
});
|
|
3604
3412
|
|
|
@@ -3611,26 +3419,22 @@ var init_common3 = __esm({
|
|
|
3611
3419
|
init_visibility();
|
|
3612
3420
|
init_defineEntity();
|
|
3613
3421
|
init_createSchema();
|
|
3614
|
-
init_optionHelpers();
|
|
3615
|
-
init_scopeProvider();
|
|
3616
3422
|
},
|
|
3617
3423
|
});
|
|
3618
3424
|
|
|
3619
|
-
// ../core/schemas/src/index.ts
|
|
3620
|
-
var
|
|
3621
|
-
'../core/schemas/src/index.ts'() {
|
|
3622
|
-
'use strict';
|
|
3623
|
-
init_client();
|
|
3425
|
+
// ../core/schemas/src/server/index.ts
|
|
3426
|
+
var init_server2 = __esm({
|
|
3427
|
+
'../core/schemas/src/server/index.ts'() {
|
|
3624
3428
|
init_common3();
|
|
3625
3429
|
},
|
|
3626
3430
|
});
|
|
3627
3431
|
|
|
3628
3432
|
// ../core/server.ts
|
|
3629
|
-
var
|
|
3433
|
+
var init_server3 = __esm({
|
|
3630
3434
|
'../core/server.ts'() {
|
|
3631
3435
|
init_server();
|
|
3632
3436
|
init_src();
|
|
3633
|
-
|
|
3437
|
+
init_server2();
|
|
3634
3438
|
init_server();
|
|
3635
3439
|
},
|
|
3636
3440
|
});
|
|
@@ -3719,7 +3523,7 @@ var getFirebaseAdminServices;
|
|
|
3719
3523
|
var init_init = __esm({
|
|
3720
3524
|
'../providers/firebase/src/server/init.ts'() {
|
|
3721
3525
|
'use strict';
|
|
3722
|
-
|
|
3526
|
+
init_server3();
|
|
3723
3527
|
__name(initializeFirebaseAdminServices, 'initializeFirebaseAdminServices');
|
|
3724
3528
|
getFirebaseAdminServices = createSingleton(initializeFirebaseAdminServices);
|
|
3725
3529
|
__name(initFirebaseAdmin, 'initFirebaseAdmin');
|
|
@@ -3735,7 +3539,7 @@ var serverImplementations, getServerAdmin, getServerFirestore, generateServerId;
|
|
|
3735
3539
|
var init_utils3 = __esm({
|
|
3736
3540
|
'../providers/firebase/src/server/utils.ts'() {
|
|
3737
3541
|
'use strict';
|
|
3738
|
-
|
|
3542
|
+
init_server3();
|
|
3739
3543
|
serverImplementations = {
|
|
3740
3544
|
async getServerAdmin() {
|
|
3741
3545
|
try {
|
|
@@ -3916,8 +3720,22 @@ function prepareForFirestore(data, removeFields = []) {
|
|
|
3916
3720
|
if (Array.isArray(data)) {
|
|
3917
3721
|
return data.map((item) => prepareForFirestore(item, removeFields));
|
|
3918
3722
|
}
|
|
3723
|
+
if (
|
|
3724
|
+
typeof data === 'string' &&
|
|
3725
|
+
/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z$/.test(data)
|
|
3726
|
+
) {
|
|
3727
|
+
try {
|
|
3728
|
+
return toTimestamp(data);
|
|
3729
|
+
} catch (error) {
|
|
3730
|
+
return data;
|
|
3731
|
+
}
|
|
3732
|
+
}
|
|
3919
3733
|
if (data instanceof Date) {
|
|
3920
|
-
|
|
3734
|
+
try {
|
|
3735
|
+
return toTimestamp(data);
|
|
3736
|
+
} catch (error) {
|
|
3737
|
+
return data;
|
|
3738
|
+
}
|
|
3921
3739
|
}
|
|
3922
3740
|
if (typeof data === 'object' && data !== null) {
|
|
3923
3741
|
const prepared = {};
|
|
@@ -3953,7 +3771,7 @@ function createFirestorePartialUpdate(original, updated) {
|
|
|
3953
3771
|
var init_transform = __esm({
|
|
3954
3772
|
'../providers/firebase/src/shared/transform.ts'() {
|
|
3955
3773
|
'use strict';
|
|
3956
|
-
|
|
3774
|
+
init_server3();
|
|
3957
3775
|
__name(createTimestamp, 'createTimestamp');
|
|
3958
3776
|
__name(toTimestamp, 'toTimestamp');
|
|
3959
3777
|
__name(firestoreToISOString, 'firestoreToISOString');
|
|
@@ -3980,7 +3798,7 @@ var init_batch = __esm({
|
|
|
3980
3798
|
'../providers/firebase/src/server/batch.ts'() {
|
|
3981
3799
|
'use strict';
|
|
3982
3800
|
init_dist();
|
|
3983
|
-
|
|
3801
|
+
init_server3();
|
|
3984
3802
|
init_utils3();
|
|
3985
3803
|
init_transform();
|
|
3986
3804
|
isClient = typeof window !== 'undefined';
|
|
@@ -4259,7 +4077,7 @@ var isClient2, notAvailableInBrowser2, admin, getAdminFirestore, generateId;
|
|
|
4259
4077
|
var init_utils4 = __esm({
|
|
4260
4078
|
'../providers/firebase/src/shared/utils.ts'() {
|
|
4261
4079
|
'use strict';
|
|
4262
|
-
|
|
4080
|
+
init_server3();
|
|
4263
4081
|
isClient2 = typeof window !== 'undefined';
|
|
4264
4082
|
notAvailableInBrowser2 = /* @__PURE__ */ __name(
|
|
4265
4083
|
(fnName) => () => {
|
|
@@ -4442,7 +4260,7 @@ async function saveSubscriptionFromStripeEvent(
|
|
|
4442
4260
|
var init_subscription = __esm({
|
|
4443
4261
|
'../providers/firebase/src/server/subscription.ts'() {
|
|
4444
4262
|
'use strict';
|
|
4445
|
-
|
|
4263
|
+
init_server3();
|
|
4446
4264
|
init_utils3();
|
|
4447
4265
|
init_transform();
|
|
4448
4266
|
init_utils4();
|
|
@@ -4602,7 +4420,7 @@ var validatorRegistry;
|
|
|
4602
4420
|
var init_uniqueness = __esm({
|
|
4603
4421
|
'../providers/firebase/src/server/uniqueness.ts'() {
|
|
4604
4422
|
'use strict';
|
|
4605
|
-
|
|
4423
|
+
init_server3();
|
|
4606
4424
|
init_utils3();
|
|
4607
4425
|
validatorRegistry = {};
|
|
4608
4426
|
__name(
|
|
@@ -4666,7 +4484,7 @@ var init_validation3 = __esm({
|
|
|
4666
4484
|
'../providers/firebase/src/server/validation.ts'() {
|
|
4667
4485
|
'use strict';
|
|
4668
4486
|
init_dist();
|
|
4669
|
-
|
|
4487
|
+
init_server3();
|
|
4670
4488
|
init_uniqueness();
|
|
4671
4489
|
init_uniqueness();
|
|
4672
4490
|
__name(validateFirestoreDocument, 'validateFirestoreDocument');
|
|
@@ -4718,7 +4536,7 @@ __export(server_exports2, {
|
|
|
4718
4536
|
validateUniqueness: () => validateUniqueness,
|
|
4719
4537
|
});
|
|
4720
4538
|
import { FieldValue, Query, Timestamp } from 'firebase-admin/firestore';
|
|
4721
|
-
var
|
|
4539
|
+
var init_server4 = __esm({
|
|
4722
4540
|
'../providers/firebase/src/server/index.ts'() {
|
|
4723
4541
|
'use strict';
|
|
4724
4542
|
init_init();
|
|
@@ -4732,8 +4550,8 @@ var init_server3 = __esm({
|
|
|
4732
4550
|
});
|
|
4733
4551
|
|
|
4734
4552
|
// src/shared/errorHandling.ts
|
|
4553
|
+
init_server3();
|
|
4735
4554
|
import { HttpsError } from 'firebase-functions/v2/https';
|
|
4736
|
-
init_server2();
|
|
4737
4555
|
var DoNotDevError3 = class _DoNotDevError extends Error {
|
|
4738
4556
|
static {
|
|
4739
4557
|
__name(this, 'DoNotDevError');
|
|
@@ -5106,9 +4924,6 @@ function isFieldVisible(key, visibility, isAdmin, isAuthenticated = true) {
|
|
|
5106
4924
|
if (visibility === 'technical') {
|
|
5107
4925
|
return isAdmin;
|
|
5108
4926
|
}
|
|
5109
|
-
if (visibility === 'owner') {
|
|
5110
|
-
return false;
|
|
5111
|
-
}
|
|
5112
4927
|
if (visibility === 'user' || visibility === void 0) {
|
|
5113
4928
|
return isAuthenticated;
|
|
5114
4929
|
}
|
|
@@ -5431,7 +5246,7 @@ function createVercelApiHandler(method, defaultSchema, handler) {
|
|
|
5431
5246
|
__name(createVercelApiHandler, 'createVercelApiHandler');
|
|
5432
5247
|
|
|
5433
5248
|
// src/shared/utils/external/date.ts
|
|
5434
|
-
|
|
5249
|
+
init_server4();
|
|
5435
5250
|
function addMonths(date, months) {
|
|
5436
5251
|
const result = new Date(date);
|
|
5437
5252
|
const originalDate = result.getDate();
|
|
@@ -5478,7 +5293,7 @@ function calculateSubscriptionEndDate(
|
|
|
5478
5293
|
__name(calculateSubscriptionEndDate, 'calculateSubscriptionEndDate');
|
|
5479
5294
|
|
|
5480
5295
|
// src/shared/utils/external/references.ts
|
|
5481
|
-
|
|
5296
|
+
init_server4();
|
|
5482
5297
|
async function findReferences(collection, documentId) {
|
|
5483
5298
|
const references = [];
|
|
5484
5299
|
return references;
|
|
@@ -5486,8 +5301,7 @@ async function findReferences(collection, documentId) {
|
|
|
5486
5301
|
__name(findReferences, 'findReferences');
|
|
5487
5302
|
|
|
5488
5303
|
// src/shared/utils/external/subscription.ts
|
|
5489
|
-
|
|
5490
|
-
init_server3();
|
|
5304
|
+
init_server4();
|
|
5491
5305
|
function getTierFromPriceId(priceId) {
|
|
5492
5306
|
const tierMapping = {
|
|
5493
5307
|
// Monthly subscriptions
|
|
@@ -5549,7 +5363,7 @@ async function getUserSubscription(firebaseUid) {
|
|
|
5549
5363
|
__name(getUserSubscription, 'getUserSubscription');
|
|
5550
5364
|
|
|
5551
5365
|
// src/shared/utils/internal/auth.ts
|
|
5552
|
-
|
|
5366
|
+
init_server4();
|
|
5553
5367
|
function assertAuthenticated(uid) {
|
|
5554
5368
|
if (!uid) {
|
|
5555
5369
|
throw new Error('Authentication required');
|
|
@@ -5590,14 +5404,14 @@ async function verifyFirebaseAuthToken(req) {
|
|
|
5590
5404
|
__name(verifyFirebaseAuthToken, 'verifyFirebaseAuthToken');
|
|
5591
5405
|
|
|
5592
5406
|
// src/shared/utils/internal/firebase.ts
|
|
5593
|
-
|
|
5407
|
+
init_server4();
|
|
5594
5408
|
async function initializeFirebaseAdmin() {
|
|
5595
5409
|
return await getFirebaseAdminApp();
|
|
5596
5410
|
}
|
|
5597
5411
|
__name(initializeFirebaseAdmin, 'initializeFirebaseAdmin');
|
|
5598
5412
|
|
|
5599
5413
|
// src/shared/utils/internal/idempotency.ts
|
|
5600
|
-
|
|
5414
|
+
init_server4();
|
|
5601
5415
|
import { logger as logger2 } from 'firebase-functions/v2';
|
|
5602
5416
|
async function checkIdempotency(key, operation) {
|
|
5603
5417
|
const db = getFirebaseAdminFirestore();
|
|
@@ -5696,7 +5510,7 @@ async function cleanupIdempotencyRecords(olderThanDays = 30) {
|
|
|
5696
5510
|
__name(cleanupIdempotencyRecords, 'cleanupIdempotencyRecords');
|
|
5697
5511
|
|
|
5698
5512
|
// src/shared/utils/internal/monitoring.ts
|
|
5699
|
-
|
|
5513
|
+
init_server4();
|
|
5700
5514
|
import { logger as logger3 } from 'firebase-functions/v2';
|
|
5701
5515
|
async function recordPaymentMetrics(metrics) {
|
|
5702
5516
|
try {
|
|
@@ -5935,7 +5749,7 @@ async function cleanupOldMetrics(
|
|
|
5935
5749
|
__name(cleanupOldMetrics, 'cleanupOldMetrics');
|
|
5936
5750
|
|
|
5937
5751
|
// src/shared/utils/internal/rateLimiter.ts
|
|
5938
|
-
|
|
5752
|
+
init_server4();
|
|
5939
5753
|
import { logger as logger4 } from 'firebase-functions/v2';
|
|
5940
5754
|
var rateLimitStore = /* @__PURE__ */ new Map();
|
|
5941
5755
|
async function checkRateLimit(key, config) {
|
|
@@ -6258,7 +6072,7 @@ async function updateUserSubscription(userId, subscriptionData, authProvider) {
|
|
|
6258
6072
|
__name(updateUserSubscription, 'updateUserSubscription');
|
|
6259
6073
|
|
|
6260
6074
|
// src/shared/billing/webhookHandler.ts
|
|
6261
|
-
|
|
6075
|
+
init_server3();
|
|
6262
6076
|
import 'stripe';
|
|
6263
6077
|
|
|
6264
6078
|
// src/shared/logger.ts
|
|
@@ -6496,7 +6310,7 @@ var FirestoreIdempotency = class {
|
|
|
6496
6310
|
async init() {
|
|
6497
6311
|
if (this.initialized) return;
|
|
6498
6312
|
const { getFirebaseAdminFirestore: getFirebaseAdminFirestore3 } =
|
|
6499
|
-
await Promise.resolve().then(() => (
|
|
6313
|
+
await Promise.resolve().then(() => (init_server4(), server_exports2));
|
|
6500
6314
|
this.db = getFirebaseAdminFirestore3();
|
|
6501
6315
|
this.initialized = true;
|
|
6502
6316
|
}
|
|
@@ -7015,7 +6829,9 @@ function prepareForFirestore2(data, removeFields = []) {
|
|
|
7015
6829
|
continue;
|
|
7016
6830
|
}
|
|
7017
6831
|
if (value instanceof Date) {
|
|
7018
|
-
prepared[key] = value
|
|
6832
|
+
prepared[key] = toTimestamp2(value);
|
|
6833
|
+
} else if (typeof value === 'string' && isISODateString2(value)) {
|
|
6834
|
+
prepared[key] = toTimestamp2(value);
|
|
7019
6835
|
} else {
|
|
7020
6836
|
prepared[key] = prepareForFirestore2(value, removeFields);
|
|
7021
6837
|
}
|
|
@@ -7023,11 +6839,25 @@ function prepareForFirestore2(data, removeFields = []) {
|
|
|
7023
6839
|
return prepared;
|
|
7024
6840
|
}
|
|
7025
6841
|
if (data instanceof Date) {
|
|
7026
|
-
return data
|
|
6842
|
+
return toTimestamp2(data);
|
|
6843
|
+
}
|
|
6844
|
+
if (typeof data === 'string' && isISODateString2(data)) {
|
|
6845
|
+
return toTimestamp2(data);
|
|
7027
6846
|
}
|
|
7028
6847
|
return data;
|
|
7029
6848
|
}
|
|
7030
6849
|
__name(prepareForFirestore2, 'prepareForFirestore');
|
|
6850
|
+
function isISODateString2(str) {
|
|
6851
|
+
if (typeof str !== 'string') return false;
|
|
6852
|
+
const isoDatePattern = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/;
|
|
6853
|
+
if (!isoDatePattern.test(str)) return false;
|
|
6854
|
+
const date = new Date(str);
|
|
6855
|
+
return (
|
|
6856
|
+
!isNaN(date.getTime()) &&
|
|
6857
|
+
date.toISOString().startsWith(str.substring(0, 19))
|
|
6858
|
+
);
|
|
6859
|
+
}
|
|
6860
|
+
__name(isISODateString2, 'isISODateString');
|
|
7031
6861
|
export {
|
|
7032
6862
|
DEFAULT_RATE_LIMITS,
|
|
7033
6863
|
DoNotDevError3 as DoNotDevError,
|