'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var sdkV6 = require('@cognite/sdk-v6');
var runtime = require('@genql/runtime');

/******************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */

var __assign = function() {
    __assign = Object.assign || function __assign(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};

function __awaiter(thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
}

function __generator(thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [op[0] & 2, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
}

var types = {
    "scalars": [
        3,
        5,
        6,
        7,
        8,
        9,
        10,
        22,
        23,
        25,
        75,
        77,
        79,
        81
    ],
    "types": {
        "Actor": {
            "name": [
                23
            ],
            "age": [
                8
            ],
            "favMovie": [
                17
            ],
            "obj": [
                10
            ],
            "spaceExternalId": [
                23
            ],
            "externalId": [
                7
            ],
            "__typename": [
                23
            ]
        },
        "ActorAggregateConnection": {
            "edges": [
                26
            ],
            "items": [
                30
            ],
            "pageInfo": [
                20
            ],
            "__typename": [
                23
            ]
        },
        "ActorConnection": {
            "edges": [
                32
            ],
            "items": [
                0
            ],
            "pageInfo": [
                20
            ],
            "__typename": [
                23
            ]
        },
        "Boolean": {},
        "DataPoint": {
            "timestamp": [
                25
            ],
            "value": [
                5
            ],
            "__typename": [
                23
            ]
        },
        "DataPointValue": {},
        "Float": {},
        "ID": {},
        "Int": {},
        "Int64": {},
        "JSONObject": {},
        "MachinePump": {
            "name": [
                23
            ],
            "description": [
                23
            ],
            "state": [
                23
            ],
            "weight": [
                8
            ],
            "isActive": [
                3
            ],
            "production_ts": [
                23
            ],
            "pressure_ts": [
                23
            ],
            "location_3dmr": [
                23
            ],
            "location_3dn": [
                23
            ],
            "pnid_file": [
                23
            ],
            "spaceExternalId": [
                23
            ],
            "externalId": [
                7
            ],
            "__typename": [
                23
            ]
        },
        "MachinePump2": {
            "name": [
                23
            ],
            "description": [
                23
            ],
            "state": [
                23
            ],
            "weight": [
                8
            ],
            "isActive": [
                3
            ],
            "production_ts": [
                23
            ],
            "pressure_ts": [
                23
            ],
            "location_3dmr": [
                23
            ],
            "location_3dn": [
                23
            ],
            "pnid_file": [
                23
            ],
            "spaceExternalId": [
                23
            ],
            "externalId": [
                7
            ],
            "__typename": [
                23
            ]
        },
        "MachinePump2AggregateConnection": {
            "edges": [
                51
            ],
            "items": [
                55
            ],
            "pageInfo": [
                20
            ],
            "__typename": [
                23
            ]
        },
        "MachinePump2Connection": {
            "edges": [
                57
            ],
            "items": [
                12
            ],
            "pageInfo": [
                20
            ],
            "__typename": [
                23
            ]
        },
        "MachinePumpAggregateConnection": {
            "edges": [
                59
            ],
            "items": [
                63
            ],
            "pageInfo": [
                20
            ],
            "__typename": [
                23
            ]
        },
        "MachinePumpConnection": {
            "edges": [
                65
            ],
            "items": [
                11
            ],
            "pageInfo": [
                20
            ],
            "__typename": [
                23
            ]
        },
        "Movie": {
            "name": [
                23
            ],
            "description": [
                23
            ],
            "watchedIt": [
                3
            ],
            "imdbRating": [
                6
            ],
            "releasedYear": [
                8
            ],
            "gross": [
                8
            ],
            "runTime": [
                8
            ],
            "actors": [
                2,
                {
                    "first": [
                        8
                    ],
                    "after": [
                        23
                    ],
                    "filter": [
                        40
                    ],
                    "sort": [
                        33,
                        "[_ActorSort!]"
                    ]
                }
            ],
            "spaceExternalId": [
                23
            ],
            "externalId": [
                7
            ],
            "__typename": [
                23
            ]
        },
        "MovieAggregateConnection": {
            "edges": [
                67
            ],
            "items": [
                71
            ],
            "pageInfo": [
                20
            ],
            "__typename": [
                23
            ]
        },
        "MovieConnection": {
            "edges": [
                73
            ],
            "items": [
                17
            ],
            "pageInfo": [
                20
            ],
            "__typename": [
                23
            ]
        },
        "PageInfo": {
            "hasPreviousPage": [
                3
            ],
            "hasNextPage": [
                3
            ],
            "startCursor": [
                23
            ],
            "endCursor": [
                23
            ],
            "__typename": [
                23
            ]
        },
        "Query": {
            "listActor": [
                2,
                {
                    "first": [
                        8
                    ],
                    "after": [
                        23
                    ],
                    "filter": [
                        40
                    ],
                    "sort": [
                        33,
                        "[_ActorSort!]"
                    ]
                }
            ],
            "searchActor": [
                2,
                {
                    "query": [
                        23,
                        "String!"
                    ],
                    "fields": [
                        75,
                        "[_SearchActorFields!]"
                    ],
                    "filter": [
                        76
                    ],
                    "first": [
                        8
                    ]
                }
            ],
            "aggregateActor": [
                1,
                {
                    "query": [
                        23
                    ],
                    "fields": [
                        75,
                        "[_SearchActorFields!]"
                    ],
                    "groupBy": [
                        75,
                        "[_SearchActorFields!]"
                    ],
                    "filter": [
                        76
                    ],
                    "after": [
                        23
                    ]
                }
            ],
            "listMovie": [
                19,
                {
                    "first": [
                        8
                    ],
                    "after": [
                        23
                    ],
                    "filter": [
                        48
                    ],
                    "sort": [
                        74,
                        "[_MovieSort!]"
                    ]
                }
            ],
            "searchMovie": [
                19,
                {
                    "query": [
                        23,
                        "String!"
                    ],
                    "fields": [
                        81,
                        "[_SearchMovieFields!]"
                    ],
                    "filter": [
                        82
                    ],
                    "first": [
                        8
                    ]
                }
            ],
            "aggregateMovie": [
                18,
                {
                    "query": [
                        23
                    ],
                    "fields": [
                        81,
                        "[_SearchMovieFields!]"
                    ],
                    "groupBy": [
                        81,
                        "[_SearchMovieFields!]"
                    ],
                    "filter": [
                        82
                    ],
                    "after": [
                        23
                    ]
                }
            ],
            "listMachinePump": [
                16,
                {
                    "first": [
                        8
                    ],
                    "after": [
                        23
                    ],
                    "filter": [
                        47
                    ],
                    "sort": [
                        66,
                        "[_MachinePumpSort!]"
                    ]
                }
            ],
            "searchMachinePump": [
                16,
                {
                    "query": [
                        23,
                        "String!"
                    ],
                    "fields": [
                        79,
                        "[_SearchMachinePumpFields!]"
                    ],
                    "filter": [
                        80
                    ],
                    "first": [
                        8
                    ]
                }
            ],
            "aggregateMachinePump": [
                15,
                {
                    "query": [
                        23
                    ],
                    "fields": [
                        79,
                        "[_SearchMachinePumpFields!]"
                    ],
                    "groupBy": [
                        79,
                        "[_SearchMachinePumpFields!]"
                    ],
                    "filter": [
                        80
                    ],
                    "after": [
                        23
                    ]
                }
            ],
            "listMachinePump2": [
                14,
                {
                    "first": [
                        8
                    ],
                    "after": [
                        23
                    ],
                    "filter": [
                        46
                    ],
                    "sort": [
                        58,
                        "[_MachinePump2Sort!]"
                    ]
                }
            ],
            "searchMachinePump2": [
                14,
                {
                    "query": [
                        23,
                        "String!"
                    ],
                    "fields": [
                        77,
                        "[_SearchMachinePump2Fields!]"
                    ],
                    "filter": [
                        78
                    ],
                    "first": [
                        8
                    ]
                }
            ],
            "aggregateMachinePump2": [
                13,
                {
                    "query": [
                        23
                    ],
                    "fields": [
                        77,
                        "[_SearchMachinePump2Fields!]"
                    ],
                    "groupBy": [
                        77,
                        "[_SearchMachinePump2Fields!]"
                    ],
                    "filter": [
                        78
                    ],
                    "after": [
                        23
                    ]
                }
            ],
            "__typename": [
                23
            ]
        },
        "SortDirection": {},
        "String": {},
        "TimeSeries": {
            "id": [
                9
            ],
            "externalId": [
                23
            ],
            "name": [
                23
            ],
            "isString": [
                3
            ],
            "metadata": [
                10
            ],
            "unit": [
                23
            ],
            "assetId": [
                9
            ],
            "isStep": [
                3
            ],
            "description": [
                23
            ],
            "securityCategories": [
                9
            ],
            "datasetId": [
                9
            ],
            "dataPoints": [
                4,
                {
                    "start": [
                        9
                    ],
                    "end": [
                        9
                    ],
                    "limit": [
                        8
                    ]
                }
            ],
            "__typename": [
                23
            ]
        },
        "Timestamp": {},
        "_ActorAggregateEdge": {
            "node": [
                30
            ],
            "cursor": [
                23
            ],
            "__typename": [
                23
            ]
        },
        "_ActorAggregateFieldCountResult": {
            "externalId": [
                8
            ],
            "name": [
                8
            ],
            "age": [
                8
            ],
            "favMovie": [
                8
            ],
            "obj": [
                8
            ],
            "__typename": [
                23
            ]
        },
        "_ActorAggregateFieldResult": {
            "age": [
                8
            ],
            "__typename": [
                23
            ]
        },
        "_ActorAggregateHistogramFieldResult": {
            "age": [
                34
            ],
            "__typename": [
                23
            ]
        },
        "_ActorAggregateResult": {
            "group": [
                10
            ],
            "avg": [
                31
            ],
            "min": [
                28
            ],
            "max": [
                28
            ],
            "count": [
                27
            ],
            "sum": [
                28
            ],
            "histogram": [
                29,
                {
                    "interval": [
                        8,
                        "Int!"
                    ]
                }
            ],
            "__typename": [
                23
            ]
        },
        "_ActorAvgAggregateFieldResult": {
            "age": [
                6
            ],
            "__typename": [
                23
            ]
        },
        "_ActorEdge": {
            "node": [
                0
            ],
            "cursor": [
                23
            ],
            "__typename": [
                23
            ]
        },
        "_ActorSort": {
            "externalId": [
                22
            ],
            "spaceExternalId": [
                22
            ],
            "name": [
                22
            ],
            "age": [
                22
            ],
            "__typename": [
                23
            ]
        },
        "_AggregateHistogramObjectType": {
            "start": [
                8
            ],
            "count": [
                8
            ],
            "__typename": [
                23
            ]
        },
        "_BooleanCondition": {
            "eq": [
                3
            ],
            "isNull": [
                3
            ],
            "in": [
                3
            ],
            "__typename": [
                23
            ]
        },
        "_FloatCondition": {
            "eq": [
                6
            ],
            "isNull": [
                3
            ],
            "in": [
                6
            ],
            "gt": [
                6
            ],
            "lt": [
                6
            ],
            "gte": [
                6
            ],
            "lte": [
                6
            ],
            "__typename": [
                23
            ]
        },
        "_IDCondition": {
            "eq": [
                7
            ],
            "isNull": [
                3
            ],
            "in": [
                7
            ],
            "__typename": [
                23
            ]
        },
        "_Int64Condition": {
            "eq": [
                9
            ],
            "isNull": [
                3
            ],
            "in": [
                9
            ],
            "gt": [
                9
            ],
            "lt": [
                9
            ],
            "gte": [
                9
            ],
            "lte": [
                9
            ],
            "__typename": [
                23
            ]
        },
        "_IntCondition": {
            "eq": [
                8
            ],
            "isNull": [
                3
            ],
            "in": [
                8
            ],
            "gt": [
                8
            ],
            "lt": [
                8
            ],
            "gte": [
                8
            ],
            "lte": [
                8
            ],
            "__typename": [
                23
            ]
        },
        "_ListActorFilter": {
            "and": [
                40
            ],
            "or": [
                40
            ],
            "not": [
                40
            ],
            "externalId": [
                37
            ],
            "spaceExternalId": [
                83
            ],
            "name": [
                83
            ],
            "age": [
                39
            ],
            "favMovie": [
                48
            ],
            "__typename": [
                23
            ]
        },
        "_ListBooleanFilter": {
            "containsAll": [
                3
            ],
            "containsAny": [
                3
            ],
            "__typename": [
                23
            ]
        },
        "_ListFloatFilter": {
            "containsAll": [
                6
            ],
            "containsAny": [
                6
            ],
            "__typename": [
                23
            ]
        },
        "_ListIDFilter": {
            "containsAll": [
                7
            ],
            "containsAny": [
                7
            ],
            "__typename": [
                23
            ]
        },
        "_ListInt64Filter": {
            "containsAll": [
                9
            ],
            "containsAny": [
                9
            ],
            "__typename": [
                23
            ]
        },
        "_ListIntFilter": {
            "containsAll": [
                8
            ],
            "containsAny": [
                8
            ],
            "__typename": [
                23
            ]
        },
        "_ListMachinePump2Filter": {
            "and": [
                46
            ],
            "or": [
                46
            ],
            "not": [
                46
            ],
            "externalId": [
                37
            ],
            "spaceExternalId": [
                83
            ],
            "name": [
                83
            ],
            "description": [
                83
            ],
            "state": [
                83
            ],
            "weight": [
                39
            ],
            "isActive": [
                35
            ],
            "production_ts": [
                83
            ],
            "pressure_ts": [
                83
            ],
            "location_3dmr": [
                83
            ],
            "location_3dn": [
                83
            ],
            "pnid_file": [
                83
            ],
            "__typename": [
                23
            ]
        },
        "_ListMachinePumpFilter": {
            "and": [
                47
            ],
            "or": [
                47
            ],
            "not": [
                47
            ],
            "externalId": [
                37
            ],
            "spaceExternalId": [
                83
            ],
            "name": [
                83
            ],
            "description": [
                83
            ],
            "state": [
                83
            ],
            "weight": [
                39
            ],
            "isActive": [
                35
            ],
            "production_ts": [
                83
            ],
            "pressure_ts": [
                83
            ],
            "location_3dmr": [
                83
            ],
            "location_3dn": [
                83
            ],
            "pnid_file": [
                83
            ],
            "__typename": [
                23
            ]
        },
        "_ListMovieFilter": {
            "and": [
                48
            ],
            "or": [
                48
            ],
            "not": [
                48
            ],
            "externalId": [
                37
            ],
            "spaceExternalId": [
                83
            ],
            "name": [
                83
            ],
            "description": [
                83
            ],
            "watchedIt": [
                35
            ],
            "imdbRating": [
                36
            ],
            "releasedYear": [
                39
            ],
            "gross": [
                39
            ],
            "runTime": [
                39
            ],
            "__typename": [
                23
            ]
        },
        "_ListStringFilter": {
            "containsAll": [
                23
            ],
            "containsAny": [
                23
            ],
            "__typename": [
                23
            ]
        },
        "_ListTimestampFilter": {
            "containsAll": [
                25
            ],
            "containsAny": [
                25
            ],
            "__typename": [
                23
            ]
        },
        "_MachinePump2AggregateEdge": {
            "node": [
                55
            ],
            "cursor": [
                23
            ],
            "__typename": [
                23
            ]
        },
        "_MachinePump2AggregateFieldCountResult": {
            "externalId": [
                8
            ],
            "name": [
                8
            ],
            "description": [
                8
            ],
            "state": [
                8
            ],
            "weight": [
                8
            ],
            "isActive": [
                8
            ],
            "production_ts": [
                8
            ],
            "pressure_ts": [
                8
            ],
            "location_3dmr": [
                8
            ],
            "location_3dn": [
                8
            ],
            "pnid_file": [
                8
            ],
            "__typename": [
                23
            ]
        },
        "_MachinePump2AggregateFieldResult": {
            "weight": [
                8
            ],
            "__typename": [
                23
            ]
        },
        "_MachinePump2AggregateHistogramFieldResult": {
            "weight": [
                34
            ],
            "__typename": [
                23
            ]
        },
        "_MachinePump2AggregateResult": {
            "group": [
                10
            ],
            "avg": [
                56
            ],
            "min": [
                53
            ],
            "max": [
                53
            ],
            "count": [
                52
            ],
            "sum": [
                53
            ],
            "histogram": [
                54,
                {
                    "interval": [
                        8,
                        "Int!"
                    ]
                }
            ],
            "__typename": [
                23
            ]
        },
        "_MachinePump2AvgAggregateFieldResult": {
            "weight": [
                6
            ],
            "__typename": [
                23
            ]
        },
        "_MachinePump2Edge": {
            "node": [
                12
            ],
            "cursor": [
                23
            ],
            "__typename": [
                23
            ]
        },
        "_MachinePump2Sort": {
            "externalId": [
                22
            ],
            "spaceExternalId": [
                22
            ],
            "name": [
                22
            ],
            "description": [
                22
            ],
            "state": [
                22
            ],
            "weight": [
                22
            ],
            "isActive": [
                22
            ],
            "production_ts": [
                22
            ],
            "pressure_ts": [
                22
            ],
            "location_3dmr": [
                22
            ],
            "location_3dn": [
                22
            ],
            "pnid_file": [
                22
            ],
            "__typename": [
                23
            ]
        },
        "_MachinePumpAggregateEdge": {
            "node": [
                63
            ],
            "cursor": [
                23
            ],
            "__typename": [
                23
            ]
        },
        "_MachinePumpAggregateFieldCountResult": {
            "externalId": [
                8
            ],
            "name": [
                8
            ],
            "description": [
                8
            ],
            "state": [
                8
            ],
            "weight": [
                8
            ],
            "isActive": [
                8
            ],
            "production_ts": [
                8
            ],
            "pressure_ts": [
                8
            ],
            "location_3dmr": [
                8
            ],
            "location_3dn": [
                8
            ],
            "pnid_file": [
                8
            ],
            "__typename": [
                23
            ]
        },
        "_MachinePumpAggregateFieldResult": {
            "weight": [
                8
            ],
            "__typename": [
                23
            ]
        },
        "_MachinePumpAggregateHistogramFieldResult": {
            "weight": [
                34
            ],
            "__typename": [
                23
            ]
        },
        "_MachinePumpAggregateResult": {
            "group": [
                10
            ],
            "avg": [
                64
            ],
            "min": [
                61
            ],
            "max": [
                61
            ],
            "count": [
                60
            ],
            "sum": [
                61
            ],
            "histogram": [
                62,
                {
                    "interval": [
                        8,
                        "Int!"
                    ]
                }
            ],
            "__typename": [
                23
            ]
        },
        "_MachinePumpAvgAggregateFieldResult": {
            "weight": [
                6
            ],
            "__typename": [
                23
            ]
        },
        "_MachinePumpEdge": {
            "node": [
                11
            ],
            "cursor": [
                23
            ],
            "__typename": [
                23
            ]
        },
        "_MachinePumpSort": {
            "externalId": [
                22
            ],
            "spaceExternalId": [
                22
            ],
            "name": [
                22
            ],
            "description": [
                22
            ],
            "state": [
                22
            ],
            "weight": [
                22
            ],
            "isActive": [
                22
            ],
            "production_ts": [
                22
            ],
            "pressure_ts": [
                22
            ],
            "location_3dmr": [
                22
            ],
            "location_3dn": [
                22
            ],
            "pnid_file": [
                22
            ],
            "__typename": [
                23
            ]
        },
        "_MovieAggregateEdge": {
            "node": [
                71
            ],
            "cursor": [
                23
            ],
            "__typename": [
                23
            ]
        },
        "_MovieAggregateFieldCountResult": {
            "externalId": [
                8
            ],
            "name": [
                8
            ],
            "description": [
                8
            ],
            "watchedIt": [
                8
            ],
            "imdbRating": [
                8
            ],
            "releasedYear": [
                8
            ],
            "gross": [
                8
            ],
            "runTime": [
                8
            ],
            "__typename": [
                23
            ]
        },
        "_MovieAggregateFieldResult": {
            "imdbRating": [
                6
            ],
            "releasedYear": [
                8
            ],
            "gross": [
                8
            ],
            "runTime": [
                8
            ],
            "__typename": [
                23
            ]
        },
        "_MovieAggregateHistogramFieldResult": {
            "imdbRating": [
                34
            ],
            "releasedYear": [
                34
            ],
            "gross": [
                34
            ],
            "runTime": [
                34
            ],
            "__typename": [
                23
            ]
        },
        "_MovieAggregateResult": {
            "group": [
                10
            ],
            "avg": [
                72
            ],
            "min": [
                69
            ],
            "max": [
                69
            ],
            "count": [
                68
            ],
            "sum": [
                69
            ],
            "histogram": [
                70,
                {
                    "interval": [
                        8,
                        "Int!"
                    ]
                }
            ],
            "__typename": [
                23
            ]
        },
        "_MovieAvgAggregateFieldResult": {
            "imdbRating": [
                6
            ],
            "releasedYear": [
                6
            ],
            "gross": [
                6
            ],
            "runTime": [
                6
            ],
            "__typename": [
                23
            ]
        },
        "_MovieEdge": {
            "node": [
                17
            ],
            "cursor": [
                23
            ],
            "__typename": [
                23
            ]
        },
        "_MovieSort": {
            "externalId": [
                22
            ],
            "spaceExternalId": [
                22
            ],
            "name": [
                22
            ],
            "description": [
                22
            ],
            "watchedIt": [
                22
            ],
            "imdbRating": [
                22
            ],
            "releasedYear": [
                22
            ],
            "gross": [
                22
            ],
            "runTime": [
                22
            ],
            "__typename": [
                23
            ]
        },
        "_SearchActorFields": {},
        "_SearchActorFilter": {
            "and": [
                76
            ],
            "or": [
                76
            ],
            "not": [
                76
            ],
            "externalId": [
                37
            ],
            "spaceExternalId": [
                83
            ],
            "name": [
                83
            ],
            "age": [
                39
            ],
            "__typename": [
                23
            ]
        },
        "_SearchMachinePump2Fields": {},
        "_SearchMachinePump2Filter": {
            "and": [
                78
            ],
            "or": [
                78
            ],
            "not": [
                78
            ],
            "externalId": [
                37
            ],
            "spaceExternalId": [
                83
            ],
            "name": [
                83
            ],
            "description": [
                83
            ],
            "state": [
                83
            ],
            "weight": [
                39
            ],
            "isActive": [
                35
            ],
            "production_ts": [
                83
            ],
            "pressure_ts": [
                83
            ],
            "location_3dmr": [
                83
            ],
            "location_3dn": [
                83
            ],
            "pnid_file": [
                83
            ],
            "__typename": [
                23
            ]
        },
        "_SearchMachinePumpFields": {},
        "_SearchMachinePumpFilter": {
            "and": [
                80
            ],
            "or": [
                80
            ],
            "not": [
                80
            ],
            "externalId": [
                37
            ],
            "spaceExternalId": [
                83
            ],
            "name": [
                83
            ],
            "description": [
                83
            ],
            "state": [
                83
            ],
            "weight": [
                39
            ],
            "isActive": [
                35
            ],
            "production_ts": [
                83
            ],
            "pressure_ts": [
                83
            ],
            "location_3dmr": [
                83
            ],
            "location_3dn": [
                83
            ],
            "pnid_file": [
                83
            ],
            "__typename": [
                23
            ]
        },
        "_SearchMovieFields": {},
        "_SearchMovieFilter": {
            "and": [
                82
            ],
            "or": [
                82
            ],
            "not": [
                82
            ],
            "externalId": [
                37
            ],
            "spaceExternalId": [
                83
            ],
            "name": [
                83
            ],
            "description": [
                83
            ],
            "watchedIt": [
                35
            ],
            "imdbRating": [
                36
            ],
            "releasedYear": [
                39
            ],
            "gross": [
                39
            ],
            "runTime": [
                39
            ],
            "__typename": [
                23
            ]
        },
        "_StringCondition": {
            "eq": [
                23
            ],
            "isNull": [
                3
            ],
            "in": [
                23
            ],
            "gt": [
                23
            ],
            "lt": [
                23
            ],
            "gte": [
                23
            ],
            "lte": [
                23
            ],
            "prefix": [
                23
            ],
            "__typename": [
                23
            ]
        },
        "_TimestampCondition": {
            "eq": [
                25
            ],
            "isNull": [
                3
            ],
            "in": [
                25
            ],
            "gt": [
                25
            ],
            "lt": [
                25
            ],
            "gte": [
                25
            ],
            "lte": [
                25
            ],
            "__typename": [
                23
            ]
        }
    }
};

var typeMap$1 = runtime.linkTypeMap(types);

var version$1 = '2.10.0';
runtime.assertSameVersion(version$1);

var generateQueryOp = function(fields) {
  return runtime.generateGraphqlOperation('query', typeMap$1.Query, fields)
};

const {
  linkTypeMap,
  createClient: createClientOriginal,
  generateGraphqlOperation,
  assertSameVersion,
} = require('@genql/runtime');
var typeMap = linkTypeMap(require('./types.cjs'));

var version = '2.10.0';
assertSameVersion(version);

module.exports.version = version;

module.exports.createClient = function(options) {
  options = options || {};
  var optionsCopy = {
    url:
      'https://greenfield.cognitedata.com/api/v1/projects/platypus/schema/api/moviedm/1/graphql',
    queryRoot: typeMap.Query,
    mutationRoot: typeMap.Mutation,
    subscriptionRoot: typeMap.Subscription,
  };
  for (var name in options) {
    optionsCopy[name] = options[name];
  }
  return createClientOriginal(optionsCopy)
};

module.exports.enumSortDirection = {
  ASC: 'ASC',
  DESC: 'DESC',
};

module.exports.enumSearchActorFields = {
  name: 'name',
  age: 'age',
  externalId: 'externalId',
  spaceExternalId: 'spaceExternalId',
};

module.exports.enumSearchMachinePump2Fields = {
  name: 'name',
  description: 'description',
  state: 'state',
  weight: 'weight',
  isActive: 'isActive',
  production_ts: 'production_ts',
  pressure_ts: 'pressure_ts',
  location_3dmr: 'location_3dmr',
  location_3dn: 'location_3dn',
  pnid_file: 'pnid_file',
  externalId: 'externalId',
  spaceExternalId: 'spaceExternalId',
};

module.exports.enumSearchMachinePumpFields = {
  name: 'name',
  description: 'description',
  state: 'state',
  weight: 'weight',
  isActive: 'isActive',
  production_ts: 'production_ts',
  pressure_ts: 'pressure_ts',
  location_3dmr: 'location_3dmr',
  location_3dn: 'location_3dn',
  pnid_file: 'pnid_file',
  externalId: 'externalId',
  spaceExternalId: 'spaceExternalId',
};

module.exports.enumSearchMovieFields = {
  name: 'name',
  description: 'description',
  watchedIt: 'watchedIt',
  imdbRating: 'imdbRating',
  releasedYear: 'releasedYear',
  gross: 'gross',
  runTime: 'runTime',
  externalId: 'externalId',
  spaceExternalId: 'spaceExternalId',
};

module.exports.generateQueryOp = function(fields) {
  return generateGraphqlOperation('query', typeMap.Query, fields)
};
module.exports.generateMutationOp = function(fields) {
  return generateGraphqlOperation('mutation', typeMap.Mutation, fields)
};
module.exports.generateSubscriptionOp = function(fields) {
  return generateGraphqlOperation('subscription', typeMap.Subscription, fields)
};
module.exports.everything = {
  __scalar: true,
};

var schemaExports = require('./guards.cjs');
for (var k in schemaExports) {
  module.exports[k] = schemaExports[k];
}

var Actor_possibleTypes = ['Actor'];
var isActor = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "isActor"');
    return Actor_possibleTypes.includes(obj.__typename);
};
var ActorAggregateConnection_possibleTypes = ['ActorAggregateConnection'];
var isActorAggregateConnection = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "isActorAggregateConnection"');
    return ActorAggregateConnection_possibleTypes.includes(obj.__typename);
};
var ActorConnection_possibleTypes = ['ActorConnection'];
var isActorConnection = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "isActorConnection"');
    return ActorConnection_possibleTypes.includes(obj.__typename);
};
var DataPoint_possibleTypes = ['DataPoint'];
var isDataPoint = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "isDataPoint"');
    return DataPoint_possibleTypes.includes(obj.__typename);
};
var MachinePump_possibleTypes = ['MachinePump'];
var isMachinePump = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "isMachinePump"');
    return MachinePump_possibleTypes.includes(obj.__typename);
};
var MachinePump2_possibleTypes = ['MachinePump2'];
var isMachinePump2 = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "isMachinePump2"');
    return MachinePump2_possibleTypes.includes(obj.__typename);
};
var MachinePump2AggregateConnection_possibleTypes = ['MachinePump2AggregateConnection'];
var isMachinePump2AggregateConnection = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "isMachinePump2AggregateConnection"');
    return MachinePump2AggregateConnection_possibleTypes.includes(obj.__typename);
};
var MachinePump2Connection_possibleTypes = ['MachinePump2Connection'];
var isMachinePump2Connection = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "isMachinePump2Connection"');
    return MachinePump2Connection_possibleTypes.includes(obj.__typename);
};
var MachinePumpAggregateConnection_possibleTypes = ['MachinePumpAggregateConnection'];
var isMachinePumpAggregateConnection = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "isMachinePumpAggregateConnection"');
    return MachinePumpAggregateConnection_possibleTypes.includes(obj.__typename);
};
var MachinePumpConnection_possibleTypes = ['MachinePumpConnection'];
var isMachinePumpConnection = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "isMachinePumpConnection"');
    return MachinePumpConnection_possibleTypes.includes(obj.__typename);
};
var Movie_possibleTypes = ['Movie'];
var isMovie = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "isMovie"');
    return Movie_possibleTypes.includes(obj.__typename);
};
var MovieAggregateConnection_possibleTypes = ['MovieAggregateConnection'];
var isMovieAggregateConnection = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "isMovieAggregateConnection"');
    return MovieAggregateConnection_possibleTypes.includes(obj.__typename);
};
var MovieConnection_possibleTypes = ['MovieConnection'];
var isMovieConnection = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "isMovieConnection"');
    return MovieConnection_possibleTypes.includes(obj.__typename);
};
var PageInfo_possibleTypes = ['PageInfo'];
var isPageInfo = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "isPageInfo"');
    return PageInfo_possibleTypes.includes(obj.__typename);
};
var Query_possibleTypes = ['Query'];
var isQuery = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "isQuery"');
    return Query_possibleTypes.includes(obj.__typename);
};
var TimeSeries_possibleTypes = ['TimeSeries'];
var isTimeSeries = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "isTimeSeries"');
    return TimeSeries_possibleTypes.includes(obj.__typename);
};
var _ActorAggregateEdge_possibleTypes = ['_ActorAggregateEdge'];
var is_ActorAggregateEdge = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_ActorAggregateEdge"');
    return _ActorAggregateEdge_possibleTypes.includes(obj.__typename);
};
var _ActorAggregateFieldCountResult_possibleTypes = ['_ActorAggregateFieldCountResult'];
var is_ActorAggregateFieldCountResult = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_ActorAggregateFieldCountResult"');
    return _ActorAggregateFieldCountResult_possibleTypes.includes(obj.__typename);
};
var _ActorAggregateFieldResult_possibleTypes = ['_ActorAggregateFieldResult'];
var is_ActorAggregateFieldResult = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_ActorAggregateFieldResult"');
    return _ActorAggregateFieldResult_possibleTypes.includes(obj.__typename);
};
var _ActorAggregateHistogramFieldResult_possibleTypes = ['_ActorAggregateHistogramFieldResult'];
var is_ActorAggregateHistogramFieldResult = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_ActorAggregateHistogramFieldResult"');
    return _ActorAggregateHistogramFieldResult_possibleTypes.includes(obj.__typename);
};
var _ActorAggregateResult_possibleTypes = ['_ActorAggregateResult'];
var is_ActorAggregateResult = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_ActorAggregateResult"');
    return _ActorAggregateResult_possibleTypes.includes(obj.__typename);
};
var _ActorAvgAggregateFieldResult_possibleTypes = ['_ActorAvgAggregateFieldResult'];
var is_ActorAvgAggregateFieldResult = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_ActorAvgAggregateFieldResult"');
    return _ActorAvgAggregateFieldResult_possibleTypes.includes(obj.__typename);
};
var _ActorEdge_possibleTypes = ['_ActorEdge'];
var is_ActorEdge = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_ActorEdge"');
    return _ActorEdge_possibleTypes.includes(obj.__typename);
};
var _AggregateHistogramObjectType_possibleTypes = ['_AggregateHistogramObjectType'];
var is_AggregateHistogramObjectType = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_AggregateHistogramObjectType"');
    return _AggregateHistogramObjectType_possibleTypes.includes(obj.__typename);
};
var _MachinePump2AggregateEdge_possibleTypes = ['_MachinePump2AggregateEdge'];
var is_MachinePump2AggregateEdge = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_MachinePump2AggregateEdge"');
    return _MachinePump2AggregateEdge_possibleTypes.includes(obj.__typename);
};
var _MachinePump2AggregateFieldCountResult_possibleTypes = ['_MachinePump2AggregateFieldCountResult'];
var is_MachinePump2AggregateFieldCountResult = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_MachinePump2AggregateFieldCountResult"');
    return _MachinePump2AggregateFieldCountResult_possibleTypes.includes(obj.__typename);
};
var _MachinePump2AggregateFieldResult_possibleTypes = ['_MachinePump2AggregateFieldResult'];
var is_MachinePump2AggregateFieldResult = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_MachinePump2AggregateFieldResult"');
    return _MachinePump2AggregateFieldResult_possibleTypes.includes(obj.__typename);
};
var _MachinePump2AggregateHistogramFieldResult_possibleTypes = ['_MachinePump2AggregateHistogramFieldResult'];
var is_MachinePump2AggregateHistogramFieldResult = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_MachinePump2AggregateHistogramFieldResult"');
    return _MachinePump2AggregateHistogramFieldResult_possibleTypes.includes(obj.__typename);
};
var _MachinePump2AggregateResult_possibleTypes = ['_MachinePump2AggregateResult'];
var is_MachinePump2AggregateResult = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_MachinePump2AggregateResult"');
    return _MachinePump2AggregateResult_possibleTypes.includes(obj.__typename);
};
var _MachinePump2AvgAggregateFieldResult_possibleTypes = ['_MachinePump2AvgAggregateFieldResult'];
var is_MachinePump2AvgAggregateFieldResult = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_MachinePump2AvgAggregateFieldResult"');
    return _MachinePump2AvgAggregateFieldResult_possibleTypes.includes(obj.__typename);
};
var _MachinePump2Edge_possibleTypes = ['_MachinePump2Edge'];
var is_MachinePump2Edge = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_MachinePump2Edge"');
    return _MachinePump2Edge_possibleTypes.includes(obj.__typename);
};
var _MachinePumpAggregateEdge_possibleTypes = ['_MachinePumpAggregateEdge'];
var is_MachinePumpAggregateEdge = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_MachinePumpAggregateEdge"');
    return _MachinePumpAggregateEdge_possibleTypes.includes(obj.__typename);
};
var _MachinePumpAggregateFieldCountResult_possibleTypes = ['_MachinePumpAggregateFieldCountResult'];
var is_MachinePumpAggregateFieldCountResult = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_MachinePumpAggregateFieldCountResult"');
    return _MachinePumpAggregateFieldCountResult_possibleTypes.includes(obj.__typename);
};
var _MachinePumpAggregateFieldResult_possibleTypes = ['_MachinePumpAggregateFieldResult'];
var is_MachinePumpAggregateFieldResult = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_MachinePumpAggregateFieldResult"');
    return _MachinePumpAggregateFieldResult_possibleTypes.includes(obj.__typename);
};
var _MachinePumpAggregateHistogramFieldResult_possibleTypes = ['_MachinePumpAggregateHistogramFieldResult'];
var is_MachinePumpAggregateHistogramFieldResult = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_MachinePumpAggregateHistogramFieldResult"');
    return _MachinePumpAggregateHistogramFieldResult_possibleTypes.includes(obj.__typename);
};
var _MachinePumpAggregateResult_possibleTypes = ['_MachinePumpAggregateResult'];
var is_MachinePumpAggregateResult = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_MachinePumpAggregateResult"');
    return _MachinePumpAggregateResult_possibleTypes.includes(obj.__typename);
};
var _MachinePumpAvgAggregateFieldResult_possibleTypes = ['_MachinePumpAvgAggregateFieldResult'];
var is_MachinePumpAvgAggregateFieldResult = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_MachinePumpAvgAggregateFieldResult"');
    return _MachinePumpAvgAggregateFieldResult_possibleTypes.includes(obj.__typename);
};
var _MachinePumpEdge_possibleTypes = ['_MachinePumpEdge'];
var is_MachinePumpEdge = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_MachinePumpEdge"');
    return _MachinePumpEdge_possibleTypes.includes(obj.__typename);
};
var _MovieAggregateEdge_possibleTypes = ['_MovieAggregateEdge'];
var is_MovieAggregateEdge = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_MovieAggregateEdge"');
    return _MovieAggregateEdge_possibleTypes.includes(obj.__typename);
};
var _MovieAggregateFieldCountResult_possibleTypes = ['_MovieAggregateFieldCountResult'];
var is_MovieAggregateFieldCountResult = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_MovieAggregateFieldCountResult"');
    return _MovieAggregateFieldCountResult_possibleTypes.includes(obj.__typename);
};
var _MovieAggregateFieldResult_possibleTypes = ['_MovieAggregateFieldResult'];
var is_MovieAggregateFieldResult = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_MovieAggregateFieldResult"');
    return _MovieAggregateFieldResult_possibleTypes.includes(obj.__typename);
};
var _MovieAggregateHistogramFieldResult_possibleTypes = ['_MovieAggregateHistogramFieldResult'];
var is_MovieAggregateHistogramFieldResult = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_MovieAggregateHistogramFieldResult"');
    return _MovieAggregateHistogramFieldResult_possibleTypes.includes(obj.__typename);
};
var _MovieAggregateResult_possibleTypes = ['_MovieAggregateResult'];
var is_MovieAggregateResult = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_MovieAggregateResult"');
    return _MovieAggregateResult_possibleTypes.includes(obj.__typename);
};
var _MovieAvgAggregateFieldResult_possibleTypes = ['_MovieAvgAggregateFieldResult'];
var is_MovieAvgAggregateFieldResult = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_MovieAvgAggregateFieldResult"');
    return _MovieAvgAggregateFieldResult_possibleTypes.includes(obj.__typename);
};
var _MovieEdge_possibleTypes = ['_MovieEdge'];
var is_MovieEdge = function (obj) {
    if (!(obj === null || obj === void 0 ? void 0 : obj.__typename))
        throw new Error('__typename is missing in "is_MovieEdge"');
    return _MovieEdge_possibleTypes.includes(obj.__typename);
};
var RelationshipMap = {
    Movie: {
        actors: "Actor"
    }
};

