@things-factory/oauth2-client 10.1.256 → 10.1.257

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.
@@ -4,8 +4,14 @@ import { PageView } from '@operato/shell';
4
4
  declare const Oauth2Client_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
5
5
  export declare class Oauth2Client extends Oauth2Client_base {
6
6
  static styles: import("lit").CSSResult[];
7
- oauth2Client: any;
8
7
  _grantType?: string;
8
+ /** The client the address names. */
9
+ private resourceId?;
10
+ private read;
11
+ private saves;
12
+ private change;
13
+ get oauth2Client(): any;
14
+ private grantTypeOf?;
9
15
  form: HTMLFormElement;
10
16
  copybuttons: any;
11
17
  private clipboard?;
@@ -39,11 +45,10 @@ export declare class Oauth2Client extends Oauth2Client_base {
39
45
  })[];
40
46
  };
41
47
  render(): import("lit-html").TemplateResult<1>;
42
- updated(changes: any): void;
48
+ updated(): void;
43
49
  firstUpdated(): void;
44
50
  pageUpdated(changes: any, lifecycle: any, before: any): Promise<void>;
45
51
  expTimer(exp: any): AsyncGenerator<string, void, unknown>;
46
- fetchOauth2Client(): Promise<void>;
47
52
  updateOauth2Client(): Promise<void>;
48
53
  deleteOauth2Client(): Promise<void>;
49
54
  generateOauth2AccessToken(): Promise<void>;
@@ -4,9 +4,9 @@ import '@operato/help/ox-help-icon.js';
4
4
  import Clipboard from 'clipboard';
5
5
  import gql from 'graphql-tag';
6
6
  import { css, html } from 'lit';
7
- import { customElement, property, query, queryAll } from 'lit/decorators.js';
7
+ import { customElement, property, query, queryAll, state } from 'lit/decorators.js';
8
8
  import { asyncReplace } from 'lit/directives/async-replace.js';
9
- import { client } from '@operato/graphql';
9
+ import { MutationController, QueryController } from '@operato/graphql';
10
10
  import { notify } from '@operato/layout';
11
11
  import { navigate, PageView } from '@operato/shell';
12
12
  import { i18next, localize } from '@operato/i18n';
@@ -39,6 +39,50 @@ updatedAt
39
39
  createdAt
40
40
  `;
41
41
  let Oauth2Client = class Oauth2Client extends localize(i18next)(PageView) {
42
+ constructor() {
43
+ super(...arguments);
44
+ this.read = new QueryController(this, gql `
45
+ query ($id: String!) {
46
+ oauth2Client(id: $id) {
47
+ ${OAUTH2CLIENT}
48
+ }
49
+ }
50
+ `, { variables: () => (this.resourceId ? { id: this.resourceId } : undefined) });
51
+ /* The client as the server holds it after each change. */
52
+ this.saves = {
53
+ update: this.change(gql `
54
+ mutation ($id: String!, $patch: Oauth2ClientPatch!) {
55
+ updateOauth2Client(id: $id, patch: $patch) {
56
+ ${OAUTH2CLIENT}
57
+ }
58
+ }
59
+ `),
60
+ accessToken: this.change(gql `
61
+ mutation ($id: String!) {
62
+ getOauth2AccessToken(id: $id) {
63
+ ${OAUTH2CLIENT}
64
+ }
65
+ }
66
+ `),
67
+ refreshAccessToken: this.change(gql `
68
+ mutation ($id: String!) {
69
+ refreshOauth2AccessToken(id: $id) {
70
+ ${OAUTH2CLIENT}
71
+ }
72
+ }
73
+ `),
74
+ authUrl: new MutationController(this, gql `
75
+ mutation ($id: String!) {
76
+ getOauth2AuthUrl(id: $id)
77
+ }
78
+ `),
79
+ delete: new MutationController(this, gql `
80
+ mutation ($id: String!) {
81
+ deleteOauth2Client(id: $id)
82
+ }
83
+ `)
84
+ };
85
+ }
42
86
  static { this.styles = [
43
87
  /* Read and edited down one column (ADR-0060 decision 8). */
44
88
  DocumentPageStyles,
@@ -190,6 +234,12 @@ let Oauth2Client = class Oauth2Client extends localize(i18next)(PageView) {
190
234
  }
191
235
  `
192
236
  ]; }
237
+ change(mutation) {
238
+ return new MutationController(this, mutation, { refetch: () => [this.read] });
239
+ }
240
+ get oauth2Client() {
241
+ return this.read.data?.oauth2Client;
242
+ }
193
243
  get context() {
194
244
  /*
195
245
  * The name and the line under it are the title bar's (ADR-0060 decision 8), and everything this
@@ -404,11 +454,10 @@ let Oauth2Client = class Oauth2Client extends localize(i18next)(PageView) {
404
454
  </div>
405
455
  `;
406
456
  }
407
- updated(changes) {
408
- if (changes.has('oauth2Client')) {
457
+ updated() {
458
+ if (this.grantTypeOf !== this.oauth2Client) {
459
+ this.grantTypeOf = this.oauth2Client;
409
460
  this._grantType = this.oauth2Client?.grantType;
410
- /* The name, the line under it and the actions all read the client, so the shell redraws them. */
411
- this.updateContext();
412
461
  }
413
462
  }
414
463
  firstUpdated() {
@@ -418,7 +467,7 @@ let Oauth2Client = class Oauth2Client extends localize(i18next)(PageView) {
418
467
  }
419
468
  async pageUpdated(changes, lifecycle, before) {
420
469
  if (this.active) {
421
- await this.fetchOauth2Client();
470
+ this.resourceId = this.lifecycle.resourceId;
422
471
  }
423
472
  }
424
473
  async *expTimer(exp) {
@@ -437,123 +486,49 @@ let Oauth2Client = class Oauth2Client extends localize(i18next)(PageView) {
437
486
  await sleep(1000);
438
487
  }
439
488
  }
440
- async fetchOauth2Client() {
441
- const response = await client.query({
442
- query: gql `
443
- query($id: String!) { oauth2Client(id: $id) { ${OAUTH2CLIENT}
444
- }
445
- }
446
- `,
447
- variables: { id: this.lifecycle.resourceId }
448
- });
449
- this.oauth2Client = response.data.oauth2Client;
450
- }
451
489
  async updateOauth2Client() {
452
490
  const formData = new FormData(this.form);
453
491
  const patch = Array.from(formData.entries()).reduce((patch, [key, value]) => {
454
492
  patch[key] = value;
455
493
  return patch;
456
494
  }, {});
457
- const id = this.lifecycle.resourceId;
458
- const response = await client.mutate({
459
- mutation: gql `
460
- mutation($id: String!, $patch: Oauth2ClientPatch!) { updateOauth2Client(id: $id, patch: $patch) { ${OAUTH2CLIENT}
461
- }
462
- }
463
- `,
464
- variables: { id, patch }
465
- });
466
- if (response.errors) {
467
- notify({ level: 'error', message: 'update oauth2 client fail' });
468
- }
469
- else {
470
- this.oauth2Client = response.data.updateOauth2Client;
471
- }
495
+ await this.saves.update.run({ id: this.lifecycle.resourceId, patch });
472
496
  }
473
497
  async deleteOauth2Client() {
474
498
  /* Deleting took the app away with no question asked. */
475
499
  if (!(await OxPrompt.confirmDelete())) {
476
500
  return;
477
501
  }
478
- const id = this.lifecycle.resourceId;
479
- const response = await client.mutate({
480
- mutation: gql `
481
- mutation ($id: String!) {
482
- deleteOauth2Client(id: $id)
483
- }
484
- `,
485
- variables: { id }
486
- });
487
- if (response.errors) {
488
- notify({ level: 'error', message: 'delete oauth2 client fail' });
489
- }
490
- else {
502
+ if (await this.saves.delete.run({ id: this.lifecycle.resourceId })) {
491
503
  navigate('oauth2-clients');
492
504
  }
493
505
  }
494
506
  async generateOauth2AccessToken() {
495
507
  const id = this.lifecycle.resourceId;
496
508
  if (this.oauth2Client.grantType == 'code') {
497
- const response = await client.mutate({
498
- mutation: gql `
499
- mutation ($id: String!) {
500
- getOauth2AuthUrl(id: $id)
501
- }
502
- `,
503
- variables: { id: this.lifecycle.resourceId }
504
- });
505
- if (!response.errors) {
506
- location.href = response.data.getOauth2AuthUrl;
507
- }
508
- else {
509
- notify({ level: 'error', message: 'getting application access token fail' });
509
+ const answer = await this.saves.authUrl.run({ id });
510
+ if (answer) {
511
+ location.href = answer.getOauth2AuthUrl;
510
512
  }
511
513
  }
512
- else {
513
- const response = await client.mutate({
514
- mutation: gql `
515
- mutation($id: String!) { getOauth2AccessToken(id: $id) { ${OAUTH2CLIENT}
516
- }
517
- }
518
- `,
519
- variables: { id: this.lifecycle.resourceId }
520
- });
521
- if (response.errors) {
522
- notify({ level: 'error', message: 'getting application access token fail' });
523
- }
524
- else {
525
- this.oauth2Client = response.data.getOauth2AccessToken;
526
- notify({ level: 'info', message: 'got application access token successfully' });
527
- }
514
+ else if (await this.saves.accessToken.run({ id })) {
515
+ notify({ level: 'info', message: 'got application access token successfully' });
528
516
  }
529
517
  }
530
518
  async refreshOauth2AccessToken() {
531
- const id = this.lifecycle.resourceId;
532
- const response = await client.mutate({
533
- mutation: gql `
534
- mutation($id: String!) { refreshOauth2AccessToken(id: $id) { ${OAUTH2CLIENT}
535
- }
536
- }
537
- `,
538
- variables: { id: this.lifecycle.resourceId }
539
- });
540
- if (response.errors) {
541
- notify({ level: 'error', message: 'getting application access token fail' });
542
- }
543
- else {
544
- this.oauth2Client = response.data.refreshOauth2AccessToken;
519
+ if (await this.saves.refreshAccessToken.run({ id: this.lifecycle.resourceId })) {
545
520
  notify({ level: 'info', message: 'got application access token successfully' });
546
521
  }
547
522
  }
548
523
  };
549
- __decorate([
550
- property({ type: Object }),
551
- __metadata("design:type", Object)
552
- ], Oauth2Client.prototype, "oauth2Client", void 0);
553
524
  __decorate([
554
525
  property({ type: String }),
555
526
  __metadata("design:type", String)
556
527
  ], Oauth2Client.prototype, "_grantType", void 0);
528
+ __decorate([
529
+ state(),
530
+ __metadata("design:type", String)
531
+ ], Oauth2Client.prototype, "resourceId", void 0);
557
532
  __decorate([
558
533
  query('form'),
559
534
  __metadata("design:type", HTMLFormElement)
@@ -1 +1 @@
1
- {"version":3,"file":"oauth2-client.js","sourceRoot":"","sources":["../../client/pages/oauth2-client.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,+BAA+B,CAAA;AAEtC,OAAO,SAAS,MAAM,WAAW,CAAA;AACjC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AACtD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,i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E,CAAC;;gDAAoB;AAEhC;IAAd,KAAK,CAAC,MAAM,CAAC;8BAAQ,eAAe;0CAAA;AACP;IAA7B,QAAQ,CAAC,kBAAkB,CAAC;;iDAAY;AA7J9B,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAsiBxB","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/help/ox-help-icon.js'\n\nimport Clipboard from 'clipboard'\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query, queryAll } from 'lit/decorators.js'\nimport { asyncReplace } from 'lit/directives/async-replace.js'\nimport { client } from '@operato/graphql'\nimport { notify } from '@operato/layout'\nimport { navigate, PageView } from '@operato/shell'\nimport { i18next, localize } from '@operato/i18n'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\nimport { CommonButtonStyles, DocumentPageStyles } from '@operato/styles'\nimport { sleep } from '@operato/utils'\n\nconst OAUTH2CLIENT = `\nid\nname\ndescription\nicon\ngrantType\nclientId\nclientSecret\ncallbackUrl\nauthUrl\naccessTokenUrl\nwebhook\nusername\npassword\ncodeChallengeMethod\ncodeVerifier\nscopes\naccessToken\nrefreshToken\njwtToken\nexpires\ntokenType\nupdatedAt\ncreatedAt\n`\n\n@customElement('oauth2-client')\nexport class Oauth2Client extends localize(i18next)(PageView) {\n static styles = [\n /* Read and edited down one column (ADR-0060 decision 8). */\n DocumentPageStyles,\n css`\n [icon] {\n float: right;\n max-width: 80px;\n }\n\n [icon] img {\n max-width: 100%;\n max-height: 100%;\n }\n\n [button-primary] {\n background-color: var(--button-primary-background-color);\n border: var(--button-border);\n border-radius: var(--button-border-radius);\n margin: var(--button-margin);\n padding: var(--button-primary-padding);\n color: var(--button-primary-color);\n font: var(--button-primary-font);\n text-transform: var(--button-text-transform);\n\n text-decoration: none;\n }\n\n [button-primary]:hover {\n background-color: var(--button-primary-active-background-color);\n box-shadow: var(--button-active-box-shadow);\n }\n\n [fieldset-container] {\n background-color: var(--md-sys-color-surface);\n margin: var(--spacing-large) 0 var(--spacing-medium) 0;\n padding: var(--spacing-medium);\n border-radius: var(--border-radius);\n box-shadow: var(--box-shadow);\n\n label {\n font: var(--label-font);\n color: var(--label-color, var(--md-sys-color-on-surface));\n text-transform: var(--label-text-transform);\n }\n\n input,\n select {\n background-color: var(--input-field-background, var(--md-sys-color-surface-container-highest));\n color: var(--input-field-color, var(--md-sys-color-on-surface));\n border: var(--border-dim-color);\n border-radius: var(--border-radius);\n margin: var(--input-margin);\n padding: var(--input-padding);\n font: var(--input-font);\n\n flex: 1;\n }\n\n select:focus,\n input:focus,\n button {\n outline: none;\n }\n\n form {\n max-width: var(--content-container-max-width);\n }\n }\n\n [fieldset-container] fieldset {\n margin: 0;\n margin-top: -15px;\n }\n\n fieldset {\n border-radius: var(--border-radius);\n border: var(--border-dim-color);\n margin: var(--fieldset-margin);\n padding: var(--fieldset-padding);\n }\n\n legend {\n padding: var(--legend-padding);\n font-weight: bold;\n color: var(--legend-color);\n }\n\n [field-2column] {\n display: grid;\n grid-template-columns: 1fr 1fr;\n grid-gap: 15px;\n }\n\n [field] {\n display: flex;\n flex-direction: column;\n position: relative;\n }\n\n [grid-span] {\n grid-column: span 2;\n }\n\n button {\n display: flex;\n align-items: center;\n gap: var(--spacing-small);\n }\n\n button,\n input[type='submit'],\n [button-in-field] {\n background-color: var(--button-background-color);\n border: var(--button-border);\n border-radius: var(--button-border-radius);\n padding: var(--button-padding);\n color: var(--button-color);\n font: var(--button-font);\n text-transform: var(--button-text-transform);\n\n margin: var(--spacing-medium) 0 var(--spacing-medium) var(--spacing-medium);\n float: right;\n text-decoration: none;\n }\n\n button:hover,\n input[type='submit']:hover {\n border: var(--button-activ-border);\n box-shadow: var(--button-active-box-shadow);\n }\n\n [button-in-field] {\n border-radius: 0 var(--button-border-radius) var(--button-border-radius) 0;\n position: absolute;\n top: 12px;\n right: 0;\n max-height: 36px;\n }\n\n [input-hint] {\n font: var(--input-hint-font);\n color: var(--input-hint-color);\n }\n\n @media screen and (max-width: 480px) {\n [field] {\n grid-column: span 2;\n }\n }\n `\n ]\n\n @property({ type: Object }) oauth2Client: any\n @property({ type: String }) _grantType?: string\n\n @query('form') form!: HTMLFormElement\n @queryAll('[clipboard-copy]') copybuttons\n\n private clipboard?: Clipboard\n private _icon?: string\n\n get context() {\n /*\n * The name and the line under it are the title bar's (ADR-0060 decision 8), and everything this\n * screen commits is in the page action bar. The bar calls action() with no arguments\n * (decision 9), so these take none.\n */\n return {\n /*\n * 이 화면이 어떤 틀인가 — 동작 줄이 이것을 읽고 자기 오른쪽 끝을 내용에 맞춘다\n * (ADR-0060 결정 9 보탬). 안 적으면 창 폭이고, 그것은 작업면의 모양이다.\n */\n frame: 'document',\n title: { icon: 'apps', text: this.oauth2Client?.name },\n description: this.oauth2Client?.description,\n actions: [\n {\n title: i18next.t('button.update'),\n action: async () => {\n await this.updateOauth2Client()\n },\n ...CommonButtonStyles.save\n },\n {\n title: i18next.t('button.new-access-token'),\n action: async () => {\n await this.updateOauth2Client()\n await this.generateOauth2AccessToken()\n }\n },\n {\n title: i18next.t('button.refresh-access-token'),\n disabled: !this.oauth2Client?.refreshToken,\n action: async () => {\n await this.updateOauth2Client()\n await this.refreshOauth2AccessToken()\n }\n },\n { title: i18next.t('button.delete'), action: () => this.deleteOauth2Client(), ...CommonButtonStyles.delete }\n ]\n }\n }\n\n render() {\n var oauth2Client = this.oauth2Client || {}\n\n /* The name and description are in the title bar, so they are not drawn here a second time. */\n return html`\n <div class=\"page\">\n ${oauth2Client.icon ? html`<div icon><img src=${oauth2Client.icon} /></div>` : html``}\n\n <form>\n <div fieldset-container>\n <fieldset>\n <legend>oauth2 client</legend>\n <div field-2column>\n <div field grid-span>\n <label for='name'>name</label>\n <input type='text' id=\"name\" name=\"name\" .value=${oauth2Client.name || ''}>\n </div>\n\n <div field grid-span>\n <label for='description'>description</label>\n <input type='text' id=\"description\" name=\"description\" .value=${oauth2Client.description || ''}>\n </div>\n\n <div field grid-span>\n <label for='icon'>icon</label>\n <input type='text' id=\"icon\" name=\"icon\" \n @change=${e => (this._icon = e.target.value)} \n .value=${oauth2Client.icon || ''}\n >\n </div>\n </div>\n </fieldset>\n </div>\n\n <div fieldset-container>\n <fieldset>\n <legend>authorization</legend>\n <div field-2column>\n <div field grid-span>\n <label for='grant-type'>grant type\n <ox-help-icon topic='/oauth2-client/grant-type'></ox-help-icon>\n </label>\n <select type='text' id=\"grant-type\" name=\"grantType\" .value=${oauth2Client.grantType || 'code'} \n @change=${e => (this._grantType = e.target.value)}>\n <option></option>\n <option value='code'>Authorization Code Grant</option>\n <option value='jwt'>JWT As Authorization Grant</option>\n <option value='owner'>Resource Owner Password Credentials Grant</option>\n <option value='credentials'>Client Credentials Grant</option>\n </select>\n </div>\n\n <div field grid-span>\n <label for='auth-url'>auth url</label>\n <input type='text' id=\"auth-url\" name=\"authUrl\" .value=${oauth2Client.authUrl || ''}>\n <div input-hint>The endpoint for authorization server. This is used to get the authorization code.</div>\n </div>\n\n <div field grid-span>\n <label for='access-token-url'>access token url</label>\n <input type='text' id=\"access-token-url\" name=\"accessTokenUrl\" .value=${\n oauth2Client.accessTokenUrl || ''\n }>\n <div input-hint>The endpoint for authentication server. This is used to exchange the authorization code for an access token.</div>\n </div>\n\n <div field grid-span>\n <label for='callback-url'>callback url</label>\n <input type='text' id=\"callback-url\" name=\"callbackUrl\" .value=${oauth2Client.callbackUrl || ''}>\n <div input-hint>This is the callback url that you will be redirected to, after your application is authorized.\n This is used to extract the authorization code or access token.\n Normally, this callback url should match the one you use during the application registration process.\n If you leave this field empty, default callback url(${\n location.origin\n }/oauth2-client/callback</label>) will be used.</div>\n </div>\n \n <div field grid-span>\n <label for='client-id'>client id</label>\n <input type='text' id=\"client-id\" name=\"clientId\" .value=${oauth2Client.clientId || ''}>\n <div input-hint>The client identifier issued to the client during the application registration process.</div>\n </div>\n\n <div field grid-span>\n <label for='client-secret'>client secret</label>\n <input type='text' id=\"client-secret\" name=\"clientSecret\" .value=${oauth2Client.clientSecret || ''}>\n <div input-hint>The client secret issued to the client during the application registration process.</div>\n </div>\n\n ${\n this._grantType == 'owner'\n ? html`\n <div field grid-span>\n <label for=\"username\">user name</label>\n <input type=\"text\" id=\"username\" name=\"username\" .value=${oauth2Client.username || ''} />\n </div>\n\n <div field grid-span>\n <label for=\"password\">password</label>\n <input type=\"password\" id=\"password\" name=\"password\" .value=${oauth2Client.password || ''} />\n </div>\n `\n : html``\n }\n\n ${\n this._grantType == 'jwt'\n ? html`\n <div field grid-span>\n <label for=\"jwt-token\">jwt-token</label>\n <input type=\"text\" id=\"jwt-token\" name=\"jwtToken\" .value=${oauth2Client.jwtToken || ''} />\n <div input-hint>The JWT Bearer Token for JWT As Authorization Grant</div>\n </div>\n `\n : html``\n }\n\n <!-- code PKCE grant type not supported yet\n <div field grid-span>\n <label for='code-challenge-method'>code challenge method</label>\n <select type='text' id=\"code-challenge-method\" name=\"codeChallengeMethod\" .value=${\n oauth2Client.codeChallengeMethod\n }>\n <option></option>\n <option>SHA-256</option>\n <option>Plain</option>\n </select>\n <div input-hint>Algorithm used for generating the code challenge</div>\n </div>\n\n <div field grid-span>\n <label for='code-verifier'>code verifier\n <ox-help-icon topic='/oauth2-client/code-verifier'></ox-help-icon>\n </label>\n <input type='text' id=\"code-verifier\" name=\"codeVerifier\" .value=${oauth2Client.codeVerifier || ''}>\n <div input-hint>A random, 43-128 character string used to connect the authorization request to the token request.\n Uses the following characters: [A-Z]/[a-z]/[0-9]/\"-\"/\".\"/\"_\"/\"~\".</div>\n </div>\n -->\n \n <div field grid-span>\n <label for='scopes'>scopes</label>\n <input type='text' id=\"scopes\" name=\"scopes\" .value=${oauth2Client.scopes || ''}>\n <div input-hint>The scopes of the access request. It may have multiple space-delimited values.</div>\n </div>\n </div>\n </fieldset>\n </div>\n\n <div fieldset-container>\n <fieldset>\n <div field grid-span>\n <label for='token-type'>token type</label>\n <input type='text' id=\"token-type\" .value=${oauth2Client.tokenType || ''} readonly>\n <div input-hint>Added to the authorization header before the access token.</div>\n </div>\n\n <legend>access token</legend>\n <div field-2column>\n <div field grid-span>\n <label for=\"access-token\">access token</label>\n <input id=\"access-token\" type=\"text\" .value=${oauth2Client.accessToken || ''} readonly />\n <button button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</button>\n ${\n oauth2Client.expires\n ? html`<div input-hint>\n expired in ${new Date(Number(oauth2Client.expires))} :\n ${asyncReplace(this.expTimer(oauth2Client.expires))}\n </div>`\n : html``\n }\n </div>\n\n <div field grid-span>\n <label for=\"refresh-token\">refresh token</label>\n <input id=\"refresh-token\" type=\"text\" .value=${oauth2Client.refreshToken || ''} readonly />\n <button button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</button>\n </div>\n </div>\n </fieldset>\n </div>\n\n </form>\n </div>\n `\n }\n\n updated(changes) {\n if (changes.has('oauth2Client')) {\n this._grantType = this.oauth2Client?.grantType\n /* The name, the line under it and the actions all read the client, so the shell redraws them. */\n this.updateContext()\n }\n }\n\n firstUpdated() {\n this.clipboard = new Clipboard(this.copybuttons, {\n target: (trigger => trigger.parentElement.querySelector('input')) as any\n })\n }\n\n async pageUpdated(changes, lifecycle, before) {\n if (this.active) {\n await this.fetchOauth2Client()\n }\n }\n\n async *expTimer(exp) {\n const DAY = 24 * 60 * 60\n const HOUR = 60 * 60\n const MIN = 60\n\n while (this.active) {\n var remain = Math.floor((Number(exp) - Date.now()) / 1000)\n const days = Math.floor(remain / DAY)\n remain -= days * DAY\n const hours = Math.floor(remain / HOUR)\n remain -= hours * HOUR\n const mins = Math.floor(remain / MIN)\n const secs = remain - mins * MIN\n\n yield `${days} days ${hours} hours ${mins} mins ${secs} seconds remain`\n\n await sleep(1000)\n }\n }\n\n async fetchOauth2Client() {\n const response = await client.query({\n query: gql`\n query($id: String!) { oauth2Client(id: $id) { ${OAUTH2CLIENT}\n }\n }\n `,\n variables: { id: this.lifecycle.resourceId }\n })\n\n this.oauth2Client = response.data.oauth2Client\n }\n\n async updateOauth2Client() {\n const formData = new FormData(this.form)\n\n const patch = Array.from(formData.entries()).reduce((patch, [key, value]) => {\n patch[key] = value\n return patch\n }, {})\n\n const id = this.lifecycle.resourceId\n\n const response = await client.mutate({\n mutation: gql`\n mutation($id: String!, $patch: Oauth2ClientPatch!) { updateOauth2Client(id: $id, patch: $patch) { ${OAUTH2CLIENT}\n }\n }\n `,\n variables: { id, patch }\n })\n\n if (response.errors) {\n notify({ level: 'error', message: 'update oauth2 client fail' })\n } else {\n this.oauth2Client = response.data.updateOauth2Client\n }\n }\n\n async deleteOauth2Client() {\n /* Deleting took the app away with no question asked. */\n if (!(await OxPrompt.confirmDelete())) {\n return\n }\n\n const id = this.lifecycle.resourceId\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!) {\n deleteOauth2Client(id: $id)\n }\n `,\n variables: { id }\n })\n\n if (response.errors) {\n notify({ level: 'error', message: 'delete oauth2 client fail' })\n } else {\n navigate('oauth2-clients')\n }\n }\n\n async generateOauth2AccessToken() {\n const id = this.lifecycle.resourceId\n\n if (this.oauth2Client.grantType == 'code') {\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!) {\n getOauth2AuthUrl(id: $id)\n }\n `,\n variables: { id: this.lifecycle.resourceId }\n })\n\n if (!response.errors) {\n location.href = response.data.getOauth2AuthUrl\n } else {\n notify({ level: 'error', message: 'getting application access token fail' })\n }\n } else {\n const response = await client.mutate({\n mutation: gql`\n mutation($id: String!) { getOauth2AccessToken(id: $id) { ${OAUTH2CLIENT}\n }\n }\n `,\n variables: { id: this.lifecycle.resourceId }\n })\n\n if (response.errors) {\n notify({ level: 'error', message: 'getting application access token fail' })\n } else {\n this.oauth2Client = response.data.getOauth2AccessToken\n notify({ level: 'info', message: 'got application access token successfully' })\n }\n }\n }\n\n async refreshOauth2AccessToken() {\n const id = this.lifecycle.resourceId\n\n const response = await client.mutate({\n mutation: gql`\n mutation($id: String!) { refreshOauth2AccessToken(id: $id) { ${OAUTH2CLIENT}\n }\n }\n `,\n variables: { id: this.lifecycle.resourceId }\n })\n\n if (response.errors) {\n notify({ level: 'error', message: 'getting application access token fail' })\n } else {\n this.oauth2Client = response.data.refreshOauth2AccessToken\n notify({ level: 'info', message: 'got application access token successfully' })\n }\n }\n}\n"]}
1
+ {"version":3,"file":"oauth2-client.js","sourceRoot":"","sources":["../../client/pages/oauth2-client.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,+BAA+B,CAAA;AAEtC,OAAO,SAAS,MAAM,WAAW,CAAA;AACjC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AACtD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAEtC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;CAwBpB,CAAA;AAGM,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;IAAtD;;QA6JG,SAAI,GAAG,IAAI,eAAe,CAChC,IAAI,EACJ,GAAG,CAAA;;;YAGK,YAAY;;;KAGn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AAA;QACjF,CAAC;IACH,CAAC;;AA9X2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAAoB;AAE9B;IAAhB,KAAK,EAAE;;gDAA4B;AAkErB;IAAd,KAAK,CAAC,MAAM,CAAC;8BAAQ,eAAe;0CAAA;AACP;IAA7B,QAAQ,CAAC,kBAAkB,CAAC;;iDAAY;AA9N9B,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAwhBxB","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/help/ox-help-icon.js'\n\nimport Clipboard from 'clipboard'\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query, queryAll, state } from 'lit/decorators.js'\nimport { asyncReplace } from 'lit/directives/async-replace.js'\nimport { MutationController, QueryController } from '@operato/graphql'\nimport { notify } from '@operato/layout'\nimport { navigate, PageView } from '@operato/shell'\nimport { i18next, localize } from '@operato/i18n'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\nimport { CommonButtonStyles, DocumentPageStyles } from '@operato/styles'\nimport { sleep } from '@operato/utils'\n\nconst OAUTH2CLIENT = `\nid\nname\ndescription\nicon\ngrantType\nclientId\nclientSecret\ncallbackUrl\nauthUrl\naccessTokenUrl\nwebhook\nusername\npassword\ncodeChallengeMethod\ncodeVerifier\nscopes\naccessToken\nrefreshToken\njwtToken\nexpires\ntokenType\nupdatedAt\ncreatedAt\n`\n\n@customElement('oauth2-client')\nexport class Oauth2Client extends localize(i18next)(PageView) {\n static styles = [\n /* Read and edited down one column (ADR-0060 decision 8). */\n DocumentPageStyles,\n css`\n [icon] {\n float: right;\n max-width: 80px;\n }\n\n [icon] img {\n max-width: 100%;\n max-height: 100%;\n }\n\n [button-primary] {\n background-color: var(--button-primary-background-color);\n border: var(--button-border);\n border-radius: var(--button-border-radius);\n margin: var(--button-margin);\n padding: var(--button-primary-padding);\n color: var(--button-primary-color);\n font: var(--button-primary-font);\n text-transform: var(--button-text-transform);\n\n text-decoration: none;\n }\n\n [button-primary]:hover {\n background-color: var(--button-primary-active-background-color);\n box-shadow: var(--button-active-box-shadow);\n }\n\n [fieldset-container] {\n background-color: var(--md-sys-color-surface);\n margin: var(--spacing-large) 0 var(--spacing-medium) 0;\n padding: var(--spacing-medium);\n border-radius: var(--border-radius);\n box-shadow: var(--box-shadow);\n\n label {\n font: var(--label-font);\n color: var(--label-color, var(--md-sys-color-on-surface));\n text-transform: var(--label-text-transform);\n }\n\n input,\n select {\n background-color: var(--input-field-background, var(--md-sys-color-surface-container-highest));\n color: var(--input-field-color, var(--md-sys-color-on-surface));\n border: var(--border-dim-color);\n border-radius: var(--border-radius);\n margin: var(--input-margin);\n padding: var(--input-padding);\n font: var(--input-font);\n\n flex: 1;\n }\n\n select:focus,\n input:focus,\n button {\n outline: none;\n }\n\n form {\n max-width: var(--content-container-max-width);\n }\n }\n\n [fieldset-container] fieldset {\n margin: 0;\n margin-top: -15px;\n }\n\n fieldset {\n border-radius: var(--border-radius);\n border: var(--border-dim-color);\n margin: var(--fieldset-margin);\n padding: var(--fieldset-padding);\n }\n\n legend {\n padding: var(--legend-padding);\n font-weight: bold;\n color: var(--legend-color);\n }\n\n [field-2column] {\n display: grid;\n grid-template-columns: 1fr 1fr;\n grid-gap: 15px;\n }\n\n [field] {\n display: flex;\n flex-direction: column;\n position: relative;\n }\n\n [grid-span] {\n grid-column: span 2;\n }\n\n button {\n display: flex;\n align-items: center;\n gap: var(--spacing-small);\n }\n\n button,\n input[type='submit'],\n [button-in-field] {\n background-color: var(--button-background-color);\n border: var(--button-border);\n border-radius: var(--button-border-radius);\n padding: var(--button-padding);\n color: var(--button-color);\n font: var(--button-font);\n text-transform: var(--button-text-transform);\n\n margin: var(--spacing-medium) 0 var(--spacing-medium) var(--spacing-medium);\n float: right;\n text-decoration: none;\n }\n\n button:hover,\n input[type='submit']:hover {\n border: var(--button-activ-border);\n box-shadow: var(--button-active-box-shadow);\n }\n\n [button-in-field] {\n border-radius: 0 var(--button-border-radius) var(--button-border-radius) 0;\n position: absolute;\n top: 12px;\n right: 0;\n max-height: 36px;\n }\n\n [input-hint] {\n font: var(--input-hint-font);\n color: var(--input-hint-color);\n }\n\n @media screen and (max-width: 480px) {\n [field] {\n grid-column: span 2;\n }\n }\n `\n ]\n\n @property({ type: String }) _grantType?: string\n /** The client the address names. */\n @state() private resourceId?: string\n\n private read = new QueryController(\n this,\n gql`\n query ($id: String!) {\n oauth2Client(id: $id) {\n ${OAUTH2CLIENT}\n }\n }\n `,\n { variables: () => (this.resourceId ? { id: this.resourceId } : undefined) }\n )\n\n /* The client as the server holds it after each change. */\n private saves = {\n update: this.change(gql`\n mutation ($id: String!, $patch: Oauth2ClientPatch!) {\n updateOauth2Client(id: $id, patch: $patch) {\n ${OAUTH2CLIENT}\n }\n }\n `),\n accessToken: this.change(gql`\n mutation ($id: String!) {\n getOauth2AccessToken(id: $id) {\n ${OAUTH2CLIENT}\n }\n }\n `),\n refreshAccessToken: this.change(gql`\n mutation ($id: String!) {\n refreshOauth2AccessToken(id: $id) {\n ${OAUTH2CLIENT}\n }\n }\n `),\n authUrl: new MutationController(\n this,\n gql`\n mutation ($id: String!) {\n getOauth2AuthUrl(id: $id)\n }\n `\n ),\n delete: new MutationController(\n this,\n gql`\n mutation ($id: String!) {\n deleteOauth2Client(id: $id)\n }\n `\n )\n }\n\n private change(mutation: any) {\n return new MutationController(this, mutation, { refetch: () => [this.read] })\n }\n\n get oauth2Client(): any {\n return this.read.data?.oauth2Client\n }\n\n /* The grant type drawn follows the client read, until it is changed in the form. */\n private grantTypeOf?: unknown\n\n @query('form') form!: HTMLFormElement\n @queryAll('[clipboard-copy]') copybuttons\n\n private clipboard?: Clipboard\n private _icon?: string\n\n get context() {\n /*\n * The name and the line under it are the title bar's (ADR-0060 decision 8), and everything this\n * screen commits is in the page action bar. The bar calls action() with no arguments\n * (decision 9), so these take none.\n */\n return {\n /*\n * 이 화면이 어떤 틀인가 — 동작 줄이 이것을 읽고 자기 오른쪽 끝을 내용에 맞춘다\n * (ADR-0060 결정 9 보탬). 안 적으면 창 폭이고, 그것은 작업면의 모양이다.\n */\n frame: 'document',\n title: { icon: 'apps', text: this.oauth2Client?.name },\n description: this.oauth2Client?.description,\n actions: [\n {\n title: i18next.t('button.update'),\n action: async () => {\n await this.updateOauth2Client()\n },\n ...CommonButtonStyles.save\n },\n {\n title: i18next.t('button.new-access-token'),\n action: async () => {\n await this.updateOauth2Client()\n await this.generateOauth2AccessToken()\n }\n },\n {\n title: i18next.t('button.refresh-access-token'),\n disabled: !this.oauth2Client?.refreshToken,\n action: async () => {\n await this.updateOauth2Client()\n await this.refreshOauth2AccessToken()\n }\n },\n { title: i18next.t('button.delete'), action: () => this.deleteOauth2Client(), ...CommonButtonStyles.delete }\n ]\n }\n }\n\n render() {\n var oauth2Client = this.oauth2Client || {}\n\n /* The name and description are in the title bar, so they are not drawn here a second time. */\n return html`\n <div class=\"page\">\n ${oauth2Client.icon ? html`<div icon><img src=${oauth2Client.icon} /></div>` : html``}\n\n <form>\n <div fieldset-container>\n <fieldset>\n <legend>oauth2 client</legend>\n <div field-2column>\n <div field grid-span>\n <label for='name'>name</label>\n <input type='text' id=\"name\" name=\"name\" .value=${oauth2Client.name || ''}>\n </div>\n\n <div field grid-span>\n <label for='description'>description</label>\n <input type='text' id=\"description\" name=\"description\" .value=${oauth2Client.description || ''}>\n </div>\n\n <div field grid-span>\n <label for='icon'>icon</label>\n <input type='text' id=\"icon\" name=\"icon\" \n @change=${e => (this._icon = e.target.value)} \n .value=${oauth2Client.icon || ''}\n >\n </div>\n </div>\n </fieldset>\n </div>\n\n <div fieldset-container>\n <fieldset>\n <legend>authorization</legend>\n <div field-2column>\n <div field grid-span>\n <label for='grant-type'>grant type\n <ox-help-icon topic='/oauth2-client/grant-type'></ox-help-icon>\n </label>\n <select type='text' id=\"grant-type\" name=\"grantType\" .value=${oauth2Client.grantType || 'code'} \n @change=${e => (this._grantType = e.target.value)}>\n <option></option>\n <option value='code'>Authorization Code Grant</option>\n <option value='jwt'>JWT As Authorization Grant</option>\n <option value='owner'>Resource Owner Password Credentials Grant</option>\n <option value='credentials'>Client Credentials Grant</option>\n </select>\n </div>\n\n <div field grid-span>\n <label for='auth-url'>auth url</label>\n <input type='text' id=\"auth-url\" name=\"authUrl\" .value=${oauth2Client.authUrl || ''}>\n <div input-hint>The endpoint for authorization server. This is used to get the authorization code.</div>\n </div>\n\n <div field grid-span>\n <label for='access-token-url'>access token url</label>\n <input type='text' id=\"access-token-url\" name=\"accessTokenUrl\" .value=${\n oauth2Client.accessTokenUrl || ''\n }>\n <div input-hint>The endpoint for authentication server. This is used to exchange the authorization code for an access token.</div>\n </div>\n\n <div field grid-span>\n <label for='callback-url'>callback url</label>\n <input type='text' id=\"callback-url\" name=\"callbackUrl\" .value=${oauth2Client.callbackUrl || ''}>\n <div input-hint>This is the callback url that you will be redirected to, after your application is authorized.\n This is used to extract the authorization code or access token.\n Normally, this callback url should match the one you use during the application registration process.\n If you leave this field empty, default callback url(${\n location.origin\n }/oauth2-client/callback</label>) will be used.</div>\n </div>\n \n <div field grid-span>\n <label for='client-id'>client id</label>\n <input type='text' id=\"client-id\" name=\"clientId\" .value=${oauth2Client.clientId || ''}>\n <div input-hint>The client identifier issued to the client during the application registration process.</div>\n </div>\n\n <div field grid-span>\n <label for='client-secret'>client secret</label>\n <input type='text' id=\"client-secret\" name=\"clientSecret\" .value=${oauth2Client.clientSecret || ''}>\n <div input-hint>The client secret issued to the client during the application registration process.</div>\n </div>\n\n ${\n this._grantType == 'owner'\n ? html`\n <div field grid-span>\n <label for=\"username\">user name</label>\n <input type=\"text\" id=\"username\" name=\"username\" .value=${oauth2Client.username || ''} />\n </div>\n\n <div field grid-span>\n <label for=\"password\">password</label>\n <input type=\"password\" id=\"password\" name=\"password\" .value=${oauth2Client.password || ''} />\n </div>\n `\n : html``\n }\n\n ${\n this._grantType == 'jwt'\n ? html`\n <div field grid-span>\n <label for=\"jwt-token\">jwt-token</label>\n <input type=\"text\" id=\"jwt-token\" name=\"jwtToken\" .value=${oauth2Client.jwtToken || ''} />\n <div input-hint>The JWT Bearer Token for JWT As Authorization Grant</div>\n </div>\n `\n : html``\n }\n\n <!-- code PKCE grant type not supported yet\n <div field grid-span>\n <label for='code-challenge-method'>code challenge method</label>\n <select type='text' id=\"code-challenge-method\" name=\"codeChallengeMethod\" .value=${\n oauth2Client.codeChallengeMethod\n }>\n <option></option>\n <option>SHA-256</option>\n <option>Plain</option>\n </select>\n <div input-hint>Algorithm used for generating the code challenge</div>\n </div>\n\n <div field grid-span>\n <label for='code-verifier'>code verifier\n <ox-help-icon topic='/oauth2-client/code-verifier'></ox-help-icon>\n </label>\n <input type='text' id=\"code-verifier\" name=\"codeVerifier\" .value=${oauth2Client.codeVerifier || ''}>\n <div input-hint>A random, 43-128 character string used to connect the authorization request to the token request.\n Uses the following characters: [A-Z]/[a-z]/[0-9]/\"-\"/\".\"/\"_\"/\"~\".</div>\n </div>\n -->\n \n <div field grid-span>\n <label for='scopes'>scopes</label>\n <input type='text' id=\"scopes\" name=\"scopes\" .value=${oauth2Client.scopes || ''}>\n <div input-hint>The scopes of the access request. It may have multiple space-delimited values.</div>\n </div>\n </div>\n </fieldset>\n </div>\n\n <div fieldset-container>\n <fieldset>\n <div field grid-span>\n <label for='token-type'>token type</label>\n <input type='text' id=\"token-type\" .value=${oauth2Client.tokenType || ''} readonly>\n <div input-hint>Added to the authorization header before the access token.</div>\n </div>\n\n <legend>access token</legend>\n <div field-2column>\n <div field grid-span>\n <label for=\"access-token\">access token</label>\n <input id=\"access-token\" type=\"text\" .value=${oauth2Client.accessToken || ''} readonly />\n <button button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</button>\n ${\n oauth2Client.expires\n ? html`<div input-hint>\n expired in ${new Date(Number(oauth2Client.expires))} :\n ${asyncReplace(this.expTimer(oauth2Client.expires))}\n </div>`\n : html``\n }\n </div>\n\n <div field grid-span>\n <label for=\"refresh-token\">refresh token</label>\n <input id=\"refresh-token\" type=\"text\" .value=${oauth2Client.refreshToken || ''} readonly />\n <button button-in-field clipboard-copy @click=${e => e.preventDefault()}>copy</button>\n </div>\n </div>\n </fieldset>\n </div>\n\n </form>\n </div>\n `\n }\n\n updated() {\n if (this.grantTypeOf !== this.oauth2Client) {\n this.grantTypeOf = this.oauth2Client\n this._grantType = this.oauth2Client?.grantType\n }\n }\n\n firstUpdated() {\n this.clipboard = new Clipboard(this.copybuttons, {\n target: (trigger => trigger.parentElement.querySelector('input')) as any\n })\n }\n\n async pageUpdated(changes, lifecycle, before) {\n if (this.active) {\n this.resourceId = this.lifecycle.resourceId\n }\n }\n\n async *expTimer(exp) {\n const DAY = 24 * 60 * 60\n const HOUR = 60 * 60\n const MIN = 60\n\n while (this.active) {\n var remain = Math.floor((Number(exp) - Date.now()) / 1000)\n const days = Math.floor(remain / DAY)\n remain -= days * DAY\n const hours = Math.floor(remain / HOUR)\n remain -= hours * HOUR\n const mins = Math.floor(remain / MIN)\n const secs = remain - mins * MIN\n\n yield `${days} days ${hours} hours ${mins} mins ${secs} seconds remain`\n\n await sleep(1000)\n }\n }\n\n async updateOauth2Client() {\n const formData = new FormData(this.form)\n\n const patch = Array.from(formData.entries()).reduce((patch, [key, value]) => {\n patch[key] = value\n return patch\n }, {})\n\n await this.saves.update.run({ id: this.lifecycle.resourceId, patch })\n }\n\n async deleteOauth2Client() {\n /* Deleting took the app away with no question asked. */\n if (!(await OxPrompt.confirmDelete())) {\n return\n }\n\n if (await this.saves.delete.run({ id: this.lifecycle.resourceId })) {\n navigate('oauth2-clients')\n }\n }\n\n async generateOauth2AccessToken() {\n const id = this.lifecycle.resourceId\n\n if (this.oauth2Client.grantType == 'code') {\n const answer = await this.saves.authUrl.run({ id })\n\n if (answer) {\n location.href = answer.getOauth2AuthUrl\n }\n } else if (await this.saves.accessToken.run({ id })) {\n notify({ level: 'info', message: 'got application access token successfully' })\n }\n }\n\n async refreshOauth2AccessToken() {\n if (await this.saves.refreshAccessToken.run({ id: this.lifecycle.resourceId })) {\n notify({ level: 'info', message: 'got application access token successfully' })\n }\n }\n}\n"]}
@@ -1,16 +1,27 @@
1
- import { __decorate, __metadata } from "tslib";
1
+ import { __decorate } from "tslib";
2
2
  import gql from 'graphql-tag';
3
3
  import { css, html } from 'lit';
4
- import { customElement, property } from 'lit/decorators.js';
5
- import { client } from '@operato/graphql';
6
- import { notify } from '@operato/layout';
4
+ import { customElement } from 'lit/decorators.js';
5
+ import { QueryController } from '@operato/graphql';
7
6
  import { navigate, PageView } from '@operato/shell';
8
7
  import { i18next, localize } from '@operato/i18n';
9
8
  import { CommonButtonStyles, DocumentPageStyles } from '@operato/styles';
10
9
  let Oauth2Clients = class Oauth2Clients extends localize(i18next)(PageView) {
11
10
  constructor() {
12
11
  super(...arguments);
13
- this.clients = [];
12
+ /* Read each time the page is shown - a client registered or deleted on its own page is in the list on the way back. */
13
+ this.list = new QueryController(this, gql `
14
+ query {
15
+ oauth2Clients {
16
+ items {
17
+ id
18
+ name
19
+ description
20
+ }
21
+ total
22
+ }
23
+ }
24
+ `);
14
25
  }
15
26
  static { this.styles = [
16
27
  /* Read and edited down one column (ADR-0060 decision 8) - the frame owns width, padding, spacing. */
@@ -72,6 +83,9 @@ let Oauth2Clients = class Oauth2Clients extends localize(i18next)(PageView) {
72
83
  }
73
84
  `
74
85
  ]; }
86
+ get clients() {
87
+ return this.list.data?.oauth2Clients?.items || [];
88
+ }
75
89
  get context() {
76
90
  /* The action goes to the page action bar, where every other screen keeps its actions. */
77
91
  return {
@@ -121,38 +135,7 @@ let Oauth2Clients = class Oauth2Clients extends localize(i18next)(PageView) {
121
135
  </div>
122
136
  `;
123
137
  }
124
- async pageUpdated(changes, lifecycle, before) {
125
- if (this.active) {
126
- this.clients = (await this.fetchOauth2Clients())?.items || [];
127
- }
128
- }
129
- async fetchOauth2Clients() {
130
- const response = await client.query({
131
- query: gql `
132
- query {
133
- oauth2Clients {
134
- items {
135
- id
136
- name
137
- description
138
- }
139
- total
140
- }
141
- }
142
- `
143
- });
144
- if (response.errors) {
145
- notify({ level: 'error', message: 'fetch oauth2 clients fail' });
146
- }
147
- else {
148
- return response.data.oauth2Clients;
149
- }
150
- }
151
138
  };
152
- __decorate([
153
- property({ type: Array }),
154
- __metadata("design:type", Array)
155
- ], Oauth2Clients.prototype, "clients", void 0);
156
139
  Oauth2Clients = __decorate([
157
140
  customElement('oauth2-clients')
158
141
  ], Oauth2Clients);
@@ -1 +1 @@
1
- {"version":3,"file":"oauth2-clients.js","sourceRoot":"","sources":["../../client/pages/oauth2-clients.ts"],"names":[],"mappings":";AACA,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAGxE,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;IAAvD;;QA8D6B,YAAO,GAAU,EAAE,CAAA;IAoFhD,CAAC;aAjJQ,WAAM,GAAG;QACd,qGAAqG;QACrG,kBAAkB;QAClB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuDF;KACF,AA3DY,CA2DZ;IAID,IAAI,OAAO;QACT,yFAAyF;QACzF,OAAO;YACL;;;eAGG;YACH,KAAK,EAAE,UAAU;YACjB,KAAK,E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E,KAAK,EAAE,CAAC;;8CAAoB;AA9D1C,aAAa;IADlB,aAAa,CAAC,gBAAgB,CAAC;GAC1B,aAAa,CAkJlB","sourcesContent":["\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { client } from '@operato/graphql'\nimport { notify } from '@operato/layout'\nimport { navigate, PageView } from '@operato/shell'\nimport { i18next, localize } from '@operato/i18n'\nimport { CommonButtonStyles, DocumentPageStyles } from '@operato/styles'\n\n@customElement('oauth2-clients')\nclass Oauth2Clients extends localize(i18next)(PageView) {\n static styles = [\n /* Read and edited down one column (ADR-0060 decision 8) - the frame owns width, padding, spacing. */\n DocumentPageStyles,\n css`\n table {\n width: 100%;\n border-collapse: collapse;\n }\n\n tr {\n background-color: var(--tr-background-color);\n }\n\n tr:nth-child(odd) {\n background-color: var(--tr-background-odd-color);\n }\n\n tr:hover {\n background-color: var(--tr-background-hover-color);\n }\n\n th {\n border-top: var(--th-border-top);\n border-bottom: var(--td-border-bottom);\n padding: var(--th-padding);\n\n font: var(--th-font);\n color: var(--th-color);\n text-transform: var(--th-text-transform);\n text-align: left;\n }\n\n td {\n padding: var(--td-padding);\n border-bottom: var(--border-dim-color);\n line-height: 1.1;\n }\n\n td a {\n font: var(--td-font);\n text-decoration: none;\n color: var(--md-sys-color-on-surface);\n }\n\n td a strong {\n font: bold 16px var(--theme-font);\n\n display: block;\n text-decoration: none;\n }\n\n .text-align-center {\n text-align: center;\n }\n\n .text-align-right {\n text-align: right;\n }\n `\n ]\n\n @property({ type: Array }) clients: any[] = []\n\n get context() {\n /* The action goes to the page action bar, where every other screen keeps its actions. */\n return {\n /*\n * 이 화면이 어떤 틀인가 — 동작 줄이 이것을 읽고 자기 오른쪽 끝을 내용에 맞춘다\n * (ADR-0060 결정 9 보탬). 안 적으면 창 폭이고, 그것은 작업면의 모양이다.\n */\n frame: 'document',\n title: i18next.t('text.oauth2-clients'),\n actions: [\n {\n title: i18next.t('button.register'),\n action: () => navigate('oauth2-client-register'),\n ...CommonButtonStyles.submit\n }\n ]\n }\n }\n\n render() {\n var clients = this.clients || []\n\n /* The screen name is in the title bar; the h2 that used to sit here said it a second time. */\n return html`\n <div class=\"page\">\n <section class=\"page-section\">\n <table class=\"page-card\">\n <tr>\n <th>app name</th>\n <th>API health</th>\n <th>Installs</th>\n <th>status</th>\n </tr>\n ${clients.map(\n client => html`\n <tr>\n <td>\n <a href=${`oauth2-client/${client.id}`}>\n <strong>${client.name}</strong>\n ${client.description}\n </a>\n </td>\n <td class=\"text-align-center\">OK</td>\n <td class=\"text-align-right\">1</td>\n <td class=\"text-align-center\">draft</td>\n </tr>\n `\n )}\n </table>\n </section>\n </div>\n `\n }\n\n async pageUpdated(changes, lifecycle, before) {\n if (this.active) {\n this.clients = (await this.fetchOauth2Clients())?.items || []\n }\n }\n\n async fetchOauth2Clients() {\n const response = await client.query({\n query: gql`\n query {\n oauth2Clients {\n items {\n id\n name\n description\n }\n total\n }\n }\n `\n })\n\n if (response.errors) {\n notify({ level: 'error', message: 'fetch oauth2 clients fail' })\n } else {\n return response.data.oauth2Clients\n }\n }\n}\n"]}
1
+ {"version":3,"file":"oauth2-clients.js","sourceRoot":"","sources":["../../client/pages/oauth2-clients.ts"],"names":[],"mappings":";AACA,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAGxE,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,QAAQ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\nimport { customElement } from 'lit/decorators.js'\nimport { QueryController } from '@operato/graphql'\nimport { navigate, PageView } from '@operato/shell'\nimport { i18next, localize } from '@operato/i18n'\nimport { CommonButtonStyles, DocumentPageStyles } from '@operato/styles'\n\n@customElement('oauth2-clients')\nclass Oauth2Clients extends localize(i18next)(PageView) {\n static styles = [\n /* Read and edited down one column (ADR-0060 decision 8) - the frame owns width, padding, spacing. */\n DocumentPageStyles,\n css`\n table {\n width: 100%;\n border-collapse: collapse;\n }\n\n tr {\n background-color: var(--tr-background-color);\n }\n\n tr:nth-child(odd) {\n background-color: var(--tr-background-odd-color);\n }\n\n tr:hover {\n background-color: var(--tr-background-hover-color);\n }\n\n th {\n border-top: var(--th-border-top);\n border-bottom: var(--td-border-bottom);\n padding: var(--th-padding);\n\n font: var(--th-font);\n color: var(--th-color);\n text-transform: var(--th-text-transform);\n text-align: left;\n }\n\n td {\n padding: var(--td-padding);\n border-bottom: var(--border-dim-color);\n line-height: 1.1;\n }\n\n td a {\n font: var(--td-font);\n text-decoration: none;\n color: var(--md-sys-color-on-surface);\n }\n\n td a strong {\n font: bold 16px var(--theme-font);\n\n display: block;\n text-decoration: none;\n }\n\n .text-align-center {\n text-align: center;\n }\n\n .text-align-right {\n text-align: right;\n }\n `\n ]\n\n /* Read each time the page is shown - a client registered or deleted on its own page is in the list on the way back. */\n private list = new QueryController(\n this,\n gql`\n query {\n oauth2Clients {\n items {\n id\n name\n description\n }\n total\n }\n }\n `\n )\n\n get clients(): any[] {\n return this.list.data?.oauth2Clients?.items || []\n }\n\n get context() {\n /* The action goes to the page action bar, where every other screen keeps its actions. */\n return {\n /*\n * 이 화면이 어떤 틀인가 — 동작 줄이 이것을 읽고 자기 오른쪽 끝을 내용에 맞춘다\n * (ADR-0060 결정 9 보탬). 안 적으면 창 폭이고, 그것은 작업면의 모양이다.\n */\n frame: 'document',\n title: i18next.t('text.oauth2-clients'),\n actions: [\n {\n title: i18next.t('button.register'),\n action: () => navigate('oauth2-client-register'),\n ...CommonButtonStyles.submit\n }\n ]\n }\n }\n\n render() {\n var clients = this.clients || []\n\n /* The screen name is in the title bar; the h2 that used to sit here said it a second time. */\n return html`\n <div class=\"page\">\n <section class=\"page-section\">\n <table class=\"page-card\">\n <tr>\n <th>app name</th>\n <th>API health</th>\n <th>Installs</th>\n <th>status</th>\n </tr>\n ${clients.map(\n client => html`\n <tr>\n <td>\n <a href=${`oauth2-client/${client.id}`}>\n <strong>${client.name}</strong>\n ${client.description}\n </a>\n </td>\n <td class=\"text-align-center\">OK</td>\n <td class=\"text-align-right\">1</td>\n <td class=\"text-align-center\">draft</td>\n </tr>\n `\n )}\n </table>\n </section>\n </div>\n `\n }\n}\n"]}