@cinerino/sdk 11.0.0-alpha.2 → 11.0.0-alpha.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cinerino/sdk",
3
- "version": "11.0.0-alpha.2",
3
+ "version": "11.0.0-alpha.4",
4
4
  "description": "Cinerino SDK",
5
5
  "main": "./lib/index.js",
6
6
  "browser": {
@@ -1,34 +0,0 @@
1
- // tslint:disable:no-implicit-dependencies no-console no-magic-numbers
2
- import * as client from '../../../lib/';
3
-
4
- const project = { id: 'cinerino' };
5
-
6
- async function main() {
7
- const authClient = await client.auth.ClientCredentials.createInstance({
8
- domain: <string>process.env.CHEVRE_AUTHORIZE_SERVER_DOMAIN,
9
- clientId: <string>process.env.CHEVRE_CLIENT_ID,
10
- clientSecret: <string>process.env.CHEVRE_CLIENT_SECRET,
11
- scopes: [],
12
- state: ''
13
- });
14
- const permitService = await (await client.loadChevreAsset({
15
- endpoint: <string>process.env.CHEVRE_ENDPOINT,
16
- auth: authClient
17
- })).createPermitInstance({
18
- project,
19
- seller: { id: '' }
20
- });
21
-
22
- // tslint:disable-next-line:prefer-array-literal
23
- const result = await permitService.publishIdentifier([...Array(100)].map(() => {
24
- return { project };
25
- }));
26
- console.log(result);
27
- console.log(result.length, 'identifiers published');
28
- }
29
-
30
- main()
31
- .then(() => {
32
- console.log('main processed.');
33
- })
34
- .catch(console.error);
@@ -1,57 +0,0 @@
1
- // tslint:disable:no-console
2
- import { factory, loadCloudAdmin } from '../../../lib/index';
3
- import * as auth from '../auth/authAsAdmin';
4
-
5
- const project = { id: String(process.env.PROJECT_ID) };
6
- async function main() {
7
- const authClient = await auth.login();
8
- await authClient.refreshAccessToken();
9
- const loginTicket = authClient.verifyIdToken({});
10
- console.log('username is', loginTicket.getUsername());
11
-
12
- const memberService = await (await loadCloudAdmin({
13
- endpoint: <string>process.env.API_ADMIN_ENDPOINT,
14
- auth: authClient
15
- })).createMemberInstance({
16
- project: { id: project.id },
17
- seller: { id: '59d20831e53ebc2b4e774466' }
18
- });
19
- const authorizationService = await (await loadCloudAdmin({
20
- endpoint: <string>process.env.API_ADMIN_ENDPOINT,
21
- auth: authClient
22
- })).createAuthorizationInstance({
23
- project: { id: project.id },
24
- seller: { id: '59d20831e53ebc2b4e774466' } // 販売者を指定(承認するロールの範囲が販売者リソースになる)
25
- });
26
-
27
- const applications = await memberService.searchSoftwareApplications({
28
- limit: 10,
29
- page: 1
30
- });
31
- console.log(applications);
32
- console.log(applications.length, 'applications found');
33
-
34
- if (applications.length > 0) {
35
- const result = await authorizationService.create([{
36
- object: {
37
- typeOf: factory.role.RoleType.OrganizationRole,
38
- member: {
39
- hasRole: [
40
- { roleName: 'sellers.inventoryManager' }
41
- ]
42
- }
43
- },
44
- expiresInSeconds: 60,
45
- audience: { id: applications[0].id }
46
- }]);
47
- console.log(result);
48
- } else {
49
- console.log('no software applications');
50
- }
51
- }
52
-
53
- main()
54
- .then(() => {
55
- console.log('success!');
56
- })
57
- .catch(console.error);
@@ -1,16 +0,0 @@
1
- import { ICreatedAuthorization, ICreateParams } from '../../chevreAdmin/authorization';
2
- import { Service } from '../../service';
3
- /**
4
- * 承認サービス
5
- */
6
- export declare class AuthorizationService extends Service {
7
- /**
8
- * 承認作成(イベント作成チケット発行)
9
- */
10
- create(
11
- /**
12
- * 承認作成パラメータ
13
- * 最大長: 1
14
- */
15
- params: ICreateParams[]): Promise<ICreatedAuthorization[]>;
16
- }
@@ -1,17 +0,0 @@
1
- import { IMember } from '../../chevreAdmin/member';
2
- import { Service } from '../../service';
3
- /**
4
- * メンバーサービス
5
- */
6
- export declare class MemberService extends Service {
7
- /**
8
- * ソフトウェア検索
9
- */
10
- searchSoftwareApplications(params: {
11
- /**
12
- * max: 20
13
- */
14
- limit?: number;
15
- page?: number;
16
- }): Promise<IMember[]>;
17
- }