var getTypeKey = function (typeName, version) {
    return "".concat(typeName, "_").concat(version);
};
var getRelationshipKey = function (typeName, attr, version) { return "".concat(typeName, "_").concat(attr, "_").concat(version); };
var CDF_ALPHA_VERSION_HEADERS = { 'cdf-version': 'alpha' };
var FDMQueryClient = /** @class */ (function () {
    function FDMQueryClient(client) {
        var _this = this;
        this.runQuery = function (query) { return __awaiter(_this, void 0, void 0, function () {
            var response;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, this._client.post("/api/v1/projects/".concat(PROJECT, "/schema/api/").concat(DM_NAME, "/").concat(DM_VERSION, "/graphql"), { data: generateQueryOp(query) })];
                    case 1:
                        response = _a.sent();
                        return [2 /*return*/, response];
                }
            });
        }); };
        this._client = client;
    }
    FDMQueryClient.prototype.upsertNodes = function (key, items) {
        return __awaiter(this, void 0, void 0, function () {
            var data, res;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        data = {
                            items: items.map(function (item) {
                                return Object.keys(item).reduce(function (prev, curKey) {
                                    var _a, _b;
                                    var key = curKey;
                                    var currKeyValue = item[key];
                                    if (isNodeRef(currKeyValue)) {
                                        var curNodeRef = currKeyValue;
                                        return __assign(__assign({}, prev), (_a = {}, _a[curKey] = curNodeRef.buildValue(DM_NAME), _a));
                                    }
                                    return __assign(__assign({}, prev), (_b = {}, _b[curKey] = item[key], _b));
                                }, {});
                            }),
                            spaceExternalId: DM_NAME,
                            model: [DM_NAME, getTypeKey(key, DM_VERSION)],
                            overwrite: true
                        };
                        return [4 /*yield*/, this._client.post("/api/v1/projects/".concat(this._client.project, "/datamodelstorage/nodes"), {
                                data: data,
                                headers: CDF_ALPHA_VERSION_HEADERS,
                                responseType: 'json',
                                withCredentials: true
                            })];
                    case 1:
                        res = _a.sent();
                        return [2 /*return*/, res.data.items];
                }
            });
        });
    };
    FDMQueryClient.prototype.upsertRelationships = function (type, property, items) {
        return __awaiter(this, void 0, void 0, function () {
            var relationshipKey, data, res;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        relationshipKey = getRelationshipKey(type, 
                        // @ts-ignore
                        property, DM_VERSION);
                        data = {
                            items: items.map(function (el) { return ({
                                startNode: el.startNode.buildValue(DM_NAME),
                                endNode: el.endNode.buildValue(DM_NAME),
                                type: [DM_NAME, relationshipKey],
                                dummy: '',
                                externalId: el.externalId ||
                                    "".concat(el.startNode.externalId, "_").concat(el.endNode.externalId)
                            }); }),
                            spaceExternalId: DM_NAME,
                            model: [DM_NAME, relationshipKey],
                            overwrite: true,
                            autoCreateStartNodes: true,
                            autoCreateEndNodes: true
                        };
                        return [4 /*yield*/, this._client.post("/api/v1/projects/".concat(this._client.project, "/datamodelstorage/edges"), {
                                data: data,
                                headers: CDF_ALPHA_VERSION_HEADERS,
                                responseType: 'json',
                                withCredentials: true
                            })];
                    case 1:
                        res = _a.sent();
                        return [2 /*return*/, res.data.items];
                }
            });
        });
    };
    FDMQueryClient.prototype.deleteNodes = function (_, items) {
        return __awaiter(this, void 0, void 0, function () {
            var data;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        data = {
                            items: items.map(function (item) {
                            }),
                            spaceExternalId: DM_NAME,
                            overwrite: true
                        };
                        return [4 /*yield*/, this._client.post("/api/v1/projects/".concat(this._client.project, "/datamodelstorage/nodes/delete"), {
                                data: data,
                                headers: CDF_ALPHA_VERSION_HEADERS,
                                responseType: 'json',
                                withCredentials: true
                            })];
                    case 1:
                        _a.sent();
                        return [2 /*return*/];
                }
            });
        });
    };
    FDMQueryClient.prototype.deleteRelationships = function (_, _2, items) {
        return __awaiter(this, void 0, void 0, function () {
            var data;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        data = {
                            items: items.map(function (el) { return ({
                                externalId: 'externalId' in el
                                    ? el.externalId
                                    : "".concat(el.startNode.externalId, "_").concat(el.endNode.externalId)
                            }); }),
                            spaceExternalId: DM_NAME
                        };
                        return [4 /*yield*/, this._client.post("/api/v1/projects/".concat(this._client.project, "/datamodelstorage/edges/delete"), {
                                data: data,
                                headers: CDF_ALPHA_VERSION_HEADERS,
                                responseType: 'json',
                                withCredentials: true
                            })];
                    case 1:
                        _a.sent();
                        return [2 /*return*/];
                }
            });
        });
    };
    return FDMQueryClient;
}());
var FDMQueryClientBuilder = {
    fromToken: function (appId) {
        if (appId === void 0) { appId = 'FDMQueryClient'; }
        return new FDMQueryClient(new sdkV6.CogniteClient({
            appId: appId,
            // @ts-ignore
            getToken: function () { return Promise.resolve(BEARER_TOKEN); },
            project: PROJECT,
            baseUrl: "https://".concat(CLUSTER, ".cognitedata.com")
        }));
    },
    fromClient: function (client) {
        return new FDMQueryClient(client);
    }
};
var NodeRef = /** @class */ (function () {
    function NodeRef(externalId, spaceId) {
        var _this = this;
        this.buildValue = function (defaultSpace) {
            return [_this.spaceId || defaultSpace, _this.externalId];
        };
        this.type = '__NODE_REF';
        this.externalId = externalId;
        this.spaceId = spaceId;
    }
    return NodeRef;
}());
function isNodeRef(item) {
    //magic happens here
    return (typeof item === 'object' &&
        'buildValue' in item &&
        'type' in item &&
        item.type === '__NODE_REF');
}
var BEARER_TOKEN = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IjJaUXBKM1VwYmpBWVhZR2FYRUpsOGxWMFRPSSIsImtpZCI6IjJaUXBKM1VwYmpBWVhZR2FYRUpsOGxWMFRPSSJ9.eyJhdWQiOiJodHRwczovL2dyZWVuZmllbGQuY29nbml0ZWRhdGEuY29tIiwiaXNzIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvMjY3Y2ZkZDgtYTIwNy00MzIwLTgwZjItYTQzNTJiMTUwNDhmLyIsImlhdCI6MTY2NTM4NTk2NiwibmJmIjoxNjY1Mzg1OTY2LCJleHAiOjE2NjUzOTA0OTIsImFjciI6IjEiLCJhaW8iOiJBWlFBYS84VEFBQUE2UzZZUDlVVEZKNUhLblZIaEdSUlc5MlhKQ1FTNDUrcWpDUlhVSlNtZC9DNXMzY0FCVHZkVW91SUM4RVE5dXdjTVhUbENkcXYvbjBXZGtUS3ZyUlE0NjZNNExsQzNTVldrT0I5M0tYU2RDLzh1enRITHBNdzU1TVlPVTJVNGQxNUcyNHNwczJieGlJa0tSOFZvVjA3RE5PWW4vR1UyQ0I1bmt0NzR1bmMybWN2Q2V6MkF4MUdNd3dOMGljVEpjM24iLCJhbXIiOlsicHdkIiwibWZhIl0sImFwcGlkIjoiNDc3MGMwZjEtN2JiNi00M2I1LThjMzctOTRmMmE5MzA2NzU3IiwiYXBwaWRhY3IiOiIwIiwiZW1haWwiOiJkYXZpZC5saXVAY29nbml0ZWRhdGEuY29tIiwiZmFtaWx5X25hbWUiOiJldmVyIiwiZ2l2ZW5fbmFtZSI6ImdyZWF0ZXN0IiwiZ3JvdXBzIjpbIjg5MGVlYjJmLTE1ODUtNGUyZi1hMjczLTNhNWI5YWU0OTJkMCIsImEyYmYyNTJhLWY3NDktNDRlNy1iODZlLWIzZTdlNDY1ODcwNyIsIjJhZGQ3NzkzLTNmNDQtNGYyNi1iY2E3LTEwYzFmMmRkNzMyNyIsIjhhMDE4NDJlLTY4NjEtNGYzOC1hNWFmLTI3NTljMjJjNmY0NiIsImIxODJlNWQ2LTY2MTUtNDE3Mi05MTA3LTRlYzYxODg3YTU4YiJdLCJpZHAiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC9hOWFlNWI1NC0zNjAwLTQ5MTctYTlkYy0zMDIwNzIzMzYwYjMvIiwiaXBhZGRyIjoiODEuMTc1LjU3Ljc0IiwibmFtZSI6InlhIGJvaSIsIm9pZCI6IjJmNGRmYWM2LTNhYjgtNGE4MS1hMDc3LTk5ZjMyOWVjM2MxMyIsInJoIjoiMC5BVTRBMlAxOEpnZWlJRU9BOHFRMUt4VUVqX19CVEV5ZDlMbE1qZGdQSEF4cWdSTk9BR28uIiwic2NwIjoiREFUQS5DSEFOR0UgREFUQS5WSUVXIElERU5USVRZIHVzZXJfaW1wZXJzb25hdGlvbiIsInN1YiI6IlRZTHZDOFoyeUpsOU9QUGJaU2lZR0dWdTF0cnpSaUczTkpUZjFhQzhDTEEiLCJ0aWQiOiIyNjdjZmRkOC1hMjA3LTQzMjAtODBmMi1hNDM1MmIxNTA0OGYiLCJ1bmlxdWVfbmFtZSI6ImRhdmlkLmxpdUBjb2duaXRlZGF0YS5jb20iLCJ1dGkiOiJGeFNzNXVkNG5FVzlKMmJQQTY5M0FBIiwidmVyIjoiMS4wIn0.nbcNiDChPQnCdSdU3u9rRccHd7ugvi2Ls3ofw60HYARnVRwFsvACaVRDGe9ZMaPMwZX_kgi3VNGgpYjcHhMwoxHxVJWLVKvlxniwPfwsFk37c-Z5J2WH44F8HRP4PE3nMDla9K2CvLAwJVgiwzeq35GJ99A2HJuIxDd6mnhwFWR-gdAlVnPFAtEN4uC9tm9at2qhAwYlEy8jl60coRkJW0CSAc3SSqEQdgUe60WV7tbR3l3G898QxPdEniqjL4rFMCFQVbCy_QcXnh8jQf8vf4lZMEg9q_ud_ZmD6BAHsqBa5gCJVtp9AD_mbvz6LO5u1RZcbCcGjZ69QDA4OidrdA";
var CLUSTER = "greenfield";
var PROJECT = "platypus";
var DM_NAME = "moviedm";
var DM_VERSION = "1";

exports.FDMQueryClient = FDMQueryClient;
exports.FDMQueryClientBuilder = FDMQueryClientBuilder;
exports.NodeRef = NodeRef;
exports.RelationshipMap = RelationshipMap;
exports.isActor = isActor;
exports.isActorAggregateConnection = isActorAggregateConnection;
exports.isActorConnection = isActorConnection;
exports.isDataPoint = isDataPoint;
exports.isMachinePump = isMachinePump;
exports.isMachinePump2 = isMachinePump2;
exports.isMachinePump2AggregateConnection = isMachinePump2AggregateConnection;
exports.isMachinePump2Connection = isMachinePump2Connection;
exports.isMachinePumpAggregateConnection = isMachinePumpAggregateConnection;
exports.isMachinePumpConnection = isMachinePumpConnection;
exports.isMovie = isMovie;
exports.isMovieAggregateConnection = isMovieAggregateConnection;
exports.isMovieConnection = isMovieConnection;
exports.isPageInfo = isPageInfo;
exports.isQuery = isQuery;
exports.isTimeSeries = isTimeSeries;
exports.is_ActorAggregateEdge = is_ActorAggregateEdge;
exports.is_ActorAggregateFieldCountResult = is_ActorAggregateFieldCountResult;
exports.is_ActorAggregateFieldResult = is_ActorAggregateFieldResult;
exports.is_ActorAggregateHistogramFieldResult = is_ActorAggregateHistogramFieldResult;
exports.is_ActorAggregateResult = is_ActorAggregateResult;
exports.is_ActorAvgAggregateFieldResult = is_ActorAvgAggregateFieldResult;
exports.is_ActorEdge = is_ActorEdge;
exports.is_AggregateHistogramObjectType = is_AggregateHistogramObjectType;
exports.is_MachinePump2AggregateEdge = is_MachinePump2AggregateEdge;
exports.is_MachinePump2AggregateFieldCountResult = is_MachinePump2AggregateFieldCountResult;
exports.is_MachinePump2AggregateFieldResult = is_MachinePump2AggregateFieldResult;
exports.is_MachinePump2AggregateHistogramFieldResult = is_MachinePump2AggregateHistogramFieldResult;
exports.is_MachinePump2AggregateResult = is_MachinePump2AggregateResult;
exports.is_MachinePump2AvgAggregateFieldResult = is_MachinePump2AvgAggregateFieldResult;
exports.is_MachinePump2Edge = is_MachinePump2Edge;
exports.is_MachinePumpAggregateEdge = is_MachinePumpAggregateEdge;
exports.is_MachinePumpAggregateFieldCountResult = is_MachinePumpAggregateFieldCountResult;
exports.is_MachinePumpAggregateFieldResult = is_MachinePumpAggregateFieldResult;
exports.is_MachinePumpAggregateHistogramFieldResult = is_MachinePumpAggregateHistogramFieldResult;
exports.is_MachinePumpAggregateResult = is_MachinePumpAggregateResult;
exports.is_MachinePumpAvgAggregateFieldResult = is_MachinePumpAvgAggregateFieldResult;
exports.is_MachinePumpEdge = is_MachinePumpEdge;
exports.is_MovieAggregateEdge = is_MovieAggregateEdge;
exports.is_MovieAggregateFieldCountResult = is_MovieAggregateFieldCountResult;
exports.is_MovieAggregateFieldResult = is_MovieAggregateFieldResult;
exports.is_MovieAggregateHistogramFieldResult = is_MovieAggregateHistogramFieldResult;
exports.is_MovieAggregateResult = is_MovieAggregateResult;
exports.is_MovieAvgAggregateFieldResult = is_MovieAvgAggregateFieldResult;
exports.is_MovieEdge = is_MovieEdge;
