@commercelayer/provisioning-sdk 2.10.2 → 3.0.0-beta.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/LICENSE +1 -1
- package/lib/actions.cjs +4 -0
- package/lib/actions.cjs.map +1 -0
- package/lib/actions.d.cts +15 -0
- package/lib/actions.d.ts +15 -0
- package/lib/actions.js +3 -0
- package/lib/actions.js.map +1 -0
- package/lib/{index.d.mts → api-BY0jb79k.d.cts} +540 -496
- package/lib/api-e4p3q-SB.d.ts +1636 -0
- package/lib/api.cjs +62 -0
- package/lib/api.cjs.map +1 -0
- package/lib/api.d.cts +2 -0
- package/lib/api.d.ts +2 -0
- package/lib/api.js +17 -0
- package/lib/api.js.map +1 -0
- package/lib/binding.cjs +14 -0
- package/lib/binding.cjs.map +1 -0
- package/lib/binding.d.cts +21 -0
- package/lib/binding.d.ts +21 -0
- package/lib/binding.js +5 -0
- package/lib/binding.js.map +1 -0
- package/lib/bundle.cjs +34 -0
- package/lib/bundle.cjs.map +1 -0
- package/lib/bundle.d.cts +27 -0
- package/lib/bundle.d.ts +25 -0
- package/lib/bundle.js +19 -0
- package/lib/bundle.js.map +1 -0
- package/lib/chunk-35GNS3WW.js +57 -0
- package/lib/chunk-35GNS3WW.js.map +1 -0
- package/lib/chunk-3ELZDTFF.js +41 -0
- package/lib/chunk-3ELZDTFF.js.map +1 -0
- package/lib/chunk-3FP4NVLD.cjs +16 -0
- package/lib/chunk-3FP4NVLD.cjs.map +1 -0
- package/lib/chunk-3XLKYXM6.cjs +84 -0
- package/lib/chunk-3XLKYXM6.cjs.map +1 -0
- package/lib/chunk-4Z4U45XQ.js +808 -0
- package/lib/chunk-4Z4U45XQ.js.map +1 -0
- package/lib/chunk-5KN7B3T2.cjs +118 -0
- package/lib/chunk-5KN7B3T2.cjs.map +1 -0
- package/lib/chunk-63TTSE4U.cjs +93 -0
- package/lib/chunk-63TTSE4U.cjs.map +1 -0
- package/lib/chunk-6I5KGZAU.js +90 -0
- package/lib/chunk-6I5KGZAU.js.map +1 -0
- package/lib/chunk-7OPCEEJV.cjs +88 -0
- package/lib/chunk-7OPCEEJV.cjs.map +1 -0
- package/lib/chunk-BWDFMGX6.cjs +84 -0
- package/lib/chunk-BWDFMGX6.cjs.map +1 -0
- package/lib/chunk-C6AOOHOR.cjs +61 -0
- package/lib/chunk-C6AOOHOR.cjs.map +1 -0
- package/lib/chunk-CFU5DNH2.cjs +19 -0
- package/lib/chunk-CFU5DNH2.cjs.map +1 -0
- package/lib/chunk-CLOSZJSZ.cjs +66 -0
- package/lib/chunk-CLOSZJSZ.cjs.map +1 -0
- package/lib/chunk-DTD2FIJ3.js +17 -0
- package/lib/chunk-DTD2FIJ3.js.map +1 -0
- package/lib/chunk-E2ERI2EX.js +114 -0
- package/lib/chunk-E2ERI2EX.js.map +1 -0
- package/lib/chunk-ELYBYKRM.cjs +32 -0
- package/lib/chunk-ELYBYKRM.cjs.map +1 -0
- package/lib/chunk-F2RLD5SN.cjs +816 -0
- package/lib/chunk-F2RLD5SN.cjs.map +1 -0
- package/lib/chunk-FOU52N6P.js +86 -0
- package/lib/chunk-FOU52N6P.js.map +1 -0
- package/lib/chunk-FWF7HBWB.js +78 -0
- package/lib/chunk-FWF7HBWB.js.map +1 -0
- package/lib/chunk-GES5UXTI.js +64 -0
- package/lib/chunk-GES5UXTI.js.map +1 -0
- package/lib/chunk-HAZ53WDW.cjs +26 -0
- package/lib/chunk-HAZ53WDW.cjs.map +1 -0
- package/lib/chunk-HOL7SMFN.cjs +59 -0
- package/lib/chunk-HOL7SMFN.cjs.map +1 -0
- package/lib/chunk-IW2T22VR.js +3 -0
- package/lib/chunk-IW2T22VR.js.map +1 -0
- package/lib/chunk-N567T7FT.cjs +4 -0
- package/lib/chunk-N567T7FT.cjs.map +1 -0
- package/lib/chunk-QRZGS4TB.js +30 -0
- package/lib/chunk-QRZGS4TB.js.map +1 -0
- package/lib/chunk-RDLVNJEW.js +82 -0
- package/lib/chunk-RDLVNJEW.js.map +1 -0
- package/lib/chunk-U2CAAK2J.js +59 -0
- package/lib/chunk-U2CAAK2J.js.map +1 -0
- package/lib/chunk-UB3WPGDV.js +12 -0
- package/lib/chunk-UB3WPGDV.js.map +1 -0
- package/lib/chunk-UYATAIX7.js +24 -0
- package/lib/chunk-UYATAIX7.js.map +1 -0
- package/lib/chunk-VAL4CE5R.js +82 -0
- package/lib/chunk-VAL4CE5R.js.map +1 -0
- package/lib/chunk-VFTFSHXQ.cjs +88 -0
- package/lib/chunk-VFTFSHXQ.cjs.map +1 -0
- package/lib/chunk-W6XILXYS.cjs +61 -0
- package/lib/chunk-W6XILXYS.cjs.map +1 -0
- package/lib/chunk-WRVLCJQZ.cjs +43 -0
- package/lib/chunk-WRVLCJQZ.cjs.map +1 -0
- package/lib/chunk-YS5PCY5D.js +76 -0
- package/lib/chunk-YS5PCY5D.js.map +1 -0
- package/lib/chunk-YYHZPR4Z.js +59 -0
- package/lib/chunk-YYHZPR4Z.js.map +1 -0
- package/lib/chunk-Z4IAVXOO.cjs +80 -0
- package/lib/chunk-Z4IAVXOO.cjs.map +1 -0
- package/lib/commercelayer.cjs +38 -0
- package/lib/commercelayer.cjs.map +1 -0
- package/lib/commercelayer.d.cts +58 -0
- package/lib/commercelayer.d.ts +56 -0
- package/lib/commercelayer.js +7 -0
- package/lib/commercelayer.js.map +1 -0
- package/lib/enum.cjs +52 -0
- package/lib/enum.cjs.map +1 -0
- package/lib/enum.d.cts +2 -0
- package/lib/enum.d.ts +2 -0
- package/lib/enum.js +3 -0
- package/lib/enum.js.map +1 -0
- package/lib/error-CVRdwnY9.d.cts +33 -0
- package/lib/error-CVRdwnY9.d.ts +33 -0
- package/lib/index.cjs +57 -0
- package/lib/index.cjs.map +1 -0
- package/lib/index.d.cts +14 -0
- package/lib/index.d.ts +9 -1591
- package/lib/index.js +26 -1
- package/lib/index.js.map +1 -0
- package/lib/model.cjs +4 -0
- package/lib/model.cjs.map +1 -0
- package/lib/model.d.cts +2 -0
- package/lib/model.d.ts +2 -0
- package/lib/model.js +3 -0
- package/lib/model.js.map +1 -0
- package/lib/resources/api_credentials.cjs +15 -0
- package/lib/resources/api_credentials.cjs.map +1 -0
- package/lib/resources/api_credentials.d.cts +5 -0
- package/lib/resources/api_credentials.d.ts +2 -0
- package/lib/resources/api_credentials.js +7 -0
- package/lib/resources/api_credentials.js.map +1 -0
- package/lib/resources/application_memberships.cjs +15 -0
- package/lib/resources/application_memberships.cjs.map +1 -0
- package/lib/resources/application_memberships.d.cts +5 -0
- package/lib/resources/application_memberships.d.ts +2 -0
- package/lib/resources/application_memberships.js +7 -0
- package/lib/resources/application_memberships.js.map +1 -0
- package/lib/resources/identity_providers.cjs +15 -0
- package/lib/resources/identity_providers.cjs.map +1 -0
- package/lib/resources/identity_providers.d.cts +5 -0
- package/lib/resources/identity_providers.d.ts +2 -0
- package/lib/resources/identity_providers.js +7 -0
- package/lib/resources/identity_providers.js.map +1 -0
- package/lib/resources/membership_profiles.cjs +15 -0
- package/lib/resources/membership_profiles.cjs.map +1 -0
- package/lib/resources/membership_profiles.d.cts +5 -0
- package/lib/resources/membership_profiles.d.ts +2 -0
- package/lib/resources/membership_profiles.js +7 -0
- package/lib/resources/membership_profiles.js.map +1 -0
- package/lib/resources/memberships.cjs +15 -0
- package/lib/resources/memberships.cjs.map +1 -0
- package/lib/resources/memberships.d.cts +5 -0
- package/lib/resources/memberships.d.ts +2 -0
- package/lib/resources/memberships.js +7 -0
- package/lib/resources/memberships.js.map +1 -0
- package/lib/resources/organizations.cjs +15 -0
- package/lib/resources/organizations.cjs.map +1 -0
- package/lib/resources/organizations.d.cts +5 -0
- package/lib/resources/organizations.d.ts +2 -0
- package/lib/resources/organizations.js +7 -0
- package/lib/resources/organizations.js.map +1 -0
- package/lib/resources/permissions.cjs +15 -0
- package/lib/resources/permissions.cjs.map +1 -0
- package/lib/resources/permissions.d.cts +5 -0
- package/lib/resources/permissions.d.ts +2 -0
- package/lib/resources/permissions.js +7 -0
- package/lib/resources/permissions.js.map +1 -0
- package/lib/resources/roles.cjs +15 -0
- package/lib/resources/roles.cjs.map +1 -0
- package/lib/resources/roles.d.cts +5 -0
- package/lib/resources/roles.d.ts +2 -0
- package/lib/resources/roles.js +7 -0
- package/lib/resources/roles.js.map +1 -0
- package/lib/resources/users.cjs +15 -0
- package/lib/resources/users.cjs.map +1 -0
- package/lib/resources/users.d.cts +5 -0
- package/lib/resources/users.d.ts +2 -0
- package/lib/resources/users.js +7 -0
- package/lib/resources/users.js.map +1 -0
- package/lib/resources/versions.cjs +15 -0
- package/lib/resources/versions.cjs.map +1 -0
- package/lib/resources/versions.d.cts +5 -0
- package/lib/resources/versions.d.ts +2 -0
- package/lib/resources/versions.js +7 -0
- package/lib/resources/versions.js.map +1 -0
- package/lib/static.cjs +17 -0
- package/lib/static.cjs.map +1 -0
- package/lib/static.d.cts +18 -0
- package/lib/static.d.ts +18 -0
- package/lib/static.js +8 -0
- package/lib/static.js.map +1 -0
- package/lib/version.cjs +20 -0
- package/lib/version.cjs.map +1 -0
- package/lib/version.d.cts +12 -0
- package/lib/version.d.ts +12 -0
- package/lib/version.js +3 -0
- package/lib/version.js.map +1 -0
- package/package.json +36 -26
- package/lib/index.mjs +0 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkF2RLD5SN_cjs = require('./chunk-F2RLD5SN.cjs');
|
|
4
|
+
|
|
5
|
+
// gen/resources/application_memberships.ts
|
|
6
|
+
var ApplicationMemberships = class _ApplicationMemberships extends chunkF2RLD5SN_cjs.ApiResource {
|
|
7
|
+
static TYPE = "application_memberships";
|
|
8
|
+
async create(resource, params, options) {
|
|
9
|
+
return this.resources.create(
|
|
10
|
+
{ ...resource, type: _ApplicationMemberships.TYPE },
|
|
11
|
+
params,
|
|
12
|
+
options
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
async update(resource, params, options) {
|
|
16
|
+
return this.resources.update(
|
|
17
|
+
{ ...resource, type: _ApplicationMemberships.TYPE },
|
|
18
|
+
params,
|
|
19
|
+
options
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
async delete(id, options) {
|
|
23
|
+
await this.resources.delete(typeof id === "string" ? { id, type: _ApplicationMemberships.TYPE } : id, options);
|
|
24
|
+
}
|
|
25
|
+
async api_credential(applicationMembershipId, params, options) {
|
|
26
|
+
const _applicationMembershipId = applicationMembershipId.id || applicationMembershipId;
|
|
27
|
+
return this.resources.fetch(
|
|
28
|
+
{ type: "api_credentials" },
|
|
29
|
+
`application_memberships/${_applicationMembershipId}/api_credential`,
|
|
30
|
+
params,
|
|
31
|
+
options
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
async membership(applicationMembershipId, params, options) {
|
|
35
|
+
const _applicationMembershipId = applicationMembershipId.id || applicationMembershipId;
|
|
36
|
+
return this.resources.fetch(
|
|
37
|
+
{ type: "memberships" },
|
|
38
|
+
`application_memberships/${_applicationMembershipId}/membership`,
|
|
39
|
+
params,
|
|
40
|
+
options
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
async membership_profile(applicationMembershipId, params, options) {
|
|
44
|
+
const _applicationMembershipId = applicationMembershipId.id || applicationMembershipId;
|
|
45
|
+
return this.resources.fetch(
|
|
46
|
+
{ type: "membership_profiles" },
|
|
47
|
+
`application_memberships/${_applicationMembershipId}/membership_profile`,
|
|
48
|
+
params,
|
|
49
|
+
options
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
async organization(applicationMembershipId, params, options) {
|
|
53
|
+
const _applicationMembershipId = applicationMembershipId.id || applicationMembershipId;
|
|
54
|
+
return this.resources.fetch(
|
|
55
|
+
{ type: "organizations" },
|
|
56
|
+
`application_memberships/${_applicationMembershipId}/organization`,
|
|
57
|
+
params,
|
|
58
|
+
options
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
async role(applicationMembershipId, params, options) {
|
|
62
|
+
const _applicationMembershipId = applicationMembershipId.id || applicationMembershipId;
|
|
63
|
+
return this.resources.fetch(
|
|
64
|
+
{ type: "roles" },
|
|
65
|
+
`application_memberships/${_applicationMembershipId}/role`,
|
|
66
|
+
params,
|
|
67
|
+
options
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
isApplicationMembership(resource) {
|
|
71
|
+
return resource.type && resource.type === _ApplicationMemberships.TYPE;
|
|
72
|
+
}
|
|
73
|
+
relationship(id) {
|
|
74
|
+
return super.relationshipOneToOne(id);
|
|
75
|
+
}
|
|
76
|
+
relationshipToMany(...ids) {
|
|
77
|
+
return super.relationshipOneToMany(...ids);
|
|
78
|
+
}
|
|
79
|
+
type() {
|
|
80
|
+
return _ApplicationMemberships.TYPE;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
var instance = new ApplicationMemberships();
|
|
84
|
+
var application_memberships_default = instance;
|
|
85
|
+
|
|
86
|
+
exports.application_memberships_default = application_memberships_default;
|
|
87
|
+
//# sourceMappingURL=chunk-7OPCEEJV.cjs.map
|
|
88
|
+
//# sourceMappingURL=chunk-7OPCEEJV.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../gen/resources/application_memberships.ts"],"names":["ApiResource"],"mappings":";;;;;AA2EA,IAAM,sBAAA,GAAN,MAAM,uBAAA,SAA+BA,6BAAA,CAAmC;AAAA,EACtE,OAAgB,IAAA,GAAkC,yBAAA;AAAA,EAElD,MAAM,MAAA,CACJ,QAAA,EACA,MAAA,EACA,OAAA,EACgC;AAChC,IAAA,OAAO,KAAK,SAAA,CAAU,MAAA;AAAA,MACpB,EAAE,GAAG,QAAA,EAAU,IAAA,EAAM,wBAAuB,IAAA,EAAK;AAAA,MACjD,MAAA;AAAA,MACA;AAAA,KACF;AAAA,EACF;AAAA,EAEA,MAAM,MAAA,CACJ,QAAA,EACA,MAAA,EACA,OAAA,EACgC;AAChC,IAAA,OAAO,KAAK,SAAA,CAAU,MAAA;AAAA,MACpB,EAAE,G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ACF;AAAA,EACF;AAAA,EAEA,MAAM,YAAA,CACJ,uBAAA,EACA,MAAA,EACA,OAAA,EACuB;AACvB,IAAA,MAAM,wBAAA,GACH,wBAAkD,EAAA,IAAO,uBAAA;AAC5D,IAAA,OAAO,KAAK,SAAA,CAAU,KAAA;AAAA,MACpB,EAAE,MAAM,eAAA,EAAgB;AAAA,MACxB,2BAA2B,wBAAwB,CAAA,aAAA,CAAA;AAAA,MACnD,MAAA;AAAA,MACA;AAAA,KACF;AAAA,EACF;AAAA,EAEA,MAAM,IAAA,CACJ,uBAAA,EACA,MAAA,EACA,OAAA,EACe;AACf,IAAA,MAAM,wBAAA,GACH,wBAAkD,EAAA,IAAO,uBAAA;AAC5D,IAAA,OAAO,KAAK,SAAA,CAAU,KAAA;AAAA,MACpB,EAAE,MAAM,OAAA,EAAQ;AAAA,MAChB,2BAA2B,wBAAwB,CAAA,KAAA,CAAA;AAAA,MACnD,MAAA;AAAA,MACA;AAAA,KACF;AAAA,EACF;AAAA,EAEA,wBAAwB,QAAA,EAAkD;AACxE,IAAA,OAAO,QAAA,CAAS,IAAA,IAAQ,QAAA,CAAS,IAAA,KAAS,uBAAA,CAAuB,IAAA;AAAA,EACnE;AAAA,EAEA,aAAa,EAAA,EAA0D;AACrE,IAAA,OAAO,KAAA,CAAM,qBAA+C,EAAE,CAAA;AAAA,EAChE;AAAA,EAEA,sBAAsB,GAAA,EAA2C;AAC/D,IAAA,OAAO,KAAA,CAAM,qBAAA,CAAgD,GAAG,GAAG,CAAA;AAAA,EACrE;AAAA,EAEA,IAAA,GAAkC;AAChC,IAAA,OAAO,uBAAA,CAAuB,IAAA;AAAA,EAChC;AACF,CAAA;AAEA,IAAM,QAAA,GAAW,IAAI,sBAAA,EAAuB;AAC5C,IAAO,+BAAA,GAAQ","file":"chunk-7OPCEEJV.cjs","sourcesContent":["import type { QueryParamsRetrieve } from '@runtime/query'\nimport type {\n Resource,\n ResourceCreate,\n ResourceId,\n ResourceRel,\n ResourceSort,\n /* ResourceFilter */ ResourcesConfig,\n ResourceUpdate,\n} from '@runtime/resource'\nimport { ApiResource } from '@runtime/resource'\n\nimport type { ApiCredential, ApiCredentialType } from './api_credentials'\nimport type { MembershipProfile, MembershipProfileType } from './membership_profiles'\nimport type { Membership, MembershipType } from './memberships'\nimport type { Organization, OrganizationType } from './organizations'\nimport type { Role, RoleType } from './roles'\n\ntype ApplicationMembershipType = 'application_memberships'\ntype ApplicationMembershipRel = ResourceRel & { type: ApplicationMembershipType }\ntype ApiCredentialRel = ResourceRel & { type: ApiCredentialType }\ntype MembershipRel = ResourceRel & { type: MembershipType }\ntype MembershipProfileRel = ResourceRel & { type: MembershipProfileType }\ntype OrganizationRel = ResourceRel & { type: OrganizationType }\ntype RoleRel = ResourceRel & { type: RoleType }\n\nexport type ApplicationMembershipSort = Pick<ApplicationMembership, 'id'> & ResourceSort\n// export type ApplicationMembershipFilter = Pick<ApplicationMembership, 'id' | 'filters'> & ResourceFilter\n\n/**\n * The Application membership object is returned as part of the response body of each successful list, retrieve, create, update or delete API call to the /api/application_memberships endpoint.\n *\n * @link https://docs.commercelayer.io/provisioning-api-reference/application_memberships/object\n */\ninterface ApplicationMembership extends Resource {\n readonly type: ApplicationMembershipType\n\n /**\n * Set of key-value pairs that contains restrictions and scopes of the application membership.\n * @example ```{\"market_id_in\":[202,203]}```\n */\n filters?: Record<string, any> | null\n\n api_credential?: ApiCredential | null\n membership?: Membership | null\n membership_profile?: MembershipProfile | null\n organization?: Organization | null\n role?: Role | null\n}\n\ninterface ApplicationMembershipCreate extends ResourceCreate {\n /**\n * Set of key-value pairs that contains restrictions and scopes of the application membership.\n * @example ```{\"market_id_in\":[202,203]}```\n */\n filters?: Record<string, any> | null\n\n api_credential: ApiCredentialRel\n membership?: MembershipRel | null\n membership_profile?: MembershipProfileRel | null\n organization: OrganizationRel\n role: RoleRel\n}\n\ninterface ApplicationMembershipUpdate extends ResourceUpdate {\n /**\n * Set of key-value pairs that contains restrictions and scopes of the application membership.\n * @example ```{\"market_id_in\":[202,203]}```\n */\n filters?: Record<string, any> | null\n\n membership_profile?: MembershipProfileRel | null\n role?: RoleRel | null\n}\n\nclass ApplicationMemberships extends ApiResource<ApplicationMembership> {\n static readonly TYPE: ApplicationMembershipType = 'application_memberships' as const\n\n async create(\n resource: ApplicationMembershipCreate,\n params?: QueryParamsRetrieve<ApplicationMembership>,\n options?: ResourcesConfig,\n ): Promise<ApplicationMembership> {\n return this.resources.create<ApplicationMembershipCreate, ApplicationMembership>(\n { ...resource, type: ApplicationMemberships.TYPE },\n params,\n options,\n )\n }\n\n async update(\n resource: ApplicationMembershipUpdate,\n params?: QueryParamsRetrieve<ApplicationMembership>,\n options?: ResourcesConfig,\n ): Promise<ApplicationMembership> {\n return this.resources.update<ApplicationMembershipUpdate, ApplicationMembership>(\n { ...resource, type: ApplicationMemberships.TYPE },\n params,\n options,\n )\n }\n\n async delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void> {\n await this.resources.delete(typeof id === 'string' ? { id, type: ApplicationMemberships.TYPE } : id, options)\n }\n\n async api_credential(\n applicationMembershipId: string | ApplicationMembership,\n params?: QueryParamsRetrieve<ApiCredential>,\n options?: ResourcesConfig,\n ): Promise<ApiCredential> {\n const _applicationMembershipId =\n (applicationMembershipId as ApplicationMembership).id || (applicationMembershipId as string)\n return this.resources.fetch<ApiCredential>(\n { type: 'api_credentials' },\n `application_memberships/${_applicationMembershipId}/api_credential`,\n params,\n options,\n ) as unknown as ApiCredential\n }\n\n async membership(\n applicationMembershipId: string | ApplicationMembership,\n params?: QueryParamsRetrieve<Membership>,\n options?: ResourcesConfig,\n ): Promise<Membership> {\n const _applicationMembershipId =\n (applicationMembershipId as ApplicationMembership).id || (applicationMembershipId as string)\n return this.resources.fetch<Membership>(\n { type: 'memberships' },\n `application_memberships/${_applicationMembershipId}/membership`,\n params,\n options,\n ) as unknown as Membership\n }\n\n async membership_profile(\n applicationMembershipId: string | ApplicationMembership,\n params?: QueryParamsRetrieve<MembershipProfile>,\n options?: ResourcesConfig,\n ): Promise<MembershipProfile> {\n const _applicationMembershipId =\n (applicationMembershipId as ApplicationMembership).id || (applicationMembershipId as string)\n return this.resources.fetch<MembershipProfile>(\n { type: 'membership_profiles' },\n `application_memberships/${_applicationMembershipId}/membership_profile`,\n params,\n options,\n ) as unknown as MembershipProfile\n }\n\n async organization(\n applicationMembershipId: string | ApplicationMembership,\n params?: QueryParamsRetrieve<Organization>,\n options?: ResourcesConfig,\n ): Promise<Organization> {\n const _applicationMembershipId =\n (applicationMembershipId as ApplicationMembership).id || (applicationMembershipId as string)\n return this.resources.fetch<Organization>(\n { type: 'organizations' },\n `application_memberships/${_applicationMembershipId}/organization`,\n params,\n options,\n ) as unknown as Organization\n }\n\n async role(\n applicationMembershipId: string | ApplicationMembership,\n params?: QueryParamsRetrieve<Role>,\n options?: ResourcesConfig,\n ): Promise<Role> {\n const _applicationMembershipId =\n (applicationMembershipId as ApplicationMembership).id || (applicationMembershipId as string)\n return this.resources.fetch<Role>(\n { type: 'roles' },\n `application_memberships/${_applicationMembershipId}/role`,\n params,\n options,\n ) as unknown as Role\n }\n\n isApplicationMembership(resource: any): resource is ApplicationMembership {\n return resource.type && resource.type === ApplicationMemberships.TYPE\n }\n\n relationship(id: string | ResourceId | null): ApplicationMembershipRel {\n return super.relationshipOneToOne<ApplicationMembershipRel>(id)\n }\n\n relationshipToMany(...ids: string[]): ApplicationMembershipRel[] {\n return super.relationshipOneToMany<ApplicationMembershipRel>(...ids)\n }\n\n type(): ApplicationMembershipType {\n return ApplicationMemberships.TYPE\n }\n}\n\nconst instance = new ApplicationMemberships()\nexport default instance\n\nexport type {\n ApplicationMembership,\n ApplicationMembershipCreate,\n ApplicationMemberships,\n ApplicationMembershipType,\n ApplicationMembershipUpdate,\n}\n"]}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkF2RLD5SN_cjs = require('./chunk-F2RLD5SN.cjs');
|
|
4
|
+
|
|
5
|
+
// gen/resources/memberships.ts
|
|
6
|
+
var Memberships = class _Memberships extends chunkF2RLD5SN_cjs.ApiResource {
|
|
7
|
+
static TYPE = "memberships";
|
|
8
|
+
async create(resource, params, options) {
|
|
9
|
+
return this.resources.create({ ...resource, type: _Memberships.TYPE }, params, options);
|
|
10
|
+
}
|
|
11
|
+
async update(resource, params, options) {
|
|
12
|
+
return this.resources.update({ ...resource, type: _Memberships.TYPE }, params, options);
|
|
13
|
+
}
|
|
14
|
+
async delete(id, options) {
|
|
15
|
+
await this.resources.delete(typeof id === "string" ? { id, type: _Memberships.TYPE } : id, options);
|
|
16
|
+
}
|
|
17
|
+
async organization(membershipId, params, options) {
|
|
18
|
+
const _membershipId = membershipId.id || membershipId;
|
|
19
|
+
return this.resources.fetch(
|
|
20
|
+
{ type: "organizations" },
|
|
21
|
+
`memberships/${_membershipId}/organization`,
|
|
22
|
+
params,
|
|
23
|
+
options
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
async role(membershipId, params, options) {
|
|
27
|
+
const _membershipId = membershipId.id || membershipId;
|
|
28
|
+
return this.resources.fetch(
|
|
29
|
+
{ type: "roles" },
|
|
30
|
+
`memberships/${_membershipId}/role`,
|
|
31
|
+
params,
|
|
32
|
+
options
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
async application_memberships(membershipId, params, options) {
|
|
36
|
+
const _membershipId = membershipId.id || membershipId;
|
|
37
|
+
return this.resources.fetch(
|
|
38
|
+
{ type: "application_memberships" },
|
|
39
|
+
`memberships/${_membershipId}/application_memberships`,
|
|
40
|
+
params,
|
|
41
|
+
options
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
async membership_profile(membershipId, params, options) {
|
|
45
|
+
const _membershipId = membershipId.id || membershipId;
|
|
46
|
+
return this.resources.fetch(
|
|
47
|
+
{ type: "membership_profiles" },
|
|
48
|
+
`memberships/${_membershipId}/membership_profile`,
|
|
49
|
+
params,
|
|
50
|
+
options
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
async versions(membershipId, params, options) {
|
|
54
|
+
const _membershipId = membershipId.id || membershipId;
|
|
55
|
+
return this.resources.fetch(
|
|
56
|
+
{ type: "versions" },
|
|
57
|
+
`memberships/${_membershipId}/versions`,
|
|
58
|
+
params,
|
|
59
|
+
options
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
async resend(membershipId, options) {
|
|
63
|
+
const _membershipId = membershipId.id || membershipId;
|
|
64
|
+
await this.resources.action("POST", `memberships/${_membershipId}/resend`, {}, options);
|
|
65
|
+
}
|
|
66
|
+
isMembership(resource) {
|
|
67
|
+
return resource.type && resource.type === _Memberships.TYPE;
|
|
68
|
+
}
|
|
69
|
+
relationship(id) {
|
|
70
|
+
return super.relationshipOneToOne(id);
|
|
71
|
+
}
|
|
72
|
+
relationshipToMany(...ids) {
|
|
73
|
+
return super.relationshipOneToMany(...ids);
|
|
74
|
+
}
|
|
75
|
+
type() {
|
|
76
|
+
return _Memberships.TYPE;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
var instance = new Memberships();
|
|
80
|
+
var memberships_default = instance;
|
|
81
|
+
|
|
82
|
+
exports.memberships_default = memberships_default;
|
|
83
|
+
//# sourceMappingURL=chunk-BWDFMGX6.cjs.map
|
|
84
|
+
//# sourceMappingURL=chunk-BWDFMGX6.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../gen/resources/memberships.ts"],"names":["ApiResource"],"mappings":";;;;;AA6GA,IAAM,WAAA,GAAN,MAAM,YAAA,SAAoBA,6BAAA,CAAwB;AAAA,EAChD,OAAgB,IAAA,GAAuB,aAAA;AAAA,EAEvC,MAAM,MAAA,CACJ,QAAA,EACA,MAAA,EACA,OAAA,EACqB;AACrB,IAAA,OAAO,IAAA,CAAK,SAAA,CAAU,MAAA,CAAqC,EAAE,GAAG,QAAA,EAAU,IAAA,EAAM,YAAA,CAAY,IAAA,EAAK,EAAG,MAAA,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AA,EAAgC;AACpD,IAAA,OAAO,KAAA,CAAM,qBAAA,CAAqC,GAAG,GAAG,CAAA;AAAA,EAC1D;AAAA,EAEA,IAAA,GAAuB;AACrB,IAAA,OAAO,YAAA,CAAY,IAAA;AAAA,EACrB;AACF,CAAA;AAEA,IAAM,QAAA,GAAW,IAAI,WAAA,EAAY;AACjC,IAAO,mBAAA,GAAQ","file":"chunk-BWDFMGX6.cjs","sourcesContent":["import type { QueryParamsList, QueryParamsRetrieve } from '@runtime/query'\nimport type {\n ListResponse,\n Resource,\n ResourceCreate,\n ResourceId,\n ResourceRel,\n ResourceSort,\n /* ResourceFilter */ ResourcesConfig,\n ResourceUpdate,\n} from '@runtime/resource'\nimport { ApiResource } from '@runtime/resource'\nimport type { ApplicationMembership, ApplicationMembershipType } from './application_memberships'\nimport type { MembershipProfile, MembershipProfileType } from './membership_profiles'\nimport type { Organization, OrganizationType } from './organizations'\nimport type { Role, RoleType } from './roles'\nimport type { Version } from './versions'\n\ntype MembershipType = 'memberships'\ntype MembershipRel = ResourceRel & { type: MembershipType }\ntype OrganizationRel = ResourceRel & { type: OrganizationType }\ntype RoleRel = ResourceRel & { type: RoleType }\ntype ApplicationMembershipRel = ResourceRel & { type: ApplicationMembershipType }\ntype MembershipProfileRel = ResourceRel & { type: MembershipProfileType }\n\nexport type MembershipSort = Pick<Membership, 'id' | 'status'> & ResourceSort\n// export type MembershipFilter = Pick<Membership, 'id' | 'user_email' | 'status' | 'owner' | 'access_scope'> & ResourceFilter\n\n/**\n * The Membership object is returned as part of the response body of each successful list, retrieve, create, update or delete API call to the /api/memberships endpoint.\n *\n * @link https://docs.commercelayer.io/provisioning-api-reference/memberships/object\n */\ninterface Membership extends Resource {\n readonly type: MembershipType\n\n /**\n * The user email.\n * @example ```\"commercelayer@commercelayer.io\"```\n */\n user_email: string\n /**\n * The user first name.\n * @example ```\"John\"```\n */\n user_first_name?: string | null\n /**\n * The user last name.\n * @example ```\"Doe\"```\n */\n user_last_name?: string | null\n /**\n * The memberships status. One of `pending` (default), `active`.\n * @example ```\"pending\"```\n */\n status: 'pending' | 'active'\n /**\n * Indicates if the user it's the owner of the organization.\n * @example ```true```\n */\n owner?: boolean | null\n /**\n * Reflects the organization's access scope, either test_access or all_access.\n * @example ```true```\n */\n test_enabled?: boolean | null\n /**\n * The access scope for applications. One of `live_access` (default), `test_access`, `all_access`.\n * @example ```\"live_access\"```\n */\n access_scope?: 'live_access' | 'test_access' | 'all_access' | null\n\n organization?: Organization | null\n role?: Role | null\n application_memberships?: ApplicationMembership[] | null\n membership_profile?: MembershipProfile | null\n versions?: Version[] | null\n}\n\ninterface MembershipCreate extends ResourceCreate {\n /**\n * The user email.\n * @example ```\"commercelayer@commercelayer.io\"```\n */\n user_email: string\n /**\n * The access scope for applications. One of `live_access` (default), `test_access`, `all_access`.\n * @example ```\"live_access\"```\n */\n access_scope?: 'live_access' | 'test_access' | 'all_access' | null\n\n organization: OrganizationRel\n role: RoleRel\n application_memberships?: ApplicationMembershipRel[] | null\n membership_profile?: MembershipProfileRel | null\n}\n\ninterface MembershipUpdate extends ResourceUpdate {\n /**\n * The access scope for applications. One of `live_access` (default), `test_access`, `all_access`.\n * @example ```\"live_access\"```\n */\n access_scope?: 'live_access' | 'test_access' | 'all_access' | null\n\n role?: RoleRel | null\n application_memberships?: ApplicationMembershipRel[] | null\n membership_profile?: MembershipProfileRel | null\n}\n\nclass Memberships extends ApiResource<Membership> {\n static readonly TYPE: MembershipType = 'memberships' as const\n\n async create(\n resource: MembershipCreate,\n params?: QueryParamsRetrieve<Membership>,\n options?: ResourcesConfig,\n ): Promise<Membership> {\n return this.resources.create<MembershipCreate, Membership>({ ...resource, type: Memberships.TYPE }, params, options)\n }\n\n async update(\n resource: MembershipUpdate,\n params?: QueryParamsRetrieve<Membership>,\n options?: ResourcesConfig,\n ): Promise<Membership> {\n return this.resources.update<MembershipUpdate, Membership>({ ...resource, type: Memberships.TYPE }, params, options)\n }\n\n async delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void> {\n await this.resources.delete(typeof id === 'string' ? { id, type: Memberships.TYPE } : id, options)\n }\n\n async organization(\n membershipId: string | Membership,\n params?: QueryParamsRetrieve<Organization>,\n options?: ResourcesConfig,\n ): Promise<Organization> {\n const _membershipId = (membershipId as Membership).id || (membershipId as string)\n return this.resources.fetch<Organization>(\n { type: 'organizations' },\n `memberships/${_membershipId}/organization`,\n params,\n options,\n ) as unknown as Organization\n }\n\n async role(\n membershipId: string | Membership,\n params?: QueryParamsRetrieve<Role>,\n options?: ResourcesConfig,\n ): Promise<Role> {\n const _membershipId = (membershipId as Membership).id || (membershipId as string)\n return this.resources.fetch<Role>(\n { type: 'roles' },\n `memberships/${_membershipId}/role`,\n params,\n options,\n ) as unknown as Role\n }\n\n async application_memberships(\n membershipId: string | Membership,\n params?: QueryParamsList<ApplicationMembership>,\n options?: ResourcesConfig,\n ): Promise<ListResponse<ApplicationMembership>> {\n const _membershipId = (membershipId as Membership).id || (membershipId as string)\n return this.resources.fetch<ApplicationMembership>(\n { type: 'application_memberships' },\n `memberships/${_membershipId}/application_memberships`,\n params,\n options,\n ) as unknown as ListResponse<ApplicationMembership>\n }\n\n async membership_profile(\n membershipId: string | Membership,\n params?: QueryParamsRetrieve<MembershipProfile>,\n options?: ResourcesConfig,\n ): Promise<MembershipProfile> {\n const _membershipId = (membershipId as Membership).id || (membershipId as string)\n return this.resources.fetch<MembershipProfile>(\n { type: 'membership_profiles' },\n `memberships/${_membershipId}/membership_profile`,\n params,\n options,\n ) as unknown as MembershipProfile\n }\n\n async versions(\n membershipId: string | Membership,\n params?: QueryParamsList<Version>,\n options?: ResourcesConfig,\n ): Promise<ListResponse<Version>> {\n const _membershipId = (membershipId as Membership).id || (membershipId as string)\n return this.resources.fetch<Version>(\n { type: 'versions' },\n `memberships/${_membershipId}/versions`,\n params,\n options,\n ) as unknown as ListResponse<Version>\n }\n\n async resend(membershipId: string | Membership, options?: ResourcesConfig): Promise<void> {\n const _membershipId = (membershipId as Membership).id || (membershipId as string)\n await this.resources.action('POST', `memberships/${_membershipId}/resend`, {}, options)\n }\n\n isMembership(resource: any): resource is Membership {\n return resource.type && resource.type === Memberships.TYPE\n }\n\n relationship(id: string | ResourceId | null): MembershipRel {\n return super.relationshipOneToOne<MembershipRel>(id)\n }\n\n relationshipToMany(...ids: string[]): MembershipRel[] {\n return super.relationshipOneToMany<MembershipRel>(...ids)\n }\n\n type(): MembershipType {\n return Memberships.TYPE\n }\n}\n\nconst instance = new Memberships()\nexport default instance\n\nexport type { Membership, MembershipCreate, Memberships, MembershipType, MembershipUpdate }\n"]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkF2RLD5SN_cjs = require('./chunk-F2RLD5SN.cjs');
|
|
4
|
+
|
|
5
|
+
// gen/resources/membership_profiles.ts
|
|
6
|
+
var MembershipProfiles = class _MembershipProfiles extends chunkF2RLD5SN_cjs.ApiResource {
|
|
7
|
+
static TYPE = "membership_profiles";
|
|
8
|
+
async create(resource, params, options) {
|
|
9
|
+
return this.resources.create(
|
|
10
|
+
{ ...resource, type: _MembershipProfiles.TYPE },
|
|
11
|
+
params,
|
|
12
|
+
options
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
async update(resource, params, options) {
|
|
16
|
+
return this.resources.update(
|
|
17
|
+
{ ...resource, type: _MembershipProfiles.TYPE },
|
|
18
|
+
params,
|
|
19
|
+
options
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
async delete(id, options) {
|
|
23
|
+
await this.resources.delete(typeof id === "string" ? { id, type: _MembershipProfiles.TYPE } : id, options);
|
|
24
|
+
}
|
|
25
|
+
async organization(membershipProfileId, params, options) {
|
|
26
|
+
const _membershipProfileId = membershipProfileId.id || membershipProfileId;
|
|
27
|
+
return this.resources.fetch(
|
|
28
|
+
{ type: "organizations" },
|
|
29
|
+
`membership_profiles/${_membershipProfileId}/organization`,
|
|
30
|
+
params,
|
|
31
|
+
options
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
async application_memberships(membershipProfileId, params, options) {
|
|
35
|
+
const _membershipProfileId = membershipProfileId.id || membershipProfileId;
|
|
36
|
+
return this.resources.fetch(
|
|
37
|
+
{ type: "application_memberships" },
|
|
38
|
+
`membership_profiles/${_membershipProfileId}/application_memberships`,
|
|
39
|
+
params,
|
|
40
|
+
options
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
isMembershipProfile(resource) {
|
|
44
|
+
return resource.type && resource.type === _MembershipProfiles.TYPE;
|
|
45
|
+
}
|
|
46
|
+
relationship(id) {
|
|
47
|
+
return super.relationshipOneToOne(id);
|
|
48
|
+
}
|
|
49
|
+
relationshipToMany(...ids) {
|
|
50
|
+
return super.relationshipOneToMany(...ids);
|
|
51
|
+
}
|
|
52
|
+
type() {
|
|
53
|
+
return _MembershipProfiles.TYPE;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
var instance = new MembershipProfiles();
|
|
57
|
+
var membership_profiles_default = instance;
|
|
58
|
+
|
|
59
|
+
exports.membership_profiles_default = membership_profiles_default;
|
|
60
|
+
//# sourceMappingURL=chunk-C6AOOHOR.cjs.map
|
|
61
|
+
//# sourceMappingURL=chunk-C6AOOHOR.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../gen/resources/membership_profiles.ts"],"names":["ApiResource"],"mappings":";;;;;AAkFA,IAAM,kBAAA,GAAN,MAAM,mBAAA,SAA2BA,6BAAA,CAA+B;AAAA,EAC9D,OAAgB,IAAA,GAA8B,qBAAA;AAAA,EAE9C,MAAM,MAAA,CACJ,QAAA,EACA,MAAA,EACA,OAAA,EAC4B;AAC5B,IAAA,OAAO,KAAK,SAAA,CAAU,MAAA;AAAA,MACpB,EAAE,GAAG,QAAA,EAAU,IAAA,EAAM,oBAAmB,IAAA,EAAK;AAAA,MAC7C,MAAA;AAAA,MACA;AAAA,KACF;AAAA,EACF;AAAA,EAEA,M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AACjE,IAAA,OAAO,KAAA,CAAM,qBAA2C,EAAE,CAAA;AAAA,EAC5D;AAAA,EAEA,sBAAsB,GAAA,EAAuC;AAC3D,IAAA,OAAO,KAAA,CAAM,qBAAA,CAA4C,GAAG,GAAG,CAAA;AAAA,EACjE;AAAA,EAEA,IAAA,GAA8B;AAC5B,IAAA,OAAO,mBAAA,CAAmB,IAAA;AAAA,EAC5B;AACF,CAAA;AAEA,IAAM,QAAA,GAAW,IAAI,kBAAA,EAAmB;AACxC,IAAO,2BAAA,GAAQ","file":"chunk-C6AOOHOR.cjs","sourcesContent":["import type { QueryParamsList, QueryParamsRetrieve } from '@runtime/query'\nimport type {\n ListResponse,\n Resource,\n ResourceCreate,\n ResourceId,\n ResourceRel,\n ResourceSort,\n /* ResourceFilter */ ResourcesConfig,\n ResourceUpdate,\n} from '@runtime/resource'\nimport { ApiResource } from '@runtime/resource'\nimport type { ApplicationMembership, ApplicationMembershipType } from './application_memberships'\nimport type { Organization, OrganizationType } from './organizations'\n\ntype MembershipProfileType = 'membership_profiles'\ntype MembershipProfileRel = ResourceRel & { type: MembershipProfileType }\ntype OrganizationRel = ResourceRel & { type: OrganizationType }\ntype ApplicationMembershipRel = ResourceRel & { type: ApplicationMembershipType }\n\nexport type MembershipProfileSort = Pick<MembershipProfile, 'id' | 'name'> & ResourceSort\n// export type MembershipProfileFilter = Pick<MembershipProfile, 'id' | 'name' | 'access_scope'> & ResourceFilter\n\n/**\n * The Membership profile object is returned as part of the response body of each successful list, retrieve, create, update or delete API call to the /api/membership_profiles endpoint.\n *\n * @link https://docs.commercelayer.io/provisioning-api-reference/membership_profiles/object\n */\ninterface MembershipProfile extends Resource {\n readonly type: MembershipProfileType\n\n /**\n * The membership profile name.\n * @example ```\"Marketing group\"```\n */\n name: string\n /**\n * Reflects the organization's access scope, either test_access or all_access.\n * @example ```true```\n */\n test_enabled?: boolean | null\n /**\n * The access scope for applications. One of `live_access` (default), `test_access`, `all_access`.\n * @example ```\"live_access\"```\n */\n access_scope: 'live_access' | 'test_access' | 'all_access'\n\n organization?: Organization | null\n application_memberships?: ApplicationMembership[] | null\n}\n\ninterface MembershipProfileCreate extends ResourceCreate {\n /**\n * The membership profile name.\n * @example ```\"Marketing group\"```\n */\n name: string\n /**\n * The access scope for applications. One of `live_access` (default), `test_access`, `all_access`.\n * @example ```\"live_access\"```\n */\n access_scope: 'live_access' | 'test_access' | 'all_access'\n\n organization: OrganizationRel\n application_memberships?: ApplicationMembershipRel[] | null\n}\n\ninterface MembershipProfileUpdate extends ResourceUpdate {\n /**\n * The membership profile name.\n * @example ```\"Marketing group\"```\n */\n name?: string | null\n /**\n * The access scope for applications. One of `live_access` (default), `test_access`, `all_access`.\n * @example ```\"live_access\"```\n */\n access_scope?: 'live_access' | 'test_access' | 'all_access' | null\n\n application_memberships?: ApplicationMembershipRel[] | null\n}\n\nclass MembershipProfiles extends ApiResource<MembershipProfile> {\n static readonly TYPE: MembershipProfileType = 'membership_profiles' as const\n\n async create(\n resource: MembershipProfileCreate,\n params?: QueryParamsRetrieve<MembershipProfile>,\n options?: ResourcesConfig,\n ): Promise<MembershipProfile> {\n return this.resources.create<MembershipProfileCreate, MembershipProfile>(\n { ...resource, type: MembershipProfiles.TYPE },\n params,\n options,\n )\n }\n\n async update(\n resource: MembershipProfileUpdate,\n params?: QueryParamsRetrieve<MembershipProfile>,\n options?: ResourcesConfig,\n ): Promise<MembershipProfile> {\n return this.resources.update<MembershipProfileUpdate, MembershipProfile>(\n { ...resource, type: MembershipProfiles.TYPE },\n params,\n options,\n )\n }\n\n async delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void> {\n await this.resources.delete(typeof id === 'string' ? { id, type: MembershipProfiles.TYPE } : id, options)\n }\n\n async organization(\n membershipProfileId: string | MembershipProfile,\n params?: QueryParamsRetrieve<Organization>,\n options?: ResourcesConfig,\n ): Promise<Organization> {\n const _membershipProfileId = (membershipProfileId as MembershipProfile).id || (membershipProfileId as string)\n return this.resources.fetch<Organization>(\n { type: 'organizations' },\n `membership_profiles/${_membershipProfileId}/organization`,\n params,\n options,\n ) as unknown as Organization\n }\n\n async application_memberships(\n membershipProfileId: string | MembershipProfile,\n params?: QueryParamsList<ApplicationMembership>,\n options?: ResourcesConfig,\n ): Promise<ListResponse<ApplicationMembership>> {\n const _membershipProfileId = (membershipProfileId as MembershipProfile).id || (membershipProfileId as string)\n return this.resources.fetch<ApplicationMembership>(\n { type: 'application_memberships' },\n `membership_profiles/${_membershipProfileId}/application_memberships`,\n params,\n options,\n ) as unknown as ListResponse<ApplicationMembership>\n }\n\n isMembershipProfile(resource: any): resource is MembershipProfile {\n return resource.type && resource.type === MembershipProfiles.TYPE\n }\n\n relationship(id: string | ResourceId | null): MembershipProfileRel {\n return super.relationshipOneToOne<MembershipProfileRel>(id)\n }\n\n relationshipToMany(...ids: string[]): MembershipProfileRel[] {\n return super.relationshipOneToMany<MembershipProfileRel>(...ids)\n }\n\n type(): MembershipProfileType {\n return MembershipProfiles.TYPE\n }\n}\n\nconst instance = new MembershipProfiles()\nexport default instance\n\nexport type {\n MembershipProfile,\n MembershipProfileCreate,\n MembershipProfiles,\n MembershipProfileType,\n MembershipProfileUpdate,\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk3FP4NVLD_cjs = require('./chunk-3FP4NVLD.cjs');
|
|
4
|
+
var chunkVFTFSHXQ_cjs = require('./chunk-VFTFSHXQ.cjs');
|
|
5
|
+
|
|
6
|
+
// gen/binding.ts
|
|
7
|
+
var binding = {
|
|
8
|
+
subdomain: "provisioning",
|
|
9
|
+
name: "provisioning",
|
|
10
|
+
sdkVersion: chunk3FP4NVLD_cjs.SDK_VERSION,
|
|
11
|
+
schemaVersion: "latest",
|
|
12
|
+
supportedVersions: [],
|
|
13
|
+
resourceList: chunkVFTFSHXQ_cjs.resourceList,
|
|
14
|
+
getResources: chunkVFTFSHXQ_cjs.getResources
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.binding = binding;
|
|
18
|
+
//# sourceMappingURL=chunk-CFU5DNH2.cjs.map
|
|
19
|
+
//# sourceMappingURL=chunk-CFU5DNH2.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../gen/binding.ts"],"names":["SDK_VERSION","resourceList","getResources"],"mappings":";;;;;;AAeO,IAAM,OAAA,GAAU;AAAA,EACrB,SAAA,EAAW,cAAA;AAAA,EACX,IAAA,EAAM,cAAA;AAAA,EACN,UAAA,EAAYA,6BAAA;AAAA,EACZ,aAAA,EAAe,QAAA;AAAA,EACf,mBAAmB,EAAC;AAAA,gBACpBC,8BAAA;AAAA,gBACAC;AACF","file":"chunk-CFU5DNH2.cjs","sourcesContent":["/**\n * © Commerce Layer Inc.\n **/\nimport type { TargetBinding } from '@runtime/binding'\nimport { getResources, resourceList } from './enum'\nimport { SDK_VERSION } from './version'\n\n// Type-level maps cannot be injected, so they are re-exported here and reached\n// through the same `#registry` alias as the value binding below.\nexport type { ResourceFields, ResourceSortFields, ResourceTypeLock } from './enum'\n\n/**\n * This target's binding. Every field comes from the Target config or the parsed\n * schema — edit `sdk.config.ts`, not this file.\n */\nexport const binding = {\n subdomain: 'provisioning',\n name: 'provisioning',\n sdkVersion: SDK_VERSION,\n schemaVersion: 'latest',\n supportedVersions: [] as const,\n resourceList,\n getResources,\n} as const satisfies TargetBinding\n\n/** The API versions this build accepts as `apiVersion`; `never` on legacy schemas. */\nexport type ApiVersion = (typeof binding.supportedVersions)[number]\n"]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkF2RLD5SN_cjs = require('./chunk-F2RLD5SN.cjs');
|
|
4
|
+
|
|
5
|
+
// gen/resources/identity_providers.ts
|
|
6
|
+
var IdentityProviders = class _IdentityProviders extends chunkF2RLD5SN_cjs.ApiResource {
|
|
7
|
+
static TYPE = "identity_providers";
|
|
8
|
+
async create(resource, params, options) {
|
|
9
|
+
return this.resources.create(
|
|
10
|
+
{ ...resource, type: _IdentityProviders.TYPE },
|
|
11
|
+
params,
|
|
12
|
+
options
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
async update(resource, params, options) {
|
|
16
|
+
return this.resources.update(
|
|
17
|
+
{ ...resource, type: _IdentityProviders.TYPE },
|
|
18
|
+
params,
|
|
19
|
+
options
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
async delete(id, options) {
|
|
23
|
+
await this.resources.delete(typeof id === "string" ? { id, type: _IdentityProviders.TYPE } : id, options);
|
|
24
|
+
}
|
|
25
|
+
async user(identityProviderId, params, options) {
|
|
26
|
+
const _identityProviderId = identityProviderId.id || identityProviderId;
|
|
27
|
+
return this.resources.fetch(
|
|
28
|
+
{ type: "users" },
|
|
29
|
+
`identity_providers/${_identityProviderId}/user`,
|
|
30
|
+
params,
|
|
31
|
+
options
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
async _disable(id, params, options) {
|
|
35
|
+
return this.resources.update(
|
|
36
|
+
{ id: typeof id === "string" ? id : id.id, type: _IdentityProviders.TYPE, _disable: true },
|
|
37
|
+
params,
|
|
38
|
+
options
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
async _enable(id, params, options) {
|
|
42
|
+
return this.resources.update(
|
|
43
|
+
{ id: typeof id === "string" ? id : id.id, type: _IdentityProviders.TYPE, _enable: true },
|
|
44
|
+
params,
|
|
45
|
+
options
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
isIdentityProvider(resource) {
|
|
49
|
+
return resource.type && resource.type === _IdentityProviders.TYPE;
|
|
50
|
+
}
|
|
51
|
+
relationship(id) {
|
|
52
|
+
return super.relationshipOneToOne(id);
|
|
53
|
+
}
|
|
54
|
+
relationshipToMany(...ids) {
|
|
55
|
+
return super.relationshipOneToMany(...ids);
|
|
56
|
+
}
|
|
57
|
+
type() {
|
|
58
|
+
return _IdentityProviders.TYPE;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var instance = new IdentityProviders();
|
|
62
|
+
var identity_providers_default = instance;
|
|
63
|
+
|
|
64
|
+
exports.identity_providers_default = identity_providers_default;
|
|
65
|
+
//# sourceMappingURL=chunk-CLOSZJSZ.cjs.map
|
|
66
|
+
//# sourceMappingURL=chunk-CLOSZJSZ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../gen/resources/identity_providers.ts"],"names":["ApiResource"],"mappings":";;;;;AAgOA,IAAM,iBAAA,GAAN,MAAM,kBAAA,SAA0BA,6BAAA,CAA8B;AAAA,EAC5D,OAAgB,IAAA,GAA6B,oBAAA;AAAA,EAE7C,MAAM,MAAA,CACJ,QAAA,EACA,MAAA,EACA,OAAA,EAC2B;AAC3B,IAAA,OAAO,KAAK,SAAA,CAAU,MAAA;AAAA,MACpB,EAAE,GAAG,QAAA,EAAU,IAAA,EAAM,mBAAkB,IAAA,EAAK;AAAA,MAC5C,MAAA;AAAA,MACA;AAAA,KACF;AAAA,EACF;AAAA,EAEA,MAAM,MAAA,CACJ,QAAA,EACA,MAAA,EACA,OAAA,EAC2B;AAC3B,IAAA,OAAO,KAAK,SAAA,CAAU,MAAA;AAAA,MACpB,EAAE,GAAG,QAAA,EAAU,IAAA,EAAM,mBAAkB,IAAA,EAAK;AAAA,MAC5C,MAAA;AAAA,MACA;AAAA,KACF;AAAA,EACF;AAAA,EAEA,MAAM,MAAA,CAAO,EAAA,EAAyB,OAAA,EAA0C;AAC9E,IAAA,MAAM,IAAA,CAAK,SAAA,CAAU,MAAA,CAAO,OAAO,EAAA,KAAO,QAAA,GAAW,EAAE,EAAA,EAAI,IAAA,EAAM,kBAAA,CAAkB,IAAA,EAAK,GAAI,IAAI,OAAO,CAAA;AAAA,EACzG;AAAA,EAEA,MAAM,IAAA,CACJ,kBAAA,EACA,MAAA,EACA,OAAA,EACe;AACf,IAAA,MAAM,mBAAA,GAAuB,mBAAwC,EAAA,IAAO,kBA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3B;AACF,CAAA;AAEA,IAAM,QAAA,GAAW,IAAI,iBAAA,EAAkB;AACvC,IAAO,0BAAA,GAAQ","file":"chunk-CLOSZJSZ.cjs","sourcesContent":["import type { QueryParamsRetrieve } from '@runtime/query'\nimport type {\n Resource,\n ResourceCreate,\n ResourceId,\n ResourceRel,\n ResourceSort,\n /* ResourceFilter */ ResourcesConfig,\n ResourceUpdate,\n} from '@runtime/resource'\nimport { ApiResource } from '@runtime/resource'\n\nimport type { User } from './users'\n\ntype IdentityProviderType = 'identity_providers'\ntype IdentityProviderRel = ResourceRel & { type: IdentityProviderType }\n\nexport type IdentityProviderSort = Pick<\n IdentityProvider,\n | 'id'\n | 'name'\n | 'client_id'\n | 'client_secret'\n | 'issuer'\n | 'status'\n | 'domains'\n | 'token_url'\n | 'authorize_url'\n | 'jwks_url'\n | 'txt_record'\n | 'organization'\n | 'disabled_at'\n> &\n ResourceSort\n// export type IdentityProviderFilter = Pick<IdentityProvider, 'id' | 'name' | 'client_id' | 'client_secret' | 'issuer' | 'status' | 'domains' | 'token_url' | 'authorize_url' | 'jwks_url' | 'txt_record' | 'organization' | 'disabled_at'> & ResourceFilter\n\n/**\n * The Identity provider object is returned as part of the response body of each successful list, retrieve, create, update or delete API call to the /api/identity_providers endpoint.\n *\n * @link https://docs.commercelayer.io/provisioning-api-reference/identity_providers/object\n */\ninterface IdentityProvider extends Resource {\n readonly type: IdentityProviderType\n\n /**\n * The name of the Identity provider.\n * @example ```\"Org auth0\"```\n */\n name: string\n /**\n * The client ID used for the auth workflow.\n * @example ```\"a6CDk5v1ZV99GrtOcfYVEZRnDDt\"```\n */\n client_id: string\n /**\n * The client secret used for the auth workflow.\n * @example ```\"s6CD55v1ZV99ArtOcfYVEZRnDDf\"```\n */\n client_secret: string\n /**\n * The issuer used for the auth workflow.\n * @example ```\"https://dev.auth987.com/\"```\n */\n issuer: string\n /**\n * The identity provider status. One of `pending` (default), `verified` or `error`.\n * @example ```\"pending\"```\n */\n status: 'pending' | 'verified' | 'error'\n /**\n * The list of domains in scope (comma-separated).\n * @example ```\"dev.auth987.com,stg.auth987.com\"```\n */\n domains: string\n /**\n * The token URL used for the auth workflow.\n * @example ```\"https://dev.auth987.com/oauth/token\"```\n */\n token_url: string\n /**\n * The authorize URL used for the auth workflow.\n * @example ```\"https://dev.auth987.com/authorize\"```\n */\n authorize_url: string\n /**\n * The JWKS key store URL used for the auth workflow.\n * @example ```\"https://dev.auth987.com/.well-known/jwks.json\"```\n */\n jwks_url: string\n /**\n * The TXT record value used to check the domain.\n * @example ```\"cl-verification=a6CDk5v\"```\n */\n txt_record?: string | null\n /**\n * The organization identifier for authorize params.\n * @example ```\"org_76gsfs5gd\"```\n */\n organization?: string | null\n /**\n * Time at which this resource was disabled.\n * @example ```\"2018-01-01T12:00:00.000Z\"```\n */\n disabled_at?: string | null\n\n user?: User | null\n}\n\ninterface IdentityProviderCreate extends ResourceCreate {\n /**\n * The name of the Identity provider.\n * @example ```\"Org auth0\"```\n */\n name: string\n /**\n * The client ID used for the auth workflow.\n * @example ```\"a6CDk5v1ZV99GrtOcfYVEZRnDDt\"```\n */\n client_id: string\n /**\n * The client secret used for the auth workflow.\n * @example ```\"s6CD55v1ZV99ArtOcfYVEZRnDDf\"```\n */\n client_secret: string\n /**\n * The issuer used for the auth workflow.\n * @example ```\"https://dev.auth987.com/\"```\n */\n issuer: string\n /**\n * The list of domains in scope (comma-separated).\n * @example ```\"dev.auth987.com,stg.auth987.com\"```\n */\n domains: string\n /**\n * The token URL used for the auth workflow.\n * @example ```\"https://dev.auth987.com/oauth/token\"```\n */\n token_url: string\n /**\n * The authorize URL used for the auth workflow.\n * @example ```\"https://dev.auth987.com/authorize\"```\n */\n authorize_url: string\n /**\n * The JWKS key store URL used for the auth workflow.\n * @example ```\"https://dev.auth987.com/.well-known/jwks.json\"```\n */\n jwks_url: string\n /**\n * The organization identifier for authorize params.\n * @example ```\"org_76gsfs5gd\"```\n */\n organization?: string | null\n /**\n * Send this attribute if you want to mark this resource as disabled.\n * @example ```true```\n */\n _disable?: boolean | null\n /**\n * Send this attribute if you want to mark this resource as enabled.\n * @example ```true```\n */\n _enable?: boolean | null\n}\n\ninterface IdentityProviderUpdate extends ResourceUpdate {\n /**\n * The name of the Identity provider.\n * @example ```\"Org auth0\"```\n */\n name?: string | null\n /**\n * The client ID used for the auth workflow.\n * @example ```\"a6CDk5v1ZV99GrtOcfYVEZRnDDt\"```\n */\n client_id?: string | null\n /**\n * The client secret used for the auth workflow.\n * @example ```\"s6CD55v1ZV99ArtOcfYVEZRnDDf\"```\n */\n client_secret?: string | null\n /**\n * The issuer used for the auth workflow.\n * @example ```\"https://dev.auth987.com/\"```\n */\n issuer?: string | null\n /**\n * The list of domains in scope (comma-separated).\n * @example ```\"dev.auth987.com,stg.auth987.com\"```\n */\n domains?: string | null\n /**\n * The token URL used for the auth workflow.\n * @example ```\"https://dev.auth987.com/oauth/token\"```\n */\n token_url?: string | null\n /**\n * The authorize URL used for the auth workflow.\n * @example ```\"https://dev.auth987.com/authorize\"```\n */\n authorize_url?: string | null\n /**\n * The JWKS key store URL used for the auth workflow.\n * @example ```\"https://dev.auth987.com/.well-known/jwks.json\"```\n */\n jwks_url?: string | null\n /**\n * The organization identifier for authorize params.\n * @example ```\"org_76gsfs5gd\"```\n */\n organization?: string | null\n /**\n * Send this attribute if you want to mark this resource as disabled.\n * @example ```true```\n */\n _disable?: boolean | null\n /**\n * Send this attribute if you want to mark this resource as enabled.\n * @example ```true```\n */\n _enable?: boolean | null\n}\n\nclass IdentityProviders extends ApiResource<IdentityProvider> {\n static readonly TYPE: IdentityProviderType = 'identity_providers' as const\n\n async create(\n resource: IdentityProviderCreate,\n params?: QueryParamsRetrieve<IdentityProvider>,\n options?: ResourcesConfig,\n ): Promise<IdentityProvider> {\n return this.resources.create<IdentityProviderCreate, IdentityProvider>(\n { ...resource, type: IdentityProviders.TYPE },\n params,\n options,\n )\n }\n\n async update(\n resource: IdentityProviderUpdate,\n params?: QueryParamsRetrieve<IdentityProvider>,\n options?: ResourcesConfig,\n ): Promise<IdentityProvider> {\n return this.resources.update<IdentityProviderUpdate, IdentityProvider>(\n { ...resource, type: IdentityProviders.TYPE },\n params,\n options,\n )\n }\n\n async delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void> {\n await this.resources.delete(typeof id === 'string' ? { id, type: IdentityProviders.TYPE } : id, options)\n }\n\n async user(\n identityProviderId: string | IdentityProvider,\n params?: QueryParamsRetrieve<User>,\n options?: ResourcesConfig,\n ): Promise<User> {\n const _identityProviderId = (identityProviderId as IdentityProvider).id || (identityProviderId as string)\n return this.resources.fetch<User>(\n { type: 'users' },\n `identity_providers/${_identityProviderId}/user`,\n params,\n options,\n ) as unknown as User\n }\n\n async _disable(\n id: string | IdentityProvider,\n params?: QueryParamsRetrieve<IdentityProvider>,\n options?: ResourcesConfig,\n ): Promise<IdentityProvider> {\n return this.resources.update<IdentityProviderUpdate, IdentityProvider>(\n { id: typeof id === 'string' ? id : id.id, type: IdentityProviders.TYPE, _disable: true },\n params,\n options,\n )\n }\n\n async _enable(\n id: string | IdentityProvider,\n params?: QueryParamsRetrieve<IdentityProvider>,\n options?: ResourcesConfig,\n ): Promise<IdentityProvider> {\n return this.resources.update<IdentityProviderUpdate, IdentityProvider>(\n { id: typeof id === 'string' ? id : id.id, type: IdentityProviders.TYPE, _enable: true },\n params,\n options,\n )\n }\n\n isIdentityProvider(resource: any): resource is IdentityProvider {\n return resource.type && resource.type === IdentityProviders.TYPE\n }\n\n relationship(id: string | ResourceId | null): IdentityProviderRel {\n return super.relationshipOneToOne<IdentityProviderRel>(id)\n }\n\n relationshipToMany(...ids: string[]): IdentityProviderRel[] {\n return super.relationshipOneToMany<IdentityProviderRel>(...ids)\n }\n\n type(): IdentityProviderType {\n return IdentityProviders.TYPE\n }\n}\n\nconst instance = new IdentityProviders()\nexport default instance\n\nexport type {\n IdentityProvider,\n IdentityProviderCreate,\n IdentityProviders,\n IdentityProviderType,\n IdentityProviderUpdate,\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SDK_VERSION } from './chunk-UB3WPGDV.js';
|
|
2
|
+
import { getResources, resourceList } from './chunk-YS5PCY5D.js';
|
|
3
|
+
|
|
4
|
+
// gen/binding.ts
|
|
5
|
+
var binding = {
|
|
6
|
+
subdomain: "provisioning",
|
|
7
|
+
name: "provisioning",
|
|
8
|
+
sdkVersion: SDK_VERSION,
|
|
9
|
+
schemaVersion: "latest",
|
|
10
|
+
supportedVersions: [],
|
|
11
|
+
resourceList,
|
|
12
|
+
getResources
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { binding };
|
|
16
|
+
//# sourceMappingURL=chunk-DTD2FIJ3.js.map
|
|
17
|
+
//# sourceMappingURL=chunk-DTD2FIJ3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../gen/binding.ts"],"names":[],"mappings":";;;;AAeO,IAAM,OAAA,GAAU;AAAA,EACrB,SAAA,EAAW,cAAA;AAAA,EACX,IAAA,EAAM,cAAA;AAAA,EACN,UAAA,EAAY,WAAA;AAAA,EACZ,aAAA,EAAe,QAAA;AAAA,EACf,mBAAmB,EAAC;AAAA,EACpB,YAAA;AAAA,EACA;AACF","file":"chunk-DTD2FIJ3.js","sourcesContent":["/**\n * © Commerce Layer Inc.\n **/\nimport type { TargetBinding } from '@runtime/binding'\nimport { getResources, resourceList } from './enum'\nimport { SDK_VERSION } from './version'\n\n// Type-level maps cannot be injected, so they are re-exported here and reached\n// through the same `#registry` alias as the value binding below.\nexport type { ResourceFields, ResourceSortFields, ResourceTypeLock } from './enum'\n\n/**\n * This target's binding. Every field comes from the Target config or the parsed\n * schema — edit `sdk.config.ts`, not this file.\n */\nexport const binding = {\n subdomain: 'provisioning',\n name: 'provisioning',\n sdkVersion: SDK_VERSION,\n schemaVersion: 'latest',\n supportedVersions: [] as const,\n resourceList,\n getResources,\n} as const satisfies TargetBinding\n\n/** The API versions this build accepts as `apiVersion`; `never` on legacy schemas. */\nexport type ApiVersion = (typeof binding.supportedVersions)[number]\n"]}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { debug_default, ApiResourceAdapter, isApiError } from './chunk-4Z4U45XQ.js';
|
|
2
|
+
import { API_SCHEMA_VERSION, API_SUPPORTED_VERSIONS } from './chunk-UB3WPGDV.js';
|
|
3
|
+
import { getResources } from './chunk-YS5PCY5D.js';
|
|
4
|
+
|
|
5
|
+
// src/commercelayer.ts
|
|
6
|
+
var debug = debug_default("commercelayer");
|
|
7
|
+
var CommerceLayerProvisioningBaseClient = class _CommerceLayerProvisioningBaseClient {
|
|
8
|
+
apiSchemaVersion = API_SCHEMA_VERSION;
|
|
9
|
+
apiSupportedVersions = API_SUPPORTED_VERSIONS;
|
|
10
|
+
static cl;
|
|
11
|
+
static get(config) {
|
|
12
|
+
if (config) return _CommerceLayerProvisioningBaseClient.cl = new _CommerceLayerProvisioningBaseClient(config);
|
|
13
|
+
else if (!_CommerceLayerProvisioningBaseClient.cl)
|
|
14
|
+
throw new Error("CommerceLayerProvisioning client not initialized");
|
|
15
|
+
return _CommerceLayerProvisioningBaseClient.cl;
|
|
16
|
+
}
|
|
17
|
+
// The ResourceAdapter created for this specific client instance. Every
|
|
18
|
+
// `CommerceLayerProvisioning(config)` call builds a fresh adapter (its own ApiClient
|
|
19
|
+
// with its own access token). The bundle client reads this so two clients
|
|
20
|
+
// stay isolated; see the `adapter` seam below.
|
|
21
|
+
instanceAdapter;
|
|
22
|
+
constructor(config) {
|
|
23
|
+
debug("new commercelayer instance %O", config);
|
|
24
|
+
this.instanceAdapter = ApiResourceAdapter.init(config);
|
|
25
|
+
}
|
|
26
|
+
// Adapter seam. The base (plain SDK) reports the process-global static
|
|
27
|
+
// adapter so `config()` and the getters below stay in sync with the
|
|
28
|
+
// directly-imported resource singletons — unchanged behaviour. The bundle
|
|
29
|
+
// overrides this to return its own `instanceAdapter`, isolating clients.
|
|
30
|
+
get adapter() {
|
|
31
|
+
return ApiResourceAdapter.get();
|
|
32
|
+
}
|
|
33
|
+
get currentOrganization() {
|
|
34
|
+
return this.adapter.client?.currentOrganization;
|
|
35
|
+
}
|
|
36
|
+
get currentAccessToken() {
|
|
37
|
+
return this.adapter.client?.currentAccessToken;
|
|
38
|
+
}
|
|
39
|
+
/** The API version pinned via `apiVersion`, or `undefined` when requests are unversioned. */
|
|
40
|
+
get currentApiVersion() {
|
|
41
|
+
return this.adapter.client?.currentApiVersion;
|
|
42
|
+
}
|
|
43
|
+
get interceptors() {
|
|
44
|
+
return this.adapter.client?.interceptors;
|
|
45
|
+
}
|
|
46
|
+
localConfig(_config) {
|
|
47
|
+
}
|
|
48
|
+
config(config) {
|
|
49
|
+
debug("config %o", config);
|
|
50
|
+
this.localConfig(config);
|
|
51
|
+
this.adapter.config(config);
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
resources(sort) {
|
|
55
|
+
return getResources(sort);
|
|
56
|
+
}
|
|
57
|
+
isApiError(error) {
|
|
58
|
+
return isApiError(error);
|
|
59
|
+
}
|
|
60
|
+
addRequestInterceptor(onSuccess, onFailure) {
|
|
61
|
+
this.interceptors.request = { onSuccess, onFailure };
|
|
62
|
+
return 1;
|
|
63
|
+
}
|
|
64
|
+
addResponseInterceptor(onSuccess, onFailure) {
|
|
65
|
+
this.interceptors.response = { onSuccess, onFailure };
|
|
66
|
+
return 1;
|
|
67
|
+
}
|
|
68
|
+
removeInterceptor(type, _id = 1) {
|
|
69
|
+
this.interceptors[type] = void 0;
|
|
70
|
+
}
|
|
71
|
+
removeInterceptors() {
|
|
72
|
+
this.removeInterceptor("request");
|
|
73
|
+
this.removeInterceptor("response");
|
|
74
|
+
this.removeRawResponseReader();
|
|
75
|
+
}
|
|
76
|
+
addRawResponseReader(options) {
|
|
77
|
+
const reader = {
|
|
78
|
+
id: 0,
|
|
79
|
+
rawResponse: void 0,
|
|
80
|
+
headers: void 0,
|
|
81
|
+
ok: true
|
|
82
|
+
};
|
|
83
|
+
async function rawResponseInterceptor(response) {
|
|
84
|
+
reader.rawResponse = await response?.clone().json().catch(() => {
|
|
85
|
+
});
|
|
86
|
+
reader.ok = response.ok;
|
|
87
|
+
if (options?.headers) {
|
|
88
|
+
const ho = {};
|
|
89
|
+
response.headers.forEach((value, key) => {
|
|
90
|
+
ho[key] = value;
|
|
91
|
+
});
|
|
92
|
+
reader.headers = ho;
|
|
93
|
+
}
|
|
94
|
+
return response;
|
|
95
|
+
}
|
|
96
|
+
this.interceptors.rawReader = {
|
|
97
|
+
onSuccess: rawResponseInterceptor,
|
|
98
|
+
onFailure: rawResponseInterceptor
|
|
99
|
+
};
|
|
100
|
+
reader.id = 1;
|
|
101
|
+
return reader;
|
|
102
|
+
}
|
|
103
|
+
removeRawResponseReader() {
|
|
104
|
+
this.interceptors.rawReader = void 0;
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
var CommerceLayerProvisioning = (config) => {
|
|
108
|
+
return CommerceLayerProvisioningBaseClient.get(config);
|
|
109
|
+
};
|
|
110
|
+
var commercelayer_default = CommerceLayerProvisioning;
|
|
111
|
+
|
|
112
|
+
export { CommerceLayerProvisioning, CommerceLayerProvisioningBaseClient, commercelayer_default };
|
|
113
|
+
//# sourceMappingURL=chunk-E2ERI2EX.js.map
|
|
114
|
+
//# sourceMappingURL=chunk-E2ERI2EX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commercelayer.ts"],"names":[],"mappings":";;;;;AAiBA,IAAM,KAAA,GAAQ,cAAM,eAAe,CAAA;AAyBnC,IAAM,mCAAA,GAAN,MAAM,oCAAA,CAAoC;AAAA,EAC/B,gBAAA,GAAmB,kBAAA;AAAA,EACnB,oBAAA,GAAuB,sBAAA;AAAA,EAEhC,OAAiB,EAAA;AAAA,EAEjB,OAAO,IAAI,MAAA,EAAuE;AAChF,IAAA,IAAI,QAAQ,OAAQ,oCAAA,CAAoC,EAAA,GAAK,IAAI,qCAAoC,MAAM,CAAA;AAA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AAA,EAAA,CAAG,GAAG,CAAA,GAAI,KAAA;AAAA,QACZ,CAAC,CAAA;AACD,QAAA,MAAA,CAAO,OAAA,GAAU,EAAA;AAAA,MACnB;AACA,MAAA,OAAO,QAAA;AAAA,IACT;AAE0B,IAAA,IAAA,CAAK,aAAa,SAAA,GAAY;AAAA,MACtD,SAAA,EAAW,sBAAA;AAAA,MACX,SAAA,EAAW;AAAA,KACb;AACA,IAAA,MAAA,CAAO,EAAA,GAAK,CAAA;AAEZ,IAAA,OAAO,MAAA;AAAA,EACT;AAAA,EAEA,uBAAA,GAAwE;AAKtE,IAAA,IAAA,CAAK,aAAa,SAAA,GAAY,MAAA;AAAA,EAChC;AACF;AAEA,IAAM,yBAAA,GAA4B,CAAC,MAAA,KAAyE;AAC1G,EAAA,OAAO,mCAAA,CAAoC,IAAI,MAAM,CAAA;AACvD;AAEA,IAAO,qBAAA,GAAQ","file":"chunk-E2ERI2EX.js","sourcesContent":["import Debug from '@runtime/debug'\nimport { type ApiError, isApiError } from '@runtime/error'\nimport type {\n ErrorInterceptor,\n HeadersObj,\n InterceptorManager,\n InterceptorType,\n RawResponseReader,\n RequestInterceptor,\n ResponseInterceptor,\n ResponseObj,\n} from '@runtime/interceptor'\nimport { ApiResourceAdapter, type ResourceAdapter, type ResourcesInitConfig } from '@runtime/resource'\n// import * as api from '../gen/api'\nimport { getResources } from '../gen/enum'\nimport { API_SCHEMA_VERSION, API_SUPPORTED_VERSIONS, type ApiVersion, SDK_VERSION } from '../gen/version'\n\nconst debug = Debug('commercelayer')\n\nexport { API_SCHEMA_VERSION, API_SUPPORTED_VERSIONS, type ApiVersion, SDK_VERSION }\n\n// SDK local configuration\ntype SdkConfig = {\n /** Set to `false` to omit the `X-CL-SDK` request header that identifies the SDK and its version. Defaults to `true`. */\n telemetry?: boolean\n}\n\n/**\n * The `apiVersion` init option, conditioned on how the SDK was generated:\n * - **Version-aware (unified) builds** — {@link API_SUPPORTED_VERSIONS} is\n * non-empty — **require** `apiVersion`. The chosen value becomes a URL path\n * segment (`/api/2026-05/orders`), keeping requests aligned with the version\n * the types were generated for.\n * - **Legacy builds** — empty {@link API_SUPPORTED_VERSIONS}, so {@link ApiVersion}\n * is `never` — take **no** `apiVersion` argument. The API is unversioned\n * (`/api/orders`).\n */\ntype ApiVersionConfig = [ApiVersion] extends [never] ? { apiVersion?: never } : { apiVersion: ApiVersion }\n\ntype CommerceLayerInitConfig = SdkConfig & ApiVersionConfig & ResourcesInitConfig\ntype CommerceLayerConfig = Partial<CommerceLayerInitConfig>\n\nclass CommerceLayerProvisioningBaseClient {\n readonly apiSchemaVersion = API_SCHEMA_VERSION\n readonly apiSupportedVersions = API_SUPPORTED_VERSIONS\n\n protected static cl: CommerceLayerProvisioningBaseClient\n\n static get(config?: CommerceLayerInitConfig): CommerceLayerProvisioningBaseClient {\n if (config) return (CommerceLayerProvisioningBaseClient.cl = new CommerceLayerProvisioningBaseClient(config))\n else if (!CommerceLayerProvisioningBaseClient.cl)\n throw new Error('CommerceLayerProvisioning client not initialized')\n return CommerceLayerProvisioningBaseClient.cl\n }\n\n // The ResourceAdapter created for this specific client instance. Every\n // `CommerceLayerProvisioning(config)` call builds a fresh adapter (its own ApiClient\n // with its own access token). The bundle client reads this so two clients\n // stay isolated; see the `adapter` seam below.\n protected readonly instanceAdapter: ResourceAdapter\n\n protected constructor(config: CommerceLayerInitConfig) {\n debug('new commercelayer instance %O', config)\n\n // `init` builds a new adapter AND sets the process-global static one.\n // We keep the return value so the bundle can bind resources to this\n // exact adapter; the static assignment stays for the plain SDK, whose\n // directly-imported resource singletons resolve through it.\n this.instanceAdapter = ApiResourceAdapter.init(config)\n }\n\n // Adapter seam. The base (plain SDK) reports the process-global static\n // adapter so `config()` and the getters below stay in sync with the\n // directly-imported resource singletons — unchanged behaviour. The bundle\n // overrides this to return its own `instanceAdapter`, isolating clients.\n protected get adapter(): ResourceAdapter {\n return ApiResourceAdapter.get()\n }\n\n get currentOrganization(): string {\n return this.adapter.client?.currentOrganization\n }\n get currentAccessToken(): string {\n return this.adapter.client?.currentAccessToken\n }\n /** The API version pinned via `apiVersion`, or `undefined` when requests are unversioned. */\n get currentApiVersion(): string | undefined {\n return this.adapter.client?.currentApiVersion\n }\n private get interceptors(): InterceptorManager {\n return this.adapter.client?.interceptors\n }\n\n private localConfig(_config: Partial<SdkConfig>): void {\n // if (config.abc) this.abc = config.abc\n }\n\n config(config: CommerceLayerConfig): this {\n debug('config %o', config)\n\n // CommerceLayerProvisioning config\n this.localConfig(config)\n // ResourceAdapter config\n this.adapter.config(config)\n\n return this\n }\n\n resources(sort?: boolean): readonly string[] {\n return getResources(sort)\n }\n\n isApiError(error: any): error is ApiError {\n return isApiError(error)\n }\n\n addRequestInterceptor(onSuccess?: RequestInterceptor, onFailure?: ErrorInterceptor): number {\n this.interceptors.request = { onSuccess, onFailure }\n return 1\n }\n\n addResponseInterceptor(onSuccess?: ResponseInterceptor, onFailure?: ErrorInterceptor): number {\n this.interceptors.response = { onSuccess, onFailure }\n return 1\n }\n\n removeInterceptor(type: InterceptorType, _id: number = 1): void {\n this.interceptors[type] = undefined\n }\n\n removeInterceptors(): void {\n this.removeInterceptor('request')\n this.removeInterceptor('response')\n this.removeRawResponseReader()\n }\n\n addRawResponseReader(options?: { headers: boolean }): RawResponseReader {\n const reader: RawResponseReader = {\n id: 0,\n rawResponse: undefined,\n headers: undefined,\n ok: true,\n }\n\n async function rawResponseInterceptor(response: ResponseObj): Promise<ResponseObj> {\n reader.rawResponse = await response\n ?.clone()\n .json()\n .catch(() => {})\n reader.ok = response.ok\n if (options?.headers) {\n const ho: HeadersObj = {}\n response.headers.forEach((value, key) => {\n ho[key] = value\n })\n reader.headers = ho\n }\n return response\n }\n\n /* const interceptor = */ this.interceptors.rawReader = {\n onSuccess: rawResponseInterceptor,\n onFailure: rawResponseInterceptor,\n }\n reader.id = 1 // interceptor\n\n return reader\n }\n\n removeRawResponseReader(/* reader: number | RawResponseReader */): void {\n /*\n\t\tconst id = (typeof reader === 'number') ? reader : reader?.id\n\t\tif (id && (id >= 0)) this.removeInterceptor('response', id)\n\t\t*/\n this.interceptors.rawReader = undefined\n }\n}\n\nconst CommerceLayerProvisioning = (config: CommerceLayerInitConfig): CommerceLayerProvisioningBaseClient => {\n return CommerceLayerProvisioningBaseClient.get(config)\n}\n\nexport default CommerceLayerProvisioning\nexport type { CommerceLayerConfig, CommerceLayerInitConfig }\nexport { CommerceLayerProvisioning, CommerceLayerProvisioningBaseClient }\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkF2RLD5SN_cjs = require('./chunk-F2RLD5SN.cjs');
|
|
4
|
+
|
|
5
|
+
// gen/resources/users.ts
|
|
6
|
+
var Users = class _Users extends chunkF2RLD5SN_cjs.ApiSingleton {
|
|
7
|
+
static TYPE = "users";
|
|
8
|
+
async update(resource, params, options) {
|
|
9
|
+
return this.resources.update({ ...resource, type: _Users.TYPE }, params, options, this.path());
|
|
10
|
+
}
|
|
11
|
+
isUser(resource) {
|
|
12
|
+
return resource.type && resource.type === _Users.TYPE;
|
|
13
|
+
}
|
|
14
|
+
relationship(id) {
|
|
15
|
+
return super.relationshipOneToOne(id);
|
|
16
|
+
}
|
|
17
|
+
relationshipToMany(...ids) {
|
|
18
|
+
return super.relationshipOneToMany(...ids);
|
|
19
|
+
}
|
|
20
|
+
type() {
|
|
21
|
+
return _Users.TYPE;
|
|
22
|
+
}
|
|
23
|
+
path() {
|
|
24
|
+
return "user";
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var instance = new Users();
|
|
28
|
+
var users_default = instance;
|
|
29
|
+
|
|
30
|
+
exports.users_default = users_default;
|
|
31
|
+
//# sourceMappingURL=chunk-ELYBYKRM.cjs.map
|
|
32
|
+
//# sourceMappingURL=chunk-ELYBYKRM.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../gen/resources/users.ts"],"names":["ApiSingleton"],"mappings":";;;;;AA2EA,IAAM,KAAA,GAAN,MAAM,MAAA,SAAcA,8BAAA,CAAmB;AAAA,EACrC,OAAgB,IAAA,GAAiB,OAAA;AAAA,EAEjC,MAAM,MAAA,CAAO,QAAA,EAAsB,MAAA,EAAoC,OAAA,EAA0C;AAC/G,IAAA,OAAO,IAAA,CAAK,SAAA,CAAU,MAAA,CAAyB,EAAE,GAAG,QAAA,EAAU,IAAA,EAAM,MAAA,CAAM,IAAA,EAAK,EAAG,MAAA,EAAQ,OAAA,EAAS,IAAA,CAAK,MAAM,CAAA;AAAA,EAChH;AAAA,EAEA,OAAO,QAAA,EAAiC;AACtC,IAAA,OAAO,QAAA,CAAS,IAAA,IAAQ,QAAA,CAAS,IAAA,KAAS,MAAA,CAAM,IAAA;AAAA,EAClD;AAAA,EAEA,aAAa,EAAA,EAAyC;AACpD,IAAA,OAAO,KAAA,CAAM,qBAA8B,EAAE,CAAA;AAAA,EAC/C;AAAA,EAEA,sBAAsB,GAAA,EAA0B;AAC9C,IAAA,OAAO,KAAA,CAAM,qBAAA,CAA+B,GAAG,GAAG,CAAA;AAAA,EACpD;AAAA,EAEA,IAAA,GAAiB;AACf,IAAA,OAAO,MAAA,CAAM,IAAA;AAAA,EACf;AAAA,EAEA,IAAA,GAAe;AACb,IAAA,OAAO,MAAA;AAAA,EACT;AACF,CAAA;AAEA,IAAM,QAAA,GAAW,IAAI,KAAA,EAAM;AAC3B,IAAO,aAAA,GAAQ","file":"chunk-ELYBYKRM.cjs","sourcesContent":["import type { QueryParamsRetrieve } from '@runtime/query'\nimport type {\n Resource,\n ResourceId,\n ResourceRel,\n ResourceSort,\n /* ResourceFilter */ ResourcesConfig,\n ResourceUpdate,\n} from '@runtime/resource'\nimport { ApiSingleton } from '@runtime/resource'\n\ntype UserType = 'users'\ntype UserRel = ResourceRel & { type: UserType }\n\nexport type UserSort = Pick<User, 'id' | 'email' | 'first_name' | 'last_name'> & ResourceSort\n// export type UserFilter = Pick<User, 'id' | 'email' | 'first_name' | 'last_name' | 'time_zone'> & ResourceFilter\n\n/**\n * The User object is returned as part of the response body of each successful retrieve or update API call to the /api/user endpoint.\n *\n * @link https://docs.commercelayer.io/provisioning-api-reference/users/object\n */\ninterface User extends Resource {\n readonly type: UserType\n\n /**\n * The user email.\n * @example ```\"user@commercelayer.io\"```\n */\n email: string\n /**\n * The user first name.\n * @example ```\"John\"```\n */\n first_name: string\n /**\n * The user last name.\n * @example ```\"Doe\"```\n */\n last_name: string\n /**\n * The user preferred timezone.\n * @example ```\"UTC\"```\n */\n time_zone?: string | null\n /**\n * The user 2FA setting.\n * @example ```true```\n */\n otp_required_for_login?: boolean | null\n}\n\ninterface UserUpdate extends ResourceUpdate {\n /**\n * The user email.\n * @example ```\"user@commercelayer.io\"```\n */\n email?: string | null\n /**\n * The user first name.\n * @example ```\"John\"```\n */\n first_name?: string | null\n /**\n * The user last name.\n * @example ```\"Doe\"```\n */\n last_name?: string | null\n /**\n * The user preferred timezone.\n * @example ```\"UTC\"```\n */\n time_zone?: string | null\n}\n\nclass Users extends ApiSingleton<User> {\n static readonly TYPE: UserType = 'users' as const\n\n async update(resource: UserUpdate, params?: QueryParamsRetrieve<User>, options?: ResourcesConfig): Promise<User> {\n return this.resources.update<UserUpdate, User>({ ...resource, type: Users.TYPE }, params, options, this.path())\n }\n\n isUser(resource: any): resource is User {\n return resource.type && resource.type === Users.TYPE\n }\n\n relationship(id: string | ResourceId | null): UserRel {\n return super.relationshipOneToOne<UserRel>(id)\n }\n\n relationshipToMany(...ids: string[]): UserRel[] {\n return super.relationshipOneToMany<UserRel>(...ids)\n }\n\n type(): UserType {\n return Users.TYPE\n }\n\n path(): string {\n return 'user'\n }\n}\n\nconst instance = new Users()\nexport default instance\n\nexport type { User, Users, UserType, UserUpdate }\n"]}
|