@cinerino/sdk 18.3.0 → 18.4.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/abstract/chevre/event/factory.d.ts +1 -1
- package/lib/abstract/chevreAdmin/offerCatalogItem.d.ts +1 -1
- package/lib/abstract/chevreConsole/offerCatalog.d.ts +2 -2
- package/lib/abstract/chevreConsole/offerCatalogItem.d.ts +1 -1
- package/lib/abstract/transporters.js +1 -0
- package/lib/auth/clientCredentialsClient.d.ts +5 -1
- package/lib/auth/oAuth2client.d.ts +5 -0
- package/lib/auth/oAuth2client.js +16 -3
- package/lib/bundle.js +3 -3
- package/lib/bundle.js.map +4 -4
- package/package.json +2 -2
|
@@ -77,7 +77,7 @@ export interface IFindSubEventsParams {
|
|
|
77
77
|
/**
|
|
78
78
|
* イベントのサブカタログ検索結果
|
|
79
79
|
*/
|
|
80
|
-
export type ISearchOfferCatalogItemResult = Pick<factory.offerCatalog.IOfferCatalog, 'id' | 'name' | 'description' | '
|
|
80
|
+
export type ISearchOfferCatalogItemResult = Pick<factory.offerCatalog.IOfferCatalog, 'id' | 'name' | 'description' | 'relatedOffer'> & {
|
|
81
81
|
/**
|
|
82
82
|
* カタログ内インデックス
|
|
83
83
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { factory } from '../factory';
|
|
2
2
|
import { Service } from '../service';
|
|
3
|
-
type IOfferCatalogAsSearchResult = Pick<factory.offerCatalog.IOfferCatalog, 'id' | 'name' | 'description' | 'project' | 'typeOf' | 'identifier' | 'itemOffered' | '
|
|
3
|
+
type IOfferCatalogAsSearchResult = Pick<factory.offerCatalog.IOfferCatalog, 'id' | 'name' | 'description' | 'project' | 'typeOf' | 'identifier' | 'itemOffered' | 'relatedOffer'> & {
|
|
4
4
|
/**
|
|
5
5
|
* アイテム数
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { factory } from '../factory';
|
|
2
2
|
import { Service } from '../service';
|
|
3
|
-
type IOfferCatalogAsSearchResult = Pick<factory.offerCatalog.IOfferCatalog, 'id' | 'name' | 'description' | 'project' | 'typeOf' | 'identifier' | 'itemOffered'
|
|
3
|
+
type IOfferCatalogAsSearchResult = Pick<factory.offerCatalog.IOfferCatalog, 'id' | 'name' | 'description' | 'project' | 'typeOf' | 'identifier' | 'itemOffered'> & {
|
|
4
4
|
/**
|
|
5
5
|
* アイテム数
|
|
6
6
|
*/
|
|
@@ -13,7 +13,7 @@ type IOfferCatalogAsSearchResult = Pick<factory.offerCatalog.IOfferCatalog, 'id'
|
|
|
13
13
|
type IItemAsOffer = Pick<factory.unitPriceOffer.IUnitPriceOffer, 'id' | 'identifier' | 'name' | 'alternateName' | 'priceSpecification' | 'typeOf'> & {
|
|
14
14
|
sortIndex?: number;
|
|
15
15
|
};
|
|
16
|
-
type IItemAsOfferCatalog = Pick<factory.offerCatalog.IOfferCatalog, 'id' | 'name' | 'description' | 'typeOf' | 'identifier' | 'itemOffered' | '
|
|
16
|
+
type IItemAsOfferCatalog = Pick<factory.offerCatalog.IOfferCatalog, 'id' | 'name' | 'description' | 'typeOf' | 'identifier' | 'itemOffered' | 'relatedOffer'> & {
|
|
17
17
|
sortIndex?: number;
|
|
18
18
|
};
|
|
19
19
|
type IItemListElement = IItemAsOffer | IItemAsOfferCatalog;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { factory } from '../factory';
|
|
2
2
|
import { Service } from '../service';
|
|
3
|
-
type IOfferCatalogAsSearchResult = Pick<factory.offerCatalog.IOfferCatalog, 'id' | 'name' | 'description' | 'project' | 'typeOf' | 'identifier' | 'itemOffered' | '
|
|
3
|
+
type IOfferCatalogAsSearchResult = Pick<factory.offerCatalog.IOfferCatalog, 'id' | 'name' | 'description' | 'project' | 'typeOf' | 'identifier' | 'itemOffered' | 'relatedOffer'> & {
|
|
4
4
|
/**
|
|
5
5
|
* アイテム数
|
|
6
6
|
*/
|
|
@@ -67,6 +67,7 @@ class DefaultTransporter {
|
|
|
67
67
|
// Headers インスタンス化して大文字・小文字を吸収する
|
|
68
68
|
const headers = new Headers(options.headers);
|
|
69
69
|
const currentUserAgent = headers.get('user-agent');
|
|
70
|
+
/* istanbul ignore else -- @preserve */
|
|
70
71
|
if (!currentUserAgent) {
|
|
71
72
|
headers.set('user-agent', DefaultTransporter.USER_AGENT);
|
|
72
73
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { ICredentials } from './credentials';
|
|
2
|
-
import { OAuth2client } from './oAuth2client';
|
|
2
|
+
import { OAuth2client, IIAPHeaderGenerator } from './oAuth2client';
|
|
3
3
|
export interface IOptions {
|
|
4
4
|
domain: string;
|
|
5
5
|
clientId: string;
|
|
6
6
|
clientSecret: string;
|
|
7
7
|
scopes: string[];
|
|
8
8
|
state: string;
|
|
9
|
+
/**
|
|
10
|
+
* Google IAP認証ヘッダー生成関数
|
|
11
|
+
*/
|
|
12
|
+
iapHeaderGenerator?: IIAPHeaderGenerator;
|
|
9
13
|
}
|
|
10
14
|
/**
|
|
11
15
|
* クライアント認証OAuthクライアント
|
|
@@ -16,6 +16,7 @@ interface IPreFetchParams {
|
|
|
16
16
|
type IPreFetch = (params: IPreFetchParams) => Promise<{
|
|
17
17
|
options: RequestInit;
|
|
18
18
|
}>;
|
|
19
|
+
export type IIAPHeaderGenerator = () => Promise<string>;
|
|
19
20
|
export interface IOptions {
|
|
20
21
|
domain: string;
|
|
21
22
|
clientId?: string;
|
|
@@ -29,6 +30,10 @@ export interface IOptions {
|
|
|
29
30
|
nonce?: string | null;
|
|
30
31
|
audience?: string;
|
|
31
32
|
tokenIssuer?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Google IAP認証ヘッダー生成関数
|
|
35
|
+
*/
|
|
36
|
+
iapHeaderGenerator?: IIAPHeaderGenerator;
|
|
32
37
|
}
|
|
33
38
|
export interface IVerifyIdTokenOptions {
|
|
34
39
|
audience?: string | string[];
|
package/lib/auth/oAuth2client.js
CHANGED
|
@@ -243,7 +243,6 @@ class OAuth2client {
|
|
|
243
243
|
) {
|
|
244
244
|
// Callbacks will close over this to ensure that we only retry once
|
|
245
245
|
let retry = true;
|
|
246
|
-
options.headers = (options.headers === undefined || options.headers === null) ? {} : options.headers;
|
|
247
246
|
let result;
|
|
248
247
|
let numberOfTry = 0;
|
|
249
248
|
while (result === undefined) {
|
|
@@ -252,8 +251,22 @@ class OAuth2client {
|
|
|
252
251
|
if (numberOfTry > exports.MAX_RETRY_NUM) {
|
|
253
252
|
retry = false;
|
|
254
253
|
}
|
|
255
|
-
|
|
256
|
-
|
|
254
|
+
// Headers インスタンスに正規化してプロパティ欠落を防止
|
|
255
|
+
const headers = new Headers((options.headers === undefined || options.headers === null) ? {} : options.headers);
|
|
256
|
+
// options.headers = (options.headers === undefined || options.headers === null) ? {} : options.headers;
|
|
257
|
+
// support IAP(2026-11-04~)
|
|
258
|
+
/* istanbul ignore if */
|
|
259
|
+
if (typeof this.options.iapHeaderGenerator === 'function') {
|
|
260
|
+
headers.set('Proxy-Authorization', `${await this.options.iapHeaderGenerator()}`);
|
|
261
|
+
}
|
|
262
|
+
headers.set('Authorization', `Bearer ${await this.getAccessToken()}`);
|
|
263
|
+
// (options.headers as Record<string, string>).Authorization = `Bearer ${await this.getAccessToken()}`;
|
|
264
|
+
// options に正規化した headers を戻す
|
|
265
|
+
const makeFetchOptions = {
|
|
266
|
+
...options,
|
|
267
|
+
headers
|
|
268
|
+
};
|
|
269
|
+
result = await this.makeFetch(url, makeFetchOptions, expectedStatusCodes);
|
|
257
270
|
break;
|
|
258
271
|
}
|
|
259
272
|
catch (error) {
|