@things-factory/oauth2-client 10.1.28 → 10.1.29

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.
@@ -6,6 +6,7 @@ export declare class Oauth2ClientRegister extends Oauth2ClientRegister_base {
6
6
  _icon?: string;
7
7
  form: HTMLFormElement;
8
8
  get context(): {
9
+ frame: string;
9
10
  title: string;
10
11
  actions: {
11
12
  icon: string;
@@ -66,6 +66,11 @@ let Oauth2ClientRegister = class Oauth2ClientRegister extends localize(i18next)(
66
66
  get context() {
67
67
  /* The action is in the page action bar, like every other screen that commits something. */
68
68
  return {
69
+ /*
70
+ * 이 화면이 어떤 틀인가 — 동작 줄이 이것을 읽고 자기 오른쪽 끝을 내용에 맞춘다
71
+ * (ADR-0060 결정 9 보탬). 안 적으면 창 폭이고, 그것은 작업면의 모양이다.
72
+ */
73
+ frame: 'document',
69
74
  title: i18next.t('title.oauth2-client-register'),
70
75
  actions: [
71
76
  {
@@ -1 +1 @@
1
- {"version":3,"file":"oauth2-client-register.js","sourceRoot":"","sources":["../../client/pages/oauth2-client-register.ts"],"names":[],"mappings":";AAAA,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,MAAM,mBAAmB,CAAA;AAClE,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;AAGjE,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,QAAQ,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,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;YACnC,QAAQ,EAAE,GAAG,CAAA;;;;;;OAMZ;YACD,SAAS,EAAE,EAAE,YAAY,EAAE;SAC5B,CAAC,CAAA;QAEF,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;YACpB,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC,CAAA;QAClE,CAAC;aAAM,CAAC;YACN,MAAM,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAA;YAC9C,QAAQ,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAA;QACjC,CAAC;IACH,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM;QAC1C,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAA;QACnB,CAAC;IACH,CAAC;;AA1F2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yDAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDAAe;AAE3B;IAAd,KAAK,CAAC,MAAM,CAAC;8BAAQ,eAAe;kDAAA;AA5D1B,oBAAoB;IADhC,aAAa,CAAC,wBAAwB,CAAC;GAC3B,oBAAoB,CAoJhC","sourcesContent":["import gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query } 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-client-register')\nexport class Oauth2ClientRegister extends localize(i18next)(PageView) {\n static styles = [\n /* A form is read and filled down one column (ADR-0060 decision 8). */\n DocumentPageStyles,\n css`\n [icon] img {\n max-width: 80px;\n max-height: 80px;\n }\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 outline: none;\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 }\n\n [grid-span] {\n grid-column: span 2;\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 }) application: any\n @property({ type: String }) _icon?: string\n\n @query('form') form!: HTMLFormElement\n\n get context() {\n /* The action is in the page action bar, like every other screen that commits something. */\n return {\n title: i18next.t('title.oauth2-client-register'),\n actions: [\n {\n title: i18next.t('button.register'),\n action: this.createOauth2Client.bind(this),\n ...CommonButtonStyles.submit\n }\n ]\n }\n }\n\n render() {\n /* The screen name is in the title bar; the h2 and the line under it repeated it. */\n return html`\n <div class=\"page\">\n <form class=\"page-card\">\n ${this._icon ? html`<div icon><img src=${this._icon} /></div>` : html``}\n <div field-2column>\n <div field grid-span>\n <label for=\"name\">name</label>\n <input type=\"text\" id=\"name\" name=\"name\" />\n </div>\n\n <div field grid-span>\n <label for=\"description\">description</label>\n <input type=\"text\" id=\"description\" name=\"description\" />\n </div>\n\n <div field grid-span>\n <label for=\"icon\">icon</label>\n <input type=\"text\" id=\"icon\" name=\"icon\" @change=${e => (this._icon = e.target.value)} />\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\" />\n The client identifier issued to the client during the application registration process.\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\" />\n The client secret issued to the client during the application registration process.\n </div>\n </div>\n </form>\n </div>\n `\n }\n\n async createOauth2Client() {\n /* The page action bar calls action() with no arguments, so this reads the form and nothing else. */\n const formData = new FormData(this.form)\n\n const oauth2Client = Array.from(formData.entries()).reduce((oauth2Client, [key, value]) => {\n oauth2Client[key] = value\n return oauth2Client\n }, {})\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($oauth2Client: NewOauth2Client!) {\n createOauth2Client(oauth2Client: $oauth2Client) {\n id\n }\n }\n `,\n variables: { oauth2Client }\n })\n\n if (response.errors) {\n notify({ level: 'error', message: 'create oauth2 client fail' })\n } else {\n const id = response.data.createOauth2Client.id\n navigate(`oauth2-client/${id}`)\n }\n }\n\n async pageUpdated(changes, lifecycle, before) {\n if (this.active) {\n this.form.reset()\n }\n }\n}\n"]}
1
+ {"version":3,"file":"oauth2-client-register.js","sourceRoot":"","sources":["../../client/pages/oauth2-client-register.ts"],"names":[],"mappings":";AAAA,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,MAAM,mBAAmB,CAAA;AAClE,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;AAGjE,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;aAC5D,WAAM,GAAG;QACd,sEAAsE;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MAAM,CAAC;YACnC,QAAQ,EAAE,GAAG,CAAA;;;;;;OAMZ;YACD,SAAS,EAAE,EAAE,YAAY,EAAE;SAC5B,CAAC,CAAA;QAEF,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;YACpB,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC,CAAA;QAClE,CAAC;aAAM,CAAC;YACN,MAAM,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAA;YAC9C,QAAQ,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAA;QACjC,CAAC;IACH,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM;QAC1C,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAA;QACnB,CAAC;IACH,CAAC;;AA/F2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yDAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDAAe;AAE3B;IAAd,KAAK,CAAC,MAAM,CAAC;8BAAQ,eAAe;kDAAA;AA5D1B,oBAAoB;IADhC,aAAa,CAAC,wBAAwB,CAAC;GAC3B,oBAAoB,CAyJhC","sourcesContent":["import gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query } 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-client-register')\nexport class Oauth2ClientRegister extends localize(i18next)(PageView) {\n static styles = [\n /* A form is read and filled down one column (ADR-0060 decision 8). */\n DocumentPageStyles,\n css`\n [icon] img {\n max-width: 80px;\n max-height: 80px;\n }\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 outline: none;\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 }\n\n [grid-span] {\n grid-column: span 2;\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 }) application: any\n @property({ type: String }) _icon?: string\n\n @query('form') form!: HTMLFormElement\n\n get context() {\n /* The action is in the page action bar, like every other screen that commits something. */\n return {\n /*\n * 이 화면이 어떤 틀인가 — 동작 줄이 이것을 읽고 자기 오른쪽 끝을 내용에 맞춘다\n * (ADR-0060 결정 9 보탬). 안 적으면 창 폭이고, 그것은 작업면의 모양이다.\n */\n frame: 'document',\n title: i18next.t('title.oauth2-client-register'),\n actions: [\n {\n title: i18next.t('button.register'),\n action: this.createOauth2Client.bind(this),\n ...CommonButtonStyles.submit\n }\n ]\n }\n }\n\n render() {\n /* The screen name is in the title bar; the h2 and the line under it repeated it. */\n return html`\n <div class=\"page\">\n <form class=\"page-card\">\n ${this._icon ? html`<div icon><img src=${this._icon} /></div>` : html``}\n <div field-2column>\n <div field grid-span>\n <label for=\"name\">name</label>\n <input type=\"text\" id=\"name\" name=\"name\" />\n </div>\n\n <div field grid-span>\n <label for=\"description\">description</label>\n <input type=\"text\" id=\"description\" name=\"description\" />\n </div>\n\n <div field grid-span>\n <label for=\"icon\">icon</label>\n <input type=\"text\" id=\"icon\" name=\"icon\" @change=${e => (this._icon = e.target.value)} />\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\" />\n The client identifier issued to the client during the application registration process.\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\" />\n The client secret issued to the client during the application registration process.\n </div>\n </div>\n </form>\n </div>\n `\n }\n\n async createOauth2Client() {\n /* The page action bar calls action() with no arguments, so this reads the form and nothing else. */\n const formData = new FormData(this.form)\n\n const oauth2Client = Array.from(formData.entries()).reduce((oauth2Client, [key, value]) => {\n oauth2Client[key] = value\n return oauth2Client\n }, {})\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($oauth2Client: NewOauth2Client!) {\n createOauth2Client(oauth2Client: $oauth2Client) {\n id\n }\n }\n `,\n variables: { oauth2Client }\n })\n\n if (response.errors) {\n notify({ level: 'error', message: 'create oauth2 client fail' })\n } else {\n const id = response.data.createOauth2Client.id\n navigate(`oauth2-client/${id}`)\n }\n }\n\n async pageUpdated(changes, lifecycle, before) {\n if (this.active) {\n this.form.reset()\n }\n }\n}\n"]}
@@ -11,6 +11,7 @@ export declare class Oauth2Client extends Oauth2Client_base {
11
11
  private clipboard?;
12
12
  private _icon?;
13
13
  get context(): {
14
+ frame: string;
14
15
  title: {
15
16
  icon: string;
16
17
  text: any;
@@ -197,6 +197,11 @@ let Oauth2Client = class Oauth2Client extends localize(i18next)(PageView) {
197
197
  * (decision 9), so these take none.
198
198
  */
199
199
  return {
200
+ /*
201
+ * 이 화면이 어떤 틀인가 — 동작 줄이 이것을 읽고 자기 오른쪽 끝을 내용에 맞춘다
202
+ * (ADR-0060 결정 9 보탬). 안 적으면 창 폭이고, 그것은 작업면의 모양이다.
203
+ */
204
+ frame: 'document',
200
205
  title: { icon: 'apps', text: this.oauth2Client?.name },
201
206
  description: this.oauth2Client?.description,
202
207
  actions: [
@@ -1 +1 @@
1
- {"version":3,"file":"oauth2-client.js","sourceRoot":"","sources":["../../client/pages/oauth2-client.ts"],"names":[],"m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M,CAAC,MAAM,CAAC;YACnC,QAAQ,EAAE,GAAG,CAAA;6FAC0E,YAAY;;;OAGlG;YACD,SAAS,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE;SAC7C,CAAC,CAAA;QAEF,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;YACpB,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,uCAAuC,EAAE,CAAC,CAAA;QAC9E,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC,wBAAwB,CAAA;YAC1D,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,2CAA2C,EAAE,CAAC,CAAA;QACjF,CAAC;IACH,CAAC;;AAvY2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDAAkB;AACjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,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,CAiiBxB","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 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,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,OAA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AC;IACH,CAAC;;AA5Y2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDAAkB;AACjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,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"]}
@@ -75,6 +75,11 @@ let Oauth2Clients = class Oauth2Clients extends localize(i18next)(PageView) {
75
75
  get context() {
76
76
  /* The action goes to the page action bar, where every other screen keeps its actions. */
77
77
  return {
78
+ /*
79
+ * 이 화면이 어떤 틀인가 — 동작 줄이 이것을 읽고 자기 오른쪽 끝을 내용에 맞춘다
80
+ * (ADR-0060 결정 9 보탬). 안 적으면 창 폭이고, 그것은 작업면의 모양이다.
81
+ */
82
+ frame: 'document',
78
83
  title: i18next.t('text.oauth2-clients'),
79
84
  actions: [
80
85
  {
@@ -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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G,CAAA;;;;;;;;;;;OAWT;SACF,CAAC,CAAA;QAEF,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;YACpB,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC,CAAA;QAClE,CAAC;aAAM,CAAC;YACN,OAAO,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAA;QACpC,CAAC;IACH,CAAC;;AA9E0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;8CAAoB;AA9D1C,aAAa;IADlB,aAAa,CAAC,gBAAgB,CAAC;GAC1B,aAAa,CA6IlB","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 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,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,E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,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,kBAAkB,EAAE,CAAC,EAAE,KAAK,IAAI,EAAE,CAAA;QAC/D,CAAC;IACH,CAAC;IAED,KAAK,CAAC,kBAAkB;QACtB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;YAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;;;;;OAWT;SACF,CAAC,CAAA;QAEF,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;YACpB,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC,CAAA;QAClE,CAAC;aAAM,CAAC;YACN,OAAO,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAA;QACpC,CAAC;IACH,CAAC;;AAnF0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,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"]}