Function deserialize

Deserializes a flat list of entries into full objects. Groups entries by a defined key (e.g. uuid or content_uuid) if present. Optionally applies a before hook to each entry before processing.

const objects = await deserialize(entries);
// objects => [{ a: 1, b: { c: 2 } }]
  • Parameters

    • serialized: {
          path: string;
          type: string;
          value: string;
          [meta: string]: any;
      }[]
    • opts: {
          before?: ((entry: {
              path: string;
              type: string;
              value: string;
              [meta: string]: any;
          }) => Promise<
              | undefined
              | null
              | false
              | Record<string, any>>);
          groupKey?: string;
          metaIdentifier?: string;
          metaObject?: boolean;
      } = {}
      • Optionalbefore?: ((entry: {
            path: string;
            type: string;
            value: string;
            [meta: string]: any;
        }) => Promise<
            | undefined
            | null
            | false
            | Record<string, any>>)
          • (entry): Promise<
                | undefined
                | null
                | false
                | Record<string, any>>
          • Parameters

            • entry: {
                  path: string;
                  type: string;
                  value: string;
                  [meta: string]: any;
              }
              • [meta: string]: any
              • path: string
              • type: string
              • value: string

            Returns Promise<
                | undefined
                | null
                | false
                | Record<string, any>>

      • OptionalgroupKey?: string
      • OptionalmetaIdentifier?: string
      • OptionalmetaObject?: boolean

    Returns Promise<Record<string, any>[]>