<commit_before>Ext.define('Jarvus.proxy.Postgrest', {
    extend: 'Jarvus.proxy.API',
    alias : 'proxy.postgrest',
    requires: [
        'Jarvus.connection.Postgrest'
    ],

    /**
     * @property {Object} actionMethods
     * Mapping of action name to HTTP request method. These default to RESTful conventions for the 'create', 'read',
     * 'update' and 'destroy' actions (which map to 'POST', 'GET', 'PUT' and 'DELETE' respectively). This object
     * should not be changed except globally via {@link Ext#override Ext.override} - the {@link #getMethod} function
     * can be overridden instead.
     */

    config: {
        connection: 'Jarvus.connection.Postgrest',

        /**
         * @cfg {Boolean} appendId
         * True to automatically append the ID of a Model instance when performing a request based on that single instance.
         * See Rest proxy intro docs for more details. Defaults to true.
         */
        appendId: true,


        /**
         * @cfg {Boolean} batchActions
         * True to batch actions of a particular type when synchronizing the store. Defaults to false.
         */
        batchActions: true,

        /**
         * @cfg {Object} actionMethods
         * @inheritdoc
         */
        actionMethods: {
            create : 'POST',
            read   : 'GET',
            update : 'PATCH',
            destroy: 'DELETE'
        },

        /**
         * @cfg {Boolean} nullsFirst
         * True to return nulls first when sorting
         */
        nullsFirst: false,

        /**
         * @cfg {Boolean} nullsLast
         * True to return nulls last when sorting
         */
        nullsLast: false,

        remoteSort: true,

        remoteFilter: true,

        noCache: false
    },

    /**
     * These parameters are what postgrest requires, they should not be changed:
     */
    sortParam: 'order',

    buildUrl: function(request) {
        var me        = this,
            operation = request.getOperation(),
            records   = operation.getRecords()|| [],
            record    = records[0],
            format    = me.format,
            url       = me.getUrl(request),
            id        = record ? record.getId() : '',
            idProp;

        if (me.appendId && me.isValidId(id) && !operation.isUpdateOperation) {
            if (!url.match(/\/$/)) {
                url += '/';
            }

            url += id;
        }

        if (format) {
            if (!url.match(/\.$/)) {
                url += '.';
            }

            url += format;
        }

        debugger;
        // @themightychris: tried to use params here too
        if (operation.isUpdateOperation) {
            idProp = record.getIdProperty();
            url += '?' + idProp + '=eq.' + id;
        }

        request.url = url;

        return me.callParent(arguments);
    },

    buildRequest: function(operation) {
        var me = this,
            initialParams = Ext.apply({}, operation.getParams()),

            params = Ext.applyIf(initialParams, me.getExtraParams() || {}),
            headers = {},

            request, operationId, idParam, page, start, limit;

        Ext.applyIf(params, me.getParams(operation));

        operationId = operation.getId();
        idParam = me.getIdParam();

        if (operationId !== undefined && params[idParam] === undefined) {
            params[idParam] = operationId;
        }

        if (operation.isReadOperation) {
            // operation.getPage() does not exist unless it is a read operation
            page = operation.getPage(),
            start = operation.getStart(),
            limit = operation.getLimit();
<commit_msg>fix setting custom url from proxy<commit_after>Ext.define('Jarvus.proxy.Postgrest', {
    extend: 'Jarvus.proxy.API',
    alias : 'proxy.postgrest',
    requires: [
        'Jarvus.connection.Postgrest'
    ],

    /**
     * @property {Object} actionMethods
     * Mapping of action name to HTTP request method. These default to RESTful conventions for the 'create', 'read',
     * 'update' and 'destroy' actions (which map to 'POST', 'GET', 'PUT' and 'DELETE' respectively). This object
     * should not be changed except globally via {@link Ext#override Ext.override} - the {@link #getMethod} function
     * can be overridden instead.
     */

    config: {
        connection: 'Jarvus.connection.Postgrest',

        /**
         * @cfg {Boolean} appendId
         * True to automatically append the ID of a Model instance when performing a request based on that single instance.
         * See Rest proxy intro docs for more details. Defaults to true.
         */
        appendId: true,


        /**
         * @cfg {Boolean} batchActions
         * True to batch actions of a particular type when synchronizing the store. Defaults to false.
         */
        batchActions: true,

        /**
         * @cfg {Object} actionMethods
         * @inheritdoc
         */
        actionMethods: {
            create : 'POST',
            read   : 'GET',
            update : 'PATCH',
            destroy: 'DELETE'
        },

        /**
         * @cfg {Boolean} nullsFirst
         * True to return nulls first when sorting
         */
        nullsFirst: false,

        /**
         * @cfg {Boolean} nullsLast
         * True to return nulls last when sorting
         */
        nullsLast: false,

        remoteSort: true,

        remoteFilter: true,

        noCache: false
    },

    /**
     * These parameters are what postgrest requires, they should not be changed:
     */
    sortParam: 'order',

    buildUrl: function(request) {
        var me        = this,
            operation = request.getOperation(),
            records   = operation.getRecords()|| [],
            record    = records[0],
            format    = me.format,
            url       = me.getUrl(request),
            id        = record ? record.getId() : '',
            idProp;

        if (me.appendId && me.isValidId(id) && !operation.isUpdateOperation) {
            if (!url.match(/\/$/)) {
                url += '/';
            }

            url += id;
        }

        if (format) {
            if (!url.match(/\.$/)) {
                url += '.';
            }

            url += format;
        }

        debugger;
        // @themightychris: tried to use params here too
        if (operation.isUpdateOperation) {
            idProp = record.getIdProperty();
            url += '?' + idProp + '=eq.' + id;
        }
 
        request.setUrl(url);

        return me.callParent(arguments);
    },

    buildRequest: function(operation) {
        var me = this,
            initialParams = Ext.apply({}, operation.getParams()),

            params = Ext.applyIf(initialParams, me.getExtraParams() || {}),
            headers = {},

            request, operationId, idParam, page, start, limit;

        Ext.applyIf(params, me.getParams(operation));

        operationId = operation.getId();
        idParam = me.getIdParam();

        if (operationId !== undefined && params[idParam] === undefined) {
            params[idParam] = operationId;
        }

        if (operation.isReadOperation) {
            // operation.getPage() does not exist unless it is a read operation
            page = operation.getPage(),
            start = operation.getStart(),
            limit = operation.getLimit();

{'fraction_non_alphanumeric': 0.11643002028397566, 'fraction_numerical': 0.0002704530087897228, 'mean_word_length': 1.663305725603169, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2271128', 'n_tokens_mistral': 2002, 'n_tokens_neox': 1938, 'n_words': 560}