@geonosis/document 0.9.1 → 0.9.2
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/CHANGELOG.md +10 -0
- package/dist/core/actor.cjs +48 -0
- package/dist/core/actor.d.cts +3 -0
- package/dist/core/actor.d.ts +3 -0
- package/dist/core/actor.js +8 -0
- package/dist/core/body-version.cjs +75 -0
- package/dist/core/body-version.d.cts +25 -0
- package/dist/core/body-version.d.ts +25 -0
- package/dist/core/body-version.js +35 -0
- package/dist/core/canonical.cjs +55 -0
- package/dist/core/canonical.d.cts +5 -0
- package/dist/core/canonical.d.ts +5 -0
- package/dist/core/canonical.js +15 -0
- package/dist/core/document.cjs +136 -0
- package/dist/core/document.d.cts +137 -0
- package/dist/core/document.d.ts +137 -0
- package/dist/core/document.js +96 -0
- package/dist/core/entities.cjs +68 -0
- package/dist/core/entities.d.cts +42 -0
- package/dist/core/entities.d.ts +42 -0
- package/dist/core/entities.js +28 -0
- package/dist/core/naming.cjs +56 -0
- package/dist/core/naming.d.cts +17 -0
- package/dist/core/naming.d.ts +17 -0
- package/dist/core/naming.js +16 -0
- package/dist/core/numbering.cjs +41 -0
- package/dist/core/numbering.d.cts +12 -0
- package/dist/core/numbering.d.ts +12 -0
- package/dist/core/numbering.js +0 -0
- package/dist/core/ports.cjs +41 -0
- package/dist/core/ports.d.cts +29 -0
- package/dist/core/ports.d.ts +29 -0
- package/dist/core/ports.js +0 -0
- package/dist/core/schema.cjs +173 -0
- package/dist/core/schema.d.cts +33 -0
- package/dist/core/schema.d.ts +33 -0
- package/dist/{chunk-NA3DLROL.js → core/schema.js} +34 -72
- package/dist/core/status.cjs +47 -0
- package/dist/core/status.d.cts +8 -0
- package/dist/core/status.d.ts +8 -0
- package/dist/core/status.js +7 -0
- package/dist/index.cjs +70 -398
- package/dist/index.d.cts +11 -32
- package/dist/index.d.ts +11 -32
- package/dist/index.js +13 -25
- package/dist/store/ddl.cjs +209 -0
- package/dist/store/ddl.d.cts +56 -0
- package/dist/store/ddl.d.ts +56 -0
- package/dist/store/ddl.js +175 -0
- package/dist/store/hash.cjs +50 -0
- package/dist/store/hash.d.cts +2 -0
- package/dist/store/hash.d.ts +2 -0
- package/dist/store/hash.js +10 -0
- package/dist/store/store.cjs +606 -0
- package/dist/store/store.d.cts +169 -0
- package/dist/store/store.d.ts +169 -0
- package/dist/store/store.js +578 -0
- package/dist/store.cjs +51 -1358
- package/dist/store.d.cts +4 -277
- package/dist/store.d.ts +4 -277
- package/dist/store.js +17 -1114
- package/dist/surface/table.cjs +326 -0
- package/dist/surface/table.d.cts +70 -0
- package/dist/surface/table.d.ts +70 -0
- package/dist/surface/table.js +296 -0
- package/dist/workflows/document-workflows.cjs +314 -0
- package/dist/workflows/document-workflows.d.cts +112 -0
- package/dist/workflows/document-workflows.d.ts +112 -0
- package/dist/workflows/document-workflows.js +281 -0
- package/dist/workflows/effects.cjs +41 -0
- package/dist/workflows/effects.d.cts +68 -0
- package/dist/workflows/effects.d.ts +68 -0
- package/dist/workflows/effects.js +0 -0
- package/dist/workflows/ports.cjs +50 -0
- package/dist/workflows/ports.d.cts +72 -0
- package/dist/workflows/ports.d.ts +72 -0
- package/dist/workflows/ports.js +10 -0
- package/dist/workflows/refusals.cjs +80 -0
- package/dist/workflows/refusals.d.cts +59 -0
- package/dist/workflows/refusals.d.ts +59 -0
- package/dist/workflows/refusals.js +40 -0
- package/dist/workflows.cjs +52 -504
- package/dist/workflows.d.cts +4 -310
- package/dist/workflows.d.ts +4 -310
- package/dist/workflows.js +21 -368
- package/package.json +8 -8
- package/dist/chunk-A6ZU4QU3.js +0 -171
- package/dist/entities-DTNJMeVf.d.cts +0 -205
- package/dist/entities-DTNJMeVf.d.ts +0 -205
- package/dist/ports-C_OfflMQ.d.cts +0 -66
- package/dist/ports-C_OfflMQ.d.ts +0 -66
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
function __accessProp(key) {
|
|
6
|
+
return this[key];
|
|
7
|
+
}
|
|
8
|
+
var __toCommonJS = (from) => {
|
|
9
|
+
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
10
|
+
if (entry)
|
|
11
|
+
return entry;
|
|
12
|
+
entry = __defProp({}, "__esModule", { value: true });
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (var key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(entry, key))
|
|
16
|
+
__defProp(entry, key, {
|
|
17
|
+
get: __accessProp.bind(from, key),
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
__moduleCache.set(from, entry);
|
|
22
|
+
return entry;
|
|
23
|
+
};
|
|
24
|
+
var __moduleCache;
|
|
25
|
+
var __returnValue = (v) => v;
|
|
26
|
+
function __exportSetter(name, newValue) {
|
|
27
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
28
|
+
}
|
|
29
|
+
var __export = (target, all) => {
|
|
30
|
+
for (var name in all)
|
|
31
|
+
__defProp(target, name, {
|
|
32
|
+
get: all[name],
|
|
33
|
+
enumerable: true,
|
|
34
|
+
configurable: true,
|
|
35
|
+
set: __exportSetter.bind(all, name)
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// src/workflows/ports.ts
|
|
40
|
+
var exports_ports = {};
|
|
41
|
+
__export(exports_ports, {
|
|
42
|
+
MAIL_UNDELIVERED_TAG: () => MAIL_UNDELIVERED_TAG,
|
|
43
|
+
MailUndelivered: () => MailUndelivered
|
|
44
|
+
});
|
|
45
|
+
module.exports = __toCommonJS(exports_ports);
|
|
46
|
+
var import_better_result = require("better-result");
|
|
47
|
+
var MAIL_UNDELIVERED_TAG = "DocumentMailUndelivered";
|
|
48
|
+
|
|
49
|
+
class MailUndelivered extends (/* @__PURE__ */ import_better_result.TaggedError(MAIL_UNDELIVERED_TAG)) {
|
|
50
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { type Result } from 'better-result';
|
|
2
|
+
export declare const MAIL_UNDELIVERED_TAG = "DocumentMailUndelivered";
|
|
3
|
+
declare const MailUndelivered_base: import("better-result").TaggedErrorClass<"DocumentMailUndelivered">;
|
|
4
|
+
/**
|
|
5
|
+
* What a mail port answers with when the message did not leave; the step it runs in fails on it.
|
|
6
|
+
* `TaggedError` is aliased the way observability aliases it: oxlint reads the bare call as an
|
|
7
|
+
* error thrown without `new`.
|
|
8
|
+
*/
|
|
9
|
+
export declare class MailUndelivered extends /* @__PURE__ */ MailUndelivered_base<{
|
|
10
|
+
to: string;
|
|
11
|
+
cause: unknown;
|
|
12
|
+
}> {
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* One entity's rows, bound to the run's organisation by the host: `stepsOf` over a store door is
|
|
16
|
+
* the shape, so every call is a journalled step in a durable run. `body` is `never` on purpose —
|
|
17
|
+
* the factory writes what the entity decided and a door typed to one body still fits.
|
|
18
|
+
*/
|
|
19
|
+
export type DocumentDoorPort = {
|
|
20
|
+
get: (params: {
|
|
21
|
+
ref: string;
|
|
22
|
+
}) => Promise<{
|
|
23
|
+
body: unknown;
|
|
24
|
+
} | null>;
|
|
25
|
+
commit: (params: {
|
|
26
|
+
actor: string;
|
|
27
|
+
body: never;
|
|
28
|
+
ref: string;
|
|
29
|
+
}) => Promise<unknown>;
|
|
30
|
+
retire: (params: {
|
|
31
|
+
actor: string;
|
|
32
|
+
ref: string;
|
|
33
|
+
}) => Promise<unknown>;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* What a host answers the generic body with. Three are the host's alone — its doors, its links,
|
|
37
|
+
* its mail — and the rest default: `counter` is asked for only by an entity numbered from one,
|
|
38
|
+
* `actor` reads a string `actor` off the context or names the system, `guard` allows, `now` is
|
|
39
|
+
* the clock, and `seed` refuses a template. Plain functions — the factory makes the steps of the
|
|
40
|
+
* two that reach the outside world, so the durable-body law holds on every host.
|
|
41
|
+
*/
|
|
42
|
+
export type DocumentWorkflowPorts<Ctx> = {
|
|
43
|
+
door: (ctx: Ctx, entity: string) => DocumentDoorPort;
|
|
44
|
+
link: (ctx: Ctx, link: {
|
|
45
|
+
entity: string;
|
|
46
|
+
ref: string;
|
|
47
|
+
now: number;
|
|
48
|
+
ttlDays?: number;
|
|
49
|
+
}) => Promise<{
|
|
50
|
+
token: string;
|
|
51
|
+
url: string;
|
|
52
|
+
expiresAt: number;
|
|
53
|
+
ttlDays: number;
|
|
54
|
+
}>;
|
|
55
|
+
mail: (ctx: Ctx, mail: {
|
|
56
|
+
to: string;
|
|
57
|
+
subject: string;
|
|
58
|
+
text: string;
|
|
59
|
+
}) => Promise<Result<void, MailUndelivered>>;
|
|
60
|
+
actor?: (ctx: Ctx, workflowName: string) => string;
|
|
61
|
+
counter?: (ctx: Ctx, key: string) => Promise<{
|
|
62
|
+
number: number;
|
|
63
|
+
}>;
|
|
64
|
+
guard?: (ctx: Ctx) => Promise<unknown>;
|
|
65
|
+
now?: () => string;
|
|
66
|
+
seed?: (ctx: Ctx, seeding: {
|
|
67
|
+
entity: string;
|
|
68
|
+
templateId: string | undefined;
|
|
69
|
+
input: Record<string, unknown>;
|
|
70
|
+
}) => Promise<Record<string, unknown>>;
|
|
71
|
+
};
|
|
72
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { type Result } from 'better-result';
|
|
2
|
+
export declare const MAIL_UNDELIVERED_TAG = "DocumentMailUndelivered";
|
|
3
|
+
declare const MailUndelivered_base: import("better-result").TaggedErrorClass<"DocumentMailUndelivered">;
|
|
4
|
+
/**
|
|
5
|
+
* What a mail port answers with when the message did not leave; the step it runs in fails on it.
|
|
6
|
+
* `TaggedError` is aliased the way observability aliases it: oxlint reads the bare call as an
|
|
7
|
+
* error thrown without `new`.
|
|
8
|
+
*/
|
|
9
|
+
export declare class MailUndelivered extends /* @__PURE__ */ MailUndelivered_base<{
|
|
10
|
+
to: string;
|
|
11
|
+
cause: unknown;
|
|
12
|
+
}> {
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* One entity's rows, bound to the run's organisation by the host: `stepsOf` over a store door is
|
|
16
|
+
* the shape, so every call is a journalled step in a durable run. `body` is `never` on purpose —
|
|
17
|
+
* the factory writes what the entity decided and a door typed to one body still fits.
|
|
18
|
+
*/
|
|
19
|
+
export type DocumentDoorPort = {
|
|
20
|
+
get: (params: {
|
|
21
|
+
ref: string;
|
|
22
|
+
}) => Promise<{
|
|
23
|
+
body: unknown;
|
|
24
|
+
} | null>;
|
|
25
|
+
commit: (params: {
|
|
26
|
+
actor: string;
|
|
27
|
+
body: never;
|
|
28
|
+
ref: string;
|
|
29
|
+
}) => Promise<unknown>;
|
|
30
|
+
retire: (params: {
|
|
31
|
+
actor: string;
|
|
32
|
+
ref: string;
|
|
33
|
+
}) => Promise<unknown>;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* What a host answers the generic body with. Three are the host's alone — its doors, its links,
|
|
37
|
+
* its mail — and the rest default: `counter` is asked for only by an entity numbered from one,
|
|
38
|
+
* `actor` reads a string `actor` off the context or names the system, `guard` allows, `now` is
|
|
39
|
+
* the clock, and `seed` refuses a template. Plain functions — the factory makes the steps of the
|
|
40
|
+
* two that reach the outside world, so the durable-body law holds on every host.
|
|
41
|
+
*/
|
|
42
|
+
export type DocumentWorkflowPorts<Ctx> = {
|
|
43
|
+
door: (ctx: Ctx, entity: string) => DocumentDoorPort;
|
|
44
|
+
link: (ctx: Ctx, link: {
|
|
45
|
+
entity: string;
|
|
46
|
+
ref: string;
|
|
47
|
+
now: number;
|
|
48
|
+
ttlDays?: number;
|
|
49
|
+
}) => Promise<{
|
|
50
|
+
token: string;
|
|
51
|
+
url: string;
|
|
52
|
+
expiresAt: number;
|
|
53
|
+
ttlDays: number;
|
|
54
|
+
}>;
|
|
55
|
+
mail: (ctx: Ctx, mail: {
|
|
56
|
+
to: string;
|
|
57
|
+
subject: string;
|
|
58
|
+
text: string;
|
|
59
|
+
}) => Promise<Result<void, MailUndelivered>>;
|
|
60
|
+
actor?: (ctx: Ctx, workflowName: string) => string;
|
|
61
|
+
counter?: (ctx: Ctx, key: string) => Promise<{
|
|
62
|
+
number: number;
|
|
63
|
+
}>;
|
|
64
|
+
guard?: (ctx: Ctx) => Promise<unknown>;
|
|
65
|
+
now?: () => string;
|
|
66
|
+
seed?: (ctx: Ctx, seeding: {
|
|
67
|
+
entity: string;
|
|
68
|
+
templateId: string | undefined;
|
|
69
|
+
input: Record<string, unknown>;
|
|
70
|
+
}) => Promise<Record<string, unknown>>;
|
|
71
|
+
};
|
|
72
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// src/workflows/ports.ts
|
|
2
|
+
import { TaggedError as tagged } from "better-result";
|
|
3
|
+
var MAIL_UNDELIVERED_TAG = "DocumentMailUndelivered";
|
|
4
|
+
|
|
5
|
+
class MailUndelivered extends (/* @__PURE__ */ tagged(MAIL_UNDELIVERED_TAG)) {
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
MAIL_UNDELIVERED_TAG,
|
|
9
|
+
MailUndelivered
|
|
10
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
function __accessProp(key) {
|
|
6
|
+
return this[key];
|
|
7
|
+
}
|
|
8
|
+
var __toCommonJS = (from) => {
|
|
9
|
+
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
10
|
+
if (entry)
|
|
11
|
+
return entry;
|
|
12
|
+
entry = __defProp({}, "__esModule", { value: true });
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (var key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(entry, key))
|
|
16
|
+
__defProp(entry, key, {
|
|
17
|
+
get: __accessProp.bind(from, key),
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
__moduleCache.set(from, entry);
|
|
22
|
+
return entry;
|
|
23
|
+
};
|
|
24
|
+
var __moduleCache;
|
|
25
|
+
var __returnValue = (v) => v;
|
|
26
|
+
function __exportSetter(name, newValue) {
|
|
27
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
28
|
+
}
|
|
29
|
+
var __export = (target, all) => {
|
|
30
|
+
for (var name in all)
|
|
31
|
+
__defProp(target, name, {
|
|
32
|
+
get: all[name],
|
|
33
|
+
enumerable: true,
|
|
34
|
+
configurable: true,
|
|
35
|
+
set: __exportSetter.bind(all, name)
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// src/workflows/refusals.ts
|
|
40
|
+
var exports_refusals = {};
|
|
41
|
+
__export(exports_refusals, {
|
|
42
|
+
CONVERSION_REFUSED_TAG: () => CONVERSION_REFUSED_TAG,
|
|
43
|
+
ConversionRefused: () => ConversionRefused,
|
|
44
|
+
DOCUMENT_NOT_FOUND_TAG: () => DOCUMENT_NOT_FOUND_TAG,
|
|
45
|
+
DOCUMENT_NOT_REMOVABLE_TAG: () => DOCUMENT_NOT_REMOVABLE_TAG,
|
|
46
|
+
DOCUMENT_TAKEN_TAG: () => DOCUMENT_TAKEN_TAG,
|
|
47
|
+
DocumentNotFound: () => DocumentNotFound,
|
|
48
|
+
DocumentNotRemovable: () => DocumentNotRemovable,
|
|
49
|
+
DocumentTaken: () => DocumentTaken,
|
|
50
|
+
NUMBERING_REFUSED_TAG: () => NUMBERING_REFUSED_TAG,
|
|
51
|
+
NumberingRefused: () => NumberingRefused,
|
|
52
|
+
TRANSITION_REFUSED_TAG: () => TRANSITION_REFUSED_TAG,
|
|
53
|
+
TransitionRefused: () => TransitionRefused
|
|
54
|
+
});
|
|
55
|
+
module.exports = __toCommonJS(exports_refusals);
|
|
56
|
+
var import_better_result = require("better-result");
|
|
57
|
+
var DOCUMENT_NOT_FOUND_TAG = "DocumentNotFound";
|
|
58
|
+
var DOCUMENT_TAKEN_TAG = "DocumentTaken";
|
|
59
|
+
var NUMBERING_REFUSED_TAG = "NumberingRefused";
|
|
60
|
+
var TRANSITION_REFUSED_TAG = "TransitionRefused";
|
|
61
|
+
var DOCUMENT_NOT_REMOVABLE_TAG = "DocumentNotRemovable";
|
|
62
|
+
var CONVERSION_REFUSED_TAG = "ConversionRefused";
|
|
63
|
+
|
|
64
|
+
class DocumentNotFound extends (/* @__PURE__ */ import_better_result.TaggedError(DOCUMENT_NOT_FOUND_TAG)) {
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
class DocumentTaken extends (/* @__PURE__ */ import_better_result.TaggedError(DOCUMENT_TAKEN_TAG)) {
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
class NumberingRefused extends (/* @__PURE__ */ import_better_result.TaggedError(NUMBERING_REFUSED_TAG)) {
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
class TransitionRefused extends (/* @__PURE__ */ import_better_result.TaggedError(TRANSITION_REFUSED_TAG)) {
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
class DocumentNotRemovable extends (/* @__PURE__ */ import_better_result.TaggedError(DOCUMENT_NOT_REMOVABLE_TAG)) {
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
class ConversionRefused extends (/* @__PURE__ */ import_better_result.TaggedError(CONVERSION_REFUSED_TAG)) {
|
|
80
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export declare const DOCUMENT_NOT_FOUND_TAG = "DocumentNotFound";
|
|
2
|
+
export declare const DOCUMENT_TAKEN_TAG = "DocumentTaken";
|
|
3
|
+
export declare const NUMBERING_REFUSED_TAG = "NumberingRefused";
|
|
4
|
+
export declare const TRANSITION_REFUSED_TAG = "TransitionRefused";
|
|
5
|
+
export declare const DOCUMENT_NOT_REMOVABLE_TAG = "DocumentNotRemovable";
|
|
6
|
+
export declare const CONVERSION_REFUSED_TAG = "ConversionRefused";
|
|
7
|
+
declare const DocumentNotFound_base: import("better-result").TaggedErrorClass<"DocumentNotFound">;
|
|
8
|
+
/**
|
|
9
|
+
* What a document workflow refuses, named. The engine wraps whatever a body throws in its own
|
|
10
|
+
* `RunFailedError` with the refusal as `cause`, so a host reads the name off the cause and answers
|
|
11
|
+
* with it — 404 for a document that is not there, 409 for a ref that is taken or a move the machine
|
|
12
|
+
* refuses, 400 for a numbering it cannot honour — instead of a 500 with the sentence inside it.
|
|
13
|
+
* Aliased the way `MailUndelivered` is: oxlint reads the bare call as an error thrown without `new`.
|
|
14
|
+
*/
|
|
15
|
+
export declare class DocumentNotFound extends /* @__PURE__ */ DocumentNotFound_base<{
|
|
16
|
+
entity: string;
|
|
17
|
+
message: string;
|
|
18
|
+
ref: string;
|
|
19
|
+
}> {
|
|
20
|
+
}
|
|
21
|
+
declare const DocumentTaken_base: import("better-result").TaggedErrorClass<"DocumentTaken">;
|
|
22
|
+
export declare class DocumentTaken extends /* @__PURE__ */ DocumentTaken_base<{
|
|
23
|
+
entity: string;
|
|
24
|
+
message: string;
|
|
25
|
+
ref: string;
|
|
26
|
+
}> {
|
|
27
|
+
}
|
|
28
|
+
declare const NumberingRefused_base: import("better-result").TaggedErrorClass<"NumberingRefused">;
|
|
29
|
+
/** `given` — a number the caller had to supply and did not; `counter` — one the caller supplied to an entity that mints its own, or the host declares no counter. */
|
|
30
|
+
export declare class NumberingRefused extends /* @__PURE__ */ NumberingRefused_base<{
|
|
31
|
+
entity: string;
|
|
32
|
+
message: string;
|
|
33
|
+
mode: 'counter' | 'given';
|
|
34
|
+
}> {
|
|
35
|
+
}
|
|
36
|
+
declare const TransitionRefused_base: import("better-result").TaggedErrorClass<"TransitionRefused">;
|
|
37
|
+
export declare class TransitionRefused extends /* @__PURE__ */ TransitionRefused_base<{
|
|
38
|
+
entity: string;
|
|
39
|
+
from: string;
|
|
40
|
+
message: string;
|
|
41
|
+
ref: string;
|
|
42
|
+
to: string;
|
|
43
|
+
}> {
|
|
44
|
+
}
|
|
45
|
+
declare const DocumentNotRemovable_base: import("better-result").TaggedErrorClass<"DocumentNotRemovable">;
|
|
46
|
+
export declare class DocumentNotRemovable extends /* @__PURE__ */ DocumentNotRemovable_base<{
|
|
47
|
+
entity: string;
|
|
48
|
+
message: string;
|
|
49
|
+
}> {
|
|
50
|
+
}
|
|
51
|
+
declare const ConversionRefused_base: import("better-result").TaggedErrorClass<"ConversionRefused">;
|
|
52
|
+
export declare class ConversionRefused extends /* @__PURE__ */ ConversionRefused_base<{
|
|
53
|
+
entity: string;
|
|
54
|
+
message: string;
|
|
55
|
+
ref: string;
|
|
56
|
+
}> {
|
|
57
|
+
}
|
|
58
|
+
export type DocumentRefusal = ConversionRefused | DocumentNotFound | DocumentNotRemovable | DocumentTaken | NumberingRefused | TransitionRefused;
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export declare const DOCUMENT_NOT_FOUND_TAG = "DocumentNotFound";
|
|
2
|
+
export declare const DOCUMENT_TAKEN_TAG = "DocumentTaken";
|
|
3
|
+
export declare const NUMBERING_REFUSED_TAG = "NumberingRefused";
|
|
4
|
+
export declare const TRANSITION_REFUSED_TAG = "TransitionRefused";
|
|
5
|
+
export declare const DOCUMENT_NOT_REMOVABLE_TAG = "DocumentNotRemovable";
|
|
6
|
+
export declare const CONVERSION_REFUSED_TAG = "ConversionRefused";
|
|
7
|
+
declare const DocumentNotFound_base: import("better-result").TaggedErrorClass<"DocumentNotFound">;
|
|
8
|
+
/**
|
|
9
|
+
* What a document workflow refuses, named. The engine wraps whatever a body throws in its own
|
|
10
|
+
* `RunFailedError` with the refusal as `cause`, so a host reads the name off the cause and answers
|
|
11
|
+
* with it — 404 for a document that is not there, 409 for a ref that is taken or a move the machine
|
|
12
|
+
* refuses, 400 for a numbering it cannot honour — instead of a 500 with the sentence inside it.
|
|
13
|
+
* Aliased the way `MailUndelivered` is: oxlint reads the bare call as an error thrown without `new`.
|
|
14
|
+
*/
|
|
15
|
+
export declare class DocumentNotFound extends /* @__PURE__ */ DocumentNotFound_base<{
|
|
16
|
+
entity: string;
|
|
17
|
+
message: string;
|
|
18
|
+
ref: string;
|
|
19
|
+
}> {
|
|
20
|
+
}
|
|
21
|
+
declare const DocumentTaken_base: import("better-result").TaggedErrorClass<"DocumentTaken">;
|
|
22
|
+
export declare class DocumentTaken extends /* @__PURE__ */ DocumentTaken_base<{
|
|
23
|
+
entity: string;
|
|
24
|
+
message: string;
|
|
25
|
+
ref: string;
|
|
26
|
+
}> {
|
|
27
|
+
}
|
|
28
|
+
declare const NumberingRefused_base: import("better-result").TaggedErrorClass<"NumberingRefused">;
|
|
29
|
+
/** `given` — a number the caller had to supply and did not; `counter` — one the caller supplied to an entity that mints its own, or the host declares no counter. */
|
|
30
|
+
export declare class NumberingRefused extends /* @__PURE__ */ NumberingRefused_base<{
|
|
31
|
+
entity: string;
|
|
32
|
+
message: string;
|
|
33
|
+
mode: 'counter' | 'given';
|
|
34
|
+
}> {
|
|
35
|
+
}
|
|
36
|
+
declare const TransitionRefused_base: import("better-result").TaggedErrorClass<"TransitionRefused">;
|
|
37
|
+
export declare class TransitionRefused extends /* @__PURE__ */ TransitionRefused_base<{
|
|
38
|
+
entity: string;
|
|
39
|
+
from: string;
|
|
40
|
+
message: string;
|
|
41
|
+
ref: string;
|
|
42
|
+
to: string;
|
|
43
|
+
}> {
|
|
44
|
+
}
|
|
45
|
+
declare const DocumentNotRemovable_base: import("better-result").TaggedErrorClass<"DocumentNotRemovable">;
|
|
46
|
+
export declare class DocumentNotRemovable extends /* @__PURE__ */ DocumentNotRemovable_base<{
|
|
47
|
+
entity: string;
|
|
48
|
+
message: string;
|
|
49
|
+
}> {
|
|
50
|
+
}
|
|
51
|
+
declare const ConversionRefused_base: import("better-result").TaggedErrorClass<"ConversionRefused">;
|
|
52
|
+
export declare class ConversionRefused extends /* @__PURE__ */ ConversionRefused_base<{
|
|
53
|
+
entity: string;
|
|
54
|
+
message: string;
|
|
55
|
+
ref: string;
|
|
56
|
+
}> {
|
|
57
|
+
}
|
|
58
|
+
export type DocumentRefusal = ConversionRefused | DocumentNotFound | DocumentNotRemovable | DocumentTaken | NumberingRefused | TransitionRefused;
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// src/workflows/refusals.ts
|
|
2
|
+
import { TaggedError as tagged } from "better-result";
|
|
3
|
+
var DOCUMENT_NOT_FOUND_TAG = "DocumentNotFound";
|
|
4
|
+
var DOCUMENT_TAKEN_TAG = "DocumentTaken";
|
|
5
|
+
var NUMBERING_REFUSED_TAG = "NumberingRefused";
|
|
6
|
+
var TRANSITION_REFUSED_TAG = "TransitionRefused";
|
|
7
|
+
var DOCUMENT_NOT_REMOVABLE_TAG = "DocumentNotRemovable";
|
|
8
|
+
var CONVERSION_REFUSED_TAG = "ConversionRefused";
|
|
9
|
+
|
|
10
|
+
class DocumentNotFound extends (/* @__PURE__ */ tagged(DOCUMENT_NOT_FOUND_TAG)) {
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
class DocumentTaken extends (/* @__PURE__ */ tagged(DOCUMENT_TAKEN_TAG)) {
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
class NumberingRefused extends (/* @__PURE__ */ tagged(NUMBERING_REFUSED_TAG)) {
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
class TransitionRefused extends (/* @__PURE__ */ tagged(TRANSITION_REFUSED_TAG)) {
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
class DocumentNotRemovable extends (/* @__PURE__ */ tagged(DOCUMENT_NOT_REMOVABLE_TAG)) {
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
class ConversionRefused extends (/* @__PURE__ */ tagged(CONVERSION_REFUSED_TAG)) {
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
CONVERSION_REFUSED_TAG,
|
|
29
|
+
ConversionRefused,
|
|
30
|
+
DOCUMENT_NOT_FOUND_TAG,
|
|
31
|
+
DOCUMENT_NOT_REMOVABLE_TAG,
|
|
32
|
+
DOCUMENT_TAKEN_TAG,
|
|
33
|
+
DocumentNotFound,
|
|
34
|
+
DocumentNotRemovable,
|
|
35
|
+
DocumentTaken,
|
|
36
|
+
NUMBERING_REFUSED_TAG,
|
|
37
|
+
NumberingRefused,
|
|
38
|
+
TRANSITION_REFUSED_TAG,
|
|
39
|
+
TransitionRefused
|
|
40
|
+
};
|