@mapcreator/api 0.0.0-co-edit.9 → 0.0.0-json-object.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +29 -29
- package/README.md +86 -86
- package/cjs/api/apiCommon.d.ts +1 -3
- package/cjs/api/apiCommon.d.ts.map +1 -1
- package/cjs/api/apiCommon.js +13 -6
- package/cjs/api/apiCommon.js.map +1 -1
- package/cjs/api/job.d.ts +13 -50
- package/cjs/api/job.d.ts.map +1 -1
- package/cjs/api/job.js +4 -42
- package/cjs/api/job.js.map +1 -1
- package/cjs/api/jobRevision.d.ts +4 -1
- package/cjs/api/jobRevision.d.ts.map +1 -1
- package/cjs/api/jobRevision.js +38 -1
- package/cjs/api/jobRevision.js.map +1 -1
- package/cjs/api/organisation.d.ts +2 -2
- package/cjs/api/organisation.d.ts.map +1 -1
- package/cjs/api/organisation.js +3 -2
- package/cjs/api/organisation.js.map +1 -1
- package/cjs/api/resources.d.ts +1 -23
- package/cjs/api/resources.d.ts.map +1 -1
- package/cjs/api/resources.js +0 -2
- package/cjs/api/resources.js.map +1 -1
- package/cjs/api/user.d.ts +18 -5
- package/cjs/api/user.d.ts.map +1 -1
- package/cjs/api/user.js +5 -9
- package/cjs/api/user.js.map +1 -1
- package/esm/api/apiCommon.d.ts +1 -3
- package/esm/api/apiCommon.d.ts.map +1 -1
- package/esm/api/apiCommon.js +13 -6
- package/esm/api/apiCommon.js.map +1 -1
- package/esm/api/job.d.ts +13 -50
- package/esm/api/job.d.ts.map +1 -1
- package/esm/api/job.js +4 -33
- package/esm/api/job.js.map +1 -1
- package/esm/api/jobRevision.d.ts +4 -1
- package/esm/api/jobRevision.d.ts.map +1 -1
- package/esm/api/jobRevision.js +36 -1
- package/esm/api/jobRevision.js.map +1 -1
- package/esm/api/organisation.d.ts +2 -2
- package/esm/api/organisation.d.ts.map +1 -1
- package/esm/api/organisation.js +3 -2
- package/esm/api/organisation.js.map +1 -1
- package/esm/api/resources.d.ts +1 -23
- package/esm/api/resources.d.ts.map +1 -1
- package/esm/api/resources.js +0 -2
- package/esm/api/resources.js.map +1 -1
- package/esm/api/user.d.ts +18 -5
- package/esm/api/user.d.ts.map +1 -1
- package/esm/api/user.js +4 -7
- package/esm/api/user.js.map +1 -1
- package/package.json +81 -81
- package/src/README.md +126 -126
- package/src/api/apiCommon.ts +16 -23
- package/src/api/job.ts +18 -87
- package/src/api/jobRevision.ts +51 -1
- package/src/api/organisation.ts +6 -6
- package/src/api/resources.ts +1 -32
- package/src/api/user.ts +27 -21
package/LICENSE
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
BSD 3-Clause License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024, Mapcreator
|
|
4
|
-
All rights reserved.
|
|
5
|
-
|
|
6
|
-
Redistribution and use in source and binary forms, with or without
|
|
7
|
-
modification, are permitted provided that the following conditions are met:
|
|
8
|
-
|
|
9
|
-
* Redistributions of source code must retain the above copyright notice, this
|
|
10
|
-
list of conditions and the following disclaimer.
|
|
11
|
-
|
|
12
|
-
* Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
-
this list of conditions and the following disclaimer in the documentation
|
|
14
|
-
and/or other materials provided with the distribution.
|
|
15
|
-
|
|
16
|
-
* Neither the name of the copyright holder nor the names of its
|
|
17
|
-
contributors may be used to endorse or promote products derived from
|
|
18
|
-
this software without specific prior written permission.
|
|
19
|
-
|
|
20
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024, Mapcreator
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
* Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
# Mapcreator Javascript API
|
|
2
|
-
|
|
3
|
-
The Mapcreator API is a powerful mapping service built for our front-end applications. This library is released to
|
|
4
|
-
provide a painless way of talking to the api using Javascript. See the LICENSE file for licensing information. Api
|
|
5
|
-
tokens can be granted through support requests.
|
|
6
|
-
|
|
7
|
-
## Table of contents
|
|
8
|
-
|
|
9
|
-
* [Installation](#installation)
|
|
10
|
-
* [Quick start](#quick-start)
|
|
11
|
-
* [Common usage](#common-usage)
|
|
12
|
-
* [Publishing](#publishing)
|
|
13
|
-
|
|
14
|
-
### Installation
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
npm install @mapcreator/api --save
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
### Quick start
|
|
21
|
-
|
|
22
|
-
```javascript
|
|
23
|
-
import { authenticate, initImplicitFlow } from '@mapcreator/api/oauth';
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* You need to initialize the authentication module.
|
|
27
|
-
* This is an important step that should be completed as soon as possible after general application init.
|
|
28
|
-
*
|
|
29
|
-
* @param {string} apiUrl - Full API URL, like 'https://api.mapcreator.io'
|
|
30
|
-
* @param {string} clientId - OAuth client id, issued for particular application
|
|
31
|
-
* @param {string} [redirectUrl] - Callback URL, typically your application URL
|
|
32
|
-
* @param {string[]} [scopes] - A list of required scopes, like ['mapcreator']
|
|
33
|
-
*/
|
|
34
|
-
initImplicitFlow(
|
|
35
|
-
import.meta.env.VITE_API_HOST,
|
|
36
|
-
import.meta.env.VITE_API_CLIENT_ID,
|
|
37
|
-
import.meta.env.VITE_API_REDIRECT_URL,
|
|
38
|
-
['mapcreator'],
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
// ...
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* The subsequent command should lead to two scenarios.
|
|
45
|
-
* If the initialization function was able to obtain the token from the local storage or from the address bar,
|
|
46
|
-
* then this command is NO-OP. If the token is not found or has expired, then a redirect will be made to the
|
|
47
|
-
* authentication page (the application will unload), but when it redirects back again (see the parameter above),
|
|
48
|
-
* this method won't do anything and the application will be able to continue its work.
|
|
49
|
-
*/
|
|
50
|
-
authenticate();
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### Common usage
|
|
54
|
-
|
|
55
|
-
The library exports independent methods for accessing the API. The recommended pattern for importing and using methods
|
|
56
|
-
looks like this:
|
|
57
|
-
|
|
58
|
-
```typescript
|
|
59
|
-
import { updateJob } from '@mapcreator/api/job';
|
|
60
|
-
|
|
61
|
-
await updateJob(someJobId, newJobTitle);
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
You can also import methods by specifying only the package name, but this results in the use of a common file with
|
|
65
|
-
re-exports and can negatively affect the size of the resulting code if you do not need some parts of the API.
|
|
66
|
-
|
|
67
|
-
```typescript
|
|
68
|
-
import { type LayerFaq, listLayerFaqs } from '@mapcreator/api';
|
|
69
|
-
|
|
70
|
-
const layerFaqs: LayerFaq = await listLayerFaqs();
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
TypeScript types are also exposed, and you can use them whenever needed.
|
|
74
|
-
|
|
75
|
-
Please consult the contents of the library. All API access files (they are located in `api` sub-folder and each file
|
|
76
|
-
generally describes methods for accessing specific entity) describe both the API type and the data type returned
|
|
77
|
-
to the application. We sincerely hope this helps you make your app development easier.
|
|
78
|
-
|
|
79
|
-
## Publishing
|
|
80
|
-
```shell
|
|
81
|
-
npm version patch # minor | major
|
|
82
|
-
npm publish
|
|
83
|
-
```
|
|
84
|
-
Until the contents of the package are stabilized, it is suggested to use the scheme with the **alpha** or **beta**
|
|
85
|
-
suffixes. And therefore the call to the first command should be replaced by manual modification of the `package.json`
|
|
86
|
-
and `package-lock.json` files (will need to change in three places).
|
|
1
|
+
# Mapcreator Javascript API
|
|
2
|
+
|
|
3
|
+
The Mapcreator API is a powerful mapping service built for our front-end applications. This library is released to
|
|
4
|
+
provide a painless way of talking to the api using Javascript. See the LICENSE file for licensing information. Api
|
|
5
|
+
tokens can be granted through support requests.
|
|
6
|
+
|
|
7
|
+
## Table of contents
|
|
8
|
+
|
|
9
|
+
* [Installation](#installation)
|
|
10
|
+
* [Quick start](#quick-start)
|
|
11
|
+
* [Common usage](#common-usage)
|
|
12
|
+
* [Publishing](#publishing)
|
|
13
|
+
|
|
14
|
+
### Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @mapcreator/api --save
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Quick start
|
|
21
|
+
|
|
22
|
+
```javascript
|
|
23
|
+
import { authenticate, initImplicitFlow } from '@mapcreator/api/oauth';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* You need to initialize the authentication module.
|
|
27
|
+
* This is an important step that should be completed as soon as possible after general application init.
|
|
28
|
+
*
|
|
29
|
+
* @param {string} apiUrl - Full API URL, like 'https://api.mapcreator.io'
|
|
30
|
+
* @param {string} clientId - OAuth client id, issued for particular application
|
|
31
|
+
* @param {string} [redirectUrl] - Callback URL, typically your application URL
|
|
32
|
+
* @param {string[]} [scopes] - A list of required scopes, like ['mapcreator']
|
|
33
|
+
*/
|
|
34
|
+
initImplicitFlow(
|
|
35
|
+
import.meta.env.VITE_API_HOST,
|
|
36
|
+
import.meta.env.VITE_API_CLIENT_ID,
|
|
37
|
+
import.meta.env.VITE_API_REDIRECT_URL,
|
|
38
|
+
['mapcreator'],
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
// ...
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The subsequent command should lead to two scenarios.
|
|
45
|
+
* If the initialization function was able to obtain the token from the local storage or from the address bar,
|
|
46
|
+
* then this command is NO-OP. If the token is not found or has expired, then a redirect will be made to the
|
|
47
|
+
* authentication page (the application will unload), but when it redirects back again (see the parameter above),
|
|
48
|
+
* this method won't do anything and the application will be able to continue its work.
|
|
49
|
+
*/
|
|
50
|
+
authenticate();
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Common usage
|
|
54
|
+
|
|
55
|
+
The library exports independent methods for accessing the API. The recommended pattern for importing and using methods
|
|
56
|
+
looks like this:
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import { updateJob } from '@mapcreator/api/job';
|
|
60
|
+
|
|
61
|
+
await updateJob(someJobId, newJobTitle);
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
You can also import methods by specifying only the package name, but this results in the use of a common file with
|
|
65
|
+
re-exports and can negatively affect the size of the resulting code if you do not need some parts of the API.
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
import { type LayerFaq, listLayerFaqs } from '@mapcreator/api';
|
|
69
|
+
|
|
70
|
+
const layerFaqs: LayerFaq = await listLayerFaqs();
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
TypeScript types are also exposed, and you can use them whenever needed.
|
|
74
|
+
|
|
75
|
+
Please consult the contents of the library. All API access files (they are located in `api` sub-folder and each file
|
|
76
|
+
generally describes methods for accessing specific entity) describe both the API type and the data type returned
|
|
77
|
+
to the application. We sincerely hope this helps you make your app development easier.
|
|
78
|
+
|
|
79
|
+
## Publishing
|
|
80
|
+
```shell
|
|
81
|
+
npm version patch # minor | major
|
|
82
|
+
npm publish
|
|
83
|
+
```
|
|
84
|
+
Until the contents of the package are stabilized, it is suggested to use the scheme with the **alpha** or **beta**
|
|
85
|
+
suffixes. And therefore the call to the first command should be replaced by manual modification of the `package.json`
|
|
86
|
+
and `package-lock.json` files (will need to change in three places).
|
package/cjs/api/apiCommon.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { type Job } from './job.js';
|
|
2
|
-
export type DashboardSortType = 'created' | '-created' | 'updated' | '-updated' | 'last_opened' | '-last_opened' | 'last_saved' | '-last_saved' | 'name' | '-name';
|
|
3
|
-
export type DashboardFilterType = 'all' | 'starred' | 'private';
|
|
4
2
|
export interface JobSearchResult {
|
|
5
3
|
pageCount: number;
|
|
6
4
|
data: Job[];
|
|
7
5
|
}
|
|
8
|
-
export declare function listJobs(pathname: string,
|
|
6
|
+
export declare function listJobs(pathname: string, title: string, page: number, searchOptions?: Record<string, unknown>): Promise<JobSearchResult>;
|
|
9
7
|
//# sourceMappingURL=apiCommon.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiCommon.d.ts","sourceRoot":"","sources":["../../src/api/apiCommon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,GAAG,EAAe,MAAM,UAAU,CAAC;AAWlE,MAAM,
|
|
1
|
+
{"version":3,"file":"apiCommon.d.ts","sourceRoot":"","sources":["../../src/api/apiCommon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,GAAG,EAAe,MAAM,UAAU,CAAC;AAWlE,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,GAAG,EAAE,CAAC;CACb;AAED,wBAAsB,QAAQ,CAC5B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACtC,OAAO,CAAC,eAAe,CAAC,CAiD1B"}
|
package/cjs/api/apiCommon.js
CHANGED
|
@@ -3,13 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.listJobs = listJobs;
|
|
4
4
|
const job_js_1 = require("./job.js");
|
|
5
5
|
const utils_js_1 = require("../utils.js");
|
|
6
|
-
async function listJobs(pathname,
|
|
6
|
+
async function listJobs(pathname, title, page, searchOptions) {
|
|
7
|
+
const defaultSearchOptions = {
|
|
8
|
+
sort: '-updated',
|
|
9
|
+
only_downloaded: false,
|
|
10
|
+
};
|
|
11
|
+
const search = { ...defaultSearchOptions, ...searchOptions };
|
|
7
12
|
const query = (0, utils_js_1.getSearchParams)({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
only_with_revisions: true,
|
|
14
|
+
search: {
|
|
15
|
+
job_type_id: ['9', '6'],
|
|
16
|
+
converted_job_id: '=:',
|
|
17
|
+
...(title.length > 0 && { title: `~:${title}` }),
|
|
18
|
+
},
|
|
19
|
+
...search,
|
|
13
20
|
});
|
|
14
21
|
const path = `${pathname}?${query}`;
|
|
15
22
|
const headers = {
|
package/cjs/api/apiCommon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiCommon.js","sourceRoot":"","sources":["../../src/api/apiCommon.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"apiCommon.js","sourceRoot":"","sources":["../../src/api/apiCommon.ts"],"names":[],"mappings":";;AAgBA,4BAsDC;AAtED,qCAAkE;AAClE,0CAQqB;AAOd,KAAK,UAAU,QAAQ,CAC5B,QAAgB,EAChB,KAAa,EACb,IAAY,EACZ,aAAuC;IAEvC,MAAM,oBAAoB,GAAG;QAC3B,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,KAAK;KACvB,CAAC;IAEF,MAAM,MAAM,GAAG,EAAE,GAAG,oBAAoB,EAAE,GAAG,aAAa,EAAE,CAAC;IAE7D,MAAM,KAAK,GAAG,IAAA,0BAAe,EAAC;QAC5B,mBAAmB,EAAE,IAAI;QACzB,MAAM,EAAE;YACN,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;YACvB,gBAAgB,EAAE,IAAI;YACtB,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,KAAK,EAAE,EAAE,CAAC;SACjD;QACD,GAAG,MAAM;KACV,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,GAAG,QAAQ,IAAI,KAAK,EAAE,CAAC;IAEpC,MAAM,OAAO,GAAG;QACd,GAAG,4BAAiB;QACpB,QAAQ,EAAE,GAAG,IAAI,EAAE;KACpB,CAAC;IACF,MAAM,OAAO,GAAG;QACd,QAAQ,EAAE,oBAAyC;QACnD,QAAQ,EAAE,IAAI;KACf,CAAC;IAMF,MAAM,MAAM,GAAG,CAAC,MAAM,IAAA,kBAAO,EAAmB,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,KAAK,CACjF,CAAC,KAAY,EAAE,EAAE;QACf,IAAI,KAAK,YAAY,kBAAO,EAAE,CAAC;YAC7B,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,KAAkC,CAAC;YAErE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QACnC,CAAC;QAED,MAAM,KAAK,CAAC;IACd,CAAC,CACF,CAA8B,CAAC;IAEhC,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;KAC1D,CAAC;AACJ,CAAC"}
|
package/cjs/api/job.d.ts
CHANGED
|
@@ -1,82 +1,45 @@
|
|
|
1
1
|
import type { JobShare, JobShareVisibility } from './jobShare.js';
|
|
2
|
-
import { type
|
|
2
|
+
import { type JobSearchResult } from './apiCommon.js';
|
|
3
3
|
import { type ApiCommonData, type ApiError, type ApiSuccess, type Flatten, type Revivers } from '../utils.js';
|
|
4
4
|
export type Job = {
|
|
5
5
|
id: number;
|
|
6
6
|
jobTypeId: number;
|
|
7
|
-
title: string;
|
|
8
|
-
autosavePreviewPath: string | null;
|
|
9
|
-
previewPath: string | undefined;
|
|
10
7
|
userId: number;
|
|
11
|
-
|
|
12
|
-
orgId: number;
|
|
13
|
-
orgName: string;
|
|
14
|
-
jobOpenUserName: string | null;
|
|
8
|
+
title: string;
|
|
15
9
|
jobFolderId: number | null;
|
|
16
10
|
jobFolderName: string | null;
|
|
17
11
|
star: boolean;
|
|
18
|
-
private: boolean;
|
|
19
|
-
convertedJobId: number | null;
|
|
20
|
-
lastOpened: string | null;
|
|
21
|
-
downloadedAt: string | null;
|
|
22
|
-
lastSavedAt: string;
|
|
23
|
-
latestRevision: number;
|
|
24
12
|
createdAt: string;
|
|
25
|
-
|
|
13
|
+
previewPath: string | undefined;
|
|
14
|
+
convertedJobId: number | null;
|
|
15
|
+
userEmail: string | undefined;
|
|
16
|
+
orgName: string | undefined;
|
|
26
17
|
};
|
|
27
18
|
export type ApiJob = {
|
|
28
19
|
data: {
|
|
29
20
|
id: number;
|
|
30
21
|
job_type_id: number;
|
|
22
|
+
user_id: number;
|
|
31
23
|
title: string;
|
|
24
|
+
description: string | null;
|
|
25
|
+
share_token: string | null;
|
|
32
26
|
autosave_preview_path: string | null;
|
|
33
|
-
preview_path: string;
|
|
34
|
-
user_id: number;
|
|
35
|
-
user_name: string | null;
|
|
36
|
-
org_id: number;
|
|
37
|
-
org_name: string;
|
|
38
|
-
job_open_user_name: string | null;
|
|
39
27
|
job_folder_id: number | null;
|
|
40
|
-
job_folder_name
|
|
28
|
+
job_folder_name?: string | null;
|
|
41
29
|
star: boolean;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
last_opened: string | null;
|
|
45
|
-
downloaded_at: string | null;
|
|
46
|
-
last_saved_at: string;
|
|
47
|
-
latest_revision: number;
|
|
48
|
-
} & Omit<ApiCommonData, 'deleted_at'>;
|
|
30
|
+
converted_job_id?: number | null;
|
|
31
|
+
} & ApiCommonData;
|
|
49
32
|
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
50
33
|
export type ApiJobData = Flatten<Exclude<ApiJob, ApiError>['data']>;
|
|
51
34
|
export declare const jobRevivers: Revivers<ApiJob, Job>;
|
|
52
35
|
export declare function createJob(title: string, jobTypeId?: number, oldJobId?: number): Promise<Job>;
|
|
53
36
|
export declare function getJob(jobId: number): Promise<Job>;
|
|
54
37
|
export declare function deleteJob(jobId: number): Promise<Record<string, never>>;
|
|
55
|
-
export declare function restoreJob(jobId: number): Promise<Record<string, never>>;
|
|
56
38
|
export declare function updateJob(jobId: number, newTitle: string): Promise<Record<string, never>>;
|
|
57
39
|
export declare function updateJobFolder(jobId: number, folderId: number | null): Promise<Record<string, never>>;
|
|
58
40
|
export declare function starJob(jobId: number, star: boolean): Promise<Record<string, never>>;
|
|
59
|
-
export declare function privateJob(jobId: number, privateValue: boolean): Promise<Record<string, never>>;
|
|
60
41
|
export declare function resetConvertedJob(jobId: number): Promise<Record<string, never>>;
|
|
61
42
|
export declare function generateJobShare(jobId: number, visibility: JobShareVisibility): Promise<JobShare>;
|
|
62
43
|
export declare function uploadJobPreview(jobId: number, preview: Blob): Promise<Record<string, never>>;
|
|
63
|
-
export declare function listFeaturedJobs(
|
|
64
|
-
export type JobCoEditEvent = {
|
|
65
|
-
jobId: number;
|
|
66
|
-
userName: string;
|
|
67
|
-
status: 'open' | 'close';
|
|
68
|
-
};
|
|
69
|
-
export type JobTakeoverEvent = {
|
|
70
|
-
userId: number;
|
|
71
|
-
userName: string;
|
|
72
|
-
requestedAt: string;
|
|
73
|
-
status: 'pending' | 'approved' | 'denied' | 'cancelled';
|
|
74
|
-
};
|
|
75
|
-
export declare function openJob(jobId: number): Promise<Record<string, never>>;
|
|
76
|
-
export declare function heartbeat(jobId: number): Promise<Record<string, never>>;
|
|
77
|
-
export declare function requestTakeover(jobId: number): Promise<Record<string, never>>;
|
|
78
|
-
export declare function approveTakeover(jobId: number, userId: number): Promise<Record<string, never>>;
|
|
79
|
-
export declare function denyTakeover(jobId: number, userId: number): Promise<Record<string, never>>;
|
|
80
|
-
export declare function cancelTakeover(jobId: number): Promise<Record<string, never>>;
|
|
81
|
-
export declare function closeJob(jobId: number): Promise<Record<string, never>>;
|
|
44
|
+
export declare function listFeaturedJobs(title: string, page: number, options?: Record<string, unknown>): Promise<JobSearchResult>;
|
|
82
45
|
//# sourceMappingURL=job.d.ts.map
|
package/cjs/api/job.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../../src/api/job.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,QAAQ,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../../src/api/job.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,QAAQ,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,KAAK,eAAe,EAAY,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,QAAQ,EAGd,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,GAAG,GAAG;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,GAAG,SAAS,CA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CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAK/F;AAED,wBAAsB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAK5G;AAED,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAK1F;AAED,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAIrF;AAED,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,kBAAkB,GAC7B,OAAO,CAAC,QAAQ,CAAC,CAKnB;AAED,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,IAAI,GACZ,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAQhC;AAED,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,OAAO,CAAC,eAAe,CAAC,CAE1B"}
|
package/cjs/api/job.js
CHANGED
|
@@ -4,25 +4,18 @@ exports.jobRevivers = void 0;
|
|
|
4
4
|
exports.createJob = createJob;
|
|
5
5
|
exports.getJob = getJob;
|
|
6
6
|
exports.deleteJob = deleteJob;
|
|
7
|
-
exports.restoreJob = restoreJob;
|
|
8
7
|
exports.updateJob = updateJob;
|
|
9
8
|
exports.updateJobFolder = updateJobFolder;
|
|
10
9
|
exports.starJob = starJob;
|
|
11
|
-
exports.privateJob = privateJob;
|
|
12
10
|
exports.resetConvertedJob = resetConvertedJob;
|
|
13
11
|
exports.generateJobShare = generateJobShare;
|
|
14
12
|
exports.uploadJobPreview = uploadJobPreview;
|
|
15
13
|
exports.listFeaturedJobs = listFeaturedJobs;
|
|
16
|
-
exports.openJob = openJob;
|
|
17
|
-
exports.heartbeat = heartbeat;
|
|
18
|
-
exports.requestTakeover = requestTakeover;
|
|
19
|
-
exports.approveTakeover = approveTakeover;
|
|
20
|
-
exports.denyTakeover = denyTakeover;
|
|
21
|
-
exports.cancelTakeover = cancelTakeover;
|
|
22
|
-
exports.closeJob = closeJob;
|
|
23
14
|
const apiCommon_js_1 = require("./apiCommon.js");
|
|
24
15
|
const utils_js_1 = require("../utils.js");
|
|
25
16
|
exports.jobRevivers = {
|
|
17
|
+
description: undefined,
|
|
18
|
+
share_token: undefined,
|
|
26
19
|
autosave_preview_path: undefined,
|
|
27
20
|
jobFolderName: (data) => data.job_folder_name ?? null,
|
|
28
21
|
createdAt: (data) => data.created_at,
|
|
@@ -46,10 +39,6 @@ async function deleteJob(jobId) {
|
|
|
46
39
|
const path = `/v1/jobs/${jobId}`;
|
|
47
40
|
return (0, utils_js_1.request)(path, null, null, { method: 'DELETE' });
|
|
48
41
|
}
|
|
49
|
-
async function restoreJob(jobId) {
|
|
50
|
-
const path = `/v1/jobs/${jobId}`;
|
|
51
|
-
return (0, utils_js_1.request)(path, null, null, { method: 'PUT' });
|
|
52
|
-
}
|
|
53
42
|
async function updateJob(jobId, newTitle) {
|
|
54
43
|
const path = `/v1/jobs/${jobId}`;
|
|
55
44
|
const body = { title: newTitle };
|
|
@@ -65,11 +54,6 @@ async function starJob(jobId, star) {
|
|
|
65
54
|
const body = { star };
|
|
66
55
|
return (0, utils_js_1.request)(path, body, null, { method: 'PATCH' });
|
|
67
56
|
}
|
|
68
|
-
async function privateJob(jobId, privateValue) {
|
|
69
|
-
const path = `/v1/jobs/${jobId}`;
|
|
70
|
-
const body = { private: privateValue };
|
|
71
|
-
return (0, utils_js_1.request)(path, body, null, { method: 'PATCH' });
|
|
72
|
-
}
|
|
73
57
|
async function resetConvertedJob(jobId) {
|
|
74
58
|
const path = `/v1/jobs/${jobId}/reset-converted`;
|
|
75
59
|
return (0, utils_js_1.request)(path, null, null, { method: 'PATCH' });
|
|
@@ -86,29 +70,7 @@ async function uploadJobPreview(jobId, preview) {
|
|
|
86
70
|
body.append('preview', preview);
|
|
87
71
|
return (0, utils_js_1.request)(path, body);
|
|
88
72
|
}
|
|
89
|
-
async function listFeaturedJobs(
|
|
90
|
-
return (0, apiCommon_js_1.listJobs)(`/v1/jobs/featured`,
|
|
91
|
-
}
|
|
92
|
-
async function openJob(jobId) {
|
|
93
|
-
return (0, utils_js_1.request)(`/v1/jobs/${jobId}/open`, null, null, { method: 'POST' });
|
|
94
|
-
}
|
|
95
|
-
async function heartbeat(jobId) {
|
|
96
|
-
// TODO handle disconnections. Throw the right error so we can show a modal in the tool when the connection is down
|
|
97
|
-
return (0, utils_js_1.request)(`/v1/jobs/${jobId}/heartbeat`, null, null, { method: 'POST' });
|
|
98
|
-
}
|
|
99
|
-
async function requestTakeover(jobId) {
|
|
100
|
-
return (0, utils_js_1.request)(`/v1/jobs/${jobId}/takeover/request`, null, null, { method: 'POST' });
|
|
101
|
-
}
|
|
102
|
-
async function approveTakeover(jobId, userId) {
|
|
103
|
-
return (0, utils_js_1.request)(`/v1/jobs/${jobId}/takeover/approve`, { user_id: userId }, null, { method: 'POST' });
|
|
104
|
-
}
|
|
105
|
-
async function denyTakeover(jobId, userId) {
|
|
106
|
-
return (0, utils_js_1.request)(`/v1/jobs/${jobId}/takeover/deny`, { user_id: userId }, null, { method: 'POST' });
|
|
107
|
-
}
|
|
108
|
-
async function cancelTakeover(jobId) {
|
|
109
|
-
return (0, utils_js_1.request)(`/v1/jobs/${jobId}/takeover/cancel`, null, null, { method: 'POST' });
|
|
110
|
-
}
|
|
111
|
-
async function closeJob(jobId) {
|
|
112
|
-
return (0, utils_js_1.request)(`/v1/jobs/${jobId}/close`, null, null, { method: 'POST' });
|
|
73
|
+
async function listFeaturedJobs(title, page, options) {
|
|
74
|
+
return (0, apiCommon_js_1.listJobs)(`/v1/jobs/featured`, title, page, options);
|
|
113
75
|
}
|
|
114
76
|
//# sourceMappingURL=job.js.map
|
package/cjs/api/job.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job.js","sourceRoot":"","sources":["../../src/api/job.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"job.js","sourceRoot":"","sources":["../../src/api/job.ts"],"names":[],"mappings":";;;AA0DA,8BASC;AAED,wBAKC;AAED,8BAIC;AAED,8BAKC;AAED,0CAKC;AAED,0BAKC;AAED,8CAIC;AAED,4CAQC;AAED,4CAWC;AAED,4CAMC;AAzID,iDAAgE;AAChE,0CASqB;AAoCR,QAAA,WAAW,GAA0B;IAChD,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,SAAS;IACtB,qBAAqB,EAAE,SAAS;IAEhC,aAAa,EAAE,CAAC,IAAgB,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,IAAI,IAAI;IACjE,SAAS,EAAE,CAAC,IAAgB,EAAE,EAAE,CAAC,IAAI,CAAC,UAAoB;IAC1D,WAAW,EAAE,CAAC,IAAgB,EAAE,EAAE,CAAC,IAAI,CAAC,qBAAqB,IAAI,SAAS;IAC1E,cAAc,EAAE,CAAC,IAAgB,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,IAAI,IAAI;CACpE,CAAC;AAEK,KAAK,UAAU,SAAS,CAAC,KAAa,EAAE,SAAS,GAAG,CAAC,EAAE,QAAiB;IAC7E,MAAM,IAAI,GAAG,UAAU,CAAC;IACxB,MAAM,IAAI,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,QAAQ,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,EAAE,CAAC;IAC9F,MAAM,OAAO,GAAG,EAAE,QAAQ,EAA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
|
|
1
1
|
import { type Layer } from './layer.js';
|
|
2
2
|
import type Echo from 'laravel-echo';
|
|
3
|
-
import { type ApiCommonData, type ApiError, type ApiSuccess, type Flatten, type Revivers } from '../utils.js';
|
|
3
|
+
import { type ApiCommonData, type ApiError, type ApiSuccess, type Flatten, type Revivers, lastJobRevision } from '../utils.js';
|
|
4
4
|
export type FileFormat = 'jpg' | 'png' | 'svg' | 'pdf' | 'tiff' | 'eps' | 'eps_log' | 'mp4' | 'mov' | 'mkv' | 'mxf' | 'webm' | 'jpg_sequence' | 'png_sequence' | 'web' | 'web_download';
|
|
5
5
|
export type JobRevision = {
|
|
6
6
|
id: number;
|
|
@@ -75,4 +75,7 @@ export type JobRevisionOutput = {
|
|
|
75
75
|
};
|
|
76
76
|
export declare function getJobRevisionOutput(jobId: number): Promise<JobRevisionOutput>;
|
|
77
77
|
export declare function getJobRevisionOutputForBackend(jobId: number, echo: Echo<'reverb'>, signal?: AbortSignal): Promise<JobRevisionOutput>;
|
|
78
|
+
export declare function startJobRevisionSSR(jobId: number, revision?: number | typeof lastJobRevision): Promise<string>;
|
|
79
|
+
export declare function getJobRevisionOutputForSSR(id: number, // jobRevisionId
|
|
80
|
+
echo: Echo<'reverb'>, signal?: AbortSignal, onProgress?: (percent: number) => void): Promise<string>;
|
|
78
81
|
//# sourceMappingURL=jobRevision.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jobRevision.d.ts","sourceRoot":"","sources":["../../src/api/jobRevision.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,KAAK,EAAiB,MAAM,YAAY,CAAC;AAG1E,OAAO,KAAK,IAAI,MAAM,cAAc,CAAC;AACrC,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,OAAO,EAGZ,KAAK,QAAQ,
|
|
1
|
+
{"version":3,"file":"jobRevision.d.ts","sourceRoot":"","sources":["../../src/api/jobRevision.ts"],"names":[],"m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AoB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAIpF;AAgHD,wBAAsB,8BAA8B,CAClD,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,EACpB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,iBAAiB,CAAC,CAS5B;AAED,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,MAAM,EACb,QAAQ,GAAE,MAAM,GAAG,OAAO,eAAiC,GAC1D,OAAO,CAAC,MAAM,CAAC,CAKjB;AAED,wBAAsB,0BAA0B,CAC9C,EAAE,EAAE,MAAM,EAAE,gBAAgB;AAC5B,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,EACpB,MAAM,CAAC,EAAE,WAAW,EACpB,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GACrC,OAAO,CAAC,MAAM,CAAC,CAiCjB"}
|
package/cjs/api/jobRevision.js
CHANGED
|
@@ -11,6 +11,8 @@ exports.listJobRevisionLayers = listJobRevisionLayers;
|
|
|
11
11
|
exports.getJobRevisionOutputUrl = getJobRevisionOutputUrl;
|
|
12
12
|
exports.getJobRevisionOutput = getJobRevisionOutput;
|
|
13
13
|
exports.getJobRevisionOutputForBackend = getJobRevisionOutputForBackend;
|
|
14
|
+
exports.startJobRevisionSSR = startJobRevisionSSR;
|
|
15
|
+
exports.getJobRevisionOutputForSSR = getJobRevisionOutputForSSR;
|
|
14
16
|
const oauth_js_1 = require("../oauth.js");
|
|
15
17
|
const layer_js_1 = require("./layer.js");
|
|
16
18
|
const utils_js_1 = require("../utils.js");
|
|
@@ -23,7 +25,7 @@ async function createJobRevision(jobId, languageCode, mapstyleSetId, layers, out
|
|
|
23
25
|
const body = {
|
|
24
26
|
language_code: languageCode,
|
|
25
27
|
mapstyle_set_id: mapstyleSetId,
|
|
26
|
-
object:
|
|
28
|
+
object: jobObject,
|
|
27
29
|
output,
|
|
28
30
|
layers,
|
|
29
31
|
...skipValidation && { skip_validation: skipValidation },
|
|
@@ -184,4 +186,39 @@ async function getJobRevisionOutputForBackend(jobId, echo, signal) {
|
|
|
184
186
|
}
|
|
185
187
|
return fetchOutput(jobId);
|
|
186
188
|
}
|
|
189
|
+
async function startJobRevisionSSR(jobId, revision = utils_js_1.lastJobRevision) {
|
|
190
|
+
const pathname = `/v1/jobs/${jobId}/revisions/${revision}/build/ssr`;
|
|
191
|
+
const path = `${pathname}?${utils_js_1.deletedNoneParam}`;
|
|
192
|
+
return (0, utils_js_1.request)(path, null, null, { method: 'POST' });
|
|
193
|
+
}
|
|
194
|
+
async function getJobRevisionOutputForSSR(id, // jobRevisionId
|
|
195
|
+
echo, signal, onProgress) {
|
|
196
|
+
signal?.throwIfAborted();
|
|
197
|
+
return new Promise((resolve, reject) => {
|
|
198
|
+
const channel = `ssr.${id}`;
|
|
199
|
+
const onAbort = () => {
|
|
200
|
+
echo.leave(channel);
|
|
201
|
+
reject(signal?.reason);
|
|
202
|
+
};
|
|
203
|
+
const cleanup = () => {
|
|
204
|
+
echo.leave(channel);
|
|
205
|
+
signal?.removeEventListener('abort', onAbort);
|
|
206
|
+
};
|
|
207
|
+
const handler = (event) => {
|
|
208
|
+
if (event.status === 'RUNNING') {
|
|
209
|
+
onProgress?.(0);
|
|
210
|
+
}
|
|
211
|
+
else if (event.status === 'SUCCEEDED' && event.url) {
|
|
212
|
+
cleanup();
|
|
213
|
+
resolve(event.url);
|
|
214
|
+
}
|
|
215
|
+
else if (event.status === 'FAILED' || event.status === 'SUCCEEDED' && !event.url) {
|
|
216
|
+
cleanup();
|
|
217
|
+
reject(new utils_js_1.APIError({ success: false, error: { type: 'API Error', message: event.status } }));
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
signal?.addEventListener('abort', onAbort, { once: true });
|
|
221
|
+
echo.private(channel).listen('.ServerSideRenderingEvent', handler);
|
|
222
|
+
});
|
|
223
|
+
}
|
|
187
224
|
//# sourceMappingURL=jobRevision.js.map
|