@_henriquewilson/gabirubi-domain 1.3.90 → 1.3.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/purchase.js.map +1 -1
- package/dist/model/purchase.mjs.map +1 -1
- package/dist/util/firestore.util.d.mts +8 -0
- package/dist/util/firestore.util.d.ts +8 -0
- package/dist/util/firestore.util.js +111 -0
- package/dist/util/firestore.util.js.map +1 -0
- package/dist/util/firestore.util.mjs +51 -0
- package/dist/util/firestore.util.mjs.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/henriquewilson/Developer/Projects/gabirubi-domain/dist/model/purchase.js","../../src/model/purchase.ts","../../src/model.ts","../../src/model/shared.ts"],"names":["__create","Object","create","__defProp","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__getProtoOf","getPrototypeOf","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toESM","mod","isNodeMode","__esModule","value","__toCommonJS","purchase_exports","ActivityProgressSchema","ModuleProgressSchema","ModuleProgressWithActivitiesSchema","PurchaseSchema","module","exports","import_zod","require","import_firestore","TimestampOrNow","z","preprocess","arg","Timestamp","now","custom","nullish","optional","import_cuid","generateFirestoreId","cuid","IdModelSchema","import_zod2","union","string","number","IdModelProcess","val","ModelSchema","object","id","createdAt","updatedAt","order","coerce","PreviousSchema","extend","previous","lazy","array","EnabledSchema","enabled","boolean","DocumentHistorySchema","description","completionPercentage","import_zod3","lastChange","completionCounter","activities","nextActivityId","nextModuleId","modulesAllowed"],"mappings":"AAAA;AACA,IAAIA,WAAWC,OAAOC,MAAM;AAC5B,IAAIC,YAAYF,OAAOG,cAAc;AACrC,IAAIC,mBAAmBJ,OAAOK,wBAAwB;AACtD,IAAIC,oBAAoBN,OAAOO,mBAAmB;AAClD,IAAIC,eAAeR,OAAOS,c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BrB,YAAAZ,CAAA,CAAEmB,MAAA,CAAO;IAC5CE,WAAWtB;IACXmC,aAAatB,YAAAZ,CAAA,CAAEc,MAAA,GAASP,QAAA;AAC1B;AF4CA,wBAAwB;AC9ExB,IAAAX,cAAgBC,QAAA;AAIT,IAAMP,yBAAyB4B,YAAYQ,MAAA,CAAO;IACvDS,sBAAsBC,YAAApC,CAAA,CAAEwB,MAAA,CAAOT,MAAA;IAC/BsB,YAAYD,YAAApC,CAAA,CAAEK,MAAA;AAChB;AAEO,IAAMd,uBAAuB2B,YAAYQ,MAAA,CAAO;IACrDY,mBAAmBF,YAAApC,CAAA,CAAEwB,MAAA,CAAOT,MAAA;AAC9B;AAEO,IAAMvB,qCAAqCD,qBAAqBmC,MAAA,CAAO;IAC5Ea,YAAYjD,uBAAuBuC,KAAA;AACrC;AAEO,IAAMpC,iBAAiByB,YAAYQ,MAAA,CAAO;IAC/Cc,gBAAgBJ,YAAApC,CAAA,CAAEc,MAAA,GAASP,QAAA;IAC3BkC,cAAcL,YAAApC,CAAA,CAAEc,MAAA,GAASP,QAAA;IACzBmC,gBAAgBN,YAAApC,CAAA,CAAEc,MAAA,GAASe,KAAA,GAAQtB,QAAA;AACrC;AD0EA,6DAA6D;AAC7D,KAAMb,CAAAA,OAAOC,OAAO,GAAG;IACrBL,wBAAAA;IACAC,sBAAAA;IACAC,oCAAAA;IACAC,gBAAAA;AACF,CAAA","sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n// src/model/purchase.ts\nvar purchase_exports = {};\n__export(purchase_exports, {\n ActivityProgressSchema: () => ActivityProgressSchema,\n ModuleProgressSchema: () => ModuleProgressSchema,\n ModuleProgressWithActivitiesSchema: () => ModuleProgressWithActivitiesSchema,\n PurchaseSchema: () => PurchaseSchema\n});\nmodule.exports = __toCommonJS(purchase_exports);\n\n// src/model.ts\nvar import_zod2 = require(\"zod\");\n\n// src/model/shared.ts\nvar import_firestore = require(\"@google-cloud/firestore\");\nvar import_zod = require(\"zod\");\nvar TimestampOrNow = import_zod.z.preprocess(\n (arg) => arg === void 0 ? import_firestore.Timestamp.now() : arg,\n import_zod.z.custom()\n).nullish().optional();\n\n// src/model.ts\nvar import_cuid = __toESM(require(\"cuid\"));\nvar generateFirestoreId = () => {\n return (0, import_cuid.default)();\n};\nvar IdModelSchema = import_zod2.z.union([import_zod2.z.string(), import_zod2.z.number()]);\nvar IdModelProcess = import_zod2.z.preprocess((val) => {\n if (val === void 0 || val === null) {\n return generateFirestoreId();\n }\n return val;\n}, IdModelSchema);\nvar ModelSchema = import_zod2.z.object({\n id: IdModelProcess,\n createdAt: TimestampOrNow,\n updatedAt: TimestampOrNow,\n order: import_zod2.z.coerce.number().nullish().optional()\n});\nvar PreviousSchema = ModelSchema.extend({\n previous: import_zod2.z.lazy(() => ModelSchema.array().optional())\n});\nvar EnabledSchema = import_zod2.z.object({\n enabled: import_zod2.z.boolean().optional()\n});\nvar DocumentHistorySchema = import_zod2.z.object({\n createdAt: TimestampOrNow,\n description: import_zod2.z.string().optional()\n});\n\n// src/model/purchase.ts\nvar import_zod3 = require(\"zod\");\nvar ActivityProgressSchema = ModelSchema.extend({\n completionPercentage: import_zod3.z.coerce.number(),\n lastChange: import_zod3.z.custom()\n});\nvar ModuleProgressSchema = ModelSchema.extend({\n completionCounter: import_zod3.z.coerce.number()\n});\nvar ModuleProgressWithActivitiesSchema = ModuleProgressSchema.extend({\n activities: ActivityProgressSchema.array()\n});\nvar PurchaseSchema = ModelSchema.extend({\n nextActivityId: import_zod3.z.string().optional(),\n nextModuleId: import_zod3.z.string().optional(),\n modulesAllowed: import_zod3.z.string().array().optional()\n});\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n ActivityProgressSchema,\n ModuleProgressSchema,\n ModuleProgressWithActivitiesSchema,\n PurchaseSchema\n});\n","import {ModelSchema} from \"../model\";\nimport {z} from \"zod\";\nimport {TimestampOrNow} from \"./shared\";\nimport {Timestamp} from \"@google-cloud/firestore\";\n\nexport const ActivityProgressSchema = ModelSchema.extend({\n completionPercentage: z.coerce.number(),\n lastChange: z.custom<Timestamp>()\n})\n\nexport const ModuleProgressSchema = ModelSchema.extend({\n completionCounter: z.coerce.number()\n})\n\nexport const ModuleProgressWithActivitiesSchema = ModuleProgressSchema.extend({\n activities: ActivityProgressSchema.array()\n})\n\nexport const PurchaseSchema = ModelSchema.extend({\n nextActivityId: z.string().optional(),\n nextModuleId: z.string().optional(),\n modulesAllowed: z.string().array().optional()\n})\n\nexport type ActivityProgress = z.infer<typeof ActivityProgressSchema>\nexport type ModuleProgress = z.infer<typeof ModuleProgressSchema>\nexport type ModuleProgressWithActivities = z.infer<typeof ModuleProgressWithActivitiesSchema>\nexport type Purchase = z.infer<typeof PurchaseSchema>\n\n\n","import {z} from \"zod\";\nimport {TimestampOrNow} from \"./model/shared\";\nimport cuid from 'cuid';\n\nexport const generateFirestoreId = () => {\n return cuid();\n}\n\nexport const IdModelSchema = z.union([z.string(), z.number()])\n\nconst IdModelProcess = z.preprocess((val) => {\n if (val === undefined || val === null) {\n return generateFirestoreId();\n }\n return val;\n}, IdModelSchema);\n\nexport const ModelSchema = z.object({\n id: IdModelProcess,\n createdAt: TimestampOrNow,\n updatedAt: TimestampOrNow,\n order: z.coerce.number().nullish().optional()\n});\n\nexport const PreviousSchema = ModelSchema.extend({\n previous: z.lazy(() => ModelSchema.array().optional())\n})\n\nexport const EnabledSchema = z.object({\n enabled: z.boolean().optional()\n})\n\nexport const DocumentHistorySchema = z.object({\n createdAt: TimestampOrNow,\n description: z.string().optional(),\n})\n\nexport type IdModel = z.infer<typeof IdModelSchema>;\nexport type Model = z.infer<typeof ModelSchema>;\nexport type Previous = z.infer<typeof PreviousSchema>;\nexport type Enabled = z.infer<typeof EnabledSchema>;\nexport type PartialWithId<T extends Model> = Partial<T> & {\n id: NonNullable<T['id']>\n}\n\n\n","import { Timestamp } from '@google-cloud/firestore';\nimport {z} from \"zod\";\n\nexport const TimestampOrNow = z\n .preprocess(\n (arg) => (arg === undefined ? Timestamp.now() : arg),\n z.custom<Timestamp>(),\n )\n .nullish().optional();\n"]}
|
|
1
|
+
{"version":3,"sources":["/Users/henriquewilson/Developer/Projects/gabirubi-domain/dist/model/purchase.js","../../src/model/purchase.ts","../../src/model.ts","../../src/model/shared.ts"],"names":["__create","Object","create","__defProp","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__getProtoOf","getPrototypeOf","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toESM","mod","isNodeMode","__esModule","value","__toCommonJS","purchase_exports","ActivityProgressSchema","ModuleProgressSchema","ModuleProgressWithActivitiesSchema","PurchaseSchema","module","exports","import_zod","require","import_firestore","TimestampOrNow","z","preprocess","arg","Timestamp","now","custom","nullish","optional","import_cuid","generateFirestoreId","cuid","IdModelSchema","import_zod2","union","string","number","IdModelProcess","val","ModelSchema","object","id","createdAt","updatedAt","order","coerce","PreviousSchema","extend","previous","lazy","array","EnabledSchema","enabled","boolean","DocumentHistorySchema","description","completionPercentage","import_zod3","lastChange","completionCounter","activities","nextActivityId","nextModuleId","modulesAllowed"],"mappings":"AAAA;AACA,IAAIA,WAAWC,OAAOC,MAAM;AAC5B,IAAIC,YAAYF,OAAOG,cAAc;AACrC,IAAIC,mBAAmBJ,OAAOK,wBAAwB;AACtD,IAAIC,oBAAoBN,OAAOO,mBAAmB;AAClD,IAAIC,eAAeR,OAAOS,cAAc;AACxC,IAAIC,eAAeV,OAAOW,SAAS,CAACC,cAAc;AAClD,IAAIC,WAAW,SAACC,QAAQC;IACtB,IAAK,IAAIC,QAAQD,IACfb,UAAUY,QAAQE,MAAM;QAAEC,KAAKF,GAAG,CAACC,KAAK;QAAEE,YAAY;IAAK;AAC/D;AACA,IAAIC,cAAc,SAACC,IAAIC,MAAMC,QAAQC;IACnC,IAAIF,QAAQ,OAAOA,SAAS,YAAY,OAAOA,SAAS,YAAY;YAC7D,kCAAA,2BAAA;;;gBAAA,IAAIG,MAAJ;gBACH,IAAI,CAACd,aAAae,IAAI,CAACL,IAAII,QAAQA,QAAQF,QACzCpB,UAAUkB,IAAII,KAAK;oBAAEP,KAAK;+BAAMI,IAAI,CAACG,IAAI;;oBAAEN,YAAY,CAAEK,CAAAA,OAAOnB,iBAAiBiB,MAAMG,IAAG,KAAMD,KAAKL,UAAU;gBAAC;;YAFpH,QAAK,YAAWZ,kBAAkBe,0BAA7B,SAAA,6BAAA,QAAA,yBAAA;;YAAA;YAAA;;;qBAAA,6BAAA;oBAAA;;;oBAAA;0BAAA;;;;IAGP;IACA,OAAOD;AACT;AACA,IAAIM,UAAU,SAACC,KAAKC,YAAYd;WAAYA,SAASa,OAAO,OAAO5B,SAASS,aAAamB,QAAQ,CAAC,GAAGR,YAC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wBAAAA;IACAC,sBAAAA;IACAC,oCAAAA;IACAC,gBAAAA;AACF,CAAA","sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n// src/model/purchase.ts\nvar purchase_exports = {};\n__export(purchase_exports, {\n ActivityProgressSchema: () => ActivityProgressSchema,\n ModuleProgressSchema: () => ModuleProgressSchema,\n ModuleProgressWithActivitiesSchema: () => ModuleProgressWithActivitiesSchema,\n PurchaseSchema: () => PurchaseSchema\n});\nmodule.exports = __toCommonJS(purchase_exports);\n\n// src/model.ts\nvar import_zod2 = require(\"zod\");\n\n// src/model/shared.ts\nvar import_firestore = require(\"@google-cloud/firestore\");\nvar import_zod = require(\"zod\");\nvar TimestampOrNow = import_zod.z.preprocess(\n (arg) => arg === void 0 ? import_firestore.Timestamp.now() : arg,\n import_zod.z.custom()\n).nullish().optional();\n\n// src/model.ts\nvar import_cuid = __toESM(require(\"cuid\"));\nvar generateFirestoreId = () => {\n return (0, import_cuid.default)();\n};\nvar IdModelSchema = import_zod2.z.union([import_zod2.z.string(), import_zod2.z.number()]);\nvar IdModelProcess = import_zod2.z.preprocess((val) => {\n if (val === void 0 || val === null) {\n return generateFirestoreId();\n }\n return val;\n}, IdModelSchema);\nvar ModelSchema = import_zod2.z.object({\n id: IdModelProcess,\n createdAt: TimestampOrNow,\n updatedAt: TimestampOrNow,\n order: import_zod2.z.coerce.number().nullish().optional()\n});\nvar PreviousSchema = ModelSchema.extend({\n previous: import_zod2.z.lazy(() => ModelSchema.array().optional())\n});\nvar EnabledSchema = import_zod2.z.object({\n enabled: import_zod2.z.boolean().optional()\n});\nvar DocumentHistorySchema = import_zod2.z.object({\n createdAt: TimestampOrNow,\n description: import_zod2.z.string().optional()\n});\n\n// src/model/purchase.ts\nvar import_zod3 = require(\"zod\");\nvar ActivityProgressSchema = ModelSchema.extend({\n completionPercentage: import_zod3.z.coerce.number(),\n lastChange: import_zod3.z.custom()\n});\nvar ModuleProgressSchema = ModelSchema.extend({\n completionCounter: import_zod3.z.coerce.number()\n});\nvar ModuleProgressWithActivitiesSchema = ModuleProgressSchema.extend({\n activities: ActivityProgressSchema.array()\n});\nvar PurchaseSchema = ModelSchema.extend({\n nextActivityId: import_zod3.z.string().optional(),\n nextModuleId: import_zod3.z.string().optional(),\n modulesAllowed: import_zod3.z.string().array().optional()\n});\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n ActivityProgressSchema,\n ModuleProgressSchema,\n ModuleProgressWithActivitiesSchema,\n PurchaseSchema\n});\n","import {ModelSchema} from \"../model\";\nimport {z} from \"zod\";\nimport {Timestamp} from \"@google-cloud/firestore\";\n\nexport const ActivityProgressSchema = ModelSchema.extend({\n completionPercentage: z.coerce.number(),\n lastChange: z.custom<Timestamp>()\n})\n\nexport const ModuleProgressSchema = ModelSchema.extend({\n completionCounter: z.coerce.number()\n})\n\nexport const ModuleProgressWithActivitiesSchema = ModuleProgressSchema.extend({\n activities: ActivityProgressSchema.array()\n})\n\nexport const PurchaseSchema = ModelSchema.extend({\n nextActivityId: z.string().optional(),\n nextModuleId: z.string().optional(),\n modulesAllowed: z.string().array().optional()\n})\n\nexport type ActivityProgress = z.infer<typeof ActivityProgressSchema>\nexport type ModuleProgress = z.infer<typeof ModuleProgressSchema>\nexport type ModuleProgressWithActivities = z.infer<typeof ModuleProgressWithActivitiesSchema>\nexport type Purchase = z.infer<typeof PurchaseSchema>\n\n\n","import {z} from \"zod\";\nimport {TimestampOrNow} from \"./model/shared\";\nimport cuid from 'cuid';\n\nexport const generateFirestoreId = () => {\n return cuid();\n}\n\nexport const IdModelSchema = z.union([z.string(), z.number()])\n\nconst IdModelProcess = z.preprocess((val) => {\n if (val === undefined || val === null) {\n return generateFirestoreId();\n }\n return val;\n}, IdModelSchema);\n\nexport const ModelSchema = z.object({\n id: IdModelProcess,\n createdAt: TimestampOrNow,\n updatedAt: TimestampOrNow,\n order: z.coerce.number().nullish().optional()\n});\n\nexport const PreviousSchema = ModelSchema.extend({\n previous: z.lazy(() => ModelSchema.array().optional())\n})\n\nexport const EnabledSchema = z.object({\n enabled: z.boolean().optional()\n})\n\nexport const DocumentHistorySchema = z.object({\n createdAt: TimestampOrNow,\n description: z.string().optional(),\n})\n\nexport type IdModel = z.infer<typeof IdModelSchema>;\nexport type Model = z.infer<typeof ModelSchema>;\nexport type Previous = z.infer<typeof PreviousSchema>;\nexport type Enabled = z.infer<typeof EnabledSchema>;\nexport type PartialWithId<T extends Model> = Partial<T> & {\n id: NonNullable<T['id']>\n}\n\n\n","import { Timestamp } from '@google-cloud/firestore';\nimport {z} from \"zod\";\n\nexport const TimestampOrNow = z\n .preprocess(\n (arg) => (arg === undefined ? Timestamp.now() : arg),\n z.custom<Timestamp>(),\n )\n .nullish().optional();\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/henriquewilson/Developer/Projects/gabirubi-domain/dist/model/purchase.mjs","../../src/model.ts","../../src/model/shared.ts","../../src/model/purchase.ts"],"names":["z","Timestamp","TimestampOrNow","preprocess","arg","now","custom","nullish","optional","cuid","generateFirestoreId","IdModelSchema","union","string","number","IdModelProcess","val","ModelSchema","object","id","createdAt","updatedAt","order","coerce","PreviousSchema","extend","previous","lazy","array","EnabledSchema","enabled","boolean","DocumentHistorySchema","description","ActivityProgressSchema","completionPercentage","lastChange","ModuleProgressSchema","completionCounter","ModuleProgressWithActivitiesSchema","activities","PurchaseSchema","nextActivityId","nextModuleId","modulesAllowed"],"mappings":"AAAA,eAAe;ACAf,SAAQA,KAAAA,EAAAA,QAAQ,MAAA;ADGhB,sBAAsB;AEHtB,SAASC,SAAA,QAAiB,0BAAA;AAC1B,SAAQD,CAAA,QAAQ,MAAA;AAET,IAAME,iBAAiBF,EAC3BG,UAAA,CACC,SAACC;WAASA,QAAQ,KAAA,IAAYH,UAAUI,GAAA,KAAQD;GAChDJ,EAAEM,MAAA,IAEHC,OAAA,GAAUC,QAAA;AFGb,eAAe;ACTf,OAAOC,UAAU,OAAA;AAEV,IAAMC,sBAAsB;IACjC,OAAOD;AACT;AAEO,IAAME,gBAAgBX,GAAEY,KAAA,CAAM;IAACZ,GAAEa,MAAA;IAAUb,GAAEc,MAAA;CAAS;AAE7D,IAAMC,iBAAiBf,GAAEG,UAAA,CAAW,SAACa;IACnC,IAAIA,QAAQ,KAAA,KAAaA,QAAQ,MAAM;QACrC,OAAON;IACT;IACA,OAAOM;AACT,GAAGL;AAEI,IAAMM,cAAcjB,GAAEkB,MAAA,CAAO;IAClCC,IAAIJ;IACJK,WAAWlB;IACXmB,WAAWnB;IACXoB,OAAOtB,GAAEuB,MAAA,CAAOT,MAAA,GAASP,OAAA,GAAUC,QAAA;AACrC;AAEO,IAAMgB,iBAAiBP,YAAYQ,MAAA,CAAO;IAC/CC,UAAU1B,GAAE2B,IAAA,CAAK;eAAMV,YAAYW,KAAA,GAAQpB,QAAA;;AAC7C;AAEO,IAAMqB,gBAAgB7B,GAAEkB,MAAA,CAAO;IACpCY,SAAS9B,GAAE+B,OAAA,GAAUvB,QAAA;AACvB;AAEO,IAAMwB,wBAAwBhC,GAAEkB,MAAA,CAAO;IAC5CE,WAAWlB;IACX+B,aAAajC,GAAEa,MAAA,GAASL,QAAA;AAC1B;ADKA,wBAAwB;AGvCxB,SAAQR,KAAAA,EAAAA,QAAQ,MAAA;
|
|
1
|
+
{"version":3,"sources":["/Users/henriquewilson/Developer/Projects/gabirubi-domain/dist/model/purchase.mjs","../../src/model.ts","../../src/model/shared.ts","../../src/model/purchase.ts"],"names":["z","Timestamp","TimestampOrNow","preprocess","arg","now","custom","nullish","optional","cuid","generateFirestoreId","IdModelSchema","union","string","number","IdModelProcess","val","ModelSchema","object","id","createdAt","updatedAt","order","coerce","PreviousSchema","extend","previous","lazy","array","EnabledSchema","enabled","boolean","DocumentHistorySchema","description","ActivityProgressSchema","completionPercentage","lastChange","ModuleProgressSchema","completionCounter","ModuleProgressWithActivitiesSchema","activities","PurchaseSchema","nextActivityId","nextModuleId","modulesAllowed"],"mappings":"AAAA,eAAe;ACAf,SAAQA,KAAAA,EAAAA,QAAQ,MAAA;ADGhB,sBAAsB;AEHtB,SAASC,SAAA,QAAiB,0BAAA;AAC1B,SAAQD,CAAA,QAAQ,MAAA;AAET,IAAME,iBAAiBF,EAC3BG,UAAA,CACC,SAACC;WAASA,QAAQ,KAAA,IAAYH,UAAUI,GAAA,KAAQD;GAChDJ,EAAEM,MAAA,IAEHC,OAAA,GAAUC,QAAA;AFGb,eAAe;ACTf,OAAOC,UAAU,OAAA;AAEV,IAAMC,sBAAsB;IACjC,OAAOD;AACT;AAEO,IAAME,gBAAgBX,GAAEY,KAAA,CAAM;IAACZ,GAAEa,MAAA;IAAUb,GAAEc,MAAA;CAAS;AAE7D,IAAMC,iBAAiBf,GAAEG,UAAA,CAAW,SAACa;IACnC,IAAIA,QAAQ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2 } from \"zod\";\n\n// src/model/shared.ts\nimport { Timestamp } from \"@google-cloud/firestore\";\nimport { z } from \"zod\";\nvar TimestampOrNow = z.preprocess(\n (arg) => arg === void 0 ? Timestamp.now() : arg,\n z.custom()\n).nullish().optional();\n\n// src/model.ts\nimport cuid from \"cuid\";\nvar generateFirestoreId = () => {\n return cuid();\n};\nvar IdModelSchema = z2.union([z2.string(), z2.number()]);\nvar IdModelProcess = z2.preprocess((val) => {\n if (val === void 0 || val === null) {\n return generateFirestoreId();\n }\n return val;\n}, IdModelSchema);\nvar ModelSchema = z2.object({\n id: IdModelProcess,\n createdAt: TimestampOrNow,\n updatedAt: TimestampOrNow,\n order: z2.coerce.number().nullish().optional()\n});\nvar PreviousSchema = ModelSchema.extend({\n previous: z2.lazy(() => ModelSchema.array().optional())\n});\nvar EnabledSchema = z2.object({\n enabled: z2.boolean().optional()\n});\nvar DocumentHistorySchema = z2.object({\n createdAt: TimestampOrNow,\n description: z2.string().optional()\n});\n\n// src/model/purchase.ts\nimport { z as z3 } from \"zod\";\nvar ActivityProgressSchema = ModelSchema.extend({\n completionPercentage: z3.coerce.number(),\n lastChange: z3.custom()\n});\nvar ModuleProgressSchema = ModelSchema.extend({\n completionCounter: z3.coerce.number()\n});\nvar ModuleProgressWithActivitiesSchema = ModuleProgressSchema.extend({\n activities: ActivityProgressSchema.array()\n});\nvar PurchaseSchema = ModelSchema.extend({\n nextActivityId: z3.string().optional(),\n nextModuleId: z3.string().optional(),\n modulesAllowed: z3.string().array().optional()\n});\nexport {\n ActivityProgressSchema,\n ModuleProgressSchema,\n ModuleProgressWithActivitiesSchema,\n PurchaseSchema\n};\n","import {z} from \"zod\";\nimport {TimestampOrNow} from \"./model/shared\";\nimport cuid from 'cuid';\n\nexport const generateFirestoreId = () => {\n return cuid();\n}\n\nexport const IdModelSchema = z.union([z.string(), z.number()])\n\nconst IdModelProcess = z.preprocess((val) => {\n if (val === undefined || val === null) {\n return generateFirestoreId();\n }\n return val;\n}, IdModelSchema);\n\nexport const ModelSchema = z.object({\n id: IdModelProcess,\n createdAt: TimestampOrNow,\n updatedAt: TimestampOrNow,\n order: z.coerce.number().nullish().optional()\n});\n\nexport const PreviousSchema = ModelSchema.extend({\n previous: z.lazy(() => ModelSchema.array().optional())\n})\n\nexport const EnabledSchema = z.object({\n enabled: z.boolean().optional()\n})\n\nexport const DocumentHistorySchema = z.object({\n createdAt: TimestampOrNow,\n description: z.string().optional(),\n})\n\nexport type IdModel = z.infer<typeof IdModelSchema>;\nexport type Model = z.infer<typeof ModelSchema>;\nexport type Previous = z.infer<typeof PreviousSchema>;\nexport type Enabled = z.infer<typeof EnabledSchema>;\nexport type PartialWithId<T extends Model> = Partial<T> & {\n id: NonNullable<T['id']>\n}\n\n\n","import { Timestamp } from '@google-cloud/firestore';\nimport {z} from \"zod\";\n\nexport const TimestampOrNow = z\n .preprocess(\n (arg) => (arg === undefined ? Timestamp.now() : arg),\n z.custom<Timestamp>(),\n )\n .nullish().optional();\n","import {ModelSchema} from \"../model\";\nimport {z} from \"zod\";\nimport {Timestamp} from \"@google-cloud/firestore\";\n\nexport const ActivityProgressSchema = ModelSchema.extend({\n completionPercentage: z.coerce.number(),\n lastChange: z.custom<Timestamp>()\n})\n\nexport const ModuleProgressSchema = ModelSchema.extend({\n completionCounter: z.coerce.number()\n})\n\nexport const ModuleProgressWithActivitiesSchema = ModuleProgressSchema.extend({\n activities: ActivityProgressSchema.array()\n})\n\nexport const PurchaseSchema = ModelSchema.extend({\n nextActivityId: z.string().optional(),\n nextModuleId: z.string().optional(),\n modulesAllowed: z.string().array().optional()\n})\n\nexport type ActivityProgress = z.infer<typeof ActivityProgressSchema>\nexport type ModuleProgress = z.infer<typeof ModuleProgressSchema>\nexport type ModuleProgressWithActivities = z.infer<typeof ModuleProgressWithActivitiesSchema>\nexport type Purchase = z.infer<typeof PurchaseSchema>\n\n\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Timestamp } from '@google-cloud/firestore';
|
|
2
|
+
|
|
3
|
+
declare class FirestoreRawService {
|
|
4
|
+
static forceTimestamp(data?: Timestamp | null): Timestamp | null;
|
|
5
|
+
}
|
|
6
|
+
declare const forceTimestamp: (data: Timestamp) => Timestamp | null;
|
|
7
|
+
|
|
8
|
+
export { FirestoreRawService, forceTimestamp };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Timestamp } from '@google-cloud/firestore';
|
|
2
|
+
|
|
3
|
+
declare class FirestoreRawService {
|
|
4
|
+
static forceTimestamp(data?: Timestamp | null): Timestamp | null;
|
|
5
|
+
}
|
|
6
|
+
declare const forceTimestamp: (data: Timestamp) => Timestamp | null;
|
|
7
|
+
|
|
8
|
+
export { FirestoreRawService, forceTimestamp };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
function _class_call_check(instance, Constructor) {
|
|
3
|
+
if (!(instance instanceof Constructor)) {
|
|
4
|
+
throw new TypeError("Cannot call a class as a function");
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
function _defineProperties(target, props) {
|
|
8
|
+
for(var i = 0; i < props.length; i++){
|
|
9
|
+
var descriptor = props[i];
|
|
10
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
11
|
+
descriptor.configurable = true;
|
|
12
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
13
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
17
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
18
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
19
|
+
return Constructor;
|
|
20
|
+
}
|
|
21
|
+
var __defProp = Object.defineProperty;
|
|
22
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
23
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
24
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
25
|
+
var __export = function(target, all) {
|
|
26
|
+
for(var name in all)__defProp(target, name, {
|
|
27
|
+
get: all[name],
|
|
28
|
+
enumerable: true
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
var __copyProps = function(to, from, except, desc) {
|
|
32
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
33
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
34
|
+
try {
|
|
35
|
+
var _loop = function() {
|
|
36
|
+
var key = _step.value;
|
|
37
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
38
|
+
get: function() {
|
|
39
|
+
return from[key];
|
|
40
|
+
},
|
|
41
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
for(var _iterator = __getOwnPropNames(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
45
|
+
} catch (err) {
|
|
46
|
+
_didIteratorError = true;
|
|
47
|
+
_iteratorError = err;
|
|
48
|
+
} finally{
|
|
49
|
+
try {
|
|
50
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
51
|
+
_iterator.return();
|
|
52
|
+
}
|
|
53
|
+
} finally{
|
|
54
|
+
if (_didIteratorError) {
|
|
55
|
+
throw _iteratorError;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return to;
|
|
61
|
+
};
|
|
62
|
+
var __toCommonJS = function(mod) {
|
|
63
|
+
return __copyProps(__defProp({}, "__esModule", {
|
|
64
|
+
value: true
|
|
65
|
+
}), mod);
|
|
66
|
+
};
|
|
67
|
+
// src/util/firestore.util.ts
|
|
68
|
+
var firestore_util_exports = {};
|
|
69
|
+
__export(firestore_util_exports, {
|
|
70
|
+
FirestoreRawService: function() {
|
|
71
|
+
return FirestoreRawService;
|
|
72
|
+
},
|
|
73
|
+
forceTimestamp: function() {
|
|
74
|
+
return forceTimestamp;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
module.exports = __toCommonJS(firestore_util_exports);
|
|
78
|
+
var import_firestore = require("@google-cloud/firestore");
|
|
79
|
+
var FirestoreRawService = /*#__PURE__*/ function() {
|
|
80
|
+
function FirestoreRawService() {
|
|
81
|
+
_class_call_check(this, FirestoreRawService);
|
|
82
|
+
}
|
|
83
|
+
_create_class(FirestoreRawService, null, [
|
|
84
|
+
{
|
|
85
|
+
key: "forceTimestamp",
|
|
86
|
+
value: function forceTimestamp(data) {
|
|
87
|
+
if (!data) return null;
|
|
88
|
+
try {
|
|
89
|
+
var d = data.toDate();
|
|
90
|
+
return import_firestore.Timestamp.fromDate(d);
|
|
91
|
+
} catch (e) {
|
|
92
|
+
try {
|
|
93
|
+
return new import_firestore.Timestamp(data.seconds, data.nanoseconds);
|
|
94
|
+
} catch (e2) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
]);
|
|
101
|
+
return FirestoreRawService;
|
|
102
|
+
}();
|
|
103
|
+
var forceTimestamp = function(data) {
|
|
104
|
+
return FirestoreRawService.forceTimestamp(data);
|
|
105
|
+
};
|
|
106
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
107
|
+
0 && (module.exports = {
|
|
108
|
+
FirestoreRawService: FirestoreRawService,
|
|
109
|
+
forceTimestamp: forceTimestamp
|
|
110
|
+
});
|
|
111
|
+
//# sourceMappingURL=firestore.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/henriquewilson/Developer/Projects/gabirubi-domain/dist/util/firestore.util.js","../../src/util/firestore.util.ts"],"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","firestore_util_exports","FirestoreRawService","forceTimestamp","module","exports","import_firestore","require","data","d","toDate","Timestamp","fromDate","e","seconds","nanoseconds"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;AACA,IAAIA,YAAYC,OAAOC,cAAc;AACrC,IAAIC,mBAAmBF,OAAOG,wBAAwB;AACtD,IAAIC,oBAAoBJ,OAAOK,mBAAmB;AAClD,IAAIC,eAAeN,OAAOO,SAAS,CAACC,cAAc;AAClD,IAAIC,WAAW,SAACC,QAAQC;IACtB,IAAK,IAAIC,QAAQD,IACfZ,UAAUW,QAAQE,MAAM;QAAEC,KAAKF,GAAG,CAACC,KAAK;QAAEE,YAAY;IAAK;AAC/D;AACA,IAAIC,cAAc,SAACC,IAAIC,MAAMC,QAAQC;IACnC,IAAIF,QAAQ,OAAOA,SAAS,YAAY,OAAOA,SAAS,YAAY;YAC7D,kCAAA,2BAAA;;;gBAAA,IAAIG,MAAJ;gBACH,IAAI,CAACd,aAAae,IAAI,CAACL,IAAII,QAAQA,QAAQF,QACzCnB,UAAUiB,IAAII,KAAK;oBAAEP,KAAK;+BAAMI,IAAI,CAACG,IAAI;;oBAAEN,YAAY,CAAEK,CAAAA,OAAOjB,iBAAiBe,MAAMG,IAAG,KAAMD,KAAKL,UAAU;gBAAC;;YAFpH,QAAK,YAAWV,kBAAkBa,0BAA7B,SAAA,6BAAA,QAAA,yBAAA;;YAAA;YAAA;;;qBAAA,6BAAA;oBAAA;;;oBAAA;0BAAA;;;;IAGP;IACA,OAAOD;AACT;AACA,IAAIM,eAAe,SAACC;WAAQR,YAAYhB,UAAU,CAAC,GAAG,cAAc;QAAEyB,OAAO;IAAK,IAAID;;AAEtF,6BAA6B;ACnB7B,IAAAE,yBAAA,CAAA;AAAAhB,SAAAgB,wBAAA;IAAAC,qBAAA;eAAAA;;IAAAC,gBAAA;eAAAA;;AAAA;AAAAC,OAAAC,OAAA,GAAAP,aAAAG;AAAA,IAAAK,mBAAwBC,QAAA;AAEjB,IAAML,oCAAN;aAAMA;;;;;YACGC,KAAAA;mBAAd,SAAcA,eAAeK,IAAA;gBAC3B,IAAI,CAACA,MAAM,OAAO;gBAClB,IAAI;oBACF,IAAMC,IAAID,KAAKE,MAAA;oBACf,OAAOJ,iBAAAK,SAAA,CAAUC,QAAA,CAASH;gBAC5B,EAAA,OAASI,GAAG;oBACV,IAAI;wBACF,OAAO,IAAIP,iBAAAK,SAAA,CAAUH,KAAKM,OAAA,EAASN,KAAKO,WAAW;oBACrD,EAAA,OAASF,IAAG;wBACV,OAAO;oBACT;gBACF;YACF;;;;;AAGK,IAAMV,iBAAiB,SAACK;WAAoBN,oBAAoBC,cAAA,CAAeK;;ADyBtF,6DAA6D;AAC7D,KAAMJ,CAAAA,OAAOC,OAAO,GAAG;IACrBH,qBAAAA;IACAC,gBAAAA;AACF,CAAA","sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n// src/util/firestore.util.ts\nvar firestore_util_exports = {};\n__export(firestore_util_exports, {\n FirestoreRawService: () => FirestoreRawService,\n forceTimestamp: () => forceTimestamp\n});\nmodule.exports = __toCommonJS(firestore_util_exports);\nvar import_firestore = require(\"@google-cloud/firestore\");\nvar FirestoreRawService = class {\n static forceTimestamp(data) {\n if (!data) return null;\n try {\n const d = data.toDate();\n return import_firestore.Timestamp.fromDate(d);\n } catch (e) {\n try {\n return new import_firestore.Timestamp(data.seconds, data.nanoseconds);\n } catch (e2) {\n return null;\n }\n }\n }\n};\nvar forceTimestamp = (data) => FirestoreRawService.forceTimestamp(data);\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n FirestoreRawService,\n forceTimestamp\n});\n","import {Timestamp} from \"@google-cloud/firestore\";\n\nexport class FirestoreRawService {\n public static forceTimestamp(data?: Timestamp | null) {\n if (!data) return null;\n try {\n const d = data.toDate();\n return Timestamp.fromDate(d)\n } catch (e) {\n try {\n return new Timestamp(data.seconds, data.nanoseconds);\n } catch (e) {\n return null\n }\n }\n }\n}\n\nexport const forceTimestamp = (data: Timestamp) => FirestoreRawService.forceTimestamp(data)\n"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// src/util/firestore.util.ts
|
|
2
|
+
function _class_call_check(instance, Constructor) {
|
|
3
|
+
if (!(instance instanceof Constructor)) {
|
|
4
|
+
throw new TypeError("Cannot call a class as a function");
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
function _defineProperties(target, props) {
|
|
8
|
+
for(var i = 0; i < props.length; i++){
|
|
9
|
+
var descriptor = props[i];
|
|
10
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
11
|
+
descriptor.configurable = true;
|
|
12
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
13
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
17
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
18
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
19
|
+
return Constructor;
|
|
20
|
+
}
|
|
21
|
+
import { Timestamp } from "@google-cloud/firestore";
|
|
22
|
+
var FirestoreRawService = /*#__PURE__*/ function() {
|
|
23
|
+
"use strict";
|
|
24
|
+
function FirestoreRawService() {
|
|
25
|
+
_class_call_check(this, FirestoreRawService);
|
|
26
|
+
}
|
|
27
|
+
_create_class(FirestoreRawService, null, [
|
|
28
|
+
{
|
|
29
|
+
key: "forceTimestamp",
|
|
30
|
+
value: function forceTimestamp(data) {
|
|
31
|
+
if (!data) return null;
|
|
32
|
+
try {
|
|
33
|
+
var d = data.toDate();
|
|
34
|
+
return Timestamp.fromDate(d);
|
|
35
|
+
} catch (e) {
|
|
36
|
+
try {
|
|
37
|
+
return new Timestamp(data.seconds, data.nanoseconds);
|
|
38
|
+
} catch (e2) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
]);
|
|
45
|
+
return FirestoreRawService;
|
|
46
|
+
}();
|
|
47
|
+
var forceTimestamp = function(data) {
|
|
48
|
+
return FirestoreRawService.forceTimestamp(data);
|
|
49
|
+
};
|
|
50
|
+
export { FirestoreRawService, forceTimestamp };
|
|
51
|
+
//# sourceMappingURL=firestore.util.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/henriquewilson/Developer/Projects/gabirubi-domain/dist/util/firestore.util.mjs","../../src/util/firestore.util.ts"],"names":["Timestamp","FirestoreRawService","forceTimestamp","data","d","toDate","fromDate","e","seconds","nanoseconds"],"mappings":"AAAA,6BAA6B;;;;;;;;;;;;;;;;;;;;ACA7B,SAAQA,SAAA,QAAgB,0BAAA;AAEjB,IAAMC,oCAAN;;aAAMA;;;;;YACGC,KAAAA;mBAAd,SAAcA,eAAeC,IAAA;gBAC3B,IAAI,CAACA,MAAM,OAAO;gBAClB,IAAI;oBACF,IAAMC,IAAID,KAAKE,MAAA;oBACf,OAAOL,UAAUM,QAAA,CAASF;gBAC5B,EAAA,OAASG,GAAG;oBACV,IAAI;wBACF,OAAO,IAAIP,UAAUG,KAAKK,OAAA,EAASL,KAAKM,WAAW;oBACrD,EAAA,OAASF,IAAG;wBACV,OAAO;oBACT;gBACF;YACF;;;;;AAGK,IAAML,iBAAiB,SAACC;WAAoBF,oBAAoBC,cAAA,CAAeC;;ADAtF,SACEF,mBAAmB,EACnBC,cAAc,GACd","sourcesContent":["// src/util/firestore.util.ts\nimport { Timestamp } from \"@google-cloud/firestore\";\nvar FirestoreRawService = class {\n static forceTimestamp(data) {\n if (!data) return null;\n try {\n const d = data.toDate();\n return Timestamp.fromDate(d);\n } catch (e) {\n try {\n return new Timestamp(data.seconds, data.nanoseconds);\n } catch (e2) {\n return null;\n }\n }\n }\n};\nvar forceTimestamp = (data) => FirestoreRawService.forceTimestamp(data);\nexport {\n FirestoreRawService,\n forceTimestamp\n};\n","import {Timestamp} from \"@google-cloud/firestore\";\n\nexport class FirestoreRawService {\n public static forceTimestamp(data?: Timestamp | null) {\n if (!data) return null;\n try {\n const d = data.toDate();\n return Timestamp.fromDate(d)\n } catch (e) {\n try {\n return new Timestamp(data.seconds, data.nanoseconds);\n } catch (e) {\n return null\n }\n }\n }\n}\n\nexport const forceTimestamp = (data: Timestamp) => FirestoreRawService.forceTimestamp(data)\n"]}
|