@owlmeans/server-job 0.1.18-rc.21 → 0.1.18-rc.23
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/README.md +1 -1
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/server-job/SKILL.md +1 -1
- package/package.json +14 -14
- package/build/consts.d.ts +0 -26
- package/build/consts.d.ts.map +0 -1
- package/build/consts.js +0 -26
- package/build/consts.js.map +0 -1
- package/build/entrypoints.d.ts +0 -20
- package/build/entrypoints.d.ts.map +0 -1
- package/build/entrypoints.js +0 -46
- package/build/entrypoints.js.map +0 -1
- package/build/schemas.d.ts +0 -10
- package/build/schemas.d.ts.map +0 -1
- package/build/schemas.js +0 -17
- package/build/schemas.js.map +0 -1
- package/build/utils/owner.d.ts +0 -33
- package/build/utils/owner.d.ts.map +0 -1
- package/build/utils/owner.js +0 -41
- package/build/utils/owner.js.map +0 -1
- package/build/utils/resource.d.ts +0 -23
- package/build/utils/resource.d.ts.map +0 -1
- package/build/utils/resource.js +0 -28
- package/build/utils/resource.js.map +0 -1
package/README.md
CHANGED
|
@@ -55,7 +55,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
|
|
|
55
55
|
your project's skill store (`.agents/skills/`):
|
|
56
56
|
|
|
57
57
|
```sh
|
|
58
|
-
npx @owlmeans/agent-skills@^0.1.18-rc.
|
|
58
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.36
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
The embedded files are version-matched to this package release. Do not edit them
|
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"package": "@owlmeans/server-job",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-09-
|
|
4
|
+
"version": "0.1.18-rc.23",
|
|
5
|
+
"generatedAt": "2026-09-22T22:22:19.444Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -8,7 +8,7 @@ user-invocable: false
|
|
|
8
8
|
# @owlmeans/server-job
|
|
9
9
|
|
|
10
10
|
**Layer:** Server
|
|
11
|
-
**Install:** `"@owlmeans/server-job": "^0.1.18-rc.
|
|
11
|
+
**Install:** `"@owlmeans/server-job": "^0.1.18-rc.23"` in `dependencies`
|
|
12
12
|
|
|
13
13
|
This package is the boundary between technical `@owlmeans/queue` records and the safe
|
|
14
14
|
`@owlmeans/job` contract. `serveJobEntrypoints` requires a `JobExposurePolicy`; there is no default
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/server-job",
|
|
3
|
-
"version": "0.1.18-rc.
|
|
3
|
+
"version": "0.1.18-rc.23",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -32,18 +32,18 @@
|
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@owlmeans/auth": "^0.1.18-rc.
|
|
36
|
-
"@owlmeans/auth-common": "^0.1.18-rc.
|
|
37
|
-
"@owlmeans/context": "^0.1.18-rc.
|
|
38
|
-
"@owlmeans/entrypoint": "^0.1.18-rc.
|
|
39
|
-
"@owlmeans/job": "^0.1.18-rc.
|
|
40
|
-
"@owlmeans/queue": "^0.1.18-rc.
|
|
41
|
-
"@owlmeans/resource": "^0.1.18-rc.
|
|
42
|
-
"@owlmeans/route": "^0.1.18-rc.
|
|
43
|
-
"@owlmeans/server-api": "^0.1.18-rc.
|
|
44
|
-
"@owlmeans/server-context": "^0.1.18-rc.
|
|
45
|
-
"@owlmeans/server-entrypoint": "^0.1.18-rc.
|
|
46
|
-
"@owlmeans/server-socket": "^0.1.18-rc.
|
|
47
|
-
"@owlmeans/socket": "^0.1.18-rc.
|
|
35
|
+
"@owlmeans/auth": "^0.1.18-rc.34",
|
|
36
|
+
"@owlmeans/auth-common": "^0.1.18-rc.36",
|
|
37
|
+
"@owlmeans/context": "^0.1.18-rc.32",
|
|
38
|
+
"@owlmeans/entrypoint": "^0.1.18-rc.35",
|
|
39
|
+
"@owlmeans/job": "^0.1.18-rc.6",
|
|
40
|
+
"@owlmeans/queue": "^0.1.18-rc.30",
|
|
41
|
+
"@owlmeans/resource": "^0.1.18-rc.34",
|
|
42
|
+
"@owlmeans/route": "^0.1.18-rc.33",
|
|
43
|
+
"@owlmeans/server-api": "^0.1.18-rc.40",
|
|
44
|
+
"@owlmeans/server-context": "^0.1.18-rc.35",
|
|
45
|
+
"@owlmeans/server-entrypoint": "^0.1.18-rc.34",
|
|
46
|
+
"@owlmeans/server-socket": "^0.1.18-rc.43",
|
|
47
|
+
"@owlmeans/socket": "^0.1.18-rc.32"
|
|
48
48
|
}
|
|
49
49
|
}
|
package/build/consts.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The alias root a target app gets when its declaration names none, and the path segment the
|
|
3
|
-
* group answers under.
|
|
4
|
-
*/
|
|
5
|
-
export declare const DEFAULT_JOB_ROOT = "jobs";
|
|
6
|
-
export declare const DEFAULT_JOB_PATH = "/jobs";
|
|
7
|
-
/**
|
|
8
|
-
* Where the owner is recorded inside a job's payload.
|
|
9
|
-
*
|
|
10
|
-
* A `JobRecord` has no owner column — the broker keeps only what the contract declares — so the
|
|
11
|
-
* producer writes the subject into the job's own `data`, and every read here filters on
|
|
12
|
-
* `data.<field>`. Change it per declaration when the app's payloads already name the subject
|
|
13
|
-
* something else.
|
|
14
|
-
*/
|
|
15
|
-
export declare const DEFAULT_OWNER_FIELD = "owner";
|
|
16
|
-
/**
|
|
17
|
-
* The socket event a `JobEvent` frame is pushed under.
|
|
18
|
-
*
|
|
19
|
-
* This name, and the `<root>:<verb>` alias shape in `entrypoints.ts`, are the whole contract
|
|
20
|
-
* between this package and `@owlmeans/client-job` — the two halves cannot share a module without
|
|
21
|
-
* dragging fastify into a browser bundle, so they each state it and the skills pin it.
|
|
22
|
-
*/
|
|
23
|
-
export declare const JOB_EVENT = "job-event";
|
|
24
|
-
/** Newest first: a job list is read to see what is happening now. */
|
|
25
|
-
export declare const DEFAULT_JOB_SORT = "createdAt";
|
|
26
|
-
//# sourceMappingURL=consts.d.ts.map
|
package/build/consts.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,gBAAgB,SAAS,CAAA;AACtC,eAAO,MAAM,gBAAgB,UAAU,CAAA;AAEvC;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,UAAU,CAAA;AAE1C;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,cAAc,CAAA;AAEpC,qEAAqE;AACrE,eAAO,MAAM,gBAAgB,cAAc,CAAA"}
|
package/build/consts.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The alias root a target app gets when its declaration names none, and the path segment the
|
|
3
|
-
* group answers under.
|
|
4
|
-
*/
|
|
5
|
-
export const DEFAULT_JOB_ROOT = 'jobs';
|
|
6
|
-
export const DEFAULT_JOB_PATH = '/jobs';
|
|
7
|
-
/**
|
|
8
|
-
* Where the owner is recorded inside a job's payload.
|
|
9
|
-
*
|
|
10
|
-
* A `JobRecord` has no owner column — the broker keeps only what the contract declares — so the
|
|
11
|
-
* producer writes the subject into the job's own `data`, and every read here filters on
|
|
12
|
-
* `data.<field>`. Change it per declaration when the app's payloads already name the subject
|
|
13
|
-
* something else.
|
|
14
|
-
*/
|
|
15
|
-
export const DEFAULT_OWNER_FIELD = 'owner';
|
|
16
|
-
/**
|
|
17
|
-
* The socket event a `JobEvent` frame is pushed under.
|
|
18
|
-
*
|
|
19
|
-
* This name, and the `<root>:<verb>` alias shape in `entrypoints.ts`, are the whole contract
|
|
20
|
-
* between this package and `@owlmeans/client-job` — the two halves cannot share a module without
|
|
21
|
-
* dragging fastify into a browser bundle, so they each state it and the skills pin it.
|
|
22
|
-
*/
|
|
23
|
-
export const JOB_EVENT = 'job-event';
|
|
24
|
-
/** Newest first: a job list is read to see what is happening now. */
|
|
25
|
-
export const DEFAULT_JOB_SORT = 'createdAt';
|
|
26
|
-
//# sourceMappingURL=consts.js.map
|
package/build/consts.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAA;AACtC,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAA;AAEvC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAA;AAE1C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAA;AAEpC,qEAAqE;AACrE,MAAM,CAAC,MAAM,gBAAgB,GAAG,WAAW,CAAA"}
|
package/build/entrypoints.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { JobEntrypointAliases, JobEntrypoints, JobEntrypointOptions } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* The aliases one job group answers under.
|
|
4
|
-
*
|
|
5
|
-
* The shape — `<root>` and `<root>:<verb>` — is the contract `@owlmeans/client-job` addresses the
|
|
6
|
-
* same group by, so a group renamed here is renamed there by passing the same root.
|
|
7
|
-
*/
|
|
8
|
-
export declare const jobEntrypointAliases: (root: string) => JobEntrypointAliases;
|
|
9
|
-
/**
|
|
10
|
-
* Declare the list/get/cancel/watch entrypoints of one job group.
|
|
11
|
-
*
|
|
12
|
-
* It belongs in the SHARED package of a target app — the one both the API and the browser import —
|
|
13
|
-
* so that the server binds and the client calls the very declarations, and neither side ever
|
|
14
|
-
* writes a path. Declaring a second group is the same call with another root.
|
|
15
|
-
*
|
|
16
|
-
* The guard rides on the base alone: guards are inherited, so stating it once is what keeps the
|
|
17
|
-
* four from drifting apart.
|
|
18
|
-
*/
|
|
19
|
-
export declare const declareJobEntrypoints: (root: string, opts?: JobEntrypointOptions) => JobEntrypoints;
|
|
20
|
-
//# sourceMappingURL=entrypoints.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entrypoints.d.ts","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,oBAAoB,EAAgB,MAAM,YAAY,CAAA;AAE1G;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,SAAU,MAAM,KAAG,oBAMlD,CAAA;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,SAC1B,MAAM,SAAS,oBAAoB,KACxC,cA0BF,CAAA"}
|
package/build/entrypoints.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { contract, openProtocol, protocol, typed } from '@owlmeans/entrypoint';
|
|
2
|
-
import { backend, route, RouteMethod, socket } from '@owlmeans/route';
|
|
3
|
-
import { DEFAULT_GUARD } from '@owlmeans/auth-common';
|
|
4
|
-
import { DEFAULT_JOB_PATH } from './consts.js';
|
|
5
|
-
import { JobListQuerySchema } from './schemas.js';
|
|
6
|
-
/**
|
|
7
|
-
* The aliases one job group answers under.
|
|
8
|
-
*
|
|
9
|
-
* The shape — `<root>` and `<root>:<verb>` — is the contract `@owlmeans/client-job` addresses the
|
|
10
|
-
* same group by, so a group renamed here is renamed there by passing the same root.
|
|
11
|
-
*/
|
|
12
|
-
export const jobEntrypointAliases = (root) => ({
|
|
13
|
-
base: root,
|
|
14
|
-
list: `${root}:list`,
|
|
15
|
-
get: `${root}:get`,
|
|
16
|
-
cancel: `${root}:cancel`,
|
|
17
|
-
watch: `${root}:watch`,
|
|
18
|
-
});
|
|
19
|
-
/**
|
|
20
|
-
* Declare the list/get/cancel/watch entrypoints of one job group.
|
|
21
|
-
*
|
|
22
|
-
* It belongs in the SHARED package of a target app — the one both the API and the browser import —
|
|
23
|
-
* so that the server binds and the client calls the very declarations, and neither side ever
|
|
24
|
-
* writes a path. Declaring a second group is the same call with another root.
|
|
25
|
-
*
|
|
26
|
-
* The guard rides on the base alone: guards are inherited, so stating it once is what keeps the
|
|
27
|
-
* four from drifting apart.
|
|
28
|
-
*/
|
|
29
|
-
export const declareJobEntrypoints = (root, opts) => {
|
|
30
|
-
const aliases = jobEntrypointAliases(root);
|
|
31
|
-
const base = {
|
|
32
|
-
...(opts?.parent != null ? { parent: opts.parent } : {}),
|
|
33
|
-
...(opts?.service != null ? { service: opts.service } : {}),
|
|
34
|
-
};
|
|
35
|
-
const guarded = opts?.guard === null ? undefined : { guards: opts?.guard ?? DEFAULT_GUARD };
|
|
36
|
-
return {
|
|
37
|
-
base: openProtocol(route(aliases.base, opts?.path ?? DEFAULT_JOB_PATH, backend(base)), guarded),
|
|
38
|
-
list: protocol(route(aliases.list, '/', backend(aliases.base)), contract.request({ query: typed(JobListQuerySchema) }, typed())),
|
|
39
|
-
// Static before parametric, so `/watch` is not swallowed by `/:id`. The router picks the
|
|
40
|
-
// static branch on its own; the order here is for whoever reads the declaration.
|
|
41
|
-
watch: protocol(route(aliases.watch, '/watch', socket(aliases.base)), contract(typed())),
|
|
42
|
-
get: protocol(route(aliases.get, '/:id', backend(aliases.base)), contract.request({ params: typed() }, typed())),
|
|
43
|
-
cancel: protocol(route(aliases.cancel, '/:id', backend(aliases.base, RouteMethod.DELETE)), contract.request({ params: typed() }, typed())),
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
//# sourceMappingURL=entrypoints.js.map
|
package/build/entrypoints.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entrypoints.js","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"AAAA,OAAO,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ional: a list screen opens before it has a filter, and a caller that knows
|
|
5
|
-
* nothing about jobs must still get the page it is allowed to see. `state` and `name` are left as
|
|
6
|
-
* plain strings rather than enums so that a driver reporting a state this line does not know
|
|
7
|
-
* narrows the list instead of failing the request.
|
|
8
|
-
*/
|
|
9
|
-
export declare const JobListQuerySchema: JSONSchemaType<JobListQuery>;
|
|
10
|
-
//# sourceMappingURL=schemas.d.ts.map
|
package/build/schemas.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAAC,YAAY,CAS3D,CAAA"}
|
package/build/schemas.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Every field is optional: a list screen opens before it has a filter, and a caller that knows
|
|
3
|
-
* nothing about jobs must still get the page it is allowed to see. `state` and `name` are left as
|
|
4
|
-
* plain strings rather than enums so that a driver reporting a state this line does not know
|
|
5
|
-
* narrows the list instead of failing the request.
|
|
6
|
-
*/
|
|
7
|
-
export const JobListQuerySchema = {
|
|
8
|
-
type: 'object',
|
|
9
|
-
properties: {
|
|
10
|
-
state: { type: 'string', maxLength: 32, nullable: true },
|
|
11
|
-
name: { type: 'string', maxLength: 256, nullable: true },
|
|
12
|
-
page: { type: 'integer', minimum: 0, nullable: true },
|
|
13
|
-
size: { type: 'integer', minimum: 1, maximum: 200, nullable: true },
|
|
14
|
-
},
|
|
15
|
-
additionalProperties: true,
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=schemas.js.map
|
package/build/schemas.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAiC;IAC9D,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;QACxD,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE;QACxD,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;QACrD,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE;KACpE;IACD,oBAAoB,EAAE,IAAI;CAC3B,CAAA"}
|
package/build/utils/owner.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { BasicConfig, BasicContext } from '@owlmeans/context';
|
|
2
|
-
import type { AbstractRequest } from '@owlmeans/entrypoint';
|
|
3
|
-
import type { Criteria } from '@owlmeans/resource';
|
|
4
|
-
import type { JobRecord } from '@owlmeans/queue';
|
|
5
|
-
import type { JobHandlerOptions } from '../types.js';
|
|
6
|
-
/**
|
|
7
|
-
* The subject a job is attributed to.
|
|
8
|
-
*
|
|
9
|
-
* Profile first, user second — the same pair `@owlmeans/server-socket` addresses a connection by,
|
|
10
|
-
* so a job enqueued for one profile of a multi-profile account is not visible to the others.
|
|
11
|
-
*/
|
|
12
|
-
export declare const jobOwnerOf: (req: AbstractRequest) => string | undefined;
|
|
13
|
-
/**
|
|
14
|
-
* @throws {AuthorizationError} when the request carries no authenticated subject.
|
|
15
|
-
*/
|
|
16
|
-
export declare const requireJobOwner: (req: AbstractRequest) => string;
|
|
17
|
-
export declare const ownerFieldOf: (opts?: JobHandlerOptions) => string;
|
|
18
|
-
/** What one record says its owner is — the payload's own field, never a broker one. */
|
|
19
|
-
export declare const ownerOf: (record: JobRecord, opts?: JobHandlerOptions) => unknown;
|
|
20
|
-
/**
|
|
21
|
-
* Who this request reads the queue as: the owner every record must name, or `undefined` for a
|
|
22
|
-
* request that reads it unscoped.
|
|
23
|
-
*
|
|
24
|
-
* `undefined` is reachable only through {@link JobHandlerOptions.admin}. Absent an admin check
|
|
25
|
-
* every read is narrowed to the caller's own jobs and an anonymous request is refused, so a group
|
|
26
|
-
* wired with no options at all is scoped rather than open.
|
|
27
|
-
*
|
|
28
|
-
* @throws {AuthorizationError}
|
|
29
|
-
*/
|
|
30
|
-
export declare const jobViewer: <C extends BasicConfig, T extends BasicContext<C>>(req: AbstractRequest, ctx: T, opts?: JobHandlerOptions) => Promise<string | undefined>;
|
|
31
|
-
/** The criteria one viewer reads the queue through; nothing to add when they read it unscoped. */
|
|
32
|
-
export declare const jobScope: (viewer: string | undefined, opts?: JobHandlerOptions) => Criteria<JobRecord>;
|
|
33
|
-
//# sourceMappingURL=owner.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"owner.d.ts","sourceRoot":"","sources":["../../src/utils/owner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAE3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEhD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAEpD;;;;;GAKG;AACH,eAAO,MAAM,UAAU,QAAS,eAAe,KAAG,MAAM,GAAG,SAClB,CAAA;AAEzC;;GAEG;AACH,eAAO,MAAM,eAAe,QAAS,eAAe,KAAG,MAOtD,CAAA;AAED,eAAO,MAAM,YAAY,UAAW,iBAAiB,KAAG,MACf,CAAA;AAEzC,uFAAuF;AACvF,eAAO,MAAM,OAAO,WAAY,SAAS,SAAS,iBAAiB,KAAG,OACM,CAAA;AAE5E;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,GAAU,CAAC,SAAS,WAAW,EAAE,CAAC,SAAS,YAAY,CAAC,CAAC,CAAC,OACzE,eAAe,OAAO,CAAC,SAAS,iBAAiB,KACrD,OAAO,CAAC,MAAM,GAAG,SAAS,CAM5B,CAAA;AAED,kGAAkG;AAClG,eAAO,MAAM,QAAQ,WACX,MAAM,GAAG,SAAS,SAAS,iBAAiB,KACnD,QAAQ,CAAC,SAAS,CAAqE,CAAA"}
|
package/build/utils/owner.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { AuthorizationError } from '@owlmeans/auth';
|
|
2
|
-
import { DEFAULT_OWNER_FIELD } from '../consts.js';
|
|
3
|
-
/**
|
|
4
|
-
* The subject a job is attributed to.
|
|
5
|
-
*
|
|
6
|
-
* Profile first, user second — the same pair `@owlmeans/server-socket` addresses a connection by,
|
|
7
|
-
* so a job enqueued for one profile of a multi-profile account is not visible to the others.
|
|
8
|
-
*/
|
|
9
|
-
export const jobOwnerOf = (req) => req.auth?.profileId ?? req.auth?.userId;
|
|
10
|
-
/**
|
|
11
|
-
* @throws {AuthorizationError} when the request carries no authenticated subject.
|
|
12
|
-
*/
|
|
13
|
-
export const requireJobOwner = (req) => {
|
|
14
|
-
const owner = jobOwnerOf(req);
|
|
15
|
-
if (owner == null || owner === '') {
|
|
16
|
-
throw new AuthorizationError();
|
|
17
|
-
}
|
|
18
|
-
return owner;
|
|
19
|
-
};
|
|
20
|
-
export const ownerFieldOf = (opts) => opts?.ownerField ?? DEFAULT_OWNER_FIELD;
|
|
21
|
-
/** What one record says its owner is — the payload's own field, never a broker one. */
|
|
22
|
-
export const ownerOf = (record, opts) => record.data?.[ownerFieldOf(opts)];
|
|
23
|
-
/**
|
|
24
|
-
* Who this request reads the queue as: the owner every record must name, or `undefined` for a
|
|
25
|
-
* request that reads it unscoped.
|
|
26
|
-
*
|
|
27
|
-
* `undefined` is reachable only through {@link JobHandlerOptions.admin}. Absent an admin check
|
|
28
|
-
* every read is narrowed to the caller's own jobs and an anonymous request is refused, so a group
|
|
29
|
-
* wired with no options at all is scoped rather than open.
|
|
30
|
-
*
|
|
31
|
-
* @throws {AuthorizationError}
|
|
32
|
-
*/
|
|
33
|
-
export const jobViewer = async (req, ctx, opts) => {
|
|
34
|
-
if (opts?.admin != null && await opts.admin(req, ctx)) {
|
|
35
|
-
return undefined;
|
|
36
|
-
}
|
|
37
|
-
return requireJobOwner(req);
|
|
38
|
-
};
|
|
39
|
-
/** The criteria one viewer reads the queue through; nothing to add when they read it unscoped. */
|
|
40
|
-
export const jobScope = (viewer, opts) => viewer == null ? {} : { [`data.${ownerFieldOf(opts)}`]: viewer };
|
|
41
|
-
//# sourceMappingURL=owner.js.map
|
package/build/utils/owner.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"owner.js","sourceRoot":"","sources":["../../src/utils/owner.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAGnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAGlD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAAoB,EAAsB,EAAE,CACrE,GAAG,CAAC,IAAI,EAAE,SAAS,IAAI,GAAG,CAAC,IAAI,EAAE,MAAM,CAAA;AAEzC;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAoB,EAAU,EAAE;IAC9D,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,CAAA;IAC7B,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QAClC,MAAM,IAAI,kBAAkB,EAAE,CAAA;IAChC,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAwB,EAAU,EAAE,CAC/D,IAAI,EAAE,UAAU,IAAI,mBAAmB,CAAA;AAEzC,uFAAuF;AACvF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,MAAiB,EAAE,IAAwB,EAAW,EAAE,CAC7E,MAAM,CAAC,IAA4C,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAA;AAE5E;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAC5B,GAAoB,EAAE,GAAM,EAAE,IAAwB,EACzB,EAAE;IAC/B,IAAI,IAAI,EAAE,KAAK,IAAI,IAAI,IAAI,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,GAAgC,CAAC,EAAE,CAAC;QACnF,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,OAAO,eAAe,CAAC,GAAG,CAAC,CAAA;AAC7B,CAAC,CAAA;AAED,kGAAkG;AAClG,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,MAA0B,EAAE,IAAwB,EAC/B,EAAE,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAA"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { BasicConfig, BasicContext } from '@owlmeans/context';
|
|
2
|
-
import type { JobRecord, QueueResource } from '@owlmeans/queue';
|
|
3
|
-
import type { JobHandlerOptions } from '../types.js';
|
|
4
|
-
/**
|
|
5
|
-
* The queue these handlers read.
|
|
6
|
-
*
|
|
7
|
-
* Named by the declaration or, with nothing named, the context's sole declared queue — which
|
|
8
|
-
* `ctx.jobs()` refuses to guess once a second queue exists, so an app that grows one is told to
|
|
9
|
-
* name it rather than quietly served the wrong backlog.
|
|
10
|
-
*/
|
|
11
|
-
export declare const jobsOf: <D = unknown, R = unknown>(ctx: BasicContext<BasicConfig>, opts?: JobHandlerOptions) => QueueResource<D, R>;
|
|
12
|
-
/** Does this viewer own that record? An unscoped viewer (`undefined`) owns everything. */
|
|
13
|
-
export declare const owns: (record: JobRecord, viewer: string | undefined, opts?: JobHandlerOptions) => boolean;
|
|
14
|
-
/**
|
|
15
|
-
* One job, as this viewer is allowed to see it.
|
|
16
|
-
*
|
|
17
|
-
* A job that exists but belongs to someone else answers exactly as an absent one does: telling an
|
|
18
|
-
* unauthorized caller apart from a wrong id is what turns an id space into an enumeration oracle.
|
|
19
|
-
*
|
|
20
|
-
* @throws {UnknownJob}
|
|
21
|
-
*/
|
|
22
|
-
export declare const readOwnedJob: <D = unknown, R = unknown>(resource: QueueResource<D, R>, id: string, viewer: string | undefined, opts?: JobHandlerOptions) => Promise<JobRecord<D, R>>;
|
|
23
|
-
//# sourceMappingURL=resource.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../src/utils/resource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/D,OAAO,KAAK,EAAW,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAG7D;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,GAAI,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,OACxC,YAAY,CAAC,WAAW,CAAC,SAAS,iBAAiB,KACvD,aAAa,CAAC,CAAC,EAAE,CAAC,CAAwD,CAAA;AAE7E,0FAA0F;AAC1F,eAAO,MAAM,IAAI,WACP,SAAS,UAAU,MAAM,GAAG,SAAS,SAAS,iBAAiB,KACtE,OAA6D,CAAA;AAEhE;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GAAU,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,YAC/C,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,MAAM,UAAU,MAAM,GAAG,SAAS,SAAS,iBAAiB,KAC9F,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAOzB,CAAA"}
|
package/build/utils/resource.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { UnknownJob } from '@owlmeans/queue';
|
|
2
|
-
import { ownerOf } from './owner.js';
|
|
3
|
-
/**
|
|
4
|
-
* The queue these handlers read.
|
|
5
|
-
*
|
|
6
|
-
* Named by the declaration or, with nothing named, the context's sole declared queue — which
|
|
7
|
-
* `ctx.jobs()` refuses to guess once a second queue exists, so an app that grows one is told to
|
|
8
|
-
* name it rather than quietly served the wrong backlog.
|
|
9
|
-
*/
|
|
10
|
-
export const jobsOf = (ctx, opts) => ctx.jobs(opts?.queue);
|
|
11
|
-
/** Does this viewer own that record? An unscoped viewer (`undefined`) owns everything. */
|
|
12
|
-
export const owns = (record, viewer, opts) => viewer == null || ownerOf(record, opts) === viewer;
|
|
13
|
-
/**
|
|
14
|
-
* One job, as this viewer is allowed to see it.
|
|
15
|
-
*
|
|
16
|
-
* A job that exists but belongs to someone else answers exactly as an absent one does: telling an
|
|
17
|
-
* unauthorized caller apart from a wrong id is what turns an id space into an enumeration oracle.
|
|
18
|
-
*
|
|
19
|
-
* @throws {UnknownJob}
|
|
20
|
-
*/
|
|
21
|
-
export const readOwnedJob = async (resource, id, viewer, opts) => {
|
|
22
|
-
const record = await resource.load(id);
|
|
23
|
-
if (record == null || !owns(record, viewer, opts)) {
|
|
24
|
-
throw new UnknownJob(`${resource.queue}:${id}`);
|
|
25
|
-
}
|
|
26
|
-
return record;
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=resource.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resource.js","sourceRoot":"","sources":["../../src/utils/resource.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEpC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,GAA8B,EAAE,IAAwB,EACnC,EAAE,CAAE,GAA0B,CAAC,IAAI,CAAO,IAAI,EAAE,KAAK,CAAC,CAAA;AAE7E,0FAA0F;AAC1F,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,MAAiB,EAAE,MAA0B,EAAE,IAAwB,EAC9D,EAAE,CAAC,MAAM,IAAI,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,MAAM,CAAA;AAEhE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAC/B,QAA6B,EAAE,EAAU,EAAE,MAA0B,EAAE,IAAwB,EACrE,EAAE;IAC5B,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACtC,IAAI,MAAM,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;QAClD,MAAM,IAAI,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC,CAAA;IACjD,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
|