@xyo-network/payload-mongodb 2.84.3 → 2.85.0
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/Mappings/fromDbRepresentation.ts","../../src/Mappings/toDbRepresentation.ts"],"sourcesContent":["export * from './BoundWitness'\nexport * from './Mappings'\nexport * from './Payload'\n","import { BoundWitness, BoundWitnessFields, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { deepOmitPrefixedFields } from '@xyo-network/hash'\nimport { Payload, PayloadMetaFields } from '@xyo-network/payload-model'\n\nimport { BoundWitnessWithMongoMeta } from '../BoundWitness'\nimport { PayloadWithMongoMeta } from '../Payload'\n\nexport const payloadFromDbRepresentation = (value: PayloadWithMongoMeta): Payload<PayloadMetaFields> => {\n const { _$hash, _$meta, ...other } = value\n const sanitized = deepOmitPrefixedFields(other, '_')\n return { ...sanitized, $hash: _$hash, $meta: _$meta }\n}\n\nexport const boundWitnessFromDbRepresentation = (value: BoundWitnessWithMongoMeta): BoundWitness<BoundWitnessFields> => {\n const { _$hash, _$meta, ...other } = value\n const sanitized = deepOmitPrefixedFields(other, '_')\n return { ...sanitized, $hash: _$hash, $meta: _$meta } as unknown as BoundWitness<BoundWitnessFields>\n}\n\nexport const fromDbRepresentation = <T = PayloadWithMongoMeta | BoundWitnessWithMongoMeta>(value: T) => {\n return isBoundWitness(value)
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/Mappings/fromDbRepresentation.ts","../../src/Mappings/toDbRepresentation.ts"],"sourcesContent":["export * from './BoundWitness'\nexport * from './Mappings'\nexport * from './Payload'\n","import { BoundWitness, BoundWitnessFields, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { deepOmitPrefixedFields } from '@xyo-network/hash'\nimport { Payload, PayloadMetaFields } from '@xyo-network/payload-model'\n\nimport { BoundWitnessWithMongoMeta } from '../BoundWitness'\nimport { PayloadWithMongoMeta } from '../Payload'\n\nexport const payloadFromDbRepresentation = (value: PayloadWithMongoMeta): Payload<PayloadMetaFields> => {\n const { _$hash, _$meta, ...other } = value\n const sanitized = deepOmitPrefixedFields(other, '_')\n return { ...sanitized, $hash: _$hash, $meta: _$meta }\n}\n\nexport const boundWitnessFromDbRepresentation = (value: BoundWitnessWithMongoMeta): BoundWitness<BoundWitnessFields> => {\n const { _$hash, _$meta, ...other } = value\n const sanitized = deepOmitPrefixedFields(other, '_')\n return { ...sanitized, $hash: _$hash, $meta: _$meta } as unknown as BoundWitness<BoundWitnessFields>\n}\n\nexport const fromDbRepresentation = <T = PayloadWithMongoMeta | BoundWitnessWithMongoMeta>(value: T) => {\n return isBoundWitness(value) ?\n (boundWitnessFromDbRepresentation(value as unknown as BoundWitnessWithMongoMeta) as BoundWitness<BoundWitnessFields>)\n : (payloadFromDbRepresentation(value as PayloadWithMongoMeta) as Payload<PayloadMetaFields>)\n}\n","import { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { BoundWitnessMongoMeta } from '../BoundWitness'\nimport { PayloadWithMongoMeta } from '../Payload'\n\nexport const payloadToDbRepresentation = async <T extends Payload>(payload: T): Promise<PayloadWithMongoMeta<T>> => {\n const built = await PayloadBuilder.build(payload)\n const _hash = await PayloadBuilder.hash(built)\n const { $hash, $meta, ...fields } = built\n return { ...fields, _$hash: $hash, _$meta: $meta, _hash, _timestamp: Date.now() } as PayloadWithMongoMeta<T>\n}\n\nexport const boundWitnessToDbRepresentation = async <T extends BoundWitness>(payload: T): Promise<BoundWitnessMongoMeta<T>> => {\n const built = await PayloadBuilder.build(payload)\n const _hash = await PayloadBuilder.hash(built)\n const { $hash, $meta, ...fields } = built\n return { ...fields, _$hash: $hash, _$meta: $meta, _hash, _timestamp: Date.now() } as unknown as BoundWitnessMongoMeta<T>\n}\n\nexport const toDbRepresentation = <T extends Payload | BoundWitness>(value: T) => {\n return isBoundWitness(value) ? boundWitnessToDbRepresentation(value) : payloadToDbRepresentation(value)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;ACAA,gCAAiE;AACjE,kBAAuC;AAMhC,IAAMA,8BAA8B,wBAACC,UAAAA;AAC1C,QAAM,EAAEC,QAAQC,QAAQ,GAAGC,MAAAA,IAAUH;AACrC,QAAMI,gBAAYC,oCAAuBF,OAAO,GAAA;AAChD,SAAO;IAAE,GAAGC;IAAWE,OAAOL;IAAQM,OAAOL;EAAO;AACtD,GAJ2C;AAMpC,IAAMM,mCAAmC,wBAACR,UAAAA;AAC/C,QAAM,EAAEC,QAAQC,QAAQ,GAAGC,MAAAA,IAAUH;AACrC,QAAMI,gBAAYC,oCAAuBF,OAAO,GAAA;AAChD,SAAO;IAAE,GAAGC;IAAWE,OAAOL;IAAQM,OAAOL;EAAO;AACtD,GAJgD;AAMzC,IAAMO,uBAAuB,wBAAuDT,UAAAA;AACzF,aAAOU,0CAAeV,KAAAA,IACjBQ,iCAAiCR,KAAAA,IACjCD,4BAA4BC,KAAAA;AACnC,GAJoC;;;ACnBpC,IAAAW,6BAA6C;AAC7C,6BAA+B;AAMxB,IAAMC,4BAA4B,8BAA0BC,YAAAA;AACjE,QAAMC,QAAQ,MAAMC,sCAAeC,MAAMH,OAAAA;AACzC,QAAMI,QAAQ,MAAMF,sCAAeG,KAAKJ,KAAAA;AACxC,QAAM,EAAEK,OAAOC,OAAO,GAAGC,OAAAA,IAAWP;AACpC,SAAO;IAAE,GAAGO;IAAQC,QAAQH;IAAOI,QAAQH;IAAOH;IAAOO,YAAYC,KAAKC,IAAG;EAAG;AAClF,GALyC;AAOlC,IAAMC,iCAAiC,8BAA+Bd,YAAAA;AAC3E,QAAMC,QAAQ,MAAMC,sCAAeC,MAAMH,OAAAA;AACzC,QAAMI,QAAQ,MAAMF,sCAAeG,KAAKJ,KAAAA;AACxC,QAAM,EAAEK,OAAOC,OAAO,GAAGC,OAAAA,IAAWP;AACpC,SAAO;IAAE,GAAGO;IAAQC,QAAQH;IAAOI,QAAQH;IAAOH;IAAOO,YAAYC,KAAKC,IAAG;EAAG;AAClF,GAL8C;AAOvC,IAAME,qBAAqB,wBAAmCC,UAAAA;AACnE,aAAOC,2CAAeD,KAAAA,IAASF,+BAA+BE,KAAAA,IAASjB,0BAA0BiB,KAAAA;AACnG,GAFkC;","names":["payloadFromDbRepresentation","value","_$hash","_$meta","other","sanitized","deepOmitPrefixedFields","$hash","$meta","boundWitnessFromDbRepresentation","fromDbRepresentation","isBoundWitness","import_boundwitness_model","payloadToDbRepresentation","payload","built","PayloadBuilder","build","_hash","hash","$hash","$meta","fields","_$hash","_$meta","_timestamp","Date","now","boundWitnessToDbRepresentation","toDbRepresentation","value","isBoundWitness"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Mappings/fromDbRepresentation.ts","../../src/Mappings/toDbRepresentation.ts"],"sourcesContent":["import { BoundWitness, BoundWitnessFields, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { deepOmitPrefixedFields } from '@xyo-network/hash'\nimport { Payload, PayloadMetaFields } from '@xyo-network/payload-model'\n\nimport { BoundWitnessWithMongoMeta } from '../BoundWitness'\nimport { PayloadWithMongoMeta } from '../Payload'\n\nexport const payloadFromDbRepresentation = (value: PayloadWithMongoMeta): Payload<PayloadMetaFields> => {\n const { _$hash, _$meta, ...other } = value\n const sanitized = deepOmitPrefixedFields(other, '_')\n return { ...sanitized, $hash: _$hash, $meta: _$meta }\n}\n\nexport const boundWitnessFromDbRepresentation = (value: BoundWitnessWithMongoMeta): BoundWitness<BoundWitnessFields> => {\n const { _$hash, _$meta, ...other } = value\n const sanitized = deepOmitPrefixedFields(other, '_')\n return { ...sanitized, $hash: _$hash, $meta: _$meta } as unknown as BoundWitness<BoundWitnessFields>\n}\n\nexport const fromDbRepresentation = <T = PayloadWithMongoMeta | BoundWitnessWithMongoMeta>(value: T) => {\n return isBoundWitness(value)
|
|
1
|
+
{"version":3,"sources":["../../src/Mappings/fromDbRepresentation.ts","../../src/Mappings/toDbRepresentation.ts"],"sourcesContent":["import { BoundWitness, BoundWitnessFields, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { deepOmitPrefixedFields } from '@xyo-network/hash'\nimport { Payload, PayloadMetaFields } from '@xyo-network/payload-model'\n\nimport { BoundWitnessWithMongoMeta } from '../BoundWitness'\nimport { PayloadWithMongoMeta } from '../Payload'\n\nexport const payloadFromDbRepresentation = (value: PayloadWithMongoMeta): Payload<PayloadMetaFields> => {\n const { _$hash, _$meta, ...other } = value\n const sanitized = deepOmitPrefixedFields(other, '_')\n return { ...sanitized, $hash: _$hash, $meta: _$meta }\n}\n\nexport const boundWitnessFromDbRepresentation = (value: BoundWitnessWithMongoMeta): BoundWitness<BoundWitnessFields> => {\n const { _$hash, _$meta, ...other } = value\n const sanitized = deepOmitPrefixedFields(other, '_')\n return { ...sanitized, $hash: _$hash, $meta: _$meta } as unknown as BoundWitness<BoundWitnessFields>\n}\n\nexport const fromDbRepresentation = <T = PayloadWithMongoMeta | BoundWitnessWithMongoMeta>(value: T) => {\n return isBoundWitness(value) ?\n (boundWitnessFromDbRepresentation(value as unknown as BoundWitnessWithMongoMeta) as BoundWitness<BoundWitnessFields>)\n : (payloadFromDbRepresentation(value as PayloadWithMongoMeta) as Payload<PayloadMetaFields>)\n}\n","import { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { BoundWitnessMongoMeta } from '../BoundWitness'\nimport { PayloadWithMongoMeta } from '../Payload'\n\nexport const payloadToDbRepresentation = async <T extends Payload>(payload: T): Promise<PayloadWithMongoMeta<T>> => {\n const built = await PayloadBuilder.build(payload)\n const _hash = await PayloadBuilder.hash(built)\n const { $hash, $meta, ...fields } = built\n return { ...fields, _$hash: $hash, _$meta: $meta, _hash, _timestamp: Date.now() } as PayloadWithMongoMeta<T>\n}\n\nexport const boundWitnessToDbRepresentation = async <T extends BoundWitness>(payload: T): Promise<BoundWitnessMongoMeta<T>> => {\n const built = await PayloadBuilder.build(payload)\n const _hash = await PayloadBuilder.hash(built)\n const { $hash, $meta, ...fields } = built\n return { ...fields, _$hash: $hash, _$meta: $meta, _hash, _timestamp: Date.now() } as unknown as BoundWitnessMongoMeta<T>\n}\n\nexport const toDbRepresentation = <T extends Payload | BoundWitness>(value: T) => {\n return isBoundWitness(value) ? boundWitnessToDbRepresentation(value) : payloadToDbRepresentation(value)\n}\n"],"mappings":";;;;AAAA,SAA2CA,sBAAsB;AACjE,SAASC,8BAA8B;AAMhC,IAAMC,8BAA8B,wBAACC,UAAAA;AAC1C,QAAM,EAAEC,QAAQC,QAAQ,GAAGC,MAAAA,IAAUH;AACrC,QAAMI,YAAYC,uBAAuBF,OAAO,GAAA;AAChD,SAAO;IAAE,GAAGC;IAAWE,OAAOL;IAAQM,OAAOL;EAAO;AACtD,GAJ2C;AAMpC,IAAMM,mCAAmC,wBAACR,UAAAA;AAC/C,QAAM,EAAEC,QAAQC,QAAQ,GAAGC,MAAAA,IAAUH;AACrC,QAAMI,YAAYC,uBAAuBF,OAAO,GAAA;AAChD,SAAO;IAAE,GAAGC;IAAWE,OAAOL;IAAQM,OAAOL;EAAO;AACtD,GAJgD;AAMzC,IAAMO,uBAAuB,wBAAuDT,UAAAA;AACzF,SAAOU,eAAeV,KAAAA,IACjBQ,iCAAiCR,KAAAA,IACjCD,4BAA4BC,KAAAA;AACnC,GAJoC;;;ACnBpC,SAAuBW,kBAAAA,uBAAsB;AAC7C,SAASC,sBAAsB;AAMxB,IAAMC,4BAA4B,8BAA0BC,YAAAA;AACjE,QAAMC,QAAQ,MAAMC,eAAeC,MAAMH,OAAAA;AACzC,QAAMI,QAAQ,MAAMF,eAAeG,KAAKJ,KAAAA;AACxC,QAAM,EAAEK,OAAOC,OAAO,GAAGC,OAAAA,IAAWP;AACpC,SAAO;IAAE,GAAGO;IAAQC,QAAQH;IAAOI,QAAQH;IAAOH;IAAOO,YAAYC,KAAKC,IAAG;EAAG;AAClF,GALyC;AAOlC,IAAMC,iCAAiC,8BAA+Bd,YAAAA;AAC3E,QAAMC,QAAQ,MAAMC,eAAeC,MAAMH,OAAAA;AACzC,QAAMI,QAAQ,MAAMF,eAAeG,KAAKJ,KAAAA;AACxC,QAAM,EAAEK,OAAOC,OAAO,GAAGC,OAAAA,IAAWP;AACpC,SAAO;IAAE,GAAGO;IAAQC,QAAQH;IAAOI,QAAQH;IAAOH;IAAOO,YAAYC,KAAKC,IAAG;EAAG;AAClF,GAL8C;AAOvC,IAAME,qBAAqB,wBAAmCC,UAAAA;AACnE,SAAOC,gBAAeD,KAAAA,IAASF,+BAA+BE,KAAAA,IAASjB,0BAA0BiB,KAAAA;AACnG,GAFkC;","names":["isBoundWitness","deepOmitPrefixedFields","payloadFromDbRepresentation","value","_$hash","_$meta","other","sanitized","deepOmitPrefixedFields","$hash","$meta","boundWitnessFromDbRepresentation","fromDbRepresentation","isBoundWitness","isBoundWitness","PayloadBuilder","payloadToDbRepresentation","payload","built","PayloadBuilder","build","_hash","hash","$hash","$meta","fields","_$hash","_$meta","_timestamp","Date","now","boundWitnessToDbRepresentation","toDbRepresentation","value","isBoundWitness"]}
|
package/dist/node/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/Mappings/fromDbRepresentation.ts","../../src/Mappings/toDbRepresentation.ts"],"sourcesContent":["export * from './BoundWitness'\nexport * from './Mappings'\nexport * from './Payload'\n","import { BoundWitness, BoundWitnessFields, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { deepOmitPrefixedFields } from '@xyo-network/hash'\nimport { Payload, PayloadMetaFields } from '@xyo-network/payload-model'\n\nimport { BoundWitnessWithMongoMeta } from '../BoundWitness'\nimport { PayloadWithMongoMeta } from '../Payload'\n\nexport const payloadFromDbRepresentation = (value: PayloadWithMongoMeta): Payload<PayloadMetaFields> => {\n const { _$hash, _$meta, ...other } = value\n const sanitized = deepOmitPrefixedFields(other, '_')\n return { ...sanitized, $hash: _$hash, $meta: _$meta }\n}\n\nexport const boundWitnessFromDbRepresentation = (value: BoundWitnessWithMongoMeta): BoundWitness<BoundWitnessFields> => {\n const { _$hash, _$meta, ...other } = value\n const sanitized = deepOmitPrefixedFields(other, '_')\n return { ...sanitized, $hash: _$hash, $meta: _$meta } as unknown as BoundWitness<BoundWitnessFields>\n}\n\nexport const fromDbRepresentation = <T = PayloadWithMongoMeta | BoundWitnessWithMongoMeta>(value: T) => {\n return isBoundWitness(value)
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/Mappings/fromDbRepresentation.ts","../../src/Mappings/toDbRepresentation.ts"],"sourcesContent":["export * from './BoundWitness'\nexport * from './Mappings'\nexport * from './Payload'\n","import { BoundWitness, BoundWitnessFields, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { deepOmitPrefixedFields } from '@xyo-network/hash'\nimport { Payload, PayloadMetaFields } from '@xyo-network/payload-model'\n\nimport { BoundWitnessWithMongoMeta } from '../BoundWitness'\nimport { PayloadWithMongoMeta } from '../Payload'\n\nexport const payloadFromDbRepresentation = (value: PayloadWithMongoMeta): Payload<PayloadMetaFields> => {\n const { _$hash, _$meta, ...other } = value\n const sanitized = deepOmitPrefixedFields(other, '_')\n return { ...sanitized, $hash: _$hash, $meta: _$meta }\n}\n\nexport const boundWitnessFromDbRepresentation = (value: BoundWitnessWithMongoMeta): BoundWitness<BoundWitnessFields> => {\n const { _$hash, _$meta, ...other } = value\n const sanitized = deepOmitPrefixedFields(other, '_')\n return { ...sanitized, $hash: _$hash, $meta: _$meta } as unknown as BoundWitness<BoundWitnessFields>\n}\n\nexport const fromDbRepresentation = <T = PayloadWithMongoMeta | BoundWitnessWithMongoMeta>(value: T) => {\n return isBoundWitness(value) ?\n (boundWitnessFromDbRepresentation(value as unknown as BoundWitnessWithMongoMeta) as BoundWitness<BoundWitnessFields>)\n : (payloadFromDbRepresentation(value as PayloadWithMongoMeta) as Payload<PayloadMetaFields>)\n}\n","import { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { BoundWitnessMongoMeta } from '../BoundWitness'\nimport { PayloadWithMongoMeta } from '../Payload'\n\nexport const payloadToDbRepresentation = async <T extends Payload>(payload: T): Promise<PayloadWithMongoMeta<T>> => {\n const built = await PayloadBuilder.build(payload)\n const _hash = await PayloadBuilder.hash(built)\n const { $hash, $meta, ...fields } = built\n return { ...fields, _$hash: $hash, _$meta: $meta, _hash, _timestamp: Date.now() } as PayloadWithMongoMeta<T>\n}\n\nexport const boundWitnessToDbRepresentation = async <T extends BoundWitness>(payload: T): Promise<BoundWitnessMongoMeta<T>> => {\n const built = await PayloadBuilder.build(payload)\n const _hash = await PayloadBuilder.hash(built)\n const { $hash, $meta, ...fields } = built\n return { ...fields, _$hash: $hash, _$meta: $meta, _hash, _timestamp: Date.now() } as unknown as BoundWitnessMongoMeta<T>\n}\n\nexport const toDbRepresentation = <T extends Payload | BoundWitness>(value: T) => {\n return isBoundWitness(value) ? boundWitnessToDbRepresentation(value) : payloadToDbRepresentation(value)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;ACAA,gCAAiE;AACjE,kBAAuC;AAMhC,IAAMA,8BAA8B,wBAACC,UAAAA;AAC1C,QAAM,EAAEC,QAAQC,QAAQ,GAAGC,MAAAA,IAAUH;AACrC,QAAMI,gBAAYC,oCAAuBF,OAAO,GAAA;AAChD,SAAO;IAAE,GAAGC;IAAWE,OAAOL;IAAQM,OAAOL;EAAO;AACtD,GAJ2C;AAMpC,IAAMM,mCAAmC,wBAACR,UAAAA;AAC/C,QAAM,EAAEC,QAAQC,QAAQ,GAAGC,MAAAA,IAAUH;AACrC,QAAMI,gBAAYC,oCAAuBF,OAAO,GAAA;AAChD,SAAO;IAAE,GAAGC;IAAWE,OAAOL;IAAQM,OAAOL;EAAO;AACtD,GAJgD;AAMzC,IAAMO,uBAAuB,wBAAuDT,UAAAA;AACzF,aAAOU,0CAAeV,KAAAA,IACjBQ,iCAAiCR,KAAAA,IACjCD,4BAA4BC,KAAAA;AACnC,GAJoC;;;ACnBpC,IAAAW,6BAA6C;AAC7C,6BAA+B;AAMxB,IAAMC,4BAA4B,8BAA0BC,YAAAA;AACjE,QAAMC,QAAQ,MAAMC,sCAAeC,MAAMH,OAAAA;AACzC,QAAMI,QAAQ,MAAMF,sCAAeG,KAAKJ,KAAAA;AACxC,QAAM,EAAEK,OAAOC,OAAO,GAAGC,OAAAA,IAAWP;AACpC,SAAO;IAAE,GAAGO;IAAQC,QAAQH;IAAOI,QAAQH;IAAOH;IAAOO,YAAYC,KAAKC,IAAG;EAAG;AAClF,GALyC;AAOlC,IAAMC,iCAAiC,8BAA+Bd,YAAAA;AAC3E,QAAMC,QAAQ,MAAMC,sCAAeC,MAAMH,OAAAA;AACzC,QAAMI,QAAQ,MAAMF,sCAAeG,KAAKJ,KAAAA;AACxC,QAAM,EAAEK,OAAOC,OAAO,GAAGC,OAAAA,IAAWP;AACpC,SAAO;IAAE,GAAGO;IAAQC,QAAQH;IAAOI,QAAQH;IAAOH;IAAOO,YAAYC,KAAKC,IAAG;EAAG;AAClF,GAL8C;AAOvC,IAAME,qBAAqB,wBAAmCC,UAAAA;AACnE,aAAOC,2CAAeD,KAAAA,IAASF,+BAA+BE,KAAAA,IAASjB,0BAA0BiB,KAAAA;AACnG,GAFkC;","names":["payloadFromDbRepresentation","value","_$hash","_$meta","other","sanitized","deepOmitPrefixedFields","$hash","$meta","boundWitnessFromDbRepresentation","fromDbRepresentation","isBoundWitness","import_boundwitness_model","payloadToDbRepresentation","payload","built","PayloadBuilder","build","_hash","hash","$hash","$meta","fields","_$hash","_$meta","_timestamp","Date","now","boundWitnessToDbRepresentation","toDbRepresentation","value","isBoundWitness"]}
|
package/dist/node/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Mappings/fromDbRepresentation.ts","../../src/Mappings/toDbRepresentation.ts"],"sourcesContent":["import { BoundWitness, BoundWitnessFields, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { deepOmitPrefixedFields } from '@xyo-network/hash'\nimport { Payload, PayloadMetaFields } from '@xyo-network/payload-model'\n\nimport { BoundWitnessWithMongoMeta } from '../BoundWitness'\nimport { PayloadWithMongoMeta } from '../Payload'\n\nexport const payloadFromDbRepresentation = (value: PayloadWithMongoMeta): Payload<PayloadMetaFields> => {\n const { _$hash, _$meta, ...other } = value\n const sanitized = deepOmitPrefixedFields(other, '_')\n return { ...sanitized, $hash: _$hash, $meta: _$meta }\n}\n\nexport const boundWitnessFromDbRepresentation = (value: BoundWitnessWithMongoMeta): BoundWitness<BoundWitnessFields> => {\n const { _$hash, _$meta, ...other } = value\n const sanitized = deepOmitPrefixedFields(other, '_')\n return { ...sanitized, $hash: _$hash, $meta: _$meta } as unknown as BoundWitness<BoundWitnessFields>\n}\n\nexport const fromDbRepresentation = <T = PayloadWithMongoMeta | BoundWitnessWithMongoMeta>(value: T) => {\n return isBoundWitness(value)
|
|
1
|
+
{"version":3,"sources":["../../src/Mappings/fromDbRepresentation.ts","../../src/Mappings/toDbRepresentation.ts"],"sourcesContent":["import { BoundWitness, BoundWitnessFields, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { deepOmitPrefixedFields } from '@xyo-network/hash'\nimport { Payload, PayloadMetaFields } from '@xyo-network/payload-model'\n\nimport { BoundWitnessWithMongoMeta } from '../BoundWitness'\nimport { PayloadWithMongoMeta } from '../Payload'\n\nexport const payloadFromDbRepresentation = (value: PayloadWithMongoMeta): Payload<PayloadMetaFields> => {\n const { _$hash, _$meta, ...other } = value\n const sanitized = deepOmitPrefixedFields(other, '_')\n return { ...sanitized, $hash: _$hash, $meta: _$meta }\n}\n\nexport const boundWitnessFromDbRepresentation = (value: BoundWitnessWithMongoMeta): BoundWitness<BoundWitnessFields> => {\n const { _$hash, _$meta, ...other } = value\n const sanitized = deepOmitPrefixedFields(other, '_')\n return { ...sanitized, $hash: _$hash, $meta: _$meta } as unknown as BoundWitness<BoundWitnessFields>\n}\n\nexport const fromDbRepresentation = <T = PayloadWithMongoMeta | BoundWitnessWithMongoMeta>(value: T) => {\n return isBoundWitness(value) ?\n (boundWitnessFromDbRepresentation(value as unknown as BoundWitnessWithMongoMeta) as BoundWitness<BoundWitnessFields>)\n : (payloadFromDbRepresentation(value as PayloadWithMongoMeta) as Payload<PayloadMetaFields>)\n}\n","import { BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { BoundWitnessMongoMeta } from '../BoundWitness'\nimport { PayloadWithMongoMeta } from '../Payload'\n\nexport const payloadToDbRepresentation = async <T extends Payload>(payload: T): Promise<PayloadWithMongoMeta<T>> => {\n const built = await PayloadBuilder.build(payload)\n const _hash = await PayloadBuilder.hash(built)\n const { $hash, $meta, ...fields } = built\n return { ...fields, _$hash: $hash, _$meta: $meta, _hash, _timestamp: Date.now() } as PayloadWithMongoMeta<T>\n}\n\nexport const boundWitnessToDbRepresentation = async <T extends BoundWitness>(payload: T): Promise<BoundWitnessMongoMeta<T>> => {\n const built = await PayloadBuilder.build(payload)\n const _hash = await PayloadBuilder.hash(built)\n const { $hash, $meta, ...fields } = built\n return { ...fields, _$hash: $hash, _$meta: $meta, _hash, _timestamp: Date.now() } as unknown as BoundWitnessMongoMeta<T>\n}\n\nexport const toDbRepresentation = <T extends Payload | BoundWitness>(value: T) => {\n return isBoundWitness(value) ? boundWitnessToDbRepresentation(value) : payloadToDbRepresentation(value)\n}\n"],"mappings":";;;;AAAA,SAA2CA,sBAAsB;AACjE,SAASC,8BAA8B;AAMhC,IAAMC,8BAA8B,wBAACC,UAAAA;AAC1C,QAAM,EAAEC,QAAQC,QAAQ,GAAGC,MAAAA,IAAUH;AACrC,QAAMI,YAAYC,uBAAuBF,OAAO,GAAA;AAChD,SAAO;IAAE,GAAGC;IAAWE,OAAOL;IAAQM,OAAOL;EAAO;AACtD,GAJ2C;AAMpC,IAAMM,mCAAmC,wBAACR,UAAAA;AAC/C,QAAM,EAAEC,QAAQC,QAAQ,GAAGC,MAAAA,IAAUH;AACrC,QAAMI,YAAYC,uBAAuBF,OAAO,GAAA;AAChD,SAAO;IAAE,GAAGC;IAAWE,OAAOL;IAAQM,OAAOL;EAAO;AACtD,GAJgD;AAMzC,IAAMO,uBAAuB,wBAAuDT,UAAAA;AACzF,SAAOU,eAAeV,KAAAA,IACjBQ,iCAAiCR,KAAAA,IACjCD,4BAA4BC,KAAAA;AACnC,GAJoC;;;ACnBpC,SAAuBW,kBAAAA,uBAAsB;AAC7C,SAASC,sBAAsB;AAMxB,IAAMC,4BAA4B,8BAA0BC,YAAAA;AACjE,QAAMC,QAAQ,MAAMC,eAAeC,MAAMH,OAAAA;AACzC,QAAMI,QAAQ,MAAMF,eAAeG,KAAKJ,KAAAA;AACxC,QAAM,EAAEK,OAAOC,OAAO,GAAGC,OAAAA,IAAWP;AACpC,SAAO;IAAE,GAAGO;IAAQC,QAAQH;IAAOI,QAAQH;IAAOH;IAAOO,YAAYC,KAAKC,IAAG;EAAG;AAClF,GALyC;AAOlC,IAAMC,iCAAiC,8BAA+Bd,YAAAA;AAC3E,QAAMC,QAAQ,MAAMC,eAAeC,MAAMH,OAAAA;AACzC,QAAMI,QAAQ,MAAMF,eAAeG,KAAKJ,KAAAA;AACxC,QAAM,EAAEK,OAAOC,OAAO,GAAGC,OAAAA,IAAWP;AACpC,SAAO;IAAE,GAAGO;IAAQC,QAAQH;IAAOI,QAAQH;IAAOH;IAAOO,YAAYC,KAAKC,IAAG;EAAG;AAClF,GAL8C;AAOvC,IAAME,qBAAqB,wBAAmCC,UAAAA;AACnE,SAAOC,gBAAeD,KAAAA,IAASF,+BAA+BE,KAAAA,IAASjB,0BAA0BiB,KAAAA;AACnG,GAFkC;","names":["isBoundWitness","deepOmitPrefixedFields","payloadFromDbRepresentation","value","_$hash","_$meta","other","sanitized","deepOmitPrefixedFields","$hash","$meta","boundWitnessFromDbRepresentation","fromDbRepresentation","isBoundWitness","isBoundWitness","PayloadBuilder","payloadToDbRepresentation","payload","built","PayloadBuilder","build","_hash","hash","$hash","$meta","fields","_$hash","_$meta","_timestamp","Date","now","boundWitnessToDbRepresentation","toDbRepresentation","value","isBoundWitness"]}
|
package/package.json
CHANGED
|
@@ -10,16 +10,16 @@
|
|
|
10
10
|
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@xylabs/hex": "^
|
|
14
|
-
"@xylabs/object": "^
|
|
15
|
-
"@xyo-network/boundwitness-model": "^2.
|
|
16
|
-
"@xyo-network/hash": "^2.
|
|
17
|
-
"@xyo-network/payload-builder": "^2.
|
|
18
|
-
"@xyo-network/payload-model": "^2.
|
|
13
|
+
"@xylabs/hex": "^3.0.1",
|
|
14
|
+
"@xylabs/object": "^3.0.1",
|
|
15
|
+
"@xyo-network/boundwitness-model": "^2.91.0",
|
|
16
|
+
"@xyo-network/hash": "^2.91.0",
|
|
17
|
+
"@xyo-network/payload-builder": "^2.91.0",
|
|
18
|
+
"@xyo-network/payload-model": "^2.91.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@xylabs/ts-scripts-yarn3": "^3.
|
|
22
|
-
"@xylabs/tsconfig": "^3.
|
|
21
|
+
"@xylabs/ts-scripts-yarn3": "^3.4.1",
|
|
22
|
+
"@xylabs/tsconfig": "^3.4.1",
|
|
23
23
|
"fake-indexeddb": "^4.0.2",
|
|
24
24
|
"typescript": "^5.3.3"
|
|
25
25
|
},
|
|
@@ -62,6 +62,6 @@
|
|
|
62
62
|
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
|
|
63
63
|
},
|
|
64
64
|
"sideEffects": false,
|
|
65
|
-
"version": "2.
|
|
65
|
+
"version": "2.85.0",
|
|
66
66
|
"type": "module"
|
|
67
67
|
}
|
|
@@ -18,7 +18,7 @@ export const boundWitnessFromDbRepresentation = (value: BoundWitnessWithMongoMet
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export const fromDbRepresentation = <T = PayloadWithMongoMeta | BoundWitnessWithMongoMeta>(value: T) => {
|
|
21
|
-
return isBoundWitness(value)
|
|
22
|
-
|
|
21
|
+
return isBoundWitness(value) ?
|
|
22
|
+
(boundWitnessFromDbRepresentation(value as unknown as BoundWitnessWithMongoMeta) as BoundWitness<BoundWitnessFields>)
|
|
23
23
|
: (payloadFromDbRepresentation(value as PayloadWithMongoMeta) as Payload<PayloadMetaFields>)
|
|
24
24
|
}
|