@commercelayer/sdk 2.0.4 → 2.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/api.d.ts +10 -3
- package/lib/client.d.ts +2 -0
- package/lib/commercelayer.d.ts +9 -1
- package/lib/index.d.ts +4 -2
- package/lib/interceptor.d.ts +10 -0
- package/lib/model.d.ts +94 -0
- package/lib/resource.d.ts +6 -3
- package/lib/resources/addresses.d.ts +1 -2
- package/lib/resources/adjustments.d.ts +1 -2
- package/lib/resources/adyen_gateways.d.ts +1 -2
- package/lib/resources/adyen_payments.d.ts +1 -2
- package/lib/resources/application.d.ts +1 -2
- package/lib/resources/attachments.d.ts +1 -2
- package/lib/resources/authorizations.d.ts +1 -2
- package/lib/resources/avalara_accounts.d.ts +1 -2
- package/lib/resources/billing_info_validation_rules.d.ts +1 -2
- package/lib/resources/bing_geocoders.d.ts +1 -2
- package/lib/resources/braintree_gateways.d.ts +1 -2
- package/lib/resources/braintree_payments.d.ts +1 -2
- package/lib/resources/bundles.d.ts +1 -2
- package/lib/resources/captures.d.ts +1 -2
- package/lib/resources/carrier_accounts.d.ts +1 -2
- package/lib/resources/checkout_com_gateways.d.ts +1 -2
- package/lib/resources/checkout_com_payments.d.ts +1 -2
- package/lib/resources/coupon_codes_promotion_rules.d.ts +1 -2
- package/lib/resources/coupons.d.ts +1 -2
- package/lib/resources/customer_addresses.d.ts +1 -2
- package/lib/resources/customer_groups.d.ts +1 -2
- package/lib/resources/customer_password_resets.d.ts +1 -2
- package/lib/resources/customer_payment_sources.d.ts +1 -2
- package/lib/resources/customer_subscriptions.d.ts +1 -2
- package/lib/resources/customers.d.ts +3 -2
- package/lib/resources/delivery_lead_times.d.ts +1 -2
- package/lib/resources/external_gateways.d.ts +1 -2
- package/lib/resources/external_payments.d.ts +1 -2
- package/lib/resources/external_promotions.d.ts +1 -2
- package/lib/resources/external_tax_calculators.d.ts +1 -2
- package/lib/resources/fixed_amount_promotions.d.ts +1 -2
- package/lib/resources/free_shipping_promotions.d.ts +1 -2
- package/lib/resources/geocoders.d.ts +1 -2
- package/lib/resources/gift_card_recipients.d.ts +1 -2
- package/lib/resources/gift_cards.d.ts +1 -2
- package/lib/resources/google_geocoders.d.ts +1 -2
- package/lib/resources/imports.d.ts +2 -3
- package/lib/resources/in_stock_subscriptions.d.ts +1 -2
- package/lib/resources/inventory_models.d.ts +1 -2
- package/lib/resources/inventory_return_locations.d.ts +1 -2
- package/lib/resources/inventory_stock_locations.d.ts +1 -2
- package/lib/resources/line_item_options.d.ts +1 -2
- package/lib/resources/line_items.d.ts +1 -2
- package/lib/resources/manual_gateways.d.ts +1 -2
- package/lib/resources/manual_tax_calculators.d.ts +1 -2
- package/lib/resources/markets.d.ts +1 -2
- package/lib/resources/merchants.d.ts +1 -2
- package/lib/resources/order_amount_promotion_rules.d.ts +1 -2
- package/lib/resources/order_copies.d.ts +1 -2
- package/lib/resources/order_subscriptions.d.ts +3 -2
- package/lib/resources/orders.d.ts +2 -2
- package/lib/resources/organization.d.ts +1 -2
- package/lib/resources/packages.d.ts +1 -2
- package/lib/resources/parcel_line_items.d.ts +1 -2
- package/lib/resources/parcels.d.ts +1 -2
- package/lib/resources/payment_gateways.d.ts +1 -2
- package/lib/resources/payment_methods.d.ts +1 -2
- package/lib/resources/paypal_gateways.d.ts +1 -2
- package/lib/resources/paypal_payments.d.ts +1 -2
- package/lib/resources/percentage_discount_promotions.d.ts +1 -2
- package/lib/resources/price_lists.d.ts +1 -2
- package/lib/resources/prices.d.ts +1 -2
- package/lib/resources/promotion_rules.d.ts +1 -2
- package/lib/resources/promotions.d.ts +1 -2
- package/lib/resources/refunds.d.ts +1 -2
- package/lib/resources/return_line_items.d.ts +1 -2
- package/lib/resources/returns.d.ts +1 -2
- package/lib/resources/shipments.d.ts +1 -2
- package/lib/resources/shipping_categories.d.ts +1 -2
- package/lib/resources/shipping_methods.d.ts +1 -2
- package/lib/resources/shipping_zones.d.ts +1 -2
- package/lib/resources/sku_list_items.d.ts +1 -2
- package/lib/resources/sku_list_promotion_rules.d.ts +1 -2
- package/lib/resources/sku_lists.d.ts +1 -2
- package/lib/resources/sku_options.d.ts +1 -2
- package/lib/resources/skus.d.ts +1 -2
- package/lib/resources/stock_items.d.ts +1 -2
- package/lib/resources/stock_line_items.d.ts +1 -2
- package/lib/resources/stock_locations.d.ts +1 -2
- package/lib/resources/stock_transfers.d.ts +1 -2
- package/lib/resources/stripe_gateways.d.ts +1 -2
- package/lib/resources/stripe_payments.d.ts +2 -2
- package/lib/resources/tax_calculators.d.ts +1 -2
- package/lib/resources/tax_categories.d.ts +1 -2
- package/lib/resources/tax_rules.d.ts +1 -2
- package/lib/resources/taxjar_accounts.d.ts +1 -2
- package/lib/resources/transactions.d.ts +1 -2
- package/lib/resources/voids.d.ts +1 -2
- package/lib/resources/webhooks.d.ts +1 -2
- package/lib/resources/wire_transfers.d.ts +1 -2
- package/lib/sdk.cjs.development.js +808 -274
- package/lib/sdk.cjs.development.js.map +1 -1
- package/lib/sdk.cjs.production.min.js +1 -1
- package/lib/sdk.cjs.production.min.js.map +1 -1
- package/lib/sdk.esm.js +808 -274
- package/lib/sdk.esm.js.map +1 -1
- package/package.json +7 -4
- package/lib/.DS_Store +0 -0
- package/lib/api.js +0 -271
- package/lib/client.js +0 -132
- package/lib/commercelayer.js +0 -163
- package/lib/error.js +0 -25
- package/lib/jsonapi.js +0 -83
- package/lib/poly.d.ts +0 -9
- package/lib/poly.js +0 -2
- package/lib/query.js +0 -172
- package/lib/resource.js +0 -94
- package/lib/resources/addresses.js +0 -45
- package/lib/resources/adjustments.js +0 -45
- package/lib/resources/adyen_gateways.js +0 -45
- package/lib/resources/adyen_payments.js +0 -45
- package/lib/resources/application.js +0 -33
- package/lib/resources/attachments.js +0 -45
- package/lib/resources/authorizations.js +0 -45
- package/lib/resources/avalara_accounts.js +0 -45
- package/lib/resources/billing_info_validation_rules.js +0 -45
- package/lib/resources/braintree_gateways.js +0 -45
- package/lib/resources/braintree_payments.js +0 -45
- package/lib/resources/captures.js +0 -39
- package/lib/resources/carrier_accounts.js +0 -36
- package/lib/resources/checkout_com_gateways.js +0 -45
- package/lib/resources/checkout_com_payments.js +0 -45
- package/lib/resources/coupon_codes_promotion_rules.js +0 -45
- package/lib/resources/coupons.js +0 -45
- package/lib/resources/customer_addresses.js +0 -45
- package/lib/resources/customer_groups.js +0 -45
- package/lib/resources/customer_password_resets.js +0 -45
- package/lib/resources/customer_payment_sources.js +0 -45
- package/lib/resources/customer_subscriptions.js +0 -45
- package/lib/resources/customers.js +0 -45
- package/lib/resources/delivery_lead_times.js +0 -45
- package/lib/resources/external_gateways.js +0 -45
- package/lib/resources/external_payments.js +0 -45
- package/lib/resources/external_promotions.js +0 -45
- package/lib/resources/external_tax_calculators.js +0 -45
- package/lib/resources/fixed_amount_promotions.js +0 -45
- package/lib/resources/free_shipping_promotions.js +0 -45
- package/lib/resources/gift_card_recipients.js +0 -45
- package/lib/resources/gift_cards.js +0 -45
- package/lib/resources/imports.js +0 -42
- package/lib/resources/in_stock_subscriptions.js +0 -45
- package/lib/resources/inventory_models.js +0 -45
- package/lib/resources/inventory_return_locations.js +0 -45
- package/lib/resources/inventory_stock_locations.js +0 -45
- package/lib/resources/line_item_options.js +0 -45
- package/lib/resources/line_items.js +0 -45
- package/lib/resources/manual_gateways.js +0 -45
- package/lib/resources/manual_tax_calculators.js +0 -45
- package/lib/resources/markets.js +0 -45
- package/lib/resources/merchants.js +0 -45
- package/lib/resources/order_amount_promotion_rules.js +0 -45
- package/lib/resources/orders.js +0 -45
- package/lib/resources/organization.js +0 -33
- package/lib/resources/packages.js +0 -45
- package/lib/resources/parcel_line_items.js +0 -45
- package/lib/resources/parcels.js +0 -45
- package/lib/resources/payment_gateways.js +0 -45
- package/lib/resources/payment_methods.js +0 -45
- package/lib/resources/paypal_gateways.js +0 -45
- package/lib/resources/paypal_payments.js +0 -45
- package/lib/resources/percentage_discount_promotions.js +0 -45
- package/lib/resources/price_lists.js +0 -45
- package/lib/resources/prices.js +0 -45
- package/lib/resources/promotion_rules.js +0 -33
- package/lib/resources/promotions.js +0 -33
- package/lib/resources/refunds.js +0 -36
- package/lib/resources/return_line_items.js +0 -45
- package/lib/resources/returns.js +0 -45
- package/lib/resources/shipments.js +0 -39
- package/lib/resources/shipping_categories.js +0 -45
- package/lib/resources/shipping_methods.js +0 -45
- package/lib/resources/shipping_zones.js +0 -45
- package/lib/resources/sku_list_items.js +0 -45
- package/lib/resources/sku_list_promotion_rules.js +0 -45
- package/lib/resources/sku_lists.js +0 -45
- package/lib/resources/sku_options.js +0 -45
- package/lib/resources/skus.js +0 -45
- package/lib/resources/stock_items.js +0 -45
- package/lib/resources/stock_line_items.js +0 -36
- package/lib/resources/stock_locations.js +0 -45
- package/lib/resources/stock_transfers.js +0 -45
- package/lib/resources/stripe_gateways.js +0 -45
- package/lib/resources/stripe_payments.js +0 -45
- package/lib/resources/tax_calculators.js +0 -33
- package/lib/resources/tax_categories.js +0 -45
- package/lib/resources/tax_rules.js +0 -45
- package/lib/resources/taxjar_accounts.js +0 -45
- package/lib/resources/transactions.js +0 -33
- package/lib/resources/voids.js +0 -36
- package/lib/resources/webhooks.js +0 -45
- package/lib/resources/wire_transfers.js +0 -45
- package/lib/util.js +0 -7
package/lib/jsonapi.js
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
5
|
-
}) : (function(o, m, k, k2) {
|
6
|
-
if (k2 === undefined) k2 = k;
|
7
|
-
o[k2] = m[k];
|
8
|
-
}));
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
11
|
-
}) : function(o, v) {
|
12
|
-
o["default"] = v;
|
13
|
-
});
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
15
|
-
if (mod && mod.__esModule) return mod;
|
16
|
-
var result = {};
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
18
|
-
__setModuleDefault(result, mod);
|
19
|
-
return result;
|
20
|
-
};
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
22
|
-
exports.normalize = exports.denormalize = exports.JSON = void 0;
|
23
|
-
const resource_1 = require("./resource");
|
24
|
-
exports.JSON = __importStar(require("json-typescript"));
|
25
|
-
// DENORMALIZATION
|
26
|
-
const denormalize = (response) => {
|
27
|
-
let denormalizedResponse;
|
28
|
-
if (response.links)
|
29
|
-
delete response.links;
|
30
|
-
const data = response.data;
|
31
|
-
const included = response.included;
|
32
|
-
if (Array.isArray(data))
|
33
|
-
denormalizedResponse = data.map(res => denormalizeResource(res, included));
|
34
|
-
else
|
35
|
-
denormalizedResponse = denormalizeResource(data, included);
|
36
|
-
return denormalizedResponse;
|
37
|
-
};
|
38
|
-
exports.denormalize = denormalize;
|
39
|
-
const findIncluded = (rel, included = []) => {
|
40
|
-
return included.find(inc => {
|
41
|
-
return (rel.id === inc.id) && (rel.type === inc.type);
|
42
|
-
});
|
43
|
-
};
|
44
|
-
const denormalizeResource = (res, included) => {
|
45
|
-
const resource = Object.assign({ id: res.id, type: res.type }, res.attributes);
|
46
|
-
if (res.relationships)
|
47
|
-
Object.keys(res.relationships).forEach(key => {
|
48
|
-
const rel = res.relationships[key].data;
|
49
|
-
if (rel) {
|
50
|
-
if (Array.isArray(rel))
|
51
|
-
resource[key] = rel.map(r => denormalizeResource(findIncluded(r, included), included));
|
52
|
-
else
|
53
|
-
resource[key] = denormalizeResource(findIncluded(rel, included), included);
|
54
|
-
}
|
55
|
-
else if (rel === null)
|
56
|
-
resource[key] = null;
|
57
|
-
});
|
58
|
-
return resource;
|
59
|
-
};
|
60
|
-
// NORMALIZATION
|
61
|
-
const normalize = (resource) => {
|
62
|
-
const attributes = {};
|
63
|
-
const relationships = {};
|
64
|
-
for (const field in resource) {
|
65
|
-
if (['type', 'id'].includes(field))
|
66
|
-
continue;
|
67
|
-
const value = resource[field];
|
68
|
-
if (resource_1.isResourceId(value)) {
|
69
|
-
relationships[field] = { data: value };
|
70
|
-
}
|
71
|
-
else
|
72
|
-
attributes[field] = value;
|
73
|
-
}
|
74
|
-
const normalized = {
|
75
|
-
type: resource.type,
|
76
|
-
attributes,
|
77
|
-
relationships
|
78
|
-
};
|
79
|
-
if (resource_1.isResourceId(resource))
|
80
|
-
normalized.id = resource.id;
|
81
|
-
return normalized;
|
82
|
-
};
|
83
|
-
exports.normalize = normalize;
|
package/lib/poly.d.ts
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
import { ResourceType } from './resource';
|
2
|
-
declare type AttachableType = /*'bundles' | */ 'carrier_accounts' | 'customers' | 'customer_groups' | 'delivery_lead_times' | /*'geocoders' |*/ 'gift_cards' | 'gift_card_recipients' | 'inventory_models' | 'markets' | 'merchants' | 'orders' | 'packages' | 'parcels' | 'payment_methods' | 'prices' | 'price_lists' | 'promotions' | 'returns' | 'shipments' | 'shipping_categories' | 'shipping_methods' | 'shipping_zones' | 'skus' | 'sku_options' | 'stock_items' | 'stock_locations' | 'tax_calculators' | 'tax_categories';
|
3
|
-
interface Attachable extends ResourceType {
|
4
|
-
type: AttachableType;
|
5
|
-
}
|
6
|
-
interface PaymentSource extends ResourceType {
|
7
|
-
type: 'paypal_payments' | 'adyen_payments' | 'stripe_payments';
|
8
|
-
}
|
9
|
-
export { Attachable, PaymentSource };
|
package/lib/poly.js
DELETED
package/lib/query.js
DELETED
@@ -1,172 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
3
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
4
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
5
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
6
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
7
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
8
|
-
};
|
9
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
10
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
11
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
12
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
13
|
-
};
|
14
|
-
var _QueryBuilderRetrieve_resource, _QueryBuilderRetrieve_include, _QueryBuilderRetrieve_fields, _QueryBuilderList_sort, _QueryBuilderList_filters, _QueryBuilderList_pageNumber, _QueryBuilderList_pageSize;
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
16
|
-
exports.generateQueryStringParams = exports.QueryBuilderList = exports.QueryBuilderRetrieve = void 0;
|
17
|
-
const isParamsList = (params) => {
|
18
|
-
return (params.filters || params.pageNumber || params.pageSize || params.sort);
|
19
|
-
};
|
20
|
-
class QueryBuilderRetrieve {
|
21
|
-
constructor(resource) {
|
22
|
-
_QueryBuilderRetrieve_resource.set(this, void 0);
|
23
|
-
_QueryBuilderRetrieve_include.set(this, void 0);
|
24
|
-
_QueryBuilderRetrieve_fields.set(this, void 0);
|
25
|
-
__classPrivateFieldSet(this, _QueryBuilderRetrieve_resource, resource || '', "f");
|
26
|
-
}
|
27
|
-
include(...resources) {
|
28
|
-
if (!__classPrivateFieldGet(this, _QueryBuilderRetrieve_include, "f"))
|
29
|
-
__classPrivateFieldSet(this, _QueryBuilderRetrieve_include, [], "f");
|
30
|
-
__classPrivateFieldGet(this, _QueryBuilderRetrieve_include, "f").push(...resources);
|
31
|
-
return this;
|
32
|
-
}
|
33
|
-
field(field, resource) {
|
34
|
-
if (!__classPrivateFieldGet(this, _QueryBuilderRetrieve_fields, "f"))
|
35
|
-
__classPrivateFieldSet(this, _QueryBuilderRetrieve_fields, {}, "f");
|
36
|
-
if (!resource)
|
37
|
-
resource = __classPrivateFieldGet(this, _QueryBuilderRetrieve_resource, "f");
|
38
|
-
if (!__classPrivateFieldGet(this, _QueryBuilderRetrieve_fields, "f")[resource])
|
39
|
-
__classPrivateFieldGet(this, _QueryBuilderRetrieve_fields, "f")[resource] = [];
|
40
|
-
__classPrivateFieldGet(this, _QueryBuilderRetrieve_fields, "f")[resource].push(field);
|
41
|
-
return this;
|
42
|
-
}
|
43
|
-
fields(fields, resource) {
|
44
|
-
fields.forEach(f => {
|
45
|
-
this.field(f, resource);
|
46
|
-
});
|
47
|
-
return this;
|
48
|
-
}
|
49
|
-
clear() {
|
50
|
-
__classPrivateFieldSet(this, _QueryBuilderRetrieve_include, undefined, "f");
|
51
|
-
__classPrivateFieldSet(this, _QueryBuilderRetrieve_fields, undefined, "f");
|
52
|
-
return this;
|
53
|
-
}
|
54
|
-
build() {
|
55
|
-
return {
|
56
|
-
include: __classPrivateFieldGet(this, _QueryBuilderRetrieve_include, "f"),
|
57
|
-
fields: __classPrivateFieldGet(this, _QueryBuilderRetrieve_fields, "f"),
|
58
|
-
};
|
59
|
-
}
|
60
|
-
generate() {
|
61
|
-
return generateQueryStringParams(this.build());
|
62
|
-
}
|
63
|
-
}
|
64
|
-
exports.QueryBuilderRetrieve = QueryBuilderRetrieve;
|
65
|
-
_QueryBuilderRetrieve_resource = new WeakMap(), _QueryBuilderRetrieve_include = new WeakMap(), _QueryBuilderRetrieve_fields = new WeakMap();
|
66
|
-
class QueryBuilderList extends QueryBuilderRetrieve {
|
67
|
-
constructor(resource) {
|
68
|
-
super(resource);
|
69
|
-
_QueryBuilderList_sort.set(this, void 0);
|
70
|
-
_QueryBuilderList_filters.set(this, void 0);
|
71
|
-
_QueryBuilderList_pageNumber.set(this, void 0);
|
72
|
-
_QueryBuilderList_pageSize.set(this, void 0);
|
73
|
-
}
|
74
|
-
include(...resources) {
|
75
|
-
return super.include(...resources);
|
76
|
-
}
|
77
|
-
field(field, resource) {
|
78
|
-
return super.field(field, resource);
|
79
|
-
}
|
80
|
-
fields(fields, resource) {
|
81
|
-
return super.fields(fields, resource);
|
82
|
-
}
|
83
|
-
pageNumber(num) {
|
84
|
-
__classPrivateFieldSet(this, _QueryBuilderList_pageNumber, num, "f");
|
85
|
-
return this;
|
86
|
-
}
|
87
|
-
pageSize(size) {
|
88
|
-
__classPrivateFieldSet(this, _QueryBuilderList_pageSize, size, "f");
|
89
|
-
return this;
|
90
|
-
}
|
91
|
-
page(num, size) {
|
92
|
-
__classPrivateFieldSet(this, _QueryBuilderList_pageNumber, num, "f");
|
93
|
-
__classPrivateFieldSet(this, _QueryBuilderList_pageSize, size, "f");
|
94
|
-
return this;
|
95
|
-
}
|
96
|
-
sort(field, descending) {
|
97
|
-
if (!__classPrivateFieldGet(this, _QueryBuilderList_sort, "f"))
|
98
|
-
__classPrivateFieldSet(this, _QueryBuilderList_sort, [], "f");
|
99
|
-
__classPrivateFieldGet(this, _QueryBuilderList_sort, "f").push(`${descending ? '-' : ''}${field}`);
|
100
|
-
return this;
|
101
|
-
}
|
102
|
-
filter(field, predicate, value, resource) {
|
103
|
-
if (!__classPrivateFieldGet(this, _QueryBuilderList_filters, "f"))
|
104
|
-
__classPrivateFieldSet(this, _QueryBuilderList_filters, {}, "f");
|
105
|
-
const r = resource ? `${resource}_` : '';
|
106
|
-
__classPrivateFieldGet(this, _QueryBuilderList_filters, "f")[`${Array.isArray(field) ? field.map(f => `${r}${f}`).join('_or_') : (r + field)}_${predicate}`] = Array.isArray(value) ? value.join(',') : value;
|
107
|
-
return this;
|
108
|
-
}
|
109
|
-
clear() {
|
110
|
-
super.clear();
|
111
|
-
__classPrivateFieldSet(this, _QueryBuilderList_sort, undefined, "f");
|
112
|
-
__classPrivateFieldSet(this, _QueryBuilderList_filters, undefined, "f");
|
113
|
-
__classPrivateFieldSet(this, _QueryBuilderList_pageNumber, undefined, "f");
|
114
|
-
__classPrivateFieldSet(this, _QueryBuilderList_pageSize, undefined, "f");
|
115
|
-
return this;
|
116
|
-
}
|
117
|
-
build() {
|
118
|
-
return Object.assign(super.build(), {
|
119
|
-
sort: __classPrivateFieldGet(this, _QueryBuilderList_sort, "f"),
|
120
|
-
filters: __classPrivateFieldGet(this, _QueryBuilderList_filters, "f"),
|
121
|
-
pageNumber: __classPrivateFieldGet(this, _QueryBuilderList_pageNumber, "f"),
|
122
|
-
pageSize: __classPrivateFieldGet(this, _QueryBuilderList_pageSize, "f"),
|
123
|
-
});
|
124
|
-
}
|
125
|
-
generate() {
|
126
|
-
return generateQueryStringParams(this.build());
|
127
|
-
}
|
128
|
-
}
|
129
|
-
exports.QueryBuilderList = QueryBuilderList;
|
130
|
-
_QueryBuilderList_sort = new WeakMap(), _QueryBuilderList_filters = new WeakMap(), _QueryBuilderList_pageNumber = new WeakMap(), _QueryBuilderList_pageSize = new WeakMap();
|
131
|
-
class QueryBuilder extends QueryBuilderList {
|
132
|
-
constructor(resource) {
|
133
|
-
super(resource);
|
134
|
-
}
|
135
|
-
}
|
136
|
-
exports.default = QueryBuilder;
|
137
|
-
const generateQueryStringParams = (params) => {
|
138
|
-
const qp = {};
|
139
|
-
if (!params)
|
140
|
-
return qp;
|
141
|
-
// Include
|
142
|
-
if (params.include)
|
143
|
-
qp['include'] = params.include.join(',');
|
144
|
-
// Fields
|
145
|
-
if (params.fields) {
|
146
|
-
Object.entries(params.fields).forEach(([p, v]) => {
|
147
|
-
qp[`fields[${p}]`] = v.join(',');
|
148
|
-
});
|
149
|
-
}
|
150
|
-
if (isParamsList(params)) {
|
151
|
-
// Sort
|
152
|
-
if (params.sort) {
|
153
|
-
if (Array.isArray(params.sort))
|
154
|
-
qp['sort'] = params.sort.join(',');
|
155
|
-
else
|
156
|
-
qp['sort'] = Object.entries(params.sort).map(([k, v]) => `${v === 'desc' ? '-' : ''}${k}`).join(',');
|
157
|
-
}
|
158
|
-
// Page
|
159
|
-
if (params.pageNumber)
|
160
|
-
qp['page[number]'] = String(params.pageNumber);
|
161
|
-
if (params.pageSize)
|
162
|
-
qp['page[size]'] = String(params.pageSize);
|
163
|
-
// Filters
|
164
|
-
if (params.filters) {
|
165
|
-
Object.entries(params.filters).forEach(([p, v]) => {
|
166
|
-
qp[`filter[q][${p}]`] = String(v);
|
167
|
-
});
|
168
|
-
}
|
169
|
-
}
|
170
|
-
return qp;
|
171
|
-
};
|
172
|
-
exports.generateQueryStringParams = generateQueryStringParams;
|
package/lib/resource.js
DELETED
@@ -1,94 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
3
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
4
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
5
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
6
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
7
|
-
};
|
8
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
10
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
11
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
12
|
-
};
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
15
|
-
};
|
16
|
-
var _ResourceAdapter_client, _ResourceAdapter_config;
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
18
|
-
exports.ApiResource = exports.isResourceType = exports.isResourceId = void 0;
|
19
|
-
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
20
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
21
|
-
const client_1 = __importDefault(require("./client"));
|
22
|
-
const jsonapi_1 = require("./jsonapi");
|
23
|
-
const query_1 = require("./query");
|
24
|
-
const isResourceId = (resource) => {
|
25
|
-
return (resource.type && resource.id);
|
26
|
-
};
|
27
|
-
exports.isResourceId = isResourceId;
|
28
|
-
const isResourceType = (resource) => {
|
29
|
-
return (typeof resource.type !== 'undefined') && resource.type;
|
30
|
-
};
|
31
|
-
exports.isResourceType = isResourceType;
|
32
|
-
class ResourceAdapter {
|
33
|
-
constructor(config) {
|
34
|
-
_ResourceAdapter_client.set(this, void 0);
|
35
|
-
_ResourceAdapter_config.set(this, {});
|
36
|
-
__classPrivateFieldSet(this, _ResourceAdapter_client, client_1.default.create(config), "f");
|
37
|
-
this.config(config);
|
38
|
-
}
|
39
|
-
config(config) {
|
40
|
-
if (!config)
|
41
|
-
return;
|
42
|
-
// Client config
|
43
|
-
__classPrivateFieldGet(this, _ResourceAdapter_client, "f").config(config);
|
44
|
-
// Resources config
|
45
|
-
// if (typeof config.rawResponse !== 'undefined') this.#config.rawResponse = config.rawResponse
|
46
|
-
return;
|
47
|
-
}
|
48
|
-
/*
|
49
|
-
private isRawResponse(options?: ResourcesConfig): boolean {
|
50
|
-
return (typeof options?.rawResponse !== 'undefined') ? (options?.rawResponse === true) : (this.#config.rawResponse === true)
|
51
|
-
}
|
52
|
-
*/
|
53
|
-
async singleton(resource, params, options) {
|
54
|
-
const queryParams = query_1.generateQueryStringParams(params);
|
55
|
-
const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('get', `${resource.type}`, undefined, Object.assign(Object.assign({}, options), { params: queryParams }));
|
56
|
-
const r = jsonapi_1.denormalize(res);
|
57
|
-
return r;
|
58
|
-
}
|
59
|
-
async retrieve(resource, params, options) {
|
60
|
-
const queryParams = query_1.generateQueryStringParams(params);
|
61
|
-
const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('get', `${resource.type}/${resource.id}`, undefined, Object.assign(Object.assign({}, options), { params: queryParams }));
|
62
|
-
const r = jsonapi_1.denormalize(res);
|
63
|
-
return r;
|
64
|
-
}
|
65
|
-
async list(resource, params, options) {
|
66
|
-
const queryParams = query_1.generateQueryStringParams(params);
|
67
|
-
const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('get', `${resource.type}`, undefined, Object.assign(Object.assign({}, options), { params: queryParams }));
|
68
|
-
const r = jsonapi_1.denormalize(res);
|
69
|
-
return r;
|
70
|
-
}
|
71
|
-
async create(resource, options) {
|
72
|
-
const data = jsonapi_1.normalize(resource);
|
73
|
-
const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('post', resource.type, data, options);
|
74
|
-
const r = jsonapi_1.denormalize(res);
|
75
|
-
return r;
|
76
|
-
}
|
77
|
-
async update(resource, options) {
|
78
|
-
const data = jsonapi_1.normalize(resource);
|
79
|
-
const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('patch', `${resource.type}/${resource.id}`, data, options);
|
80
|
-
const r = jsonapi_1.denormalize(res);
|
81
|
-
return r;
|
82
|
-
}
|
83
|
-
async delete(resource, options) {
|
84
|
-
__classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('delete', `${resource.type}/${resource.id}`, undefined, options);
|
85
|
-
}
|
86
|
-
}
|
87
|
-
_ResourceAdapter_client = new WeakMap(), _ResourceAdapter_config = new WeakMap();
|
88
|
-
class ApiResource {
|
89
|
-
constructor(adapter) {
|
90
|
-
this.resources = adapter;
|
91
|
-
}
|
92
|
-
}
|
93
|
-
exports.ApiResource = ApiResource;
|
94
|
-
exports.default = ResourceAdapter;
|
@@ -1,45 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
/**
|
3
|
-
* ©2021 Commerce Layer Inc.
|
4
|
-
* Source code generated automatically by SDK codegen from OpenAPI schema 2.3.0
|
5
|
-
* Generation date: 22-07-2021
|
6
|
-
**/
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
8
|
-
const resource_1 = require("../resource");
|
9
|
-
class Addresses extends resource_1.ApiResource {
|
10
|
-
// static readonly PATH = 'addresses'
|
11
|
-
async list(params, options) {
|
12
|
-
return this.resources.list({ type: Addresses.TYPE }, params, options);
|
13
|
-
}
|
14
|
-
async create(resource, options) {
|
15
|
-
return this.resources.create(Object.assign(resource, { type: Addresses.TYPE }), options);
|
16
|
-
}
|
17
|
-
async retrieve(id, params, options) {
|
18
|
-
return this.resources.retrieve({ type: Addresses.TYPE, id }, params, options);
|
19
|
-
}
|
20
|
-
async update(resource, options) {
|
21
|
-
return this.resources.update(Object.assign(Object.assign({}, resource), { type: Addresses.TYPE }), options);
|
22
|
-
}
|
23
|
-
async delete(id, options) {
|
24
|
-
this.resources.delete({ type: Addresses.TYPE, id }, options);
|
25
|
-
}
|
26
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
27
|
-
isAddress(resource) {
|
28
|
-
return resource.type && (resource.type === Addresses.TYPE);
|
29
|
-
}
|
30
|
-
/*
|
31
|
-
filter(): QueryBuilderRetrieve {
|
32
|
-
return new QueryBuilderRetrieve(Addresses.TYPE)
|
33
|
-
}
|
34
|
-
*/
|
35
|
-
/*
|
36
|
-
filterList(): QueryBuilderList {
|
37
|
-
return new QueryBuilderList(Addresses.TYPE)
|
38
|
-
}
|
39
|
-
*/
|
40
|
-
relationship(id) {
|
41
|
-
return { id, type: Addresses.TYPE };
|
42
|
-
}
|
43
|
-
}
|
44
|
-
Addresses.TYPE = 'addresses';
|
45
|
-
exports.default = Addresses;
|
@@ -1,45 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
/**
|
3
|
-
* ©2021 Commerce Layer Inc.
|
4
|
-
* Source code generated automatically by SDK codegen from OpenAPI schema 2.3.0
|
5
|
-
* Generation date: 22-07-2021
|
6
|
-
**/
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
8
|
-
const resource_1 = require("../resource");
|
9
|
-
class Adjustments extends resource_1.ApiResource {
|
10
|
-
// static readonly PATH = 'adjustments'
|
11
|
-
async list(params, options) {
|
12
|
-
return this.resources.list({ type: Adjustments.TYPE }, params, options);
|
13
|
-
}
|
14
|
-
async create(resource, options) {
|
15
|
-
return this.resources.create(Object.assign(resource, { type: Adjustments.TYPE }), options);
|
16
|
-
}
|
17
|
-
async retrieve(id, params, options) {
|
18
|
-
return this.resources.retrieve({ type: Adjustments.TYPE, id }, params, options);
|
19
|
-
}
|
20
|
-
async update(resource, options) {
|
21
|
-
return this.resources.update(Object.assign(Object.assign({}, resource), { type: Adjustments.TYPE }), options);
|
22
|
-
}
|
23
|
-
async delete(id, options) {
|
24
|
-
this.resources.delete({ type: Adjustments.TYPE, id }, options);
|
25
|
-
}
|
26
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
27
|
-
isAdjustment(resource) {
|
28
|
-
return resource.type && (resource.type === Adjustments.TYPE);
|
29
|
-
}
|
30
|
-
/*
|
31
|
-
filter(): QueryBuilderRetrieve {
|
32
|
-
return new QueryBuilderRetrieve(Adjustments.TYPE)
|
33
|
-
}
|
34
|
-
*/
|
35
|
-
/*
|
36
|
-
filterList(): QueryBuilderList {
|
37
|
-
return new QueryBuilderList(Adjustments.TYPE)
|
38
|
-
}
|
39
|
-
*/
|
40
|
-
relationship(id) {
|
41
|
-
return { id, type: Adjustments.TYPE };
|
42
|
-
}
|
43
|
-
}
|
44
|
-
Adjustments.TYPE = 'adjustments';
|
45
|
-
exports.default = Adjustments;
|
@@ -1,45 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
/**
|
3
|
-
* ©2021 Commerce Layer Inc.
|
4
|
-
* Source code generated automatically by SDK codegen from OpenAPI schema 2.3.0
|
5
|
-
* Generation date: 22-07-2021
|
6
|
-
**/
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
8
|
-
const resource_1 = require("../resource");
|
9
|
-
class AdyenGateways extends resource_1.ApiResource {
|
10
|
-
// static readonly PATH = 'adyen_gateways'
|
11
|
-
async list(params, options) {
|
12
|
-
return this.resources.list({ type: AdyenGateways.TYPE }, params, options);
|
13
|
-
}
|
14
|
-
async create(resource, options) {
|
15
|
-
return this.resources.create(Object.assign(resource, { type: AdyenGateways.TYPE }), options);
|
16
|
-
}
|
17
|
-
async retrieve(id, params, options) {
|
18
|
-
return this.resources.retrieve({ type: AdyenGateways.TYPE, id }, params, options);
|
19
|
-
}
|
20
|
-
async update(resource, options) {
|
21
|
-
return this.resources.update(Object.assign(Object.assign({}, resource), { type: AdyenGateways.TYPE }), options);
|
22
|
-
}
|
23
|
-
async delete(id, options) {
|
24
|
-
this.resources.delete({ type: AdyenGateways.TYPE, id }, options);
|
25
|
-
}
|
26
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
27
|
-
isAdyenGateway(resource) {
|
28
|
-
return resource.type && (resource.type === AdyenGateways.TYPE);
|
29
|
-
}
|
30
|
-
/*
|
31
|
-
filter(): QueryBuilderRetrieve {
|
32
|
-
return new QueryBuilderRetrieve(AdyenGateways.TYPE)
|
33
|
-
}
|
34
|
-
*/
|
35
|
-
/*
|
36
|
-
filterList(): QueryBuilderList {
|
37
|
-
return new QueryBuilderList(AdyenGateways.TYPE)
|
38
|
-
}
|
39
|
-
*/
|
40
|
-
relationship(id) {
|
41
|
-
return { id, type: AdyenGateways.TYPE };
|
42
|
-
}
|
43
|
-
}
|
44
|
-
AdyenGateways.TYPE = 'adyen_gateways';
|
45
|
-
exports.default = AdyenGateways;
|
@@ -1,45 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
/**
|
3
|
-
* ©2021 Commerce Layer Inc.
|
4
|
-
* Source code generated automatically by SDK codegen from OpenAPI schema 2.3.0
|
5
|
-
* Generation date: 22-07-2021
|
6
|
-
**/
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
8
|
-
const resource_1 = require("../resource");
|
9
|
-
class AdyenPayments extends resource_1.ApiResource {
|
10
|
-
// static readonly PATH = 'adyen_payments'
|
11
|
-
async list(params, options) {
|
12
|
-
return this.resources.list({ type: AdyenPayments.TYPE }, params, options);
|
13
|
-
}
|
14
|
-
async create(resource, options) {
|
15
|
-
return this.resources.create(Object.assign(resource, { type: AdyenPayments.TYPE }), options);
|
16
|
-
}
|
17
|
-
async retrieve(id, params, options) {
|
18
|
-
return this.resources.retrieve({ type: AdyenPayments.TYPE, id }, params, options);
|
19
|
-
}
|
20
|
-
async update(resource, options) {
|
21
|
-
return this.resources.update(Object.assign(Object.assign({}, resource), { type: AdyenPayments.TYPE }), options);
|
22
|
-
}
|
23
|
-
async delete(id, options) {
|
24
|
-
this.resources.delete({ type: AdyenPayments.TYPE, id }, options);
|
25
|
-
}
|
26
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
27
|
-
isAdyenPayment(resource) {
|
28
|
-
return resource.type && (resource.type === AdyenPayments.TYPE);
|
29
|
-
}
|
30
|
-
/*
|
31
|
-
filter(): QueryBuilderRetrieve {
|
32
|
-
return new QueryBuilderRetrieve(AdyenPayments.TYPE)
|
33
|
-
}
|
34
|
-
*/
|
35
|
-
/*
|
36
|
-
filterList(): QueryBuilderList {
|
37
|
-
return new QueryBuilderList(AdyenPayments.TYPE)
|
38
|
-
}
|
39
|
-
*/
|
40
|
-
relationship(id) {
|
41
|
-
return { id, type: AdyenPayments.TYPE };
|
42
|
-
}
|
43
|
-
}
|
44
|
-
AdyenPayments.TYPE = 'adyen_payments';
|
45
|
-
exports.default = AdyenPayments;
|
@@ -1,33 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
/**
|
3
|
-
* ©2021 Commerce Layer Inc.
|
4
|
-
* Source code generated automatically by SDK codegen from OpenAPI schema 2.3.0
|
5
|
-
* Generation date: 22-07-2021
|
6
|
-
**/
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
8
|
-
const resource_1 = require("../resource");
|
9
|
-
class Applications extends resource_1.ApiResource {
|
10
|
-
// static readonly PATH = 'application'
|
11
|
-
async retrieve(params, options) {
|
12
|
-
return this.resources.singleton({ type: Applications.TYPE }, params, options);
|
13
|
-
}
|
14
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
15
|
-
isApplication(resource) {
|
16
|
-
return resource.type && (resource.type === Applications.TYPE);
|
17
|
-
}
|
18
|
-
/*
|
19
|
-
filter(): QueryBuilderRetrieve {
|
20
|
-
return new QueryBuilderRetrieve(Applications.TYPE)
|
21
|
-
}
|
22
|
-
*/
|
23
|
-
/*
|
24
|
-
filterList(): QueryBuilderList {
|
25
|
-
return new QueryBuilderList(Applications.TYPE)
|
26
|
-
}
|
27
|
-
*/
|
28
|
-
relationship(id) {
|
29
|
-
return { id, type: Applications.TYPE };
|
30
|
-
}
|
31
|
-
}
|
32
|
-
Applications.TYPE = 'application';
|
33
|
-
exports.default = Applications;
|
@@ -1,45 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
/**
|
3
|
-
* ©2021 Commerce Layer Inc.
|
4
|
-
* Source code generated automatically by SDK codegen from OpenAPI schema 2.3.0
|
5
|
-
* Generation date: 22-07-2021
|
6
|
-
**/
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
8
|
-
const resource_1 = require("../resource");
|
9
|
-
class Attachments extends resource_1.ApiResource {
|
10
|
-
// static readonly PATH = 'attachments'
|
11
|
-
async list(params, options) {
|
12
|
-
return this.resources.list({ type: Attachments.TYPE }, params, options);
|
13
|
-
}
|
14
|
-
async create(resource, options) {
|
15
|
-
return this.resources.create(Object.assign(resource, { type: Attachments.TYPE }), options);
|
16
|
-
}
|
17
|
-
async retrieve(id, params, options) {
|
18
|
-
return this.resources.retrieve({ type: Attachments.TYPE, id }, params, options);
|
19
|
-
}
|
20
|
-
async update(resource, options) {
|
21
|
-
return this.resources.update(Object.assign(Object.assign({}, resource), { type: Attachments.TYPE }), options);
|
22
|
-
}
|
23
|
-
async delete(id, options) {
|
24
|
-
this.resources.delete({ type: Attachments.TYPE, id }, options);
|
25
|
-
}
|
26
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
27
|
-
isAttachment(resource) {
|
28
|
-
return resource.type && (resource.type === Attachments.TYPE);
|
29
|
-
}
|
30
|
-
/*
|
31
|
-
filter(): QueryBuilderRetrieve {
|
32
|
-
return new QueryBuilderRetrieve(Attachments.TYPE)
|
33
|
-
}
|
34
|
-
*/
|
35
|
-
/*
|
36
|
-
filterList(): QueryBuilderList {
|
37
|
-
return new QueryBuilderList(Attachments.TYPE)
|
38
|
-
}
|
39
|
-
*/
|
40
|
-
relationship(id) {
|
41
|
-
return { id, type: Attachments.TYPE };
|
42
|
-
}
|
43
|
-
}
|
44
|
-
Attachments.TYPE = 'attachments';
|
45
|
-
exports.default = Attachments;
|
@@ -1,45 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
/**
|
3
|
-
* ©2021 Commerce Layer Inc.
|
4
|
-
* Source code generated automatically by SDK codegen from OpenAPI schema 2.3.0
|
5
|
-
* Generation date: 22-07-2021
|
6
|
-
**/
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
8
|
-
const resource_1 = require("../resource");
|
9
|
-
class Authorizations extends resource_1.ApiResource {
|
10
|
-
// static readonly PATH = 'authorizations'
|
11
|
-
async list(params, options) {
|
12
|
-
return this.resources.list({ type: Authorizations.TYPE }, params, options);
|
13
|
-
}
|
14
|
-
async create(resource, options) {
|
15
|
-
return this.resources.create(Object.assign(resource, { type: Authorizations.TYPE }), options);
|
16
|
-
}
|
17
|
-
async retrieve(id, params, options) {
|
18
|
-
return this.resources.retrieve({ type: Authorizations.TYPE, id }, params, options);
|
19
|
-
}
|
20
|
-
async update(resource, options) {
|
21
|
-
return this.resources.update(Object.assign(Object.assign({}, resource), { type: Authorizations.TYPE }), options);
|
22
|
-
}
|
23
|
-
async delete(id, options) {
|
24
|
-
this.resources.delete({ type: Authorizations.TYPE, id }, options);
|
25
|
-
}
|
26
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
27
|
-
isAuthorization(resource) {
|
28
|
-
return resource.type && (resource.type === Authorizations.TYPE);
|
29
|
-
}
|
30
|
-
/*
|
31
|
-
filter(): QueryBuilderRetrieve {
|
32
|
-
return new QueryBuilderRetrieve(Authorizations.TYPE)
|
33
|
-
}
|
34
|
-
*/
|
35
|
-
/*
|
36
|
-
filterList(): QueryBuilderList {
|
37
|
-
return new QueryBuilderList(Authorizations.TYPE)
|
38
|
-
}
|
39
|
-
*/
|
40
|
-
relationship(id) {
|
41
|
-
return { id, type: Authorizations.TYPE };
|
42
|
-
}
|
43
|
-
}
|
44
|
-
Authorizations.TYPE = 'authorizations';
|
45
|
-
exports.default = Authorizations;
|