@remkoj/optimizely-cms-api 2.0.0-pre3 → 2.0.0-pre4

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.
Files changed (97) hide show
  1. package/dist/client/CmsIntegrationApiClient.d.ts +2 -0
  2. package/dist/client/CmsIntegrationApiClient.js +36 -34
  3. package/dist/client/core/ApiError.js +15 -15
  4. package/dist/client/core/ApiRequestOptions.js +2 -2
  5. package/dist/client/core/ApiResult.js +2 -2
  6. package/dist/client/core/BaseHttpRequest.js +9 -9
  7. package/dist/client/core/CancelablePromise.js +116 -116
  8. package/dist/client/core/FetchHttpRequest.js +20 -20
  9. package/dist/client/core/OpenAPI.js +14 -14
  10. package/dist/client/core/request.js +294 -294
  11. package/dist/client/index.d.ts +5 -0
  12. package/dist/client/index.js +48 -46
  13. package/dist/client/models/BinaryProperty.js +2 -2
  14. package/dist/client/models/BooleanProperty.js +2 -2
  15. package/dist/client/models/Changeset.js +2 -2
  16. package/dist/client/models/ChangesetItem.js +2 -2
  17. package/dist/client/models/ChangesetItemPage.js +2 -2
  18. package/dist/client/models/ChangesetPage.js +2 -2
  19. package/dist/client/models/ComponentListItem.js +2 -2
  20. package/dist/client/models/ComponentProperty.js +2 -2
  21. package/dist/client/models/ContentBaseType.js +19 -19
  22. package/dist/client/models/ContentComponent.js +2 -2
  23. package/dist/client/models/ContentItem.js +2 -2
  24. package/dist/client/models/ContentItemListWithContentTypes.js +2 -2
  25. package/dist/client/models/ContentItemPage.js +2 -2
  26. package/dist/client/models/ContentItemWithContentTypes.js +2 -2
  27. package/dist/client/models/ContentListItem.js +2 -2
  28. package/dist/client/models/ContentLocaleInfo.js +2 -2
  29. package/dist/client/models/ContentMetadata.js +2 -2
  30. package/dist/client/models/ContentMetadataPage.js +2 -2
  31. package/dist/client/models/ContentProperty.js +2 -2
  32. package/dist/client/models/ContentReference.js +2 -2
  33. package/dist/client/models/ContentReferenceListItem.js +2 -2
  34. package/dist/client/models/ContentReferenceProperty.js +2 -2
  35. package/dist/client/models/ContentType.js +2 -2
  36. package/dist/client/models/ContentTypeFeature.js +18 -18
  37. package/dist/client/models/ContentTypePage.js +2 -2
  38. package/dist/client/models/ContentTypeProperty.js +2 -2
  39. package/dist/client/models/ContentTypeUsage.js +15 -15
  40. package/dist/client/models/CopyContentOptions.js +2 -2
  41. package/dist/client/models/DateTimeListItem.js +2 -2
  42. package/dist/client/models/DateTimeProperty.js +2 -2
  43. package/dist/client/models/DisplaySetting.d.ts +22 -0
  44. package/dist/client/models/DisplaySetting.js +2 -0
  45. package/dist/client/models/DisplaySettingChoice.d.ts +13 -0
  46. package/dist/client/models/DisplaySettingChoice.js +2 -0
  47. package/dist/client/models/DisplayTemplate.d.ts +49 -0
  48. package/dist/client/models/DisplayTemplate.js +2 -0
  49. package/dist/client/models/DisplayTemplatePage.d.ts +19 -0
  50. package/dist/client/models/DisplayTemplatePage.js +2 -0
  51. package/dist/client/models/DoubleEnumerationSettings.js +2 -2
  52. package/dist/client/models/FloatListItem.js +2 -2
  53. package/dist/client/models/FloatProperty.js +2 -2
  54. package/dist/client/models/ImageDescriptor.js +2 -2
  55. package/dist/client/models/ImportPackageMessage.js +2 -2
  56. package/dist/client/models/ImportPackageResult.js +2 -2
  57. package/dist/client/models/IndexingType.js +16 -16
  58. package/dist/client/models/Int32EnumerationSettings.js +2 -2
  59. package/dist/client/models/IntegerListItem.js +2 -2
  60. package/dist/client/models/IntegerProperty.js +2 -2
  61. package/dist/client/models/JsonStringProperty.js +2 -2
  62. package/dist/client/models/ListProperty.js +2 -2
  63. package/dist/client/models/ListPropertyItem.js +2 -2
  64. package/dist/client/models/LocaleStatus.js +15 -15
  65. package/dist/client/models/Manifest.d.ts +5 -0
  66. package/dist/client/models/Manifest.js +2 -2
  67. package/dist/client/models/OauthToken.js +2 -2
  68. package/dist/client/models/OauthTokenError.js +2 -2
  69. package/dist/client/models/OauthTokenRequest.js +2 -2
  70. package/dist/client/models/PackageJob.js +2 -2
  71. package/dist/client/models/PackageJobMessage.js +2 -2
  72. package/dist/client/models/PackageJobStatus.js +2 -2
  73. package/dist/client/models/ProblemDetails.js +2 -2
  74. package/dist/client/models/PropertyDataType.js +26 -26
  75. package/dist/client/models/PropertyFormat.js +2 -2
  76. package/dist/client/models/PropertyFormatPage.js +2 -2
  77. package/dist/client/models/PropertyGroup.js +2 -2
  78. package/dist/client/models/PropertyGroupPage.js +2 -2
  79. package/dist/client/models/StringEnumerationSettings.js +2 -2
  80. package/dist/client/models/StringListItem.js +2 -2
  81. package/dist/client/models/StringProperty.js +2 -2
  82. package/dist/client/models/UrlListItem.js +2 -2
  83. package/dist/client/models/UrlProperty.js +2 -2
  84. package/dist/client/models/VersionStatus.js +20 -20
  85. package/dist/client/services/ChangesetsService.js +239 -239
  86. package/dist/client/services/ContentService.js +409 -409
  87. package/dist/client/services/ContentTypesService.js +149 -149
  88. package/dist/client/services/DisplayTemplatesService.d.ts +60 -0
  89. package/dist/client/services/DisplayTemplatesService.js +135 -0
  90. package/dist/client/services/OauthService.js +28 -28
  91. package/dist/client/services/PackagesService.js +80 -80
  92. package/dist/client/services/PropertyFormatsService.js +53 -53
  93. package/dist/client/services/PropertyGroupsService.js +135 -135
  94. package/dist/config.d.ts +1 -0
  95. package/dist/config.js +40 -39
  96. package/dist/index.js +95 -95
  97. package/package.json +1 -1
@@ -1,80 +1,80 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PackagesService = void 0;
4
- class PackagesService {
5
- constructor(httpRequest) {
6
- this.httpRequest = httpRequest;
7
- }
8
- /**
9
- * Get job status
10
- * Get a package job status.
11
- * @param key The key of the package job.
12
- * @returns PackageJob Success
13
- * @throws ApiError
14
- */
15
- packagesGet(key) {
16
- return this.httpRequest.request({
17
- method: 'GET',
18
- url: '/packages/{key}',
19
- path: {
20
- 'key': key,
21
- },
22
- errors: {
23
- 403: `Forbidden`,
24
- },
25
- });
26
- }
27
- /**
28
- * Export package
29
- * Export a data package.
30
- * @param includeReadOnly Indicates if read-only resources should be included in the export data.
31
- * @returns Manifest Success
32
- * @throws ApiError
33
- */
34
- packagesExport(includeReadOnly) {
35
- return this.httpRequest.request({
36
- method: 'GET',
37
- url: '/packages',
38
- query: {
39
- 'includeReadOnly': includeReadOnly,
40
- },
41
- errors: {
42
- 403: `Forbidden`,
43
- },
44
- });
45
- }
46
- /**
47
- * Import package
48
- * Import a data package.
49
- * @param container The key of the container content where new content items should be created under.
50
- * @param overwriteExistingContentItems Indicates if the existing content item in CMS could be overwritten when the importing package contains
51
- * content item with the same key.
52
- * If set to `false`, always create new content item under the specified container regardless of the content key.
53
- * @param ignoreDataLossWarnings Updates the content type even though the changes might result in data loss.
54
- * @param locale Specifies the locale in which content item in that locale will be imported. If no locale is defined
55
- * then content in all locales are imported.
56
- * @param requestBody
57
- * @returns ImportPackageResult Success
58
- * @returns PackageJob Accepted
59
- * @throws ApiError
60
- */
61
- packagesImport(container, overwriteExistingContentItems = false, ignoreDataLossWarnings = false, locale, requestBody) {
62
- return this.httpRequest.request({
63
- method: 'POST',
64
- url: '/packages',
65
- query: {
66
- 'container': container,
67
- 'overwriteExistingContentItems': overwriteExistingContentItems,
68
- 'ignoreDataLossWarnings': ignoreDataLossWarnings,
69
- 'locale': locale,
70
- },
71
- body: requestBody,
72
- mediaType: 'application/vnd.episerver.cms.data',
73
- errors: {
74
- 400: `Bad Request`,
75
- 403: `Forbidden`,
76
- },
77
- });
78
- }
79
- }
80
- exports.PackagesService = PackagesService;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PackagesService = void 0;
4
+ class PackagesService {
5
+ constructor(httpRequest) {
6
+ this.httpRequest = httpRequest;
7
+ }
8
+ /**
9
+ * Get job status
10
+ * Get a package job status.
11
+ * @param key The key of the package job.
12
+ * @returns PackageJob Success
13
+ * @throws ApiError
14
+ */
15
+ packagesGet(key) {
16
+ return this.httpRequest.request({
17
+ method: 'GET',
18
+ url: '/packages/{key}',
19
+ path: {
20
+ 'key': key,
21
+ },
22
+ errors: {
23
+ 403: `Forbidden`,
24
+ },
25
+ });
26
+ }
27
+ /**
28
+ * Export package
29
+ * Export a data package.
30
+ * @param includeReadOnly Indicates if read-only resources should be included in the export data.
31
+ * @returns Manifest Success
32
+ * @throws ApiError
33
+ */
34
+ packagesExport(includeReadOnly) {
35
+ return this.httpRequest.request({
36
+ method: 'GET',
37
+ url: '/packages',
38
+ query: {
39
+ 'includeReadOnly': includeReadOnly,
40
+ },
41
+ errors: {
42
+ 403: `Forbidden`,
43
+ },
44
+ });
45
+ }
46
+ /**
47
+ * Import package
48
+ * Import a data package.
49
+ * @param container The key of the container content where new content items should be created under.
50
+ * @param overwriteExistingContentItems Indicates if the existing content item in CMS could be overwritten when the importing package contains
51
+ * content item with the same key.
52
+ * If set to `false`, always create new content item under the specified container regardless of the content key.
53
+ * @param ignoreDataLossWarnings Updates the content type even though the changes might result in data loss.
54
+ * @param locale Specifies the locale in which content item in that locale will be imported. If no locale is defined
55
+ * then content in all locales are imported.
56
+ * @param requestBody
57
+ * @returns ImportPackageResult Success
58
+ * @returns PackageJob Accepted
59
+ * @throws ApiError
60
+ */
61
+ packagesImport(container, overwriteExistingContentItems = false, ignoreDataLossWarnings = false, locale, requestBody) {
62
+ return this.httpRequest.request({
63
+ method: 'POST',
64
+ url: '/packages',
65
+ query: {
66
+ 'container': container,
67
+ 'overwriteExistingContentItems': overwriteExistingContentItems,
68
+ 'ignoreDataLossWarnings': ignoreDataLossWarnings,
69
+ 'locale': locale,
70
+ },
71
+ body: requestBody,
72
+ mediaType: 'application/vnd.episerver.cms.data',
73
+ errors: {
74
+ 400: `Bad Request`,
75
+ 403: `Forbidden`,
76
+ },
77
+ });
78
+ }
79
+ }
80
+ exports.PackagesService = PackagesService;
@@ -1,53 +1,53 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PropertyFormatsService = void 0;
4
- class PropertyFormatsService {
5
- constructor(httpRequest) {
6
- this.httpRequest = httpRequest;
7
- }
8
- /**
9
- * List property formats
10
- * List all property formats using the provided options.
11
- * @param pageIndex
12
- * @param pageSize
13
- * @returns PropertyFormatPage Success
14
- * @throws ApiError
15
- */
16
- propertyFormatsList(pageIndex, pageSize) {
17
- return this.httpRequest.request({
18
- method: 'GET',
19
- url: '/propertyformats',
20
- query: {
21
- 'pageIndex': pageIndex,
22
- 'pageSize': pageSize,
23
- },
24
- errors: {
25
- 403: `Forbidden`,
26
- },
27
- });
28
- }
29
- /**
30
- * Get property format
31
- * Get the property format with the provided key.
32
- * @param key The key of the property format to retrieve.
33
- * @param allowDeleted Indicates that a deleted property format may be returned.
34
- * @returns PropertyFormat Success
35
- * @throws ApiError
36
- */
37
- propertyFormatsGet(key, allowDeleted) {
38
- return this.httpRequest.request({
39
- method: 'GET',
40
- url: '/propertyformats/{key}',
41
- path: {
42
- 'key': key,
43
- },
44
- query: {
45
- 'allowDeleted': allowDeleted,
46
- },
47
- errors: {
48
- 403: `Forbidden`,
49
- },
50
- });
51
- }
52
- }
53
- exports.PropertyFormatsService = PropertyFormatsService;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PropertyFormatsService = void 0;
4
+ class PropertyFormatsService {
5
+ constructor(httpRequest) {
6
+ this.httpRequest = httpRequest;
7
+ }
8
+ /**
9
+ * List property formats
10
+ * List all property formats using the provided options.
11
+ * @param pageIndex
12
+ * @param pageSize
13
+ * @returns PropertyFormatPage Success
14
+ * @throws ApiError
15
+ */
16
+ propertyFormatsList(pageIndex, pageSize) {
17
+ return this.httpRequest.request({
18
+ method: 'GET',
19
+ url: '/propertyformats',
20
+ query: {
21
+ 'pageIndex': pageIndex,
22
+ 'pageSize': pageSize,
23
+ },
24
+ errors: {
25
+ 403: `Forbidden`,
26
+ },
27
+ });
28
+ }
29
+ /**
30
+ * Get property format
31
+ * Get the property format with the provided key.
32
+ * @param key The key of the property format to retrieve.
33
+ * @param allowDeleted Indicates that a deleted property format may be returned.
34
+ * @returns PropertyFormat Success
35
+ * @throws ApiError
36
+ */
37
+ propertyFormatsGet(key, allowDeleted) {
38
+ return this.httpRequest.request({
39
+ method: 'GET',
40
+ url: '/propertyformats/{key}',
41
+ path: {
42
+ 'key': key,
43
+ },
44
+ query: {
45
+ 'allowDeleted': allowDeleted,
46
+ },
47
+ errors: {
48
+ 403: `Forbidden`,
49
+ },
50
+ });
51
+ }
52
+ }
53
+ exports.PropertyFormatsService = PropertyFormatsService;
@@ -1,135 +1,135 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PropertyGroupsService = void 0;
4
- class PropertyGroupsService {
5
- constructor(httpRequest) {
6
- this.httpRequest = httpRequest;
7
- }
8
- /**
9
- * List property groups
10
- * List property groups using the provided options.
11
- * @param sources Indicates which property groups sources that should be listed.
12
- * Use All to include groups from all sources or
13
- * Default to include groups without a specific sources.
14
- * @returns PropertyGroupPage Success
15
- * @throws ApiError
16
- */
17
- propertyGroupsList(sources) {
18
- return this.httpRequest.request({
19
- method: 'GET',
20
- url: '/propertygroups',
21
- query: {
22
- 'sources': sources,
23
- },
24
- errors: {
25
- 403: `Forbidden`,
26
- },
27
- });
28
- }
29
- /**
30
- * Create property group
31
- * Create a new property group.
32
- * @param requestBody The property group that should be created.
33
- * @returns PropertyGroup Success
34
- * @throws ApiError
35
- */
36
- propertyGroupsCreate(requestBody) {
37
- return this.httpRequest.request({
38
- method: 'POST',
39
- url: '/propertygroups',
40
- body: requestBody,
41
- mediaType: 'application/json',
42
- errors: {
43
- 400: `Bad Request`,
44
- 403: `Forbidden`,
45
- },
46
- });
47
- }
48
- /**
49
- * Get property group
50
- * Get the property group with the provided key.
51
- * @param key The key of the property group to retrieve.
52
- * @returns PropertyGroup Success
53
- * @throws ApiError
54
- */
55
- propertyGroupsGet(key) {
56
- return this.httpRequest.request({
57
- method: 'GET',
58
- url: '/propertygroups/{key}',
59
- path: {
60
- 'key': key,
61
- },
62
- errors: {
63
- 403: `Forbidden`,
64
- },
65
- });
66
- }
67
- /**
68
- * Create or replace property group
69
- * Create or replace a property group. If a property group with the provided key exist it is replaced.
70
- * Otherwise a new property group is created.
71
- * @param key The key of the property group to update or create.
72
- * @param requestBody The values of the created or replaced property group.
73
- * @returns PropertyGroup Success
74
- * @throws ApiError
75
- */
76
- propertyGroupsPut(key, requestBody) {
77
- return this.httpRequest.request({
78
- method: 'PUT',
79
- url: '/propertygroups/{key}',
80
- path: {
81
- 'key': key,
82
- },
83
- body: requestBody,
84
- mediaType: 'application/json',
85
- errors: {
86
- 400: `Bad Request`,
87
- 403: `Forbidden`,
88
- },
89
- });
90
- }
91
- /**
92
- * Update property group
93
- * Update an existing property group.
94
- * @param key The key of the property group to patch.
95
- * @param requestBody The values of the property group that should be updated.
96
- * @returns PropertyGroup Success
97
- * @throws ApiError
98
- */
99
- propertyGroupsPatch(key, requestBody) {
100
- return this.httpRequest.request({
101
- method: 'PATCH',
102
- url: '/propertygroups/{key}',
103
- path: {
104
- 'key': key,
105
- },
106
- body: requestBody,
107
- mediaType: 'application/merge-patch+json',
108
- errors: {
109
- 400: `Bad Request`,
110
- 403: `Forbidden`,
111
- },
112
- });
113
- }
114
- /**
115
- * Delete property group
116
- * Deletes the property group with the provided key.
117
- * @param key The key of the property group to delete.
118
- * @returns PropertyGroup Success
119
- * @throws ApiError
120
- */
121
- propertyGroupsDelete(key) {
122
- return this.httpRequest.request({
123
- method: 'DELETE',
124
- url: '/propertygroups/{key}',
125
- path: {
126
- 'key': key,
127
- },
128
- errors: {
129
- 400: `Bad Request`,
130
- 403: `Forbidden`,
131
- },
132
- });
133
- }
134
- }
135
- exports.PropertyGroupsService = PropertyGroupsService;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PropertyGroupsService = void 0;
4
+ class PropertyGroupsService {
5
+ constructor(httpRequest) {
6
+ this.httpRequest = httpRequest;
7
+ }
8
+ /**
9
+ * List property groups
10
+ * List property groups using the provided options.
11
+ * @param sources Indicates which property groups sources that should be listed.
12
+ * Use All to include groups from all sources or
13
+ * Default to include groups without a specific sources.
14
+ * @returns PropertyGroupPage Success
15
+ * @throws ApiError
16
+ */
17
+ propertyGroupsList(sources) {
18
+ return this.httpRequest.request({
19
+ method: 'GET',
20
+ url: '/propertygroups',
21
+ query: {
22
+ 'sources': sources,
23
+ },
24
+ errors: {
25
+ 403: `Forbidden`,
26
+ },
27
+ });
28
+ }
29
+ /**
30
+ * Create property group
31
+ * Create a new property group.
32
+ * @param requestBody The property group that should be created.
33
+ * @returns PropertyGroup Success
34
+ * @throws ApiError
35
+ */
36
+ propertyGroupsCreate(requestBody) {
37
+ return this.httpRequest.request({
38
+ method: 'POST',
39
+ url: '/propertygroups',
40
+ body: requestBody,
41
+ mediaType: 'application/json',
42
+ errors: {
43
+ 400: `Bad Request`,
44
+ 403: `Forbidden`,
45
+ },
46
+ });
47
+ }
48
+ /**
49
+ * Get property group
50
+ * Get the property group with the provided key.
51
+ * @param key The key of the property group to retrieve.
52
+ * @returns PropertyGroup Success
53
+ * @throws ApiError
54
+ */
55
+ propertyGroupsGet(key) {
56
+ return this.httpRequest.request({
57
+ method: 'GET',
58
+ url: '/propertygroups/{key}',
59
+ path: {
60
+ 'key': key,
61
+ },
62
+ errors: {
63
+ 403: `Forbidden`,
64
+ },
65
+ });
66
+ }
67
+ /**
68
+ * Create or replace property group
69
+ * Create or replace a property group. If a property group with the provided key exist it is replaced.
70
+ * Otherwise a new property group is created.
71
+ * @param key The key of the property group to update or create.
72
+ * @param requestBody The values of the created or replaced property group.
73
+ * @returns PropertyGroup Success
74
+ * @throws ApiError
75
+ */
76
+ propertyGroupsPut(key, requestBody) {
77
+ return this.httpRequest.request({
78
+ method: 'PUT',
79
+ url: '/propertygroups/{key}',
80
+ path: {
81
+ 'key': key,
82
+ },
83
+ body: requestBody,
84
+ mediaType: 'application/json',
85
+ errors: {
86
+ 400: `Bad Request`,
87
+ 403: `Forbidden`,
88
+ },
89
+ });
90
+ }
91
+ /**
92
+ * Update property group
93
+ * Update an existing property group.
94
+ * @param key The key of the property group to patch.
95
+ * @param requestBody The values of the property group that should be updated.
96
+ * @returns PropertyGroup Success
97
+ * @throws ApiError
98
+ */
99
+ propertyGroupsPatch(key, requestBody) {
100
+ return this.httpRequest.request({
101
+ method: 'PATCH',
102
+ url: '/propertygroups/{key}',
103
+ path: {
104
+ 'key': key,
105
+ },
106
+ body: requestBody,
107
+ mediaType: 'application/merge-patch+json',
108
+ errors: {
109
+ 400: `Bad Request`,
110
+ 403: `Forbidden`,
111
+ },
112
+ });
113
+ }
114
+ /**
115
+ * Delete property group
116
+ * Deletes the property group with the provided key.
117
+ * @param key The key of the property group to delete.
118
+ * @returns PropertyGroup Success
119
+ * @throws ApiError
120
+ */
121
+ propertyGroupsDelete(key) {
122
+ return this.httpRequest.request({
123
+ method: 'DELETE',
124
+ url: '/propertygroups/{key}',
125
+ path: {
126
+ 'key': key,
127
+ },
128
+ errors: {
129
+ 400: `Bad Request`,
130
+ 403: `Forbidden`,
131
+ },
132
+ });
133
+ }
134
+ }
135
+ exports.PropertyGroupsService = PropertyGroupsService;
package/dist/config.d.ts CHANGED
@@ -3,5 +3,6 @@ export type CmsIntegrationApiOptions = {
3
3
  clientId?: string;
4
4
  clientSecret?: string;
5
5
  actAs?: string;
6
+ debug?: boolean;
6
7
  };
7
8
  export declare function getCmsIntegrationApiConfigFromEnvironment(): CmsIntegrationApiOptions;
package/dist/config.js CHANGED
@@ -1,39 +1,40 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCmsIntegrationApiConfigFromEnvironment = void 0;
4
- const OpenAPI_1 = require("./client/core/OpenAPI");
5
- function getCmsIntegrationApiConfigFromEnvironment() {
6
- const cmsUrl = getMandatory('OPTIMIZELY_CMS_URL');
7
- const clientId = getMandatory('OPTIMIZELY_CMS_CLIENT_ID');
8
- const clientSecret = getMandatory('OPTIMIZELY_CMS_CLIENT_SECRET');
9
- const actAs = getOptional('OPTIMIZELY_CMS_USER_ID');
10
- const debug = getOptional('OPTIMIZELY_DEBUG', "0") == "1";
11
- let baseUrl;
12
- try {
13
- baseUrl = new URL(OpenAPI_1.OpenAPI.BASE, cmsUrl);
14
- }
15
- catch {
16
- throw new Error("Invalid URL provided");
17
- }
18
- if (debug)
19
- console.log(`[Optimizely CMS API] Connecting to ${baseUrl} as ${clientId}`);
20
- return {
21
- base: baseUrl,
22
- clientId,
23
- clientSecret,
24
- actAs
25
- };
26
- }
27
- exports.getCmsIntegrationApiConfigFromEnvironment = getCmsIntegrationApiConfigFromEnvironment;
28
- function getOptional(variable, defaultValue) {
29
- const envValue = process.env[variable];
30
- if (!envValue || envValue == "")
31
- return defaultValue;
32
- return envValue;
33
- }
34
- function getMandatory(variable) {
35
- const envValue = process.env[variable];
36
- if (!envValue)
37
- throw new Error(`The environment variable ${variable} is missing or empty`);
38
- return envValue;
39
- }
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCmsIntegrationApiConfigFromEnvironment = void 0;
4
+ const OpenAPI_1 = require("./client/core/OpenAPI");
5
+ function getCmsIntegrationApiConfigFromEnvironment() {
6
+ const cmsUrl = getMandatory('OPTIMIZELY_CMS_URL');
7
+ const clientId = getMandatory('OPTIMIZELY_CMS_CLIENT_ID');
8
+ const clientSecret = getMandatory('OPTIMIZELY_CMS_CLIENT_SECRET');
9
+ const actAs = getOptional('OPTIMIZELY_CMS_USER_ID');
10
+ const debug = getOptional('OPTIMIZELY_DEBUG', "0") == "1";
11
+ let baseUrl;
12
+ try {
13
+ baseUrl = new URL(OpenAPI_1.OpenAPI.BASE, cmsUrl);
14
+ }
15
+ catch {
16
+ throw new Error("Invalid URL provided");
17
+ }
18
+ if (debug)
19
+ console.log(`[Optimizely CMS API] Connecting to ${baseUrl} as ${clientId}`);
20
+ return {
21
+ base: baseUrl,
22
+ clientId,
23
+ clientSecret,
24
+ actAs,
25
+ debug
26
+ };
27
+ }
28
+ exports.getCmsIntegrationApiConfigFromEnvironment = getCmsIntegrationApiConfigFromEnvironment;
29
+ function getOptional(variable, defaultValue) {
30
+ const envValue = process.env[variable];
31
+ if (!envValue || envValue == "")
32
+ return defaultValue;
33
+ return envValue;
34
+ }
35
+ function getMandatory(variable) {
36
+ const envValue = process.env[variable];
37
+ if (!envValue)
38
+ throw new Error(`The environment variable ${variable} is missing or empty`);
39
+ return envValue;
40
+ }