@commercelayer/provisioning-sdk 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.mts +576 -0
- package/lib/index.d.ts +576 -0
- package/lib/index.js +1 -0
- package/lib/index.mjs +1 -0
- package/package.json +14 -15
- package/lib/cjs/api.d.ts +0 -43
- package/lib/cjs/api.js +0 -45
- package/lib/cjs/client.d.ts +0 -42
- package/lib/cjs/client.js +0 -149
- package/lib/cjs/commercelayer.d.ts +0 -39
- package/lib/cjs/commercelayer.js +0 -130
- package/lib/cjs/common.d.ts +0 -5
- package/lib/cjs/common.js +0 -12
- package/lib/cjs/config.d.ts +0 -15
- package/lib/cjs/config.js +0 -19
- package/lib/cjs/debug.d.ts +0 -3
- package/lib/cjs/debug.js +0 -38
- package/lib/cjs/error.d.ts +0 -31
- package/lib/cjs/error.js +0 -77
- package/lib/cjs/index.d.ts +0 -7
- package/lib/cjs/index.js +0 -13
- package/lib/cjs/interceptor.d.ts +0 -25
- package/lib/cjs/interceptor.js +0 -2
- package/lib/cjs/jsonapi.d.ts +0 -6
- package/lib/cjs/jsonapi.js +0 -94
- package/lib/cjs/model.d.ts +0 -11
- package/lib/cjs/model.js +0 -3
- package/lib/cjs/query.d.ts +0 -17
- package/lib/cjs/query.js +0 -52
- package/lib/cjs/resource.d.ts +0 -86
- package/lib/cjs/resource.js +0 -194
- package/lib/cjs/resources/api_credentials.d.ts +0 -59
- package/lib/cjs/resources/api_credentials.js +0 -33
- package/lib/cjs/resources/application_memberships.d.ts +0 -57
- package/lib/cjs/resources/application_memberships.js +0 -41
- package/lib/cjs/resources/memberships.d.ts +0 -58
- package/lib/cjs/resources/memberships.js +0 -45
- package/lib/cjs/resources/organizations.d.ts +0 -84
- package/lib/cjs/resources/organizations.js +0 -42
- package/lib/cjs/resources/permissions.d.ts +0 -52
- package/lib/cjs/resources/permissions.js +0 -34
- package/lib/cjs/resources/roles.d.ts +0 -47
- package/lib/cjs/resources/roles.js +0 -42
- package/lib/cjs/resources/user.d.ts +0 -29
- package/lib/cjs/resources/user.js +0 -20
- package/lib/cjs/resources/versions.d.ts +0 -22
- package/lib/cjs/resources/versions.js +0 -16
- package/lib/cjs/static.d.ts +0 -12
- package/lib/cjs/static.js +0 -51
- package/lib/cjs/util.d.ts +0 -9
- package/lib/cjs/util.js +0 -16
- package/lib/esm/api.d.ts +0 -43
- package/lib/esm/api.js +0 -31
- package/lib/esm/client.d.ts +0 -42
- package/lib/esm/client.js +0 -144
- package/lib/esm/commercelayer.d.ts +0 -39
- package/lib/esm/commercelayer.js +0 -101
- package/lib/esm/common.d.ts +0 -5
- package/lib/esm/common.js +0 -8
- package/lib/esm/config.d.ts +0 -15
- package/lib/esm/config.js +0 -17
- package/lib/esm/debug.d.ts +0 -3
- package/lib/esm/debug.js +0 -36
- package/lib/esm/error.d.ts +0 -31
- package/lib/esm/error.js +0 -69
- package/lib/esm/index.d.ts +0 -7
- package/lib/esm/index.js +0 -4
- package/lib/esm/interceptor.d.ts +0 -25
- package/lib/esm/interceptor.js +0 -1
- package/lib/esm/jsonapi.d.ts +0 -6
- package/lib/esm/jsonapi.js +0 -87
- package/lib/esm/model.d.ts +0 -11
- package/lib/esm/model.js +0 -2
- package/lib/esm/query.d.ts +0 -17
- package/lib/esm/query.js +0 -45
- package/lib/esm/resource.d.ts +0 -86
- package/lib/esm/resource.js +0 -187
- package/lib/esm/resources/api_credentials.d.ts +0 -59
- package/lib/esm/resources/api_credentials.js +0 -31
- package/lib/esm/resources/application_memberships.d.ts +0 -57
- package/lib/esm/resources/application_memberships.js +0 -39
- package/lib/esm/resources/memberships.d.ts +0 -58
- package/lib/esm/resources/memberships.js +0 -43
- package/lib/esm/resources/organizations.d.ts +0 -84
- package/lib/esm/resources/organizations.js +0 -40
- package/lib/esm/resources/permissions.d.ts +0 -52
- package/lib/esm/resources/permissions.js +0 -32
- package/lib/esm/resources/roles.d.ts +0 -47
- package/lib/esm/resources/roles.js +0 -40
- package/lib/esm/resources/user.d.ts +0 -29
- package/lib/esm/resources/user.js +0 -18
- package/lib/esm/resources/versions.d.ts +0 -22
- package/lib/esm/resources/versions.js +0 -14
- package/lib/esm/static.d.ts +0 -12
- package/lib/esm/static.js +0 -25
- package/lib/esm/util.d.ts +0 -9
- package/lib/esm/util.js +0 -37
- package/lib/tsconfig.esm.tsbuildinfo +0 -1
- package/lib/tsconfig.tsbuildinfo +0 -1
package/lib/cjs/error.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.handleError = exports.ErrorType = exports.ApiError = exports.SdkError = void 0;
|
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
var ErrorType;
|
|
9
|
-
(function (ErrorType) {
|
|
10
|
-
ErrorType["CLIENT"] = "client";
|
|
11
|
-
ErrorType["REQUEST"] = "request";
|
|
12
|
-
ErrorType["RESPONSE"] = "response";
|
|
13
|
-
ErrorType["CANCEL"] = "cancel";
|
|
14
|
-
ErrorType["PARSE"] = "parse";
|
|
15
|
-
ErrorType["GENERIC"] = "generic";
|
|
16
|
-
})(ErrorType || (exports.ErrorType = ErrorType = {}));
|
|
17
|
-
class SdkError extends Error {
|
|
18
|
-
static isSdkError(error) {
|
|
19
|
-
return error && [SdkError.NAME, ApiError.NAME].includes(error.name) && Object.values(ErrorType).includes(error.type);
|
|
20
|
-
}
|
|
21
|
-
constructor(error) {
|
|
22
|
-
super(error.message);
|
|
23
|
-
this.name = SdkError.NAME; // this.constructor.name
|
|
24
|
-
this.type = error.type || ErrorType.GENERIC;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.SdkError = SdkError;
|
|
28
|
-
SdkError.NAME = 'SdkError';
|
|
29
|
-
class ApiError extends SdkError {
|
|
30
|
-
static isApiError(error) {
|
|
31
|
-
return SdkError.isSdkError(error) && (error.name === ApiError.NAME) && (error.type === ErrorType.RESPONSE);
|
|
32
|
-
}
|
|
33
|
-
constructor(error) {
|
|
34
|
-
super({ ...error, type: ErrorType.RESPONSE });
|
|
35
|
-
this.errors = [];
|
|
36
|
-
this.name = ApiError.NAME; // this.constructor.name
|
|
37
|
-
}
|
|
38
|
-
first() {
|
|
39
|
-
var _a;
|
|
40
|
-
return (((_a = this.errors) === null || _a === void 0 ? void 0 : _a.length) > 0) ? this.errors[0] : undefined;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.ApiError = ApiError;
|
|
44
|
-
ApiError.NAME = 'ApiError';
|
|
45
|
-
const handleError = (error) => {
|
|
46
|
-
let sdkError = new SdkError({ message: error.message });
|
|
47
|
-
if (axios_1.default.isAxiosError(error)) {
|
|
48
|
-
if (error.response) {
|
|
49
|
-
// The request was made and the server responded with a status code that falls out of the range of 2xx
|
|
50
|
-
const apiError = new ApiError(sdkError);
|
|
51
|
-
apiError.type = ErrorType.RESPONSE;
|
|
52
|
-
apiError.status = error.response.status;
|
|
53
|
-
apiError.statusText = error.response.statusText;
|
|
54
|
-
apiError.code = String(apiError.status);
|
|
55
|
-
apiError.errors = error.response.data.errors;
|
|
56
|
-
if (!apiError.message && apiError.statusText)
|
|
57
|
-
apiError.message = apiError.statusText;
|
|
58
|
-
sdkError = apiError;
|
|
59
|
-
}
|
|
60
|
-
else if (error.request) {
|
|
61
|
-
// The request was made but no response was received
|
|
62
|
-
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of http.ClientRequest in node.js
|
|
63
|
-
sdkError.type = ErrorType.REQUEST;
|
|
64
|
-
sdkError.request = error.request;
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
// Something happened in setting up the request that triggered an Error
|
|
68
|
-
sdkError.type = ErrorType.CLIENT;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
else if (axios_1.default.isCancel(error))
|
|
72
|
-
sdkError.type = ErrorType.CANCEL;
|
|
73
|
-
else
|
|
74
|
-
sdkError.source = error;
|
|
75
|
-
throw sdkError;
|
|
76
|
-
};
|
|
77
|
-
exports.handleError = handleError;
|
package/lib/cjs/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { default, CommerceLayerProvisioning } from './commercelayer';
|
|
2
|
-
export type { CommerceLayerProvisioningClient } from './commercelayer';
|
|
3
|
-
export { CommerceLayerProvisioningStatic } from './static';
|
|
4
|
-
export type { QueryParamsRetrieve, QueryParamsList, QueryParams } from './query';
|
|
5
|
-
export type * from './model';
|
|
6
|
-
export type { RequestObj, ResponseObj, ErrorObj, HeadersObj } from './interceptor';
|
|
7
|
-
export type { SdkError, ApiError, ErrorType } from './error';
|
package/lib/cjs/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.CommerceLayerProvisioningStatic = exports.CommerceLayerProvisioning = exports.default = void 0;
|
|
7
|
-
// SDK
|
|
8
|
-
var commercelayer_1 = require("./commercelayer");
|
|
9
|
-
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(commercelayer_1).default; } });
|
|
10
|
-
Object.defineProperty(exports, "CommerceLayerProvisioning", { enumerable: true, get: function () { return commercelayer_1.CommerceLayerProvisioning; } });
|
|
11
|
-
// Commerce Layer Provisioning static functions
|
|
12
|
-
var static_1 = require("./static");
|
|
13
|
-
Object.defineProperty(exports, "CommerceLayerProvisioningStatic", { enumerable: true, get: function () { return static_1.CommerceLayerProvisioningStatic; } });
|
package/lib/cjs/interceptor.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { AxiosError, AxiosInterceptorManager, AxiosRequestConfig, AxiosResponse, AxiosResponseHeaders, RawAxiosResponseHeaders } from 'axios';
|
|
2
|
-
type InterceptorManager = {
|
|
3
|
-
request: AxiosInterceptorManager<AxiosRequestConfig>;
|
|
4
|
-
response: AxiosInterceptorManager<any>;
|
|
5
|
-
};
|
|
6
|
-
type RequestObj = AxiosRequestConfig;
|
|
7
|
-
type RequestInterceptor = (request: RequestObj) => RequestObj | Promise<RequestObj>;
|
|
8
|
-
type ResponseObj = AxiosResponse;
|
|
9
|
-
type ResponseInterceptor = (response: ResponseObj) => ResponseObj;
|
|
10
|
-
type ApiHeadersList = 'x-ratelimit-limit' | 'x-ratelimit-count' | 'x-ratelimit-period' | 'x-ratelimit-interval' | 'x-ratelimit-remaining';
|
|
11
|
-
type ApiHeaders = {
|
|
12
|
-
[key in ApiHeadersList]: string | number | boolean;
|
|
13
|
-
};
|
|
14
|
-
type HeadersObj = (AxiosResponseHeaders | RawAxiosResponseHeaders) & ApiHeaders;
|
|
15
|
-
type ErrorObj = AxiosError;
|
|
16
|
-
type ErrorInterceptor = (error: ErrorObj) => ErrorObj;
|
|
17
|
-
type InterceptorType = 'request' | 'response';
|
|
18
|
-
export type { InterceptorManager, RequestInterceptor, ResponseInterceptor, ErrorInterceptor, InterceptorType };
|
|
19
|
-
export type { RequestObj, ResponseObj, ErrorObj, HeadersObj };
|
|
20
|
-
type RawResponseReader = {
|
|
21
|
-
id: number | undefined;
|
|
22
|
-
rawResponse: ResponseObj | undefined;
|
|
23
|
-
headers: HeadersObj | undefined;
|
|
24
|
-
};
|
|
25
|
-
export type { RawResponseReader };
|
package/lib/cjs/interceptor.js
DELETED
package/lib/cjs/jsonapi.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { DocWithData, ResourceObject as JSONAPIObject } from 'jsonapi-typescript';
|
|
2
|
-
import type { ResourceCreate, ResourceUpdate, ResourceId, ResourceType, Resource } from './resource';
|
|
3
|
-
export type { DocWithData };
|
|
4
|
-
declare const denormalize: <R extends Resource>(response: DocWithData) => R | R[];
|
|
5
|
-
declare const normalize: (resource: (ResourceCreate & ResourceType) | (ResourceUpdate & ResourceId)) => JSONAPIObject;
|
|
6
|
-
export { denormalize, normalize };
|
package/lib/cjs/jsonapi.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.normalize = exports.denormalize = void 0;
|
|
7
|
-
const common_1 = require("./common");
|
|
8
|
-
const config_1 = __importDefault(require("./config"));
|
|
9
|
-
const debug_1 = __importDefault(require("./debug"));
|
|
10
|
-
const debug = (0, debug_1.default)('jsonapi');
|
|
11
|
-
// DENORMALIZATION
|
|
12
|
-
const denormalize = (response) => {
|
|
13
|
-
let denormalizedResponse;
|
|
14
|
-
if (response.links)
|
|
15
|
-
delete response.links;
|
|
16
|
-
const data = response.data;
|
|
17
|
-
const included = response.included;
|
|
18
|
-
if (!data)
|
|
19
|
-
denormalizedResponse = data;
|
|
20
|
-
else {
|
|
21
|
-
if (Array.isArray(data))
|
|
22
|
-
denormalizedResponse = data.map(res => denormalizeResource(res, included));
|
|
23
|
-
else
|
|
24
|
-
denormalizedResponse = denormalizeResource(data, included);
|
|
25
|
-
}
|
|
26
|
-
return denormalizedResponse;
|
|
27
|
-
};
|
|
28
|
-
exports.denormalize = denormalize;
|
|
29
|
-
const findIncluded = (rel, included = []) => {
|
|
30
|
-
const inc = included.find(inc => {
|
|
31
|
-
return (rel.id === inc.id) && (rel.type === inc.type);
|
|
32
|
-
});
|
|
33
|
-
return inc || rel;
|
|
34
|
-
};
|
|
35
|
-
const denormalizeResource = (res, included, chain = []) => {
|
|
36
|
-
debug('denormalize resource: %O, %o', res, included || {});
|
|
37
|
-
if (!res)
|
|
38
|
-
return res;
|
|
39
|
-
const resource = {
|
|
40
|
-
id: res.id,
|
|
41
|
-
type: res.type,
|
|
42
|
-
...res.attributes,
|
|
43
|
-
};
|
|
44
|
-
if (res.relationships)
|
|
45
|
-
Object.keys(res.relationships).forEach(key => {
|
|
46
|
-
const rel = res.relationships[key].data;
|
|
47
|
-
if (rel) {
|
|
48
|
-
if (chain.filter(r => (r.id === rel.id) && (r.type === rel.type)).length >= config_1.default.jsonapi.maxResourceIncluded)
|
|
49
|
-
resource[key] = rel;
|
|
50
|
-
else {
|
|
51
|
-
if (Array.isArray(rel))
|
|
52
|
-
resource[key] = rel.map((r) => denormalizeResource(findIncluded(r, included), included, [...chain, r]));
|
|
53
|
-
else
|
|
54
|
-
resource[key] = denormalizeResource(findIncluded(rel, included), included, [...chain, rel]);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
else if (rel === null)
|
|
58
|
-
resource[key] = null;
|
|
59
|
-
});
|
|
60
|
-
debug('denormalized resource: %O', resource);
|
|
61
|
-
return resource;
|
|
62
|
-
};
|
|
63
|
-
// NORMALIZATION
|
|
64
|
-
const normalize = (resource) => {
|
|
65
|
-
debug('normalize resource: %O', resource);
|
|
66
|
-
const attributes = {};
|
|
67
|
-
const relationships = {};
|
|
68
|
-
for (const field in resource) {
|
|
69
|
-
if (['type', 'id'].includes(field))
|
|
70
|
-
continue;
|
|
71
|
-
const value = resource[field];
|
|
72
|
-
if (Array.isArray(value) && (value.length === 1) && (0, common_1.isResourceType)(value[0]) && (value[0].id === null)) {
|
|
73
|
-
relationships[field] = { data: [] };
|
|
74
|
-
}
|
|
75
|
-
else if (value && (0, common_1.isResourceType)(value) && (value.id === null)) {
|
|
76
|
-
relationships[field] = { data: null };
|
|
77
|
-
}
|
|
78
|
-
else if (value && ((0, common_1.isResourceId)(value) || (Array.isArray(value) && (0, common_1.isResourceId)(value[0])))) {
|
|
79
|
-
relationships[field] = { data: value };
|
|
80
|
-
}
|
|
81
|
-
else
|
|
82
|
-
attributes[field] = value;
|
|
83
|
-
}
|
|
84
|
-
const normalized = {
|
|
85
|
-
type: resource.type,
|
|
86
|
-
attributes,
|
|
87
|
-
relationships
|
|
88
|
-
};
|
|
89
|
-
if ((0, common_1.isResourceId)(resource))
|
|
90
|
-
normalized.id = resource.id;
|
|
91
|
-
debug('normalized resource: %O', normalized);
|
|
92
|
-
return normalized;
|
|
93
|
-
};
|
|
94
|
-
exports.normalize = normalize;
|
package/lib/cjs/model.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ©2024 Commerce Layer Inc.
|
|
3
|
-
**/
|
|
4
|
-
export type { ApiCredential, ApiCredentialCreate, ApiCredentialUpdate } from './resources/api_credentials';
|
|
5
|
-
export type { ApplicationMembership, ApplicationMembershipCreate, ApplicationMembershipUpdate } from './resources/application_memberships';
|
|
6
|
-
export type { Membership, MembershipCreate, MembershipUpdate } from './resources/memberships';
|
|
7
|
-
export type { Organization, OrganizationCreate, OrganizationUpdate } from './resources/organizations';
|
|
8
|
-
export type { Permission, PermissionCreate, PermissionUpdate } from './resources/permissions';
|
|
9
|
-
export type { Role, RoleCreate, RoleUpdate } from './resources/roles';
|
|
10
|
-
export type { User, UserUpdate } from './resources/user';
|
|
11
|
-
export type { Version } from './resources/versions';
|
package/lib/cjs/model.js
DELETED
package/lib/cjs/query.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { ResourceType } from "./resource";
|
|
2
|
-
type QueryFilter = Record<string, string | number | boolean>;
|
|
3
|
-
interface QueryParamsRetrieve {
|
|
4
|
-
include?: string[];
|
|
5
|
-
fields?: string[] | Record<string, string[]>;
|
|
6
|
-
}
|
|
7
|
-
interface QueryParamsList extends QueryParamsRetrieve {
|
|
8
|
-
sort?: string[] | Record<string, 'asc' | 'desc'>;
|
|
9
|
-
filters?: QueryFilter;
|
|
10
|
-
pageNumber?: number;
|
|
11
|
-
pageSize?: number;
|
|
12
|
-
}
|
|
13
|
-
type QueryParams = QueryParamsRetrieve | QueryParamsList;
|
|
14
|
-
export type { QueryParamsRetrieve, QueryParamsList, QueryParams, QueryFilter };
|
|
15
|
-
declare const isParamsList: (params: any) => params is QueryParamsList;
|
|
16
|
-
declare const generateQueryStringParams: (params: QueryParamsRetrieve | QueryParamsList | undefined, res: string | ResourceType) => Record<string, string>;
|
|
17
|
-
export { generateQueryStringParams, isParamsList };
|
package/lib/cjs/query.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.isParamsList = exports.generateQueryStringParams = void 0;
|
|
7
|
-
const debug_1 = __importDefault(require("./debug"));
|
|
8
|
-
const debug = (0, debug_1.default)('query');
|
|
9
|
-
const isParamsList = (params) => {
|
|
10
|
-
return params && (params.filters || params.pageNumber || params.pageSize || params.sort);
|
|
11
|
-
};
|
|
12
|
-
exports.isParamsList = isParamsList;
|
|
13
|
-
const generateQueryStringParams = (params, res) => {
|
|
14
|
-
debug('generate query string params: %O, %O', params, res);
|
|
15
|
-
const qp = {};
|
|
16
|
-
if (!params)
|
|
17
|
-
return qp;
|
|
18
|
-
// Include
|
|
19
|
-
if (params.include)
|
|
20
|
-
qp.include = params.include.join(',');
|
|
21
|
-
// Fields
|
|
22
|
-
if (params.fields) {
|
|
23
|
-
if (Array.isArray(params.fields))
|
|
24
|
-
params.fields = { [res.type || res]: params.fields };
|
|
25
|
-
Object.entries(params.fields).forEach(([p, v]) => {
|
|
26
|
-
qp[`fields[${p}]`] = v.join(',');
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
if (isParamsList(params)) {
|
|
30
|
-
// Sort
|
|
31
|
-
if (params.sort) {
|
|
32
|
-
if (Array.isArray(params.sort))
|
|
33
|
-
qp.sort = params.sort.join(',');
|
|
34
|
-
else
|
|
35
|
-
qp.sort = Object.entries(params.sort).map(([k, v]) => `${v === 'desc' ? '-' : ''}${k}`).join(',');
|
|
36
|
-
}
|
|
37
|
-
// Page
|
|
38
|
-
if (params.pageNumber)
|
|
39
|
-
qp['page[number]'] = String(params.pageNumber);
|
|
40
|
-
if (params.pageSize)
|
|
41
|
-
qp['page[size]'] = String(params.pageSize);
|
|
42
|
-
// Filters
|
|
43
|
-
if (params.filters) {
|
|
44
|
-
Object.entries(params.filters).forEach(([p, v]) => {
|
|
45
|
-
qp[`filter[q][${p}]`] = String(v);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
debug('query string params: %O', qp);
|
|
50
|
-
return qp;
|
|
51
|
-
};
|
|
52
|
-
exports.generateQueryStringParams = generateQueryStringParams;
|
package/lib/cjs/resource.d.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { type ApiClientInitConfig } from './client';
|
|
2
|
-
import type { QueryParamsRetrieve, QueryParamsList, QueryFilter, QueryParams } from './query';
|
|
3
|
-
import type { ResourceTypeLock } from './api';
|
|
4
|
-
import type { InterceptorManager } from './interceptor';
|
|
5
|
-
type ResourceNull = {
|
|
6
|
-
id: null;
|
|
7
|
-
} & ResourceType;
|
|
8
|
-
type ResourceRel = ResourceId | ResourceNull;
|
|
9
|
-
type Metadata = Record<string, any>;
|
|
10
|
-
interface ResourceType {
|
|
11
|
-
readonly type: ResourceTypeLock;
|
|
12
|
-
}
|
|
13
|
-
interface ResourceId extends ResourceType {
|
|
14
|
-
readonly id: string;
|
|
15
|
-
}
|
|
16
|
-
interface ResourceBase {
|
|
17
|
-
reference?: string | null;
|
|
18
|
-
reference_origin?: string | null;
|
|
19
|
-
metadata?: Metadata;
|
|
20
|
-
}
|
|
21
|
-
interface Resource extends ResourceBase, ResourceId {
|
|
22
|
-
readonly created_at: string;
|
|
23
|
-
readonly updated_at: string;
|
|
24
|
-
}
|
|
25
|
-
interface ResourceCreate extends ResourceBase {
|
|
26
|
-
}
|
|
27
|
-
interface ResourceUpdate extends ResourceBase {
|
|
28
|
-
readonly id: string;
|
|
29
|
-
}
|
|
30
|
-
type ListMeta = {
|
|
31
|
-
readonly pageCount: number;
|
|
32
|
-
readonly recordCount: number;
|
|
33
|
-
readonly currentPage: number;
|
|
34
|
-
readonly recordsPerPage: number;
|
|
35
|
-
};
|
|
36
|
-
declare class ListResponse<R> extends Array<R> {
|
|
37
|
-
readonly meta: ListMeta;
|
|
38
|
-
constructor(meta: ListMeta, data: R[]);
|
|
39
|
-
first(): R | undefined;
|
|
40
|
-
last(): R | undefined;
|
|
41
|
-
get(index: number): R | undefined;
|
|
42
|
-
hasNextPage(): boolean;
|
|
43
|
-
hasPrevPage(): boolean;
|
|
44
|
-
getRecordCount(): number;
|
|
45
|
-
getPageCount(): number;
|
|
46
|
-
get recordCount(): number;
|
|
47
|
-
get pageCount(): number;
|
|
48
|
-
}
|
|
49
|
-
export type { Metadata, ResourceType, ResourceId, Resource, ResourceCreate, ResourceUpdate, ListResponse, ListMeta, ResourceRel };
|
|
50
|
-
type ResourceAdapterConfig = {};
|
|
51
|
-
type ResourcesInitConfig = ResourceAdapterConfig & ApiClientInitConfig;
|
|
52
|
-
type ResourcesConfig = Partial<ResourcesInitConfig>;
|
|
53
|
-
declare class ResourceAdapter {
|
|
54
|
-
#private;
|
|
55
|
-
constructor(config: ResourcesInitConfig);
|
|
56
|
-
get interceptors(): InterceptorManager;
|
|
57
|
-
private localConfig;
|
|
58
|
-
config(config: ResourcesConfig): ResourceAdapter;
|
|
59
|
-
retrieve<R extends Resource>(resource: ResourceId | ResourceType, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
|
60
|
-
list<R extends Resource>(resource: ResourceType, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<R>>;
|
|
61
|
-
create<C extends ResourceCreate, R extends Resource>(resource: C & ResourceType, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
|
62
|
-
update<U extends ResourceUpdate, R extends Resource>(resource: U & ResourceId, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
|
63
|
-
delete(resource: ResourceId, options?: ResourcesConfig): Promise<void>;
|
|
64
|
-
fetch<R extends Resource>(resource: string | ResourceType, path: string, params?: QueryParams, options?: ResourcesConfig): Promise<R | ListResponse<R>>;
|
|
65
|
-
action(cmd: 'post' | 'patch', path: string, payload?: any, options?: ResourcesConfig): Promise<void>;
|
|
66
|
-
}
|
|
67
|
-
declare abstract class ApiResourceBase<R extends Resource> {
|
|
68
|
-
static readonly TYPE: ResourceTypeLock;
|
|
69
|
-
protected readonly resources: ResourceAdapter;
|
|
70
|
-
constructor(adapter: ResourceAdapter);
|
|
71
|
-
abstract relationship(id: string | ResourceId | null): ResourceRel;
|
|
72
|
-
abstract type(): ResourceTypeLock;
|
|
73
|
-
parse(resource: string): R | R[];
|
|
74
|
-
update(resource: ResourceUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
|
75
|
-
}
|
|
76
|
-
declare abstract class ApiResource<R extends Resource> extends ApiResourceBase<R> {
|
|
77
|
-
retrieve(id: string | ResourceId, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
|
78
|
-
list(params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<R>>;
|
|
79
|
-
count(filter?: QueryFilter | QueryParamsList, options?: ResourcesConfig): Promise<number>;
|
|
80
|
-
}
|
|
81
|
-
declare abstract class ApiSingleton<R extends Resource> extends ApiResourceBase<R> {
|
|
82
|
-
retrieve(params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
|
83
|
-
}
|
|
84
|
-
export default ResourceAdapter;
|
|
85
|
-
export { ApiResource, ApiSingleton };
|
|
86
|
-
export type { ResourcesConfig, ResourcesInitConfig };
|
package/lib/cjs/resource.js
DELETED
|
@@ -1,194 +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.ApiSingleton = exports.ApiResource = void 0;
|
|
19
|
-
const client_1 = __importDefault(require("./client"));
|
|
20
|
-
const jsonapi_1 = require("./jsonapi");
|
|
21
|
-
const query_1 = require("./query");
|
|
22
|
-
const config_1 = __importDefault(require("./config"));
|
|
23
|
-
const error_1 = require("./error");
|
|
24
|
-
const static_1 = require("./static");
|
|
25
|
-
const debug_1 = __importDefault(require("./debug"));
|
|
26
|
-
const debug = (0, debug_1.default)('resource');
|
|
27
|
-
class ListResponse extends Array {
|
|
28
|
-
constructor(meta, data) {
|
|
29
|
-
super(...(data || []));
|
|
30
|
-
this.meta = meta;
|
|
31
|
-
}
|
|
32
|
-
first() { return this.length ? this[0] : undefined; }
|
|
33
|
-
last() { return this.length ? this[this.length - 1] : undefined; }
|
|
34
|
-
get(index) { return (this.length && (index >= 0)) ? this[index] : undefined; }
|
|
35
|
-
hasNextPage() { return (this.meta.currentPage < this.meta.pageCount); }
|
|
36
|
-
hasPrevPage() { return (this.meta.currentPage > 1); }
|
|
37
|
-
getRecordCount() { return this.meta.recordCount; }
|
|
38
|
-
getPageCount() { return this.meta.pageCount; }
|
|
39
|
-
get recordCount() { return this.meta.recordCount; }
|
|
40
|
-
get pageCount() { return this.meta.pageCount; }
|
|
41
|
-
}
|
|
42
|
-
class ResourceAdapter {
|
|
43
|
-
constructor(config) {
|
|
44
|
-
_ResourceAdapter_client.set(this, void 0);
|
|
45
|
-
_ResourceAdapter_config.set(this, {});
|
|
46
|
-
__classPrivateFieldSet(this, _ResourceAdapter_client, client_1.default.create(config), "f");
|
|
47
|
-
this.localConfig(config);
|
|
48
|
-
}
|
|
49
|
-
get interceptors() { return __classPrivateFieldGet(this, _ResourceAdapter_client, "f").interceptors; }
|
|
50
|
-
localConfig(config) {
|
|
51
|
-
// if (typeof config.xyz !== 'undefined') this.#config.xyz = config.xyz
|
|
52
|
-
}
|
|
53
|
-
config(config) {
|
|
54
|
-
debug('config %o', config);
|
|
55
|
-
// ResourceAdapter config
|
|
56
|
-
this.localConfig(config);
|
|
57
|
-
// Client config
|
|
58
|
-
__classPrivateFieldGet(this, _ResourceAdapter_client, "f").config(config);
|
|
59
|
-
return this;
|
|
60
|
-
}
|
|
61
|
-
/*
|
|
62
|
-
get clientInstance(): ApiClient {
|
|
63
|
-
return this.#client
|
|
64
|
-
}
|
|
65
|
-
*/
|
|
66
|
-
async retrieve(resource, params, options) {
|
|
67
|
-
const singleton = !('id' in resource) || static_1.CommerceLayerProvisioningStatic.isSingleton(resource.type);
|
|
68
|
-
debug('retrieve:%s %o, %O, %O', (singleton ? ' singleton,' : ''), resource, params || {}, options || {});
|
|
69
|
-
const queryParams = (0, query_1.generateQueryStringParams)(params, resource);
|
|
70
|
-
if (options === null || options === void 0 ? void 0 : options.params)
|
|
71
|
-
Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
|
|
72
|
-
const path = `${resource.type}${singleton ? '' : `/${resource.id}`}`;
|
|
73
|
-
const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('get', path, undefined, { ...options, params: queryParams });
|
|
74
|
-
const r = (0, jsonapi_1.denormalize)(res);
|
|
75
|
-
return r;
|
|
76
|
-
}
|
|
77
|
-
async list(resource, params, options) {
|
|
78
|
-
var _a, _b;
|
|
79
|
-
debug('list: %o, %O, %O', resource, params || {}, options || {});
|
|
80
|
-
const queryParams = (0, query_1.generateQueryStringParams)(params, resource);
|
|
81
|
-
if (options === null || options === void 0 ? void 0 : options.params)
|
|
82
|
-
Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
|
|
83
|
-
const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('get', `${resource.type}`, undefined, { ...options, params: queryParams });
|
|
84
|
-
const r = (0, jsonapi_1.denormalize)(res);
|
|
85
|
-
const meta = {
|
|
86
|
-
pageCount: Number((_a = res.meta) === null || _a === void 0 ? void 0 : _a.page_count),
|
|
87
|
-
recordCount: Number((_b = res.meta) === null || _b === void 0 ? void 0 : _b.record_count),
|
|
88
|
-
currentPage: (params === null || params === void 0 ? void 0 : params.pageNumber) || config_1.default.default.pageNumber,
|
|
89
|
-
recordsPerPage: (params === null || params === void 0 ? void 0 : params.pageSize) || config_1.default.default.pageSize
|
|
90
|
-
};
|
|
91
|
-
return new ListResponse(meta, r);
|
|
92
|
-
}
|
|
93
|
-
async create(resource, params, options) {
|
|
94
|
-
debug('create: %o, %O, %O', resource, params || {}, options || {});
|
|
95
|
-
const queryParams = (0, query_1.generateQueryStringParams)(params, resource);
|
|
96
|
-
if (options === null || options === void 0 ? void 0 : options.params)
|
|
97
|
-
Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
|
|
98
|
-
const data = (0, jsonapi_1.normalize)(resource);
|
|
99
|
-
const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('post', resource.type, data, { ...options, params: queryParams });
|
|
100
|
-
const r = (0, jsonapi_1.denormalize)(res);
|
|
101
|
-
return r;
|
|
102
|
-
}
|
|
103
|
-
async update(resource, params, options) {
|
|
104
|
-
const singleton = !('id' in resource) || static_1.CommerceLayerProvisioningStatic.isSingleton(resource.type);
|
|
105
|
-
debug('update:%s %o, %O, %O', (singleton ? ' singleton,' : ''), resource, params || {}, options || {});
|
|
106
|
-
const queryParams = (0, query_1.generateQueryStringParams)(params, resource);
|
|
107
|
-
if (options === null || options === void 0 ? void 0 : options.params)
|
|
108
|
-
Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
|
|
109
|
-
const path = `${resource.type}${singleton ? '' : `/${resource.id}`}`;
|
|
110
|
-
const data = (0, jsonapi_1.normalize)(resource);
|
|
111
|
-
const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('patch', path, data, { ...options, params: queryParams });
|
|
112
|
-
const r = (0, jsonapi_1.denormalize)(res);
|
|
113
|
-
return r;
|
|
114
|
-
}
|
|
115
|
-
async delete(resource, options) {
|
|
116
|
-
debug('delete: %o, %O', resource, options || {});
|
|
117
|
-
await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('delete', `${resource.type}/${resource.id}`, undefined, options);
|
|
118
|
-
}
|
|
119
|
-
async fetch(resource, path, params, options) {
|
|
120
|
-
var _a, _b;
|
|
121
|
-
debug('fetch: %o, %O, %O', path, params || {}, options || {});
|
|
122
|
-
const queryParams = (0, query_1.generateQueryStringParams)(params, resource);
|
|
123
|
-
if (options === null || options === void 0 ? void 0 : options.params)
|
|
124
|
-
Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
|
|
125
|
-
const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('get', path, undefined, { ...options, params: queryParams });
|
|
126
|
-
const r = (0, jsonapi_1.denormalize)(res);
|
|
127
|
-
if (Array.isArray(r)) {
|
|
128
|
-
const p = params;
|
|
129
|
-
const meta = {
|
|
130
|
-
pageCount: Number((_a = res.meta) === null || _a === void 0 ? void 0 : _a.page_count),
|
|
131
|
-
recordCount: Number((_b = res.meta) === null || _b === void 0 ? void 0 : _b.record_count),
|
|
132
|
-
currentPage: (p === null || p === void 0 ? void 0 : p.pageNumber) || config_1.default.default.pageNumber,
|
|
133
|
-
recordsPerPage: (p === null || p === void 0 ? void 0 : p.pageSize) || config_1.default.default.pageSize
|
|
134
|
-
};
|
|
135
|
-
return new ListResponse(meta, r);
|
|
136
|
-
}
|
|
137
|
-
else
|
|
138
|
-
return r;
|
|
139
|
-
}
|
|
140
|
-
async action(cmd, path, payload, options) {
|
|
141
|
-
debug('action: %o %o, %O', cmd, path, options || {});
|
|
142
|
-
const queryParams = {};
|
|
143
|
-
if (options === null || options === void 0 ? void 0 : options.params)
|
|
144
|
-
Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
|
|
145
|
-
await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request(cmd, path, payload, { ...options, params: queryParams });
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
_ResourceAdapter_client = new WeakMap(), _ResourceAdapter_config = new WeakMap();
|
|
149
|
-
class ApiResourceBase {
|
|
150
|
-
constructor(adapter) {
|
|
151
|
-
debug('new resource instance: %s', this.type());
|
|
152
|
-
this.resources = adapter;
|
|
153
|
-
}
|
|
154
|
-
parse(resource) {
|
|
155
|
-
var _a, _b;
|
|
156
|
-
try {
|
|
157
|
-
const res = JSON.parse(resource);
|
|
158
|
-
if (((_a = res.data) === null || _a === void 0 ? void 0 : _a.type) !== this.type())
|
|
159
|
-
throw new error_1.SdkError({ message: `Invalid resource type [${(_b = res.data) === null || _b === void 0 ? void 0 : _b.type}]`, type: error_1.ErrorType.PARSE });
|
|
160
|
-
return (0, jsonapi_1.denormalize)(res);
|
|
161
|
-
}
|
|
162
|
-
catch (error) {
|
|
163
|
-
if (error_1.SdkError.isSdkError(error))
|
|
164
|
-
throw error;
|
|
165
|
-
else
|
|
166
|
-
throw new error_1.SdkError({ message: `Payload parse error [${error.message}]`, type: error_1.ErrorType.PARSE });
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
// reference, reference_origin and metadata attributes are always updatable
|
|
170
|
-
async update(resource, params, options) {
|
|
171
|
-
return this.resources.update({ ...resource, type: this.type() }, params, options);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
class ApiResource extends ApiResourceBase {
|
|
175
|
-
async retrieve(id, params, options) {
|
|
176
|
-
return this.resources.retrieve((typeof id === 'string') ? { type: this.type(), id } : id, params, options);
|
|
177
|
-
}
|
|
178
|
-
async list(params, options) {
|
|
179
|
-
return this.resources.list({ type: this.type() }, params, options);
|
|
180
|
-
}
|
|
181
|
-
async count(filter, options) {
|
|
182
|
-
const params = { filters: (0, query_1.isParamsList)(filter) ? filter.filters : filter, pageNumber: 1, pageSize: 1 };
|
|
183
|
-
const response = await this.list(params, options);
|
|
184
|
-
return Promise.resolve(response.meta.recordCount);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
exports.ApiResource = ApiResource;
|
|
188
|
-
class ApiSingleton extends ApiResourceBase {
|
|
189
|
-
async retrieve(params, options) {
|
|
190
|
-
return this.resources.retrieve({ type: this.type() }, params, options);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
exports.ApiSingleton = ApiSingleton;
|
|
194
|
-
exports.default = ResourceAdapter;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { ApiResource } from '../resource';
|
|
2
|
-
import type { Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel } from '../resource';
|
|
3
|
-
import type { QueryParamsRetrieve } from '../query';
|
|
4
|
-
import type { Organization, OrganizationType } from './organizations';
|
|
5
|
-
import type { Role, RoleType } from './roles';
|
|
6
|
-
type ApiCredentialType = 'api_credentials';
|
|
7
|
-
type ApiCredentialRel = ResourceRel & {
|
|
8
|
-
type: ApiCredentialType;
|
|
9
|
-
};
|
|
10
|
-
type OrganizationRel = ResourceRel & {
|
|
11
|
-
type: OrganizationType;
|
|
12
|
-
};
|
|
13
|
-
type RoleRel = ResourceRel & {
|
|
14
|
-
type: RoleType;
|
|
15
|
-
};
|
|
16
|
-
interface ApiCredential extends Resource {
|
|
17
|
-
readonly type: ApiCredentialType;
|
|
18
|
-
name: string;
|
|
19
|
-
kind: string;
|
|
20
|
-
confidential: boolean;
|
|
21
|
-
redirect_uri?: string | null;
|
|
22
|
-
client_id: string;
|
|
23
|
-
client_secret: string;
|
|
24
|
-
scopes: string;
|
|
25
|
-
expires_in?: number | null;
|
|
26
|
-
mode?: string | null;
|
|
27
|
-
custom?: boolean | null;
|
|
28
|
-
organization?: Organization | null;
|
|
29
|
-
role?: Role | null;
|
|
30
|
-
}
|
|
31
|
-
interface ApiCredentialCreate extends ResourceCreate {
|
|
32
|
-
name: string;
|
|
33
|
-
kind: string;
|
|
34
|
-
redirect_uri?: string | null;
|
|
35
|
-
expires_in?: number | null;
|
|
36
|
-
mode?: string | null;
|
|
37
|
-
custom?: boolean | null;
|
|
38
|
-
organization: OrganizationRel;
|
|
39
|
-
role?: RoleRel | null;
|
|
40
|
-
}
|
|
41
|
-
interface ApiCredentialUpdate extends ResourceUpdate {
|
|
42
|
-
name?: string | null;
|
|
43
|
-
redirect_uri?: string | null;
|
|
44
|
-
expires_in?: number | null;
|
|
45
|
-
role?: RoleRel | null;
|
|
46
|
-
}
|
|
47
|
-
declare class ApiCredentials extends ApiResource<ApiCredential> {
|
|
48
|
-
static readonly TYPE: ApiCredentialType;
|
|
49
|
-
create(resource: ApiCredentialCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ApiCredential>;
|
|
50
|
-
update(resource: ApiCredentialUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ApiCredential>;
|
|
51
|
-
delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
|
|
52
|
-
organization(apiCredentialId: string | ApiCredential, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Organization>;
|
|
53
|
-
role(apiCredentialId: string | ApiCredential, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Role>;
|
|
54
|
-
isApiCredential(resource: any): resource is ApiCredential;
|
|
55
|
-
relationship(id: string | ResourceId | null): ApiCredentialRel;
|
|
56
|
-
type(): ApiCredentialType;
|
|
57
|
-
}
|
|
58
|
-
export default ApiCredentials;
|
|
59
|
-
export type { ApiCredential, ApiCredentialCreate, ApiCredentialUpdate, ApiCredentialType };
|