@cinerino/sdk 18.3.0 → 18.4.0-alpha.1
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/implicitGrantClient.d.ts +3 -1
- package/lib/auth/implicitGrantClient.js +2 -1
- package/lib/auth/oAuth2client.d.ts +5 -0
- package/lib/auth/oAuth2client.js +17 -3
- package/lib/browser.d.ts +1 -1
- 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クライアント
|
|
@@ -12,6 +12,7 @@ export interface IOptions {
|
|
|
12
12
|
nonce: string | null;
|
|
13
13
|
audience?: string;
|
|
14
14
|
tokenIssuer: string;
|
|
15
|
+
iapHeaderGenerator?: never;
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
18
|
* OAuth2 client using grant type 'implicit grant'
|
|
@@ -21,7 +22,8 @@ export declare class ImplicitGrantClient extends OAuth2client {
|
|
|
21
22
|
static LOGOUT_URL: string;
|
|
22
23
|
options: IOptions;
|
|
23
24
|
credentials: ICredentials;
|
|
24
|
-
constructor(
|
|
25
|
+
constructor({ iapHeaderGenerator: _iapHeaderGenerator, // browserではひとまず非対応(2026-11-05~)
|
|
26
|
+
...options }: IOptions);
|
|
25
27
|
static BUILD_PASRSE_HASH_RESPONS(qsParams: any, __: string, idTokenPayload: any): ICredentials;
|
|
26
28
|
isSignedIn(): Promise<ICredentials | null>;
|
|
27
29
|
getAccessToken(): Promise<string>;
|
|
@@ -23,7 +23,8 @@ class ImplicitGrantClient extends oAuth2client_1.OAuth2client {
|
|
|
23
23
|
static LOGOUT_URL = '/logout';
|
|
24
24
|
options;
|
|
25
25
|
credentials;
|
|
26
|
-
constructor(
|
|
26
|
+
constructor({ iapHeaderGenerator: _iapHeaderGenerator, // browserではひとまず非対応(2026-11-05~)
|
|
27
|
+
...options }) {
|
|
27
28
|
// assert.check(
|
|
28
29
|
// options,
|
|
29
30
|
// { type: 'object', message: 'options parameter is not valid' },
|
|
@@ -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,23 @@ 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
|
+
console.log('await this.options.iapHeaderGenerator():', await this.options.iapHeaderGenerator());
|
|
261
|
+
headers.set('Proxy-Authorization', `${await this.options.iapHeaderGenerator()}`);
|
|
262
|
+
}
|
|
263
|
+
headers.set('Authorization', `Bearer ${await this.getAccessToken()}`);
|
|
264
|
+
// (options.headers as Record<string, string>).Authorization = `Bearer ${await this.getAccessToken()}`;
|
|
265
|
+
// options に正規化した headers を戻す
|
|
266
|
+
const makeFetchOptions = {
|
|
267
|
+
...options,
|
|
268
|
+
headers
|
|
269
|
+
};
|
|
270
|
+
result = await this.makeFetch(url, makeFetchOptions, expectedStatusCodes);
|
|
257
271
|
break;
|
|
258
272
|
}
|
|
259
273
|
catch (error) {
|
package/lib/browser.d.ts
CHANGED
|
@@ -7,4 +7,4 @@ export { loadCloudAdmin, loadCloudAsset, loadCloudPay, loadCloudSearch, loadClou
|
|
|
7
7
|
/**
|
|
8
8
|
* create OAuth2 client instance using implicit grant
|
|
9
9
|
*/
|
|
10
|
-
export declare function createAuthInstance(options: IImplicitGrantClientOptions): ImplicitGrantClient;
|
|
10
|
+
export declare function createAuthInstance(options: Pick<IImplicitGrantClientOptions, 'audience' | 'clientId' | 'domain' | 'logoutUri' | 'nonce' | 'redirectUri' | 'responseMode' | 'responseType' | 'scope' | 'state' | 'tokenIssuer'>): ImplicitGrantClient;
|