@remkoj/optimizely-graph-client 2.0.4 → 3.0.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/README.md +195 -135
- package/dist/admin-api/client/OptimizelyGraphAdminApi.js +1 -1
- package/dist/admin-api/client/core/OpenAPI.js +1 -1
- package/dist/admin-api/client/index.d.ts +4 -3
- package/dist/admin-api/client/index.js.map +1 -1
- package/dist/admin-api/client/models/{ContentTypeDefinition_V2.d.ts → ContentSource_V2.d.ts} +1 -1
- package/dist/admin-api/client/models/ContentSource_V2.js +2 -0
- package/dist/admin-api/client/models/ContentSource_V2.js.map +1 -0
- package/dist/admin-api/client/models/{ContentTypeDefinition_V3.d.ts → ContentSource_V3.d.ts} +2 -1
- package/dist/admin-api/client/models/ContentSource_V3.js +2 -0
- package/dist/admin-api/client/models/ContentSource_V3.js.map +1 -0
- package/dist/admin-api/client/models/FilterMap.d.ts +2 -2
- package/dist/admin-api/client/models/OperationMap.d.ts +1 -1
- package/dist/admin-api/client/models/Partial_Record_string_OperationMap__.d.ts +5 -0
- package/dist/admin-api/client/models/Partial_Record_string_OperationMap__.js +2 -0
- package/dist/admin-api/client/models/Partial_Record_string_OperationMap__.js.map +1 -0
- package/dist/admin-api/client/models/SourceInfo.d.ts +1 -0
- package/dist/admin-api/client/models/SourceMetadata.d.ts +4 -0
- package/dist/admin-api/client/models/SourceMetadata.js +2 -0
- package/dist/admin-api/client/models/SourceMetadata.js.map +1 -0
- package/dist/admin-api/client/models/Webhook.d.ts +2 -0
- package/dist/admin-api/client/models/WebhookPayload.d.ts +2 -2
- package/dist/admin-api/client/services/DefinitionV2Service.d.ts +2 -2
- package/dist/admin-api/client/services/DefinitionV2Service.js.map +1 -1
- package/dist/admin-api/client/services/DefinitionV3Service.d.ts +16 -6
- package/dist/admin-api/client/services/DefinitionV3Service.js +21 -2
- package/dist/admin-api/client/services/DefinitionV3Service.js.map +1 -1
- package/dist/client/client.d.ts +5 -2
- package/dist/client/client.js +40 -6
- package/dist/client/client.js.map +1 -1
- package/dist/client/index.d.ts +14 -3
- package/dist/client/index.js +15 -3
- package/dist/client/index.js.map +1 -1
- package/dist/client/types.d.ts +53 -6
- package/dist/client/types.js +6 -0
- package/dist/client/types.js.map +1 -1
- package/dist/client/utils.d.ts +33 -1
- package/dist/client/utils.js +46 -0
- package/dist/client/utils.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.js +14 -1
- package/dist/config.js.map +1 -1
- package/dist/services/channel-repository/repository.d.ts +1 -1
- package/dist/services/channel-repository/repository.js +4 -2
- package/dist/services/channel-repository/repository.js.map +1 -1
- package/dist/services/routing/queries/cms12/getAllRoutes.d.ts +32 -0
- package/dist/services/routing/queries/cms12/getAllRoutes.js +34 -0
- package/dist/services/routing/queries/cms12/getAllRoutes.js.map +1 -0
- package/dist/services/routing/queries/cms12/getRouteById.d.ts +13 -0
- package/dist/services/routing/queries/cms12/getRouteById.js +39 -0
- package/dist/services/routing/queries/cms12/getRouteById.js.map +1 -0
- package/dist/services/routing/queries/cms12/getRouteByPath.d.ts +12 -0
- package/dist/services/routing/queries/cms12/getRouteByPath.js +31 -0
- package/dist/services/routing/queries/cms12/getRouteByPath.js.map +1 -0
- package/dist/services/routing/queries/cms12/index.d.ts +14 -0
- package/dist/services/routing/queries/cms12/index.js +118 -0
- package/dist/services/routing/queries/cms12/index.js.map +1 -0
- package/dist/services/routing/queries/cms13/getAllRoutes.js.map +1 -0
- package/dist/services/routing/queries/cms13/getRouteById.js.map +1 -0
- package/dist/services/routing/queries/{getRouteByPath.js → cms13/getRouteByPath.js} +1 -1
- package/dist/services/routing/queries/cms13/getRouteByPath.js.map +1 -0
- package/dist/services/routing/queries/cms13/index.d.ts +12 -0
- package/dist/services/routing/queries/cms13/index.js +91 -0
- package/dist/services/routing/queries/cms13/index.js.map +1 -0
- package/dist/services/routing/queries/index.d.ts +1 -0
- package/dist/services/routing/queries/index.js +2 -0
- package/dist/services/routing/queries/index.js.map +1 -0
- package/dist/services/routing/queries/types.d.ts +7 -0
- package/dist/services/routing/queries/types.js +2 -0
- package/dist/services/routing/queries/types.js.map +1 -0
- package/dist/services/routing/resolver.d.ts +11 -9
- package/dist/services/routing/resolver.js +24 -85
- package/dist/services/routing/resolver.js.map +1 -1
- package/dist/services/routing/types.d.ts +32 -0
- package/dist/services/utils.js +2 -2
- package/dist/services/utils.js.map +1 -1
- package/dist/types.d.ts +9 -0
- package/package.json +3 -3
- package/dist/admin-api/client/models/ContentTypeDefinition_V2.js +0 -2
- package/dist/admin-api/client/models/ContentTypeDefinition_V2.js.map +0 -1
- package/dist/admin-api/client/models/ContentTypeDefinition_V3.js +0 -2
- package/dist/admin-api/client/models/ContentTypeDefinition_V3.js.map +0 -1
- package/dist/admin-api/client/models/Partial_Record_FieldKeys_OperationMap__.d.ts +0 -8
- package/dist/admin-api/client/models/Partial_Record_FieldKeys_OperationMap__.js +0 -2
- package/dist/admin-api/client/models/Partial_Record_FieldKeys_OperationMap__.js.map +0 -1
- package/dist/services/routing/queries/getAllRoutes.js.map +0 -1
- package/dist/services/routing/queries/getRouteById.js.map +0 -1
- package/dist/services/routing/queries/getRouteByPath.js.map +0 -1
- /package/dist/services/routing/queries/{getAllRoutes.d.ts → cms13/getAllRoutes.d.ts} +0 -0
- /package/dist/services/routing/queries/{getAllRoutes.js → cms13/getAllRoutes.js} +0 -0
- /package/dist/services/routing/queries/{getRouteById.d.ts → cms13/getRouteById.d.ts} +0 -0
- /package/dist/services/routing/queries/{getRouteById.js → cms13/getRouteById.js} +0 -0
- /package/dist/services/routing/queries/{getRouteByPath.d.ts → cms13/getRouteByPath.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,135 +1,195 @@
|
|
|
1
|
-
# Optimizely Graph Client <!-- omit in toc -->
|
|
2
|
-
An extension of the [graphql-request](https://www.npmjs.com/package/graphql-request) package, providing the configuration and additional logic needed to connect with Optimizely Graph.
|
|
3
|
-
|
|
4
|
-
## Within this document <!-- omit in toc -->
|
|
5
|
-
- [1. Provided services](#1-provided-services)
|
|
6
|
-
- [2. Usage example](#2-usage-example)
|
|
7
|
-
- [2.1. GraphQL Client](#21-graphql-client)
|
|
8
|
-
- [2.2.
|
|
9
|
-
- [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
//
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
1
|
+
# Optimizely Graph Client <!-- omit in toc -->
|
|
2
|
+
An extension of the [graphql-request](https://www.npmjs.com/package/graphql-request) package, providing the configuration and additional logic needed to connect with Optimizely Graph.
|
|
3
|
+
|
|
4
|
+
## Within this document <!-- omit in toc -->
|
|
5
|
+
- [1. Provided services](#1-provided-services)
|
|
6
|
+
- [2. Usage example](#2-usage-example)
|
|
7
|
+
- [2.1. GraphQL Client](#21-graphql-client)
|
|
8
|
+
- [2.2. GraphQL Client Authentication](#22-graphql-client-authentication)
|
|
9
|
+
- [2.2.1. Graph Keys](#221-graph-keys)
|
|
10
|
+
- [2.2.2. Token passthrough](#222-token-passthrough)
|
|
11
|
+
- [2.2.3. OpenID Connect](#223-openid-connect)
|
|
12
|
+
- [2.2.4. Token passthrough](#224-token-passthrough)
|
|
13
|
+
- [2.3. Admin API](#23-admin-api)
|
|
14
|
+
- [3. Configuration](#3-configuration)
|
|
15
|
+
- [3.1. Advanced Features](#31-advanced-features)
|
|
16
|
+
|
|
17
|
+
## 1. Provided services
|
|
18
|
+
The package contains the following services:
|
|
19
|
+
- The configuration logic, to read and validate the configuration. Supports both runtime configuration objects as well a reading from environment variables.
|
|
20
|
+
- The GraphQL Client, based upon [graphql-request](https://www.npmjs.com/package/graphql-request), supporting the following authentication schemes for Optimizely Graph:
|
|
21
|
+
- Public access (e.g. using the Single key)
|
|
22
|
+
- HMAC Signed messages
|
|
23
|
+
- Basic Authentication
|
|
24
|
+
- Token pass-through (for Optimizely CMS in context editing)
|
|
25
|
+
- A RouteResolver, which simplifies handling routes when using Optimizely CMS, using the Optimizely Graph as datasource.
|
|
26
|
+
- A ChannelRepository, which simplifies reading channel (website) configuration from the Optimizely CMS, using the Optimizely Graph as datasource.
|
|
27
|
+
- An OpenAPI Client for the administrative REST services of Optimizely Graph. This follows the [service specification](https://cg.optimizely.com/app/swagger/swagger.json) and is based upon the code generated by [openapi-typescript-codegen](https://www.npmjs.com/package/openapi-typescript-codegen) from this service specification.
|
|
28
|
+
|
|
29
|
+
## 2. Usage example
|
|
30
|
+
### 2.1. GraphQL Client
|
|
31
|
+
```typescript
|
|
32
|
+
// Import the library
|
|
33
|
+
import { gql } from 'graphql-request'
|
|
34
|
+
import createClient, { AuthMode } from '@remkoj/optimizely-graph-client/client'
|
|
35
|
+
import Router from '@remkoj/optimizely-graph-client/router'
|
|
36
|
+
import ChannelRepository from '@remkoj/optimizely-graph-client/channels'
|
|
37
|
+
|
|
38
|
+
// Prepare the query
|
|
39
|
+
const document = gql`query {
|
|
40
|
+
Content {
|
|
41
|
+
items {
|
|
42
|
+
Name
|
|
43
|
+
ContentLink {
|
|
44
|
+
GuidValue
|
|
45
|
+
}
|
|
46
|
+
Language {
|
|
47
|
+
Name
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}`
|
|
52
|
+
|
|
53
|
+
// Create an instance of the client, the configuration object may be omitted
|
|
54
|
+
// when executing on Node.JS. If no configuration is provided, it will be read
|
|
55
|
+
// from the environment variables.
|
|
56
|
+
// The variable client will be of type: GraphQLClient
|
|
57
|
+
const client = createClient({
|
|
58
|
+
single_key: "your_single_key"
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
// By default the client will always use AuthMode.Public, unless overridden by the
|
|
62
|
+
// second parameter of createClient. Use the updateAuthentication to change the
|
|
63
|
+
// authentication mode after creation
|
|
64
|
+
client.updateAuthentication(AuthMode.Public)
|
|
65
|
+
|
|
66
|
+
// Execute a GraphQL query, the second paramer can be used to send in variables
|
|
67
|
+
const result = await client.request(document)
|
|
68
|
+
|
|
69
|
+
// Use the Router to get all routes registered by Optimizely CMS
|
|
70
|
+
const router = new Router(client)
|
|
71
|
+
const allPaths = await router.getRoutes()
|
|
72
|
+
|
|
73
|
+
// Use the ChannelRepository to get all registered channels within Optimizely CMS
|
|
74
|
+
const channels = new ChannelRepository(client)
|
|
75
|
+
const allChannels = await channels.getAll()
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 2.2. GraphQL Client Authentication
|
|
79
|
+
Optimizely Graph allows restricted content to be queried, using either of the following patterns:
|
|
80
|
+
|
|
81
|
+
* **Graph Keys**: Admin authentication using Graph Sercet Key and App Key
|
|
82
|
+
* **Token passthrough**: Used by CMS preview/edit mode to provide a short lived access token to query the content to be previewed/edited. [Read more](https://docs.developers.optimizely.com/platform-optimizely/v1.4.0-optimizely-graph/docs/on-page-editing-using-content-graph)
|
|
83
|
+
* **OpenID Connect**: Used by the frontend to pass through OpenID Connect based JWT to authorize content. [Read more](https://docs.developers.optimizely.com/platform-optimizely/v1.4.0-optimizely-graph/docs/opti-id)
|
|
84
|
+
* **Generic Login**: Used by the fronend to pass through the username/roles from a trusted identity provider. [Read more](https://docs.developers.optimizely.com/platform-optimizely/v1.4.0-optimizely-graph/docs/basic-auth-from-backend)
|
|
85
|
+
|
|
86
|
+
#### 2.2.1. Graph Keys
|
|
87
|
+
The Graph Keys authentication mechanism can be enabled by providing the App Secret and App Key as part of the configuration. Then depending on your security policy, use either:
|
|
88
|
+
|
|
89
|
+
- Basic Authentication: `client.updateAuthentication(AuthMode.Basic)`
|
|
90
|
+
- HMAC Authentication: `client.updateAuthentication(AuthMode.HMAC)`
|
|
91
|
+
|
|
92
|
+
HMAC provides slightly better security as it both ensures message integrity and never transmits the App Secret in a decryptable form.
|
|
93
|
+
|
|
94
|
+
#### 2.2.2. Token passthrough
|
|
95
|
+
This method of authentication is specific to Optimizely CMS, where the edit UI will provide a short-lived token that allows access to the content that is being edited. This only requires the Single Key to be known.
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
const tokenValue: string = ''; //Your token value here
|
|
99
|
+
client.updateAuthentication(tokenValue)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
#### 2.2.3. OpenID Connect
|
|
103
|
+
This method requires two steps, first, the client must be configured with the Turnstile Tenant ID, secondly the JWT Token of the OIDC provider must be added to the client.
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
const client = createClient({
|
|
107
|
+
single_key: "your_single_key",
|
|
108
|
+
tenant_id: "your_turnstile_tenant_id"
|
|
109
|
+
})
|
|
110
|
+
const tokenValue: string = ''; //Your OIDC JWT Token
|
|
111
|
+
client.updateAuthentication(tokenValue)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
#### 2.2.4. Token passthrough
|
|
115
|
+
This method works with non-OIDC compliant identity providers, but requires a trusted connection with Optimizely Graph. As such, it requires the Graph Keys to ensure that the client is authorized to pass in the username and roles directly.
|
|
116
|
+
|
|
117
|
+
The roles must be provided as a comma separated list, without spaces around the values. Both the username and roles must exactly match the roles and usernames defined in Optimizely CMS.
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
const client = createClient({
|
|
121
|
+
single_key: "your_single_key",
|
|
122
|
+
app_key: "your_app_key",
|
|
123
|
+
secret: "your_secret"
|
|
124
|
+
})
|
|
125
|
+
client.setFrontendUser({
|
|
126
|
+
username: "your_username",
|
|
127
|
+
roles: "list_of_roles"
|
|
128
|
+
})
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### 2.3. Admin API
|
|
132
|
+
***Warning***: The AdminAPI of Optimizely Graph requires your App Key & Secret as it allows full management of the service. When used in a browser, take all needed steps to prevent leaking of these credentials.
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
import createAdminApi from '@remkoj/optimizely-graph-client/admin'
|
|
136
|
+
|
|
137
|
+
// Create an instance of the client, the configuration object may be omitted
|
|
138
|
+
// when executing on Node.JS. If no configuration is provided, it will be read
|
|
139
|
+
// from the environment variables.
|
|
140
|
+
const api = createAdminApi({
|
|
141
|
+
single_key: "your single key",
|
|
142
|
+
app_key: "your app key",
|
|
143
|
+
secret: "your secret"
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
// Use the webhooks endpoint to list all registered webhooks
|
|
147
|
+
const hooks = await api.webhooks.listWebhookHandler()
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## 3. Configuration
|
|
151
|
+
The following configuration options are available, the table lists both the environment variable as well as property within the configuration object.
|
|
152
|
+
|
|
153
|
+
| Environment | Configuration object | Required | Usage |
|
|
154
|
+
| --- | --- | --- | --- |
|
|
155
|
+
| `OPTIMIZELY_GRAPH_GATEWAY` | gateway | no | The endpoint for Optimizely Graph |
|
|
156
|
+
| `OPTIMIZELY_GRAPH_SINGLE_KEY` | single_key | yes | The key needed for public, read-only access |
|
|
157
|
+
| `OPTIMIZELY_GRAPH_SECRET` | secret | no | The Optimizely Graph secret for write access, this value must never be made available in a browser |
|
|
158
|
+
| `OPTIMIZELY_GRAPH_APP_KEY` | app_key | no | The Optimizely Graph app_key for write access, this value must never be made available in a browser |
|
|
159
|
+
| `OPTIMIZELY_GRAPH_TENANT_ID` | tenant_id | no | The Optimizely Graph Tenant ID.<br/><br/>*Only required when using OIDC Authentication* |
|
|
160
|
+
| `SITE_DOMAIN` | deploy_domain | no | The domain of the frontend |
|
|
161
|
+
| `OPTIMIZELY_CMS_URL` | dxp_url | yes | The domain where the CMS has been installed |
|
|
162
|
+
| `OPTIMIZELY_CMS_SCHEMA` | opti_cms_schema | no | The marker for the CMS schema version, which can be used by services and the implementation. Valid values are: `OPTI-CMS-12` and `OPTI-CMS-13`. The default value is `OPTI-CMS-13` |
|
|
163
|
+
| `OPTIMIZELY_GRAPH_QUERY_LOG` | query_log | no | Set to "true" to enable query output to the console |
|
|
164
|
+
| `OPTIMIZELY_DEBUG` | debug | no | Set to "true" to enable verbose debug output to the console |
|
|
165
|
+
|
|
166
|
+
### 3.1. Advanced Features
|
|
167
|
+
The Optimizely Graph Client has support for a number of the feature flags in Optimizely Graph and can enable/disable those on the fly.
|
|
168
|
+
|
|
169
|
+
The following features can currently be toggled:
|
|
170
|
+
- **Caching *[Default: enabled]*:** Provides control over the service output cache, setting this to false will make all requests be evaluated in real time instead of being cached.
|
|
171
|
+
- **Stored queries *[Default: enabled]*:** This will store the query to the underlying data store, so even when the output cache is invalidated, this will prevent the query to the data store to be regenerated. **Warning**: This feature does not work with cursors, so either disable it temporary or completely if you need cursors in you queries.
|
|
172
|
+
- **Recursive queries *[Default: disabled]*:** When enabled it enables the execution of the `@recursive(depth: n)` directive. If compatible with the queries used, this can significantly reduce the number of queries needed to build a page.
|
|
173
|
+
|
|
174
|
+
The flags are controlled by the following instance methods & fields on the Client object:
|
|
175
|
+
- `updateFlags(newFlags, temporary)`: Update the flags for the instance. If there's roll-back information it will throw an Error. When temporary is enabled it will create a roll-back copy of the current flags prior to updating.
|
|
176
|
+
- `restoreFlags()`: Restore the flags to the stored 'roll-back' copy, if there's no roll-back copy, no action is taken and no Error will be thrown.
|
|
177
|
+
|
|
178
|
+
#### Example <!-- omit in toc -->
|
|
179
|
+
For server-side code, with access to environment variables, adjust according to your case.
|
|
180
|
+
```typescript
|
|
181
|
+
// Import client & create instance
|
|
182
|
+
import createClient from '@remkoj/optimizely-graph-client/client';
|
|
183
|
+
const client = createClient();
|
|
184
|
+
|
|
185
|
+
// Set the default for this client to add support for recursive queries
|
|
186
|
+
client.updateFlags({ recursive: true });
|
|
187
|
+
|
|
188
|
+
// Temporary disable the query cache to allow queries with cursor
|
|
189
|
+
client.updateFlags({ queryCache: false }, true);
|
|
190
|
+
|
|
191
|
+
...
|
|
192
|
+
|
|
193
|
+
// Roll-back to preferred flag settings
|
|
194
|
+
client.restoreFlags();
|
|
195
|
+
```
|
|
@@ -11,7 +11,7 @@ export class OptimizelyGraphAdminApi {
|
|
|
11
11
|
constructor(config, HttpRequest = FetchHttpRequest) {
|
|
12
12
|
this.request = new HttpRequest({
|
|
13
13
|
BASE: config?.BASE ?? 'https://prod.cg.optimizely.com',
|
|
14
|
-
VERSION: config?.VERSION ?? '3.
|
|
14
|
+
VERSION: config?.VERSION ?? '3.13.0',
|
|
15
15
|
WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false,
|
|
16
16
|
CREDENTIALS: config?.CREDENTIALS ?? 'include',
|
|
17
17
|
TOKEN: config?.TOKEN,
|
|
@@ -7,10 +7,10 @@ export type { OpenAPIConfig } from './core/OpenAPI.js';
|
|
|
7
7
|
export type { BestBetCollectionPayload } from './models/BestBetCollectionPayload.js';
|
|
8
8
|
export type { BestBetCollectionResult } from './models/BestBetCollectionResult.js';
|
|
9
9
|
export type { CacheInvalidationConfig } from './models/CacheInvalidationConfig.js';
|
|
10
|
+
export type { ContentSource_V2 } from './models/ContentSource_V2.js';
|
|
11
|
+
export type { ContentSource_V3 } from './models/ContentSource_V3.js';
|
|
10
12
|
export type { ContentType_V2 } from './models/ContentType_V2.js';
|
|
11
13
|
export type { ContentType_V3 } from './models/ContentType_V3.js';
|
|
12
|
-
export type { ContentTypeDefinition_V2 } from './models/ContentTypeDefinition_V2.js';
|
|
13
|
-
export type { ContentTypeDefinition_V3 } from './models/ContentTypeDefinition_V3.js';
|
|
14
14
|
export type { ContentTypeMap_V3 } from './models/ContentTypeMap_V3.js';
|
|
15
15
|
export type { ContentTypeProperty_V2 } from './models/ContentTypeProperty_V2.js';
|
|
16
16
|
export type { ContentTypeProperty_V3 } from './models/ContentTypeProperty_V3.js';
|
|
@@ -22,7 +22,7 @@ export type { LinkMap } from './models/LinkMap.js';
|
|
|
22
22
|
export type { LinkProperty } from './models/LinkProperty.js';
|
|
23
23
|
export type { OperationMap } from './models/OperationMap.js';
|
|
24
24
|
export type { Optional_string_ } from './models/Optional_string_.js';
|
|
25
|
-
export type {
|
|
25
|
+
export type { Partial_Record_string_OperationMap__ } from './models/Partial_Record_string_OperationMap__.js';
|
|
26
26
|
export { Preset } from './models/Preset.js';
|
|
27
27
|
export type { Property_V2 } from './models/Property_V2.js';
|
|
28
28
|
export type { Property_V3 } from './models/Property_V3.js';
|
|
@@ -35,6 +35,7 @@ export type { Request } from './models/Request.js';
|
|
|
35
35
|
export type { RequestLog } from './models/RequestLog.js';
|
|
36
36
|
export type { SourceInfo } from './models/SourceInfo.js';
|
|
37
37
|
export type { SourceInfoMap } from './models/SourceInfoMap.js';
|
|
38
|
+
export type { SourceMetadata } from './models/SourceMetadata.js';
|
|
38
39
|
export type { StopwordsBody } from './models/StopwordsBody.js';
|
|
39
40
|
export type { SynonymsBody } from './models/SynonymsBody.js';
|
|
40
41
|
export type { TokenClaims } from './models/TokenClaims.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/admin-api/client/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,0BAA0B;AAC1B,oBAAoB;AACpB,oBAAoB;AACpB,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAa5C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AASpD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/admin-api/client/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,0BAA0B;AAC1B,oBAAoB;AACpB,oBAAoB;AACpB,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAa5C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AASpD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAmB5C,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC"}
|
package/dist/admin-api/client/models/{ContentTypeDefinition_V2.d.ts → ContentSource_V2.d.ts}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ContentType_V2 } from './ContentType_V2.js';
|
|
2
2
|
import type { LinkMap } from './LinkMap.js';
|
|
3
3
|
import type { PropertyType_V2 } from './PropertyType_V2.js';
|
|
4
|
-
export type
|
|
4
|
+
export type ContentSource_V2 = {
|
|
5
5
|
useTypedFieldNames?: boolean;
|
|
6
6
|
languages?: Array<string>;
|
|
7
7
|
links?: LinkMap;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentSource_V2.js","sourceRoot":"","sources":["../../../../src/admin-api/client/models/ContentSource_V2.ts"],"names":[],"mappings":""}
|
package/dist/admin-api/client/models/{ContentTypeDefinition_V3.d.ts → ContentSource_V3.d.ts}
RENAMED
|
@@ -3,12 +3,13 @@ import type { LinkMap } from './LinkMap.js';
|
|
|
3
3
|
import type { Optional_string_ } from './Optional_string_.js';
|
|
4
4
|
import type { Preset } from './Preset.js';
|
|
5
5
|
import type { PropertyTypeMap_V3 } from './PropertyTypeMap_V3.js';
|
|
6
|
-
export type
|
|
6
|
+
export type ContentSource_V3 = {
|
|
7
7
|
languages?: Array<string>;
|
|
8
8
|
contentTypes?: ContentTypeMap_V3;
|
|
9
9
|
propertyTypes?: PropertyTypeMap_V3;
|
|
10
10
|
links?: LinkMap;
|
|
11
11
|
label?: Optional_string_;
|
|
12
|
+
description?: Optional_string_;
|
|
12
13
|
useTypedFieldNames?: boolean;
|
|
13
14
|
preset?: Preset;
|
|
14
15
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentSource_V3.js","sourceRoot":"","sources":["../../../../src/admin-api/client/models/ContentSource_V3.ts"],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type FilterMap =
|
|
1
|
+
import type { Partial_Record_string_OperationMap__ } from './Partial_Record_string_OperationMap__.js';
|
|
2
|
+
export type FilterMap = Partial_Record_string_OperationMap__;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Partial_Record_string_OperationMap__.js","sourceRoot":"","sources":["../../../../src/admin-api/client/models/Partial_Record_string_OperationMap__.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SourceMetadata.js","sourceRoot":"","sources":["../../../../src/admin-api/client/models/SourceMetadata.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Partial_Record_string_OperationMap__ } from './Partial_Record_string_OperationMap__.js';
|
|
2
2
|
import type { Request } from './Request.js';
|
|
3
3
|
/**
|
|
4
4
|
* The `WebhookPayload` type represents the payload of a webhook request, which includes information
|
|
@@ -8,5 +8,5 @@ export type WebhookPayload = {
|
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
request: Request;
|
|
10
10
|
topics?: Array<string>;
|
|
11
|
-
filters?: (Array<
|
|
11
|
+
filters?: (Array<Partial_Record_string_OperationMap__> | Partial_Record_string_OperationMap__);
|
|
12
12
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ContentSource_V2 } from '../models/ContentSource_V2.js';
|
|
2
2
|
import type { CancelablePromise } from '../core/CancelablePromise.js';
|
|
3
3
|
import type { BaseHttpRequest } from '../core/BaseHttpRequest.js';
|
|
4
4
|
export declare class DefinitionV2Service {
|
|
@@ -30,5 +30,5 @@ export declare class DefinitionV2Service {
|
|
|
30
30
|
* @returns any Successfully updated content type
|
|
31
31
|
* @throws ApiError
|
|
32
32
|
*/
|
|
33
|
-
postContentV2TypeHandler(requestBody:
|
|
33
|
+
postContentV2TypeHandler(requestBody: ContentSource_V2): CancelablePromise<any>;
|
|
34
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefinitionV2Service.js","sourceRoot":"","sources":["../../../../src/admin-api/client/services/DefinitionV2Service.ts"],"names":[],"mappings":"AAOA,MAAM,OAAO,mBAAmB;IAC5B,YAA4B,WAA4B;QAA5B,gBAAW,GAAX,WAAW,CAAiB;IAAG,CAAC;IAC5D;;;;;;;OAOG;IACI,wBAAwB,CAC3B,EAAU,EACV,WAAmB;QAEnB,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;YAC5B,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,sBAAsB;YAC3B,KAAK,EAAE;gBACH,IAAI,EAAE,EAAE;aACX;YACD,IAAI,EAAE,WAAW;YACjB,SAAS,EAAE,kBAAkB;SAChC,CAAC,CAAC;IACP,CAAC;IACD;;;;;;;OAOG;IACI,0BAA0B,CAC7B,EAAU,EACV,SAAyB;QAEzB,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;YAC5B,MAAM,EAAE,QAAQ;YAChB,GAAG,EAAE,sBAAsB;YAC3B,KAAK,EAAE;gBACH,IAAI,EAAE,EAAE;gBACR,WAAW,EAAE,SAAS;aACzB;SACJ,CAAC,CAAC;IACP,CAAC;IACD;;;;;;;OAOG;IACI,wBAAwB,CAC3B,
|
|
1
|
+
{"version":3,"file":"DefinitionV2Service.js","sourceRoot":"","sources":["../../../../src/admin-api/client/services/DefinitionV2Service.ts"],"names":[],"mappings":"AAOA,MAAM,OAAO,mBAAmB;IAC5B,YAA4B,WAA4B;QAA5B,gBAAW,GAAX,WAAW,CAAiB;IAAG,CAAC;IAC5D;;;;;;;OAOG;IACI,wBAAwB,CAC3B,EAAU,EACV,WAAmB;QAEnB,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;YAC5B,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,sBAAsB;YAC3B,KAAK,EAAE;gBACH,IAAI,EAAE,EAAE;aACX;YACD,IAAI,EAAE,WAAW;YACjB,SAAS,EAAE,kBAAkB;SAChC,CAAC,CAAC;IACP,CAAC;IACD;;;;;;;OAOG;IACI,0BAA0B,CAC7B,EAAU,EACV,SAAyB;QAEzB,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;YAC5B,MAAM,EAAE,QAAQ;YAChB,GAAG,EAAE,sBAAsB;YAC3B,KAAK,EAAE;gBACH,IAAI,EAAE,EAAE;gBACR,WAAW,EAAE,SAAS;aACzB;SACJ,CAAC,CAAC;IACP,CAAC;IACD;;;;;;;OAOG;IACI,wBAAwB,CAC3B,WAA6B;QAE7B,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;YAC5B,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,uBAAuB;YAC5B,IAAI,EAAE,WAAW;YACjB,SAAS,EAAE,kBAAkB;YAC7B,MAAM,EAAE;gBACJ,GAAG,EAAE,6CAA6C;aACrD;SACJ,CAAC,CAAC;IACP,CAAC;CACJ"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ContentSource_V3 } from '../models/ContentSource_V3.js';
|
|
2
2
|
import type { DeleteMode } from '../models/DeleteMode.js';
|
|
3
3
|
import type { SourceInfoMap } from '../models/SourceInfoMap.js';
|
|
4
|
+
import type { SourceMetadata } from '../models/SourceMetadata.js';
|
|
4
5
|
import type { CancelablePromise } from '../core/CancelablePromise.js';
|
|
5
6
|
import type { BaseHttpRequest } from '../core/BaseHttpRequest.js';
|
|
6
7
|
export declare class DefinitionV3Service {
|
|
@@ -8,7 +9,7 @@ export declare class DefinitionV3Service {
|
|
|
8
9
|
constructor(httpRequest: BaseHttpRequest);
|
|
9
10
|
/**
|
|
10
11
|
* Get source metadata
|
|
11
|
-
* Get `id`, `label` and `languages` fields of the source
|
|
12
|
+
* Get `id`, `label`, `description` and `languages` fields of the source
|
|
12
13
|
* @param id The id of the source _(optional)_
|
|
13
14
|
* - _(empty): all sources_
|
|
14
15
|
* - _**default**: only default source_
|
|
@@ -36,14 +37,23 @@ export declare class DefinitionV3Service {
|
|
|
36
37
|
* @throws ApiError
|
|
37
38
|
*/
|
|
38
39
|
deleteContentV3SourceHandler(id?: string, mode?: DeleteMode): CancelablePromise<any>;
|
|
40
|
+
/**
|
|
41
|
+
* Update source metadata
|
|
42
|
+
* Update `label`, `description` fields of the source
|
|
43
|
+
* @param id The id of the source
|
|
44
|
+
* @param requestBody The new metadata source
|
|
45
|
+
* @returns void
|
|
46
|
+
* @throws ApiError
|
|
47
|
+
*/
|
|
48
|
+
postContentV3SourceHandler(id: string, requestBody: SourceMetadata): CancelablePromise<void>;
|
|
39
49
|
/**
|
|
40
50
|
* Get content types
|
|
41
51
|
* Get content types of the source
|
|
42
52
|
* @param id The id of the source
|
|
43
|
-
* @returns
|
|
53
|
+
* @returns ContentSource_V3 Ok
|
|
44
54
|
* @throws ApiError
|
|
45
55
|
*/
|
|
46
|
-
getContentV3TypeHandler(id?: string): CancelablePromise<
|
|
56
|
+
getContentV3TypeHandler(id?: string): CancelablePromise<ContentSource_V3>;
|
|
47
57
|
/**
|
|
48
58
|
* Partial content type update
|
|
49
59
|
* Update content types of the source partially
|
|
@@ -52,7 +62,7 @@ export declare class DefinitionV3Service {
|
|
|
52
62
|
* @returns void
|
|
53
63
|
* @throws ApiError
|
|
54
64
|
*/
|
|
55
|
-
postContentV3TypeHandler(requestBody:
|
|
65
|
+
postContentV3TypeHandler(requestBody: ContentSource_V3, id?: string): CancelablePromise<void>;
|
|
56
66
|
/**
|
|
57
67
|
* Full content type update
|
|
58
68
|
* Update content types of the source (overwrite all)
|
|
@@ -61,5 +71,5 @@ export declare class DefinitionV3Service {
|
|
|
61
71
|
* @returns void
|
|
62
72
|
* @throws ApiError
|
|
63
73
|
*/
|
|
64
|
-
putContentV3TypeHandler(requestBody:
|
|
74
|
+
putContentV3TypeHandler(requestBody: ContentSource_V3, id?: string): CancelablePromise<void>;
|
|
65
75
|
}
|