@things-factory/pdf 10.1.228 → 10.1.232

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.
Files changed (71) hide show
  1. package/dist-client/index.d.ts +2 -0
  2. package/dist-client/index.js +2 -0
  3. package/dist-client/index.js.map +1 -0
  4. package/dist-client/issue-document.d.ts +44 -0
  5. package/dist-client/issue-document.js +162 -0
  6. package/dist-client/issue-document.js.map +1 -0
  7. package/dist-client/pages/issued-document/issued-document-list.d.ts +52 -0
  8. package/dist-client/pages/issued-document/issued-document-list.js +265 -0
  9. package/dist-client/pages/issued-document/issued-document-list.js.map +1 -0
  10. package/dist-client/pages/pdf-template/pdf-template-list-page.js +12 -0
  11. package/dist-client/pages/pdf-template/pdf-template-list-page.js.map +1 -1
  12. package/dist-client/route.d.ts +1 -1
  13. package/dist-client/route.js +3 -2
  14. package/dist-client/route.js.map +1 -1
  15. package/dist-client/tsconfig.tsbuildinfo +1 -1
  16. package/dist-server/controller/issued-document-kind.d.ts +60 -0
  17. package/dist-server/controller/issued-document-kind.js +48 -0
  18. package/dist-server/controller/issued-document-kind.js.map +1 -0
  19. package/dist-server/controller/pdf-release-reader.d.ts +1 -0
  20. package/dist-server/controller/pdf-release-reader.js +15 -0
  21. package/dist-server/controller/pdf-release-reader.js.map +1 -0
  22. package/dist-server/controller/pdf-release-service.d.ts +29 -4
  23. package/dist-server/controller/pdf-release-service.js +120 -9
  24. package/dist-server/controller/pdf-release-service.js.map +1 -1
  25. package/dist-server/index.d.ts +6 -1
  26. package/dist-server/index.js +13 -1
  27. package/dist-server/index.js.map +1 -1
  28. package/dist-server/role-tasks.js +3 -1
  29. package/dist-server/role-tasks.js.map +1 -1
  30. package/dist-server/service/index.d.ts +10 -1
  31. package/dist-server/service/index.js +1 -0
  32. package/dist-server/service/index.js.map +1 -1
  33. package/dist-server/service/pdf-generate/pdf-generate-resolver.d.ts +0 -2
  34. package/dist-server/service/pdf-generate/pdf-generate-resolver.js +8 -18
  35. package/dist-server/service/pdf-generate/pdf-generate-resolver.js.map +1 -1
  36. package/dist-server/service/pdf-release/index.d.ts +2 -2
  37. package/dist-server/service/pdf-release/index.js +4 -3
  38. package/dist-server/service/pdf-release/index.js.map +1 -1
  39. package/dist-server/service/pdf-release/pdf-release-query.d.ts +31 -5
  40. package/dist-server/service/pdf-release/pdf-release-query.js +213 -30
  41. package/dist-server/service/pdf-release/pdf-release-query.js.map +1 -1
  42. package/dist-server/service/pdf-release/pdf-release-type.d.ts +1 -16
  43. package/dist-server/service/pdf-release/pdf-release-type.js +4 -60
  44. package/dist-server/service/pdf-release/pdf-release-type.js.map +1 -1
  45. package/dist-server/service/pdf-release/pdf-release.d.ts +13 -1
  46. package/dist-server/service/pdf-release/pdf-release.js +67 -4
  47. package/dist-server/service/pdf-release/pdf-release.js.map +1 -1
  48. package/dist-server/service/pdf-template/pdf-template-type.d.ts +2 -0
  49. package/dist-server/service/pdf-template/pdf-template-type.js +8 -0
  50. package/dist-server/service/pdf-template/pdf-template-type.js.map +1 -1
  51. package/dist-server/service/pdf-template/pdf-template.d.ts +1 -0
  52. package/dist-server/service/pdf-template/pdf-template.js +5 -0
  53. package/dist-server/service/pdf-template/pdf-template.js.map +1 -1
  54. package/dist-server/tsconfig.tsbuildinfo +1 -1
  55. package/package.json +6 -4
  56. package/things-factory.config.js +2 -1
  57. package/translations/en.json +30 -1
  58. package/translations/es.json +30 -1
  59. package/translations/ja.json +30 -1
  60. package/translations/ko.json +30 -1
  61. package/translations/ms.json +30 -1
  62. package/translations/zh.json +30 -1
  63. package/dist-client/pages/pdf-release/pdf-release-importer.d.ts +0 -23
  64. package/dist-client/pages/pdf-release/pdf-release-importer.js +0 -93
  65. package/dist-client/pages/pdf-release/pdf-release-importer.js.map +0 -1
  66. package/dist-client/pages/pdf-release/pdf-release-list-page.d.ts +0 -60
  67. package/dist-client/pages/pdf-release/pdf-release-list-page.js +0 -317
  68. package/dist-client/pages/pdf-release/pdf-release-list-page.js.map +0 -1
  69. package/dist-server/service/pdf-release/pdf-release-mutation.d.ts +0 -10
  70. package/dist-server/service/pdf-release/pdf-release-mutation.js +0 -156
  71. package/dist-server/service/pdf-release/pdf-release-mutation.js.map +0 -1
@@ -1,317 +0,0 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import '@material/web/icon/icon.js';
3
- import '@material/web/button/elevated-button.js';
4
- import '@operato/data-grist/ox-grist.js';
5
- import '@operato/data-grist/ox-filters-form.js';
6
- import '@operato/data-grist/ox-record-creator.js';
7
- import { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles';
8
- import { PageView } from '@operato/shell';
9
- import { css, html } from 'lit';
10
- import { customElement, property, query } from 'lit/decorators.js';
11
- import { ScopedElementsMixin } from '@open-wc/scoped-elements';
12
- import { DataGrist } from '@operato/data-grist';
13
- import { client } from '@operato/graphql';
14
- import { i18next, localize } from '@operato/i18n';
15
- import { notify, openPopup } from '@operato/layout';
16
- import { OxPrompt } from '@operato/popup';
17
- import { isMobileDevice } from '@operato/utils';
18
- import gql from 'graphql-tag';
19
- import { PdfReleaseImporter } from './pdf-release-importer';
20
- let PdfReleaseListPage = class PdfReleaseListPage extends localize(i18next)(ScopedElementsMixin(PageView)) {
21
- constructor() {
22
- super(...arguments);
23
- this.mode = isMobileDevice() ? 'CARD' : 'GRID';
24
- }
25
- static { this.styles = [
26
- /* The work surface frame for a list screen (ADR-0060 decision 8). */
27
- WorkSurfacePageStyles,
28
- ScrollbarStyles,
29
- CommonGristStyles,
30
- CommonHeaderStyles,
31
- css `
32
- :host {
33
- --grid-record-emphasized-background-color: #8B0000;
34
- --grid-record-emphasized-color: #FF6B6B;
35
- }
36
-
37
- ox-filters-form { flex: 1;
38
- }
39
- `
40
- ]; }
41
- static get scopedElements() {
42
- return { 'pdf-release-importer': PdfReleaseImporter
43
- };
44
- }
45
- get context() {
46
- return { title: i18next.t('title.pdf-release list'),
47
- search: { handler: (search) => {
48
- this.grist.searchText = search;
49
- },
50
- value: this.grist.searchText },
51
- filter: { handler: () => {
52
- this.grist.toggleHeadroom();
53
- }
54
- },
55
- help: 'pdf/pdf-release',
56
- actions: [
57
- { title: i18next.t('button.save'),
58
- action: this._updatePdfRelease.bind(this),
59
- ...CommonButtonStyles.save
60
- },
61
- { title: i18next.t('button.delete'),
62
- action: this._deletePdfRelease.bind(this),
63
- ...CommonButtonStyles.delete
64
- }
65
- ],
66
- exportable: { name: i18next.t('title.pdf-release list'),
67
- data: this.exportHandler.bind(this)
68
- },
69
- importable: { handler: this.importHandler.bind(this)
70
- } };
71
- }
72
- render() {
73
- const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID');
74
- return html `
75
- <ox-grist class="page-fill"
76
- .mode=${mode}
77
- .config=${this.gristConfig}
78
- .fetchHandler=${this.fetchHandler.bind(this)}
79
- >
80
- <div slot="headroom" class="header">
81
- <div class="filters">
82
- <ox-filters-form autofocus without-search></ox-filters-form>
83
-
84
- <div id="modes">
85
- <md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>
86
- <md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>
87
- <md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>
88
- </div>
89
-
90
- <ox-record-creator id="add" .callback=${this.creationCallback.bind(this)}>
91
- <button>
92
- <md-icon>add</md-icon>
93
- </button>
94
- </ox-record-creator>
95
-
96
- </div>
97
- </div>
98
- </ox-grist>
99
- `;
100
- }
101
- async pageInitialized(lifecycle) {
102
- this.gristConfig = { list: { fields: ['name', 'description'],
103
- details: ['active', 'updatedAt']
104
- },
105
- columns: [
106
- { type: 'gutter', gutterName: 'sequence' },
107
- { type: 'gutter', gutterName: 'row-selector', multiple: true },
108
- { type: 'string',
109
- name: 'name',
110
- header: i18next.t('field.name'),
111
- record: { editable: true
112
- },
113
- filter: 'search',
114
- sortable: true,
115
- width: 150
116
- },
117
- { type: 'string',
118
- name: 'description',
119
- header: i18next.t('field.description'),
120
- record: { editable: true
121
- },
122
- filter: 'search',
123
- width: 200
124
- },
125
- { type: 'checkbox',
126
- name: 'active',
127
- label: true,
128
- header: i18next.t('field.active'),
129
- record: { editable: true
130
- },
131
- filter: true,
132
- sortable: true,
133
- width: 60
134
- },
135
- { type: 'resource-object',
136
- name: 'updater',
137
- header: i18next.t('field.updater'),
138
- record: { editable: false
139
- },
140
- sortable: true,
141
- width: 120
142
- },
143
- { type: 'datetime',
144
- name: 'updatedAt',
145
- header: i18next.t('field.updated_at'),
146
- record: { editable: false
147
- },
148
- sortable: true,
149
- width: 180
150
- }
151
- ],
152
- rows: { appendable: false,
153
- selectable: { multiple: true
154
- }
155
- },
156
- sorters: [
157
- { name: 'name'
158
- }
159
- ]
160
- };
161
- }
162
- async pageUpdated(changes, lifecycle) {
163
- if (this.active) { // do something here when this page just became as active
164
- }
165
- }
166
- async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }) {
167
- const response = await client.query({ query: gql `
168
- query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: pdfReleases(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id
169
- name
170
- description
171
- active
172
- updater { id
173
- name
174
- }
175
- updatedAt
176
- }
177
- total
178
- }
179
- }
180
- `,
181
- variables: { filters,
182
- pagination: { page, limit },
183
- sortings
184
- }
185
- });
186
- return { total: response.data.responses.total || 0,
187
- records: response.data.responses.items || []
188
- };
189
- }
190
- async _deletePdfRelease() {
191
- if (await OxPrompt.open({ title: i18next.t('text.are_you_sure'),
192
- text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),
193
- confirmButton: { text: i18next.t('button.confirm') },
194
- cancelButton: { text: i18next.t('button.cancel') }
195
- })) {
196
- const ids = this.grist.selected.map(record => record.id);
197
- if (ids && ids.length > 0) {
198
- const response = await client.mutate({ mutation: gql `
199
- mutation ($ids: [String!]!) { deletePdfReleases(ids: $ids)
200
- }
201
- `,
202
- variables: { ids
203
- }
204
- });
205
- if (!response.errors) {
206
- this.grist.fetch();
207
- notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
208
- });
209
- }
210
- }
211
- }
212
- }
213
- async _updatePdfRelease() {
214
- let patches = this.grist.dirtyRecords;
215
- if (patches && patches.length) {
216
- patches = patches.map(patch => {
217
- let patchField = patch.id ? { id: patch.id } : {};
218
- const dirtyFields = patch.__dirtyfields__;
219
- for (let key in dirtyFields) {
220
- patchField[key] = dirtyFields[key].after;
221
- }
222
- patchField.cuFlag = patch.__dirty__;
223
- return patchField;
224
- });
225
- const response = await client.mutate({ mutation: gql `
226
- mutation ($patches: [PdfReleasePatch!]!) { updateMultiplePdfRelease(patches: $patches) { name
227
- }
228
- }
229
- `,
230
- variables: { patches
231
- }
232
- });
233
- if (!response.errors) {
234
- this.grist.fetch();
235
- }
236
- }
237
- }
238
- async creationCallback(pdfRelease) {
239
- try {
240
- const response = await client.query({ query: gql `
241
- mutation ($pdfRelease: NewPdfRelease!) { createPdfRelease(pdfRelease: $pdfRelease) { id
242
- }
243
- }
244
- `,
245
- variables: { pdfRelease
246
- },
247
- context: { hasUpload: true
248
- }
249
- });
250
- if (!response.errors) {
251
- this.grist.fetch();
252
- document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.data_created_successfully')
253
- }
254
- }));
255
- }
256
- return true;
257
- }
258
- catch (ex) {
259
- console.error(ex);
260
- document.dispatchEvent(new CustomEvent('notify', { detail: { type: 'error',
261
- message: i18next.t('text.error')
262
- }
263
- }));
264
- return false;
265
- }
266
- }
267
- async exportHandler() {
268
- const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records;
269
- const targetFieldSet = new Set([
270
- 'id',
271
- 'name',
272
- 'description',
273
- 'active'
274
- ]);
275
- return exportTargets.map(pdfRelease => {
276
- let tempObj = {};
277
- for (const field of targetFieldSet) {
278
- tempObj[field] = pdfRelease[field];
279
- }
280
- return tempObj;
281
- });
282
- }
283
- async importHandler(records) {
284
- const popup = openPopup(html `
285
- <pdf-release-importer
286
- .pdfReleases=${records}
287
- @imported=${() => {
288
- history.back();
289
- this.grist.fetch();
290
- }}
291
- ></pdf-release-importer>
292
- `, { backdrop: true,
293
- size: 'large',
294
- title: i18next.t('title.import pdf-release')
295
- });
296
- popup.onclosed = () => {
297
- this.grist.fetch();
298
- };
299
- }
300
- };
301
- __decorate([
302
- property({ type: Object }),
303
- __metadata("design:type", Object)
304
- ], PdfReleaseListPage.prototype, "gristConfig", void 0);
305
- __decorate([
306
- property({ type: String }),
307
- __metadata("design:type", String)
308
- ], PdfReleaseListPage.prototype, "mode", void 0);
309
- __decorate([
310
- query('ox-grist'),
311
- __metadata("design:type", DataGrist)
312
- ], PdfReleaseListPage.prototype, "grist", void 0);
313
- PdfReleaseListPage = __decorate([
314
- customElement('pdf-release-list-page')
315
- ], PdfReleaseListPage);
316
- export { PdfReleaseListPage };
317
- //# sourceMappingURL=pdf-release-list-page.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pdf-release-list-page.js","sourceRoot":"","sources":["../../../client/pages/pdf-release/pdf-release-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,yCAAyC,CAAA;AAChD,OAAO,iCAAiC,CAAA;AACxC,OAAO,wCAAwC,CAAA;AAC/C,OAAO,0CAA0C,CAAA;AAEjD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AACnI,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,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,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC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C,KAAK,EAAE,CAAA;QAC7B,CAAC;;OAEK,EACD,EAAU,QAAQ,EAAE,IAAI;YACtB,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,0BAA0B,CAAC;SAClD,CACG,CAAA;QAED,KAAK,CAAC,QAAQ,GAAG,GAAG,EAAE;YAAS,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;QACpD,CAAC,CAAA;IACD,CAAC;;AAvQ4B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;uDAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAAoE;AAEpE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;iDAAA;AAzBjC,kBAAkB;IAD9B,aAAa,CAAC,uBAAuB,CAAC;GAC1B,kBAAkB,CA8R9B","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@material/web/button/elevated-button.js'\nimport '@operato/data-grist/ox-grist.js'\nimport '@operato/data-grist/ox-filters-form.js'\nimport '@operato/data-grist/ox-record-creator.js'\n\nimport { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { PageView } from '@operato/shell'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { ColumnConfig, DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { OxPopup, OxPrompt } from '@operato/popup'\nimport { isMobileDevice } from '@operato/utils'\n\nimport gql from 'graphql-tag'\n\nimport { PdfReleaseImporter } from './pdf-release-importer'\n\n@customElement('pdf-release-list-page')\nexport class PdfReleaseListPage extends localize(i18next)(ScopedElementsMixin(PageView)) { \n static styles = [\n /* The work surface frame for a list screen (ADR-0060 decision 8). */\n WorkSurfacePageStyles,\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n css`\n :host {\n --grid-record-emphasized-background-color: #8B0000;\n --grid-record-emphasized-color: #FF6B6B;\n }\n\n ox-filters-form { flex: 1;\n }\n `\n ]\n\n static get scopedElements() { return { 'pdf-release-importer': PdfReleaseImporter\n }\n }\n\n @property({ type: Object }) gristConfig: any\n @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() { return { title: i18next.t('title.pdf-release list'),\n search: { handler: (search: string) => { this.grist.searchText = search\n },\n value: this.grist.searchText\n },\n filter: { handler: () => { this.grist.toggleHeadroom()\n }\n },\n help: 'pdf/pdf-release',\n actions: [\n { title: i18next.t('button.save'),\n action: this._updatePdfRelease.bind(this),\n ...CommonButtonStyles.save\n },\n { title: i18next.t('button.delete'),\n action: this._deletePdfRelease.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: { name: i18next.t('title.pdf-release list'),\n data: this.exportHandler.bind(this)\n },\n importable: { handler: this.importHandler.bind(this)\n }\n }\n }\n\n render() { const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist class=\"page-fill\"\n .mode=${mode}\n .config=${this.gristConfig}\n .fetchHandler=${this.fetchHandler.bind(this)}\n >\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">\n <ox-filters-form autofocus without-search></ox-filters-form>\n\n <div id=\"modes\">\n <md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>\n <md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>\n <md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>\n </div>\n\n <ox-record-creator id=\"add\" .callback=${this.creationCallback.bind(this)}>\n <button>\n <md-icon>add</md-icon>\n </button>\n </ox-record-creator>\n\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) { this.gristConfig = { list: { fields: ['name', 'description'],\n details: ['active', 'updatedAt']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n { type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: { editable: true\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n { type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: { editable: true\n },\n filter: 'search',\n width: 200\n },\n { type: 'checkbox',\n name: 'active',\n label: true,\n header: i18next.t('field.active'),\n record: { editable: true\n },\n filter: true,\n sortable: true,\n width: 60\n },\n { type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n record: { editable: false\n },\n sortable: true,\n width: 120\n },\n { type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n record: { editable: false\n },\n sortable: true,\n width: 180\n }\n ],\n rows: { appendable: false,\n selectable: { multiple: true\n }\n },\n sorters: [\n { name: 'name'\n }\n ]\n }\n }\n\n async pageUpdated(changes: any, lifecycle: any) { if (this.active) { // do something here when this page just became as active\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) { const response = await client.query({ query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: pdfReleases(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id\n name\n description\n active\n updater { id\n name\n }\n updatedAt\n }\n total\n }\n }\n `,\n variables: { filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return { total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async _deletePdfRelease() { if (\n await OxPrompt.open({ title: i18next.t('text.are_you_sure'),\n text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),\n confirmButton: { text: i18next.t('button.confirm') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n ) { const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) { const response = await client.mutate({ mutation: gql`\n mutation ($ids: [String!]!) { deletePdfReleases(ids: $ids)\n }\n `,\n variables: { ids\n }\n })\n\n if (!response.errors) { this.grist.fetch()\n notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n async _updatePdfRelease() { let patches = this.grist.dirtyRecords\n if (patches && patches.length) { patches = patches.map(patch => { let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) { patchField[key] = dirtyFields[key].after\n }\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({ mutation: gql`\n mutation ($patches: [PdfReleasePatch!]!) { updateMultiplePdfRelease(patches: $patches) { name\n }\n }\n `,\n variables: { patches\n }\n })\n\n if (!response.errors) { this.grist.fetch()\n }\n }\n }\n\n async creationCallback(pdfRelease) { try { const response = await client.query({ query: gql`\n mutation ($pdfRelease: NewPdfRelease!) { createPdfRelease(pdfRelease: $pdfRelease) { id\n }\n }\n `,\n variables: { pdfRelease\n },\n context: { hasUpload: true\n }\n })\n\n if (!response.errors) { this.grist.fetch()\n document.dispatchEvent(\n new CustomEvent('notify', { detail: { message: i18next.t('text.data_created_successfully')\n }\n })\n )\n }\n\n return true\n } catch (ex) { console.error(ex)\n document.dispatchEvent(\n new CustomEvent('notify', { detail: { type: 'error',\n message: i18next.t('text.error')\n }\n })\n )\n return false\n }\n }\n\n async exportHandler() { const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records\n const targetFieldSet = new Set([\n 'id',\n 'name',\n 'description',\n 'active'\n ])\n\n return exportTargets.map(pdfRelease => { let tempObj = {}\n for (const field of targetFieldSet) { tempObj[field] = pdfRelease[field]\n }\n\n return tempObj\n })\n }\n\n async importHandler(records) { const popup = openPopup(\n html`\n <pdf-release-importer\n .pdfReleases=${records}\n @imported=${() => { history.back()\n this.grist.fetch()\n }}\n ></pdf-release-importer>\n `,\n { backdrop: true,\n size: 'large',\n title: i18next.t('title.import pdf-release')\n }\n )\n \n popup.onclosed = () => { this.grist.fetch()\n }\n }\n}\n\n"]}
@@ -1,10 +0,0 @@
1
- import { PDFRelease } from './pdf-release';
2
- import { NewPDFRelease, PDFReleasePatch } from './pdf-release-type';
3
- export declare class PDFReleaseMutation {
4
- createPDFRelease(pdfRelease: NewPDFRelease, context: ResolverContext): Promise<PDFRelease>;
5
- updatePDFRelease(id: string, patch: PDFReleasePatch, context: ResolverContext): Promise<PDFRelease>;
6
- updateMultiplePDFRelease(patches: PDFReleasePatch[], context: ResolverContext): Promise<PDFRelease[]>;
7
- deletePDFRelease(id: string, context: ResolverContext): Promise<boolean>;
8
- deletePDFReleases(ids: string[], context: ResolverContext): Promise<boolean>;
9
- importPDFReleases(pdfReleases: PDFReleasePatch[], context: ResolverContext): Promise<boolean>;
10
- }
@@ -1,156 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PDFReleaseMutation = void 0;
4
- const tslib_1 = require("tslib");
5
- const type_graphql_1 = require("type-graphql");
6
- const typeorm_1 = require("typeorm");
7
- const pdf_release_1 = require("./pdf-release");
8
- const pdf_release_type_1 = require("./pdf-release-type");
9
- let PDFReleaseMutation = class PDFReleaseMutation {
10
- async createPDFRelease(pdfRelease, context) {
11
- const { domain, user, tx } = context.state;
12
- const result = await tx.getRepository(pdf_release_1.PDFRelease).save({
13
- ...pdfRelease,
14
- domain,
15
- creator: user,
16
- updater: user
17
- });
18
- return result;
19
- }
20
- async updatePDFRelease(id, patch, context) {
21
- const { domain, user, tx } = context.state;
22
- const repository = tx.getRepository(pdf_release_1.PDFRelease);
23
- const pdfRelease = await repository.findOne({
24
- where: { domain: { id: domain.id }, id }
25
- });
26
- const result = await repository.save({
27
- ...pdfRelease,
28
- ...patch,
29
- updater: user
30
- });
31
- return result;
32
- }
33
- async updateMultiplePDFRelease(patches, context) {
34
- const { domain, user, tx } = context.state;
35
- let results = [];
36
- const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
37
- const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
38
- const pdfReleaseRepo = tx.getRepository(pdf_release_1.PDFRelease);
39
- if (_createRecords.length > 0) {
40
- for (let i = 0; i < _createRecords.length; i++) {
41
- const newRecord = _createRecords[i];
42
- const result = await pdfReleaseRepo.save({
43
- ...newRecord,
44
- domain,
45
- creator: user,
46
- updater: user
47
- });
48
- results.push({ ...result, cuFlag: '+' });
49
- }
50
- }
51
- if (_updateRecords.length > 0) {
52
- for (let i = 0; i < _updateRecords.length; i++) {
53
- const updateRecord = _updateRecords[i];
54
- const pdfRelease = await pdfReleaseRepo.findOne({
55
- where: { domain: { id: domain.id }, id: updateRecord.id }
56
- });
57
- if (!pdfRelease) {
58
- throw new Error(`failed to find pdfRelease to update: ${updateRecord.id}`);
59
- }
60
- const result = await pdfReleaseRepo.save({
61
- ...pdfRelease,
62
- ...updateRecord,
63
- updater: user
64
- });
65
- results.push({ ...result, cuFlag: 'M' });
66
- }
67
- }
68
- return results;
69
- }
70
- async deletePDFRelease(id, context) {
71
- const { domain, tx } = context.state;
72
- await tx.getRepository(pdf_release_1.PDFRelease).delete({ domain: { id: domain.id }, id });
73
- return true;
74
- }
75
- async deletePDFReleases(ids, context) {
76
- const { domain, tx } = context.state;
77
- await tx.getRepository(pdf_release_1.PDFRelease).delete({
78
- domain: { id: domain.id },
79
- id: (0, typeorm_1.In)(ids)
80
- });
81
- return true;
82
- }
83
- async importPDFReleases(pdfReleases, context) {
84
- const { domain, tx } = context.state;
85
- await Promise.all(pdfReleases.map(async (pdfRelease) => {
86
- const createdPDFRelease = await tx.getRepository(pdf_release_1.PDFRelease).save({ domain, ...pdfRelease });
87
- }));
88
- return true;
89
- }
90
- };
91
- exports.PDFReleaseMutation = PDFReleaseMutation;
92
- tslib_1.__decorate([
93
- (0, type_graphql_1.Directive)('@privilege(category: "pdf", privilege: "mutation", domainOwnerGranted: true)'),
94
- (0, type_graphql_1.Directive)('@transaction'),
95
- (0, type_graphql_1.Mutation)(returns => pdf_release_1.PDFRelease, { description: 'To create new PDFRelease' }),
96
- tslib_1.__param(0, (0, type_graphql_1.Arg)('pdfRelease')),
97
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
98
- tslib_1.__metadata("design:type", Function),
99
- tslib_1.__metadata("design:paramtypes", [pdf_release_type_1.NewPDFRelease, Object]),
100
- tslib_1.__metadata("design:returntype", Promise)
101
- ], PDFReleaseMutation.prototype, "createPDFRelease", null);
102
- tslib_1.__decorate([
103
- (0, type_graphql_1.Directive)('@privilege(category: "pdf", privilege: "mutation", domainOwnerGranted: true)'),
104
- (0, type_graphql_1.Directive)('@transaction'),
105
- (0, type_graphql_1.Mutation)(returns => pdf_release_1.PDFRelease, { description: 'To modify PDFRelease information' }),
106
- tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
107
- tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
108
- tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
109
- tslib_1.__metadata("design:type", Function),
110
- tslib_1.__metadata("design:paramtypes", [String, pdf_release_type_1.PDFReleasePatch, Object]),
111
- tslib_1.__metadata("design:returntype", Promise)
112
- ], PDFReleaseMutation.prototype, "updatePDFRelease", null);
113
- tslib_1.__decorate([
114
- (0, type_graphql_1.Directive)('@privilege(category: "pdf", privilege: "mutation", domainOwnerGranted: true)'),
115
- (0, type_graphql_1.Directive)('@transaction'),
116
- (0, type_graphql_1.Mutation)(returns => [pdf_release_1.PDFRelease], { description: "To modify multiple PDFReleases' information" }),
117
- tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [pdf_release_type_1.PDFReleasePatch])),
118
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
119
- tslib_1.__metadata("design:type", Function),
120
- tslib_1.__metadata("design:paramtypes", [Array, Object]),
121
- tslib_1.__metadata("design:returntype", Promise)
122
- ], PDFReleaseMutation.prototype, "updateMultiplePDFRelease", null);
123
- tslib_1.__decorate([
124
- (0, type_graphql_1.Directive)('@privilege(category: "pdf", privilege: "mutation", domainOwnerGranted: true)'),
125
- (0, type_graphql_1.Directive)('@transaction'),
126
- (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete PDFRelease' }),
127
- tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
128
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
129
- tslib_1.__metadata("design:type", Function),
130
- tslib_1.__metadata("design:paramtypes", [String, Object]),
131
- tslib_1.__metadata("design:returntype", Promise)
132
- ], PDFReleaseMutation.prototype, "deletePDFRelease", null);
133
- tslib_1.__decorate([
134
- (0, type_graphql_1.Directive)('@privilege(category: "pdf", privilege: "mutation", domainOwnerGranted: true)'),
135
- (0, type_graphql_1.Directive)('@transaction'),
136
- (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple PDFReleases' }),
137
- tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
138
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
139
- tslib_1.__metadata("design:type", Function),
140
- tslib_1.__metadata("design:paramtypes", [Array, Object]),
141
- tslib_1.__metadata("design:returntype", Promise)
142
- ], PDFReleaseMutation.prototype, "deletePDFReleases", null);
143
- tslib_1.__decorate([
144
- (0, type_graphql_1.Directive)('@privilege(category: "pdf", privilege: "mutation", domainOwnerGranted: true)'),
145
- (0, type_graphql_1.Directive)('@transaction'),
146
- (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple PDFReleases' }),
147
- tslib_1.__param(0, (0, type_graphql_1.Arg)('pdfReleases', type => [pdf_release_type_1.PDFReleasePatch])),
148
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
149
- tslib_1.__metadata("design:type", Function),
150
- tslib_1.__metadata("design:paramtypes", [Array, Object]),
151
- tslib_1.__metadata("design:returntype", Promise)
152
- ], PDFReleaseMutation.prototype, "importPDFReleases", null);
153
- exports.PDFReleaseMutation = PDFReleaseMutation = tslib_1.__decorate([
154
- (0, type_graphql_1.Resolver)(pdf_release_1.PDFRelease)
155
- ], PDFReleaseMutation);
156
- //# sourceMappingURL=pdf-release-mutation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pdf-release-mutation.js","sourceRoot":"","sources":["../../../server/service/pdf-release/pdf-release-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,+CAA0C;AAC1C,yDAAmE;AAG5D,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAIvB,AAAN,KAAK,CAAC,gBAAgB,CACD,UAAyB,EACrC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,aAAa,CAAC,wBAAU,CAAC,CAAC,IAAI,CAAC;YACrD,GAAG,UAAU;YACb,MAAM;YACN,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;SACd,CAAC,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;IAKK,AAAN,KAAK,CAAC,gBAAgB,CACT,EAAU,EACP,KAAsB,EAC7B,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,wBAAU,CAAC,CAAA;QAC/C,MAAM,UAAU,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;YAC1C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC,CAAA;QAEF,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC;YACnC,GAAG,UAAU;YACb,GAAG,KAAK;YACR,OAAO,EAAE,IAAI;SACd,CAAC,CAAA;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AAA,kBAAG,GAAE,CAAA;;;;2DAWP;6BA7IU,kBAAkB;IAD9B,IAAA,uBAAQ,EAAC,wBAAU,CAAC;GACR,kBAAkB,CA8I9B","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { PDFRelease } from './pdf-release'\nimport { NewPDFRelease, PDFReleasePatch } from './pdf-release-type'\n\n@Resolver(PDFRelease)\nexport class PDFReleaseMutation {\n @Directive('@privilege(category: \"pdf\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Directive('@transaction')\n @Mutation(returns => PDFRelease, { description: 'To create new PDFRelease' })\n async createPDFRelease(\n @Arg('pdfRelease') pdfRelease: NewPDFRelease,\n @Ctx() context: ResolverContext\n ): Promise<PDFRelease> {\n const { domain, user, tx } = context.state\n\n const result = await tx.getRepository(PDFRelease).save({\n ...pdfRelease,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@privilege(category: \"pdf\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Directive('@transaction')\n @Mutation(returns => PDFRelease, { description: 'To modify PDFRelease information' })\n async updatePDFRelease(\n @Arg('id') id: string,\n @Arg('patch') patch: PDFReleasePatch,\n @Ctx() context: ResolverContext\n ): Promise<PDFRelease> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(PDFRelease)\n const pdfRelease = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...pdfRelease,\n ...patch,\n updater: user\n })\n\n return result\n }\n\n @Directive('@privilege(category: \"pdf\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Directive('@transaction')\n @Mutation(returns => [PDFRelease], { description: \"To modify multiple PDFReleases' information\" })\n async updateMultiplePDFRelease(\n @Arg('patches', type => [PDFReleasePatch]) patches: PDFReleasePatch[],\n @Ctx() context: ResolverContext\n ): Promise<PDFRelease[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const pdfReleaseRepo = tx.getRepository(PDFRelease)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await pdfReleaseRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const updateRecord = _updateRecords[i]\n const pdfRelease = await pdfReleaseRepo.findOne({\n where: { domain: { id: domain.id }, id: updateRecord.id }\n })\n\n if (!pdfRelease) {\n throw new Error(`failed to find pdfRelease to update: ${updateRecord.id}`)\n }\n\n const result = await pdfReleaseRepo.save({\n ...pdfRelease,\n ...updateRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@privilege(category: \"pdf\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete PDFRelease' })\n async deletePDFRelease(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(PDFRelease).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@privilege(category: \"pdf\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple PDFReleases' })\n async deletePDFReleases(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(PDFRelease).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@privilege(category: \"pdf\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To import multiple PDFReleases' })\n async importPDFReleases(\n @Arg('pdfReleases', type => [PDFReleasePatch]) pdfReleases: PDFReleasePatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n pdfReleases.map(async (pdfRelease: PDFReleasePatch) => {\n const createdPDFRelease: PDFRelease = await tx.getRepository(PDFRelease).save({ domain, ...pdfRelease })\n })\n )\n\n return true\n }\n}\n"]}