@homeflare/alchemy 0.24.0 → 0.25.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.
Files changed (100) hide show
  1. package/README.md +10 -0
  2. package/dist/linux/fake-linux-host.d.ts.map +1 -1
  3. package/dist/linux/fake-systemd.d.ts +15 -0
  4. package/dist/linux/fake-systemd.d.ts.map +1 -1
  5. package/dist/linux/index.js +18 -7
  6. package/dist/linux/index.js.map +5 -5
  7. package/dist/linux/unit-form.d.ts +41 -0
  8. package/dist/linux/unit-form.d.ts.map +1 -1
  9. package/dist/linux/unit-lifecycle.d.ts.map +1 -1
  10. package/dist/linux/unit-settle.d.ts.map +1 -1
  11. package/dist/paperless/client.d.ts +37 -0
  12. package/dist/paperless/client.d.ts.map +1 -0
  13. package/dist/paperless/constraint-guard.d.ts +19 -0
  14. package/dist/paperless/constraint-guard.d.ts.map +1 -0
  15. package/dist/paperless/constraints.d.ts +50 -0
  16. package/dist/paperless/constraints.d.ts.map +1 -0
  17. package/dist/paperless/credentials.d.ts +40 -0
  18. package/dist/paperless/credentials.d.ts.map +1 -0
  19. package/dist/paperless/custom-field.d.ts +75 -0
  20. package/dist/paperless/custom-field.d.ts.map +1 -0
  21. package/dist/paperless/document-type.d.ts +30 -0
  22. package/dist/paperless/document-type.d.ts.map +1 -0
  23. package/dist/paperless/errors.d.ts +49 -0
  24. package/dist/paperless/errors.d.ts.map +1 -0
  25. package/dist/paperless/fake-paperless.d.ts +39 -0
  26. package/dist/paperless/fake-paperless.d.ts.map +1 -0
  27. package/dist/paperless/generated/constraints/index.d.ts +13 -0
  28. package/dist/paperless/generated/constraints/index.d.ts.map +1 -0
  29. package/dist/paperless/generated/constraints/paperless-custom_fields.d.ts +21 -0
  30. package/dist/paperless/generated/constraints/paperless-custom_fields.d.ts.map +1 -0
  31. package/dist/paperless/generated/constraints/paperless-document_types.d.ts +21 -0
  32. package/dist/paperless/generated/constraints/paperless-document_types.d.ts.map +1 -0
  33. package/dist/paperless/generated/constraints/paperless-storage_paths.d.ts +21 -0
  34. package/dist/paperless/generated/constraints/paperless-storage_paths.d.ts.map +1 -0
  35. package/dist/paperless/generated/constraints/paperless-tags.d.ts +21 -0
  36. package/dist/paperless/generated/constraints/paperless-tags.d.ts.map +1 -0
  37. package/dist/paperless/generated/types/custom-fields.d.ts +23 -0
  38. package/dist/paperless/generated/types/custom-fields.d.ts.map +1 -0
  39. package/dist/paperless/generated/types/document-types.d.ts +39 -0
  40. package/dist/paperless/generated/types/document-types.d.ts.map +1 -0
  41. package/dist/paperless/generated/types/index.d.ts +10 -0
  42. package/dist/paperless/generated/types/index.d.ts.map +1 -0
  43. package/dist/paperless/generated/types/storage-paths.d.ts +31 -0
  44. package/dist/paperless/generated/types/storage-paths.d.ts.map +1 -0
  45. package/dist/paperless/generated/types/tags.d.ts +37 -0
  46. package/dist/paperless/generated/types/tags.d.ts.map +1 -0
  47. package/dist/paperless/index.d.ts +19 -0
  48. package/dist/paperless/index.d.ts.map +1 -0
  49. package/dist/paperless/index.js +524 -0
  50. package/dist/paperless/index.js.map +26 -0
  51. package/dist/paperless/matching-locate.d.ts +33 -0
  52. package/dist/paperless/matching-locate.d.ts.map +1 -0
  53. package/dist/paperless/matching-types.d.ts +60 -0
  54. package/dist/paperless/matching-types.d.ts.map +1 -0
  55. package/dist/paperless/matching.d.ts +61 -0
  56. package/dist/paperless/matching.d.ts.map +1 -0
  57. package/dist/paperless/providers.d.ts +15 -0
  58. package/dist/paperless/providers.d.ts.map +1 -0
  59. package/dist/paperless/storage-path.d.ts +32 -0
  60. package/dist/paperless/storage-path.d.ts.map +1 -0
  61. package/dist/paperless/tag.d.ts +47 -0
  62. package/dist/paperless/tag.d.ts.map +1 -0
  63. package/docs/linux-host.md +2 -0
  64. package/docs/paperless.md +115 -0
  65. package/package.json +5 -1
  66. package/src/linux/fake-linux-host.ts +2 -0
  67. package/src/linux/fake-systemd.ts +36 -2
  68. package/src/linux/unit-activating.test.ts +164 -0
  69. package/src/linux/unit-form.ts +51 -0
  70. package/src/linux/unit-lifecycle.ts +9 -2
  71. package/src/linux/unit-settle.ts +8 -4
  72. package/src/paperless/client.ts +88 -0
  73. package/src/paperless/constraint-guard.ts +50 -0
  74. package/src/paperless/constraints.test.ts +74 -0
  75. package/src/paperless/constraints.ts +111 -0
  76. package/src/paperless/credentials.ts +69 -0
  77. package/src/paperless/custom-field.test.ts +74 -0
  78. package/src/paperless/custom-field.ts +95 -0
  79. package/src/paperless/document-type.ts +74 -0
  80. package/src/paperless/errors.ts +62 -0
  81. package/src/paperless/fake-paperless.ts +156 -0
  82. package/src/paperless/generated/constraints/index.ts +23 -0
  83. package/src/paperless/generated/constraints/paperless-custom_fields.ts +29 -0
  84. package/src/paperless/generated/constraints/paperless-document_types.ts +32 -0
  85. package/src/paperless/generated/constraints/paperless-storage_paths.ts +34 -0
  86. package/src/paperless/generated/constraints/paperless-tags.ts +34 -0
  87. package/src/paperless/generated/types/custom-fields.ts +23 -0
  88. package/src/paperless/generated/types/document-types.ts +30 -0
  89. package/src/paperless/generated/types/index.ts +9 -0
  90. package/src/paperless/generated/types/storage-paths.ts +31 -0
  91. package/src/paperless/generated/types/tags.ts +37 -0
  92. package/src/paperless/index.ts +56 -0
  93. package/src/paperless/matching-identity.test.ts +194 -0
  94. package/src/paperless/matching-locate.ts +104 -0
  95. package/src/paperless/matching-types.ts +61 -0
  96. package/src/paperless/matching.test.ts +128 -0
  97. package/src/paperless/matching.ts +239 -0
  98. package/src/paperless/providers.ts +27 -0
  99. package/src/paperless/storage-path.ts +78 -0
  100. package/src/paperless/tag.ts +91 -0
@@ -0,0 +1,156 @@
1
+ /**
2
+ * A fake Paperless-ngx for the tests beside it — `Bun.serve` on an ephemeral 127.0.0.1 port, the
3
+ * same shape `../openbao/fake-bao.ts` and `../caddy/fake-caddy.ts` use.
4
+ *
5
+ * ⛔ TEST-ONLY. No provider imports this file. It stores rows in memory for exactly the four
6
+ * taxonomy collections and answers `name__iexact` the way Django does — case-insensitive,
7
+ * never collapsing two differently-cased rows into one.
8
+ */
9
+ import * as Effect from 'effect/Effect';
10
+ import * as FetchHttpClient from 'effect/unstable/http/FetchHttpClient';
11
+ import type { PaperlessRequirements } from './client.ts';
12
+ import { type PaperlessCredentialsError, environmentLayer } from './credentials.ts';
13
+ import type { PaperlessError } from './errors.ts';
14
+
15
+ export const FAKE_TOKEN = 'fake-token-not-real';
16
+
17
+ export interface Seen {
18
+ readonly method: string;
19
+ readonly path: string;
20
+ readonly headers: Headers;
21
+ readonly body: string;
22
+ }
23
+
24
+ export type Row = Record<string, unknown> & { id: number };
25
+
26
+ const COLLECTIONS = ['tags', 'document_types', 'storage_paths', 'custom_fields'] as const;
27
+
28
+ export interface FakePaperless {
29
+ readonly url: string;
30
+ readonly seen: Seen[];
31
+ readonly rows: (collection: (typeof COLLECTIONS)[number]) => readonly Row[];
32
+ /** `undefined` to answer normally; a status to force it once per subsequent call. */
33
+ forceStatus: number | undefined;
34
+ stop(): void;
35
+ }
36
+
37
+ const nextId = (store: Row[]): number =>
38
+ store.length === 0 ? 1 : Math.max(...store.map((r) => r.id)) + 1;
39
+
40
+ export const fakePaperless = (): FakePaperless => {
41
+ const seen: Seen[] = [];
42
+ const store = new Map<(typeof COLLECTIONS)[number], Row[]>(COLLECTIONS.map((c) => [c, []]));
43
+ let forced: number | undefined;
44
+
45
+ const fetch = async (request: Request): Promise<Response> => {
46
+ const url = new URL(request.url);
47
+ const body = await request.text();
48
+ seen.push({
49
+ body,
50
+ headers: request.headers,
51
+ method: request.method,
52
+ path: `${url.pathname}${url.search}`,
53
+ });
54
+
55
+ const token = request.headers.get('Authorization');
56
+ if (token !== `Token ${FAKE_TOKEN}`) return json(401, { detail: 'Invalid token.' });
57
+ if (forced !== undefined) {
58
+ const status = forced;
59
+ forced = undefined;
60
+ return json(status, { detail: 'injected for the test' });
61
+ }
62
+
63
+ const segments = url.pathname.split('/').filter((s) => s !== '');
64
+ // ['api', collection, (id)?]
65
+ const collection = segments[1] as (typeof COLLECTIONS)[number] | undefined;
66
+ if (collection === undefined || !COLLECTIONS.includes(collection))
67
+ return json(404, { detail: 'Not found.' });
68
+ const rows = store.get(collection) as Row[];
69
+ const id = segments[2] === undefined ? undefined : Number(segments[2]);
70
+
71
+ if (request.method === 'GET' && id === undefined) {
72
+ const filter = url.searchParams.get('name__iexact');
73
+ const matched =
74
+ filter === null
75
+ ? rows
76
+ : rows.filter((r) => String(r['name']).toLowerCase() === filter.toLowerCase());
77
+ return json(200, { count: matched.length, next: null, previous: null, results: matched });
78
+ }
79
+ if (request.method === 'POST' && id === undefined) {
80
+ const row: Row = { id: nextId(rows), ...(JSON.parse(body) as Record<string, unknown>) };
81
+ rows.push(row);
82
+ return json(201, row);
83
+ }
84
+ const found = id === undefined ? undefined : rows.find((r) => r.id === id);
85
+ if (found === undefined) return json(404, { detail: 'Not found.' });
86
+ if (request.method === 'GET') return json(200, found);
87
+ if (request.method === 'PATCH') {
88
+ Object.assign(found, JSON.parse(body) as Record<string, unknown>);
89
+ return json(200, found);
90
+ }
91
+ if (request.method === 'DELETE') {
92
+ store.set(
93
+ collection,
94
+ rows.filter((r) => r.id !== id),
95
+ );
96
+ return new Response(null, { status: 204 });
97
+ }
98
+ return json(405, { detail: 'method not allowed' });
99
+ };
100
+
101
+ const server = Bun.serve({ fetch, hostname: '127.0.0.1', port: 0 });
102
+ return {
103
+ get forceStatus() {
104
+ return forced;
105
+ },
106
+ set forceStatus(value: number | undefined) {
107
+ forced = value;
108
+ },
109
+ rows: (collection) => store.get(collection) ?? [],
110
+ seen,
111
+ stop: () => void server.stop(true),
112
+ url: server.url.origin,
113
+ };
114
+ };
115
+
116
+ const json = (status: number, body: unknown): Response =>
117
+ new Response(status === 204 ? null : JSON.stringify(body), {
118
+ headers: { 'content-type': 'application/json' },
119
+ status,
120
+ });
121
+
122
+ /** Run `body` against a fresh fake, `PAPERLESS_URL`/`PAPERLESS_TOKEN` set only for its duration. */
123
+ export const withFake = async (body: (fake: FakePaperless) => Promise<void>): Promise<void> => {
124
+ const fake = fakePaperless();
125
+ const savedUrl = process.env['PAPERLESS_URL'];
126
+ const savedToken = process.env['PAPERLESS_TOKEN'];
127
+ process.env['PAPERLESS_URL'] = fake.url;
128
+ process.env['PAPERLESS_TOKEN'] = FAKE_TOKEN;
129
+ try {
130
+ await body(fake);
131
+ } finally {
132
+ fake.stop();
133
+ if (savedUrl === undefined) delete process.env['PAPERLESS_URL'];
134
+ else process.env['PAPERLESS_URL'] = savedUrl;
135
+ if (savedToken === undefined) delete process.env['PAPERLESS_TOKEN'];
136
+ else process.env['PAPERLESS_TOKEN'] = savedToken;
137
+ }
138
+ };
139
+
140
+ /** Run an effect through the real `FetchHttpClient` and the real environment credentials layer. */
141
+ export const run = <A>(
142
+ effect: Effect.Effect<A, PaperlessError | PaperlessCredentialsError, PaperlessRequirements>,
143
+ ) =>
144
+ Effect.runPromise(
145
+ effect.pipe(Effect.provide(FetchHttpClient.layer), Effect.provide(environmentLayer)),
146
+ );
147
+
148
+ export const runFailure = <A>(
149
+ effect: Effect.Effect<A, PaperlessError | PaperlessCredentialsError, PaperlessRequirements>,
150
+ ) =>
151
+ Effect.runPromise(
152
+ Effect.flip(effect).pipe(
153
+ Effect.provide(FetchHttpClient.layer),
154
+ Effect.provide(environmentLayer),
155
+ ),
156
+ );
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Every generated Paperless constraint table, merged — DO NOT EDIT BY HAND.
3
+ *
4
+ * Run: bun codegen/paperless.ts
5
+ *
6
+ * ⚠️ EVERY KEY IS PREFIXED `paperless:`, so one estate running several vendors' readers cannot
7
+ * collide on an unprefixed `POST /api/…`.
8
+ */
9
+ import type { EndpointConstraints } from '../../constraints.ts';
10
+ import { PAPERLESS_CUSTOM_FIELDS_CONSTRAINTS } from './paperless-custom_fields.ts';
11
+ import { PAPERLESS_DOCUMENT_TYPES_CONSTRAINTS } from './paperless-document_types.ts';
12
+ import { PAPERLESS_STORAGE_PATHS_CONSTRAINTS } from './paperless-storage_paths.ts';
13
+ import { PAPERLESS_TAGS_CONSTRAINTS } from './paperless-tags.ts';
14
+
15
+ export const PAPERLESS_CONSTRAINTS: Readonly<Record<string, EndpointConstraints>> = {
16
+ ...PAPERLESS_CUSTOM_FIELDS_CONSTRAINTS,
17
+ ...PAPERLESS_DOCUMENT_TYPES_CONSTRAINTS,
18
+ ...PAPERLESS_STORAGE_PATHS_CONSTRAINTS,
19
+ ...PAPERLESS_TAGS_CONSTRAINTS,
20
+ };
21
+
22
+ /** sha256 of the merged table, truncated — a digest of the DATA, not the file text. */
23
+ export const PAPERLESS_CONSTRAINTS_DIGEST = '66e61dce8c099d7d';
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Generated Paperless-ngx REST API (OpenAPI 3.0.3) request-body constraints for `/api/custom_fields/` — DO NOT EDIT BY HAND.
3
+ *
4
+ * Run: bun codegen/paperless.ts
5
+ * Manifest entry: `paperless-openapi` — Paperless-ngx REST API (OpenAPI 3.0.3) 3.1.1
6
+ * sha256 d0fe550d2135e37b, Paperless-ngx web service, loopback
7
+ * /api/schema/?format=json
8
+ *
9
+ * 8 of this product's 100 POST/PUT/PATCH/DELETE endpoints are tabled across all
10
+ * areas: the ones this package writes to, named in its own source. Every other vendor write
11
+ * endpoint is UNTABLED and therefore unchecked at plan time.
12
+ *
13
+ * ⚠️ A `patternSource` with no `pattern` beside it could NOT be carried into a JavaScript
14
+ * RegExp faithfully — Django/DRF's `\w` is Unicode and JavaScript's is ASCII
15
+ * (codegen/py-pattern.ts). It is recorded and NOT enforced.
16
+ * ⚠️ `data_type` on a custom field is CREATE-ONLY: enforced here as a value rule, never as a
17
+ * reason to allow a PATCH — the refusal on change lives in the provider (custom-field.ts).
18
+ */
19
+ import type { EndpointConstraints } from '../../constraints.ts';
20
+
21
+ export const PAPERLESS_CUSTOM_FIELDS_CONSTRAINTS: Readonly<Record<string, EndpointConstraints>> = {
22
+ "paperless:PATCH /api/custom_fields/{id}/": {
23
+ "name": {"maxLength":128,"minLength":1,"type":"string"},
24
+ },
25
+ "paperless:POST /api/custom_fields/": {
26
+ "data_type": {"required":true},
27
+ "name": {"maxLength":128,"minLength":1,"required":true,"type":"string"},
28
+ },
29
+ };
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Generated Paperless-ngx REST API (OpenAPI 3.0.3) request-body constraints for `/api/document_types/` — DO NOT EDIT BY HAND.
3
+ *
4
+ * Run: bun codegen/paperless.ts
5
+ * Manifest entry: `paperless-openapi` — Paperless-ngx REST API (OpenAPI 3.0.3) 3.1.1
6
+ * sha256 d0fe550d2135e37b, Paperless-ngx web service, loopback
7
+ * /api/schema/?format=json
8
+ *
9
+ * 8 of this product's 100 POST/PUT/PATCH/DELETE endpoints are tabled across all
10
+ * areas: the ones this package writes to, named in its own source. Every other vendor write
11
+ * endpoint is UNTABLED and therefore unchecked at plan time.
12
+ *
13
+ * ⚠️ A `patternSource` with no `pattern` beside it could NOT be carried into a JavaScript
14
+ * RegExp faithfully — Django/DRF's `\w` is Unicode and JavaScript's is ASCII
15
+ * (codegen/py-pattern.ts). It is recorded and NOT enforced.
16
+ * ⚠️ `data_type` on a custom field is CREATE-ONLY: enforced here as a value rule, never as a
17
+ * reason to allow a PATCH — the refusal on change lives in the provider (custom-field.ts).
18
+ */
19
+ import type { EndpointConstraints } from '../../constraints.ts';
20
+
21
+ export const PAPERLESS_DOCUMENT_TYPES_CONSTRAINTS: Readonly<Record<string, EndpointConstraints>> = {
22
+ "paperless:PATCH /api/document_types/{id}/": {
23
+ "match": {"maxLength":256,"type":"string"},
24
+ "matching_algorithm": {"enum":[0,1,2,3,4,5,6],"type":"integer"},
25
+ "name": {"maxLength":128,"minLength":1,"type":"string"},
26
+ },
27
+ "paperless:POST /api/document_types/": {
28
+ "match": {"maxLength":256,"type":"string"},
29
+ "matching_algorithm": {"enum":[0,1,2,3,4,5,6],"type":"integer"},
30
+ "name": {"maxLength":128,"minLength":1,"required":true,"type":"string"},
31
+ },
32
+ };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Generated Paperless-ngx REST API (OpenAPI 3.0.3) request-body constraints for `/api/storage_paths/` — DO NOT EDIT BY HAND.
3
+ *
4
+ * Run: bun codegen/paperless.ts
5
+ * Manifest entry: `paperless-openapi` — Paperless-ngx REST API (OpenAPI 3.0.3) 3.1.1
6
+ * sha256 d0fe550d2135e37b, Paperless-ngx web service, loopback
7
+ * /api/schema/?format=json
8
+ *
9
+ * 8 of this product's 100 POST/PUT/PATCH/DELETE endpoints are tabled across all
10
+ * areas: the ones this package writes to, named in its own source. Every other vendor write
11
+ * endpoint is UNTABLED and therefore unchecked at plan time.
12
+ *
13
+ * ⚠️ A `patternSource` with no `pattern` beside it could NOT be carried into a JavaScript
14
+ * RegExp faithfully — Django/DRF's `\w` is Unicode and JavaScript's is ASCII
15
+ * (codegen/py-pattern.ts). It is recorded and NOT enforced.
16
+ * ⚠️ `data_type` on a custom field is CREATE-ONLY: enforced here as a value rule, never as a
17
+ * reason to allow a PATCH — the refusal on change lives in the provider (custom-field.ts).
18
+ */
19
+ import type { EndpointConstraints } from '../../constraints.ts';
20
+
21
+ export const PAPERLESS_STORAGE_PATHS_CONSTRAINTS: Readonly<Record<string, EndpointConstraints>> = {
22
+ "paperless:PATCH /api/storage_paths/{id}/": {
23
+ "match": {"maxLength":256,"type":"string"},
24
+ "matching_algorithm": {"enum":[0,1,2,3,4,5,6],"type":"integer"},
25
+ "name": {"maxLength":128,"minLength":1,"type":"string"},
26
+ "path": {"minLength":1,"type":"string"},
27
+ },
28
+ "paperless:POST /api/storage_paths/": {
29
+ "match": {"maxLength":256,"type":"string"},
30
+ "matching_algorithm": {"enum":[0,1,2,3,4,5,6],"type":"integer"},
31
+ "name": {"maxLength":128,"minLength":1,"required":true,"type":"string"},
32
+ "path": {"minLength":1,"required":true,"type":"string"},
33
+ },
34
+ };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Generated Paperless-ngx REST API (OpenAPI 3.0.3) request-body constraints for `/api/tags/` — DO NOT EDIT BY HAND.
3
+ *
4
+ * Run: bun codegen/paperless.ts
5
+ * Manifest entry: `paperless-openapi` — Paperless-ngx REST API (OpenAPI 3.0.3) 3.1.1
6
+ * sha256 d0fe550d2135e37b, Paperless-ngx web service, loopback
7
+ * /api/schema/?format=json
8
+ *
9
+ * 8 of this product's 100 POST/PUT/PATCH/DELETE endpoints are tabled across all
10
+ * areas: the ones this package writes to, named in its own source. Every other vendor write
11
+ * endpoint is UNTABLED and therefore unchecked at plan time.
12
+ *
13
+ * ⚠️ A `patternSource` with no `pattern` beside it could NOT be carried into a JavaScript
14
+ * RegExp faithfully — Django/DRF's `\w` is Unicode and JavaScript's is ASCII
15
+ * (codegen/py-pattern.ts). It is recorded and NOT enforced.
16
+ * ⚠️ `data_type` on a custom field is CREATE-ONLY: enforced here as a value rule, never as a
17
+ * reason to allow a PATCH — the refusal on change lives in the provider (custom-field.ts).
18
+ */
19
+ import type { EndpointConstraints } from '../../constraints.ts';
20
+
21
+ export const PAPERLESS_TAGS_CONSTRAINTS: Readonly<Record<string, EndpointConstraints>> = {
22
+ "paperless:PATCH /api/tags/{id}/": {
23
+ "color": {"maxLength":7,"minLength":1,"type":"string"},
24
+ "match": {"maxLength":256,"type":"string"},
25
+ "matching_algorithm": {"enum":[0,1,2,3,4,5,6],"type":"integer"},
26
+ "name": {"maxLength":128,"minLength":1,"type":"string"},
27
+ },
28
+ "paperless:POST /api/tags/": {
29
+ "color": {"maxLength":7,"minLength":1,"type":"string"},
30
+ "match": {"maxLength":256,"type":"string"},
31
+ "matching_algorithm": {"enum":[0,1,2,3,4,5,6],"type":"integer"},
32
+ "name": {"maxLength":128,"minLength":1,"required":true,"type":"string"},
33
+ },
34
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Generated Paperless-ngx REST API (OpenAPI 3.0.3) request/response types for `/api/custom_fields/` — DO NOT EDIT BY HAND.
3
+ *
4
+ * Run: bun codegen/paperless.ts
5
+ * Manifest entry: `paperless-openapi` — Paperless-ngx REST API (OpenAPI 3.0.3) 3.1.1, sha256 d0fe550d2135e37b
6
+ *
7
+ * 8 of Paperless-ngx REST API (OpenAPI 3.0.3)'s 100 write endpoints are used by this family; this file covers only /api/custom_fields/.
8
+ *
9
+ * ⛔ `set_permissions` (writeOnly) is not modelled in this slice — no property here writes it.
10
+ */
11
+ export interface PaperlessCustomFieldRequest {
12
+ name: string;
13
+ data_type: "string" | "url" | "date" | "boolean" | "integer" | "float" | "monetary" | "documentlink" | "select" | "longtext";
14
+ extra_data?: unknown | null;
15
+ }
16
+
17
+ export interface PaperlessCustomField {
18
+ readonly id: number;
19
+ name: string;
20
+ data_type: "string" | "url" | "date" | "boolean" | "integer" | "float" | "monetary" | "documentlink" | "select" | "longtext";
21
+ extra_data?: unknown | null;
22
+ readonly document_count: number;
23
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Generated Paperless-ngx REST API (OpenAPI 3.0.3) request/response types for `/api/document_types/` — DO NOT EDIT BY HAND.
3
+ *
4
+ * Run: bun codegen/paperless.ts
5
+ * Manifest entry: `paperless-openapi` — Paperless-ngx REST API (OpenAPI 3.0.3) 3.1.1, sha256 d0fe550d2135e37b
6
+ *
7
+ * 8 of Paperless-ngx REST API (OpenAPI 3.0.3)'s 100 write endpoints are used by this family; this file covers only /api/document_types/.
8
+ *
9
+ * ⛔ `set_permissions` (writeOnly) is not modelled in this slice — no property here writes it.
10
+ */
11
+ export interface PaperlessDocumentTypeRequest {
12
+ name: string;
13
+ match?: string;
14
+ matching_algorithm?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
15
+ is_insensitive?: boolean;
16
+ owner?: number | null;
17
+ }
18
+
19
+ export interface PaperlessDocumentType {
20
+ readonly id: number;
21
+ readonly slug: string;
22
+ name: string;
23
+ match?: string;
24
+ matching_algorithm?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
25
+ is_insensitive?: boolean;
26
+ readonly document_count: number;
27
+ owner?: number | null;
28
+ readonly permissions: { view?: { users?: number[]; groups?: number[] }; change?: { users?: number[]; groups?: number[] } };
29
+ readonly user_can_change: boolean;
30
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Every generated Paperless taxonomy type, re-exported — DO NOT EDIT BY HAND.
3
+ *
4
+ * Run: bun codegen/paperless.ts
5
+ */
6
+ export * from './tags.ts';
7
+ export * from './document-types.ts';
8
+ export * from './storage-paths.ts';
9
+ export * from './custom-fields.ts';
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Generated Paperless-ngx REST API (OpenAPI 3.0.3) request/response types for `/api/storage_paths/` — DO NOT EDIT BY HAND.
3
+ *
4
+ * Run: bun codegen/paperless.ts
5
+ * Manifest entry: `paperless-openapi` — Paperless-ngx REST API (OpenAPI 3.0.3) 3.1.1, sha256 d0fe550d2135e37b
6
+ *
7
+ * 8 of Paperless-ngx REST API (OpenAPI 3.0.3)'s 100 write endpoints are used by this family; this file covers only /api/storage_paths/.
8
+ *
9
+ * ⛔ `set_permissions` (writeOnly) is not modelled in this slice — no property here writes it.
10
+ */
11
+ export interface PaperlessStoragePathRequest {
12
+ name: string;
13
+ path: string;
14
+ match?: string;
15
+ matching_algorithm?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
16
+ is_insensitive?: boolean;
17
+ owner?: number | null;
18
+ }
19
+
20
+ export interface PaperlessStoragePath {
21
+ readonly id: number;
22
+ readonly slug: string;
23
+ name: string;
24
+ path: string;
25
+ match?: string;
26
+ matching_algorithm?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
27
+ is_insensitive?: boolean;
28
+ readonly document_count: number;
29
+ owner?: number | null;
30
+ readonly user_can_change: boolean;
31
+ }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Generated Paperless-ngx REST API (OpenAPI 3.0.3) request/response types for `/api/tags/` — DO NOT EDIT BY HAND.
3
+ *
4
+ * Run: bun codegen/paperless.ts
5
+ * Manifest entry: `paperless-openapi` — Paperless-ngx REST API (OpenAPI 3.0.3) 3.1.1, sha256 d0fe550d2135e37b
6
+ *
7
+ * 8 of Paperless-ngx REST API (OpenAPI 3.0.3)'s 100 write endpoints are used by this family; this file covers only /api/tags/.
8
+ *
9
+ * ⛔ `set_permissions` (writeOnly) is not modelled in this slice — no property here writes it.
10
+ */
11
+ export interface PaperlessTagRequest {
12
+ name: string;
13
+ color?: string;
14
+ match?: string;
15
+ matching_algorithm?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
16
+ is_insensitive?: boolean;
17
+ is_inbox_tag?: boolean;
18
+ owner?: number | null;
19
+ parent?: number | null;
20
+ }
21
+
22
+ export interface PaperlessTag {
23
+ readonly id: number;
24
+ readonly slug: string;
25
+ name: string;
26
+ color?: string;
27
+ readonly text_color: string;
28
+ match?: string;
29
+ matching_algorithm?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
30
+ is_insensitive?: boolean;
31
+ is_inbox_tag?: boolean;
32
+ readonly document_count: number;
33
+ owner?: number | null;
34
+ readonly user_can_change: boolean;
35
+ parent?: number | null;
36
+ readonly children: number[];
37
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Paperless-ngx taxonomy providers for Alchemy: Tag, DocumentType, StoragePath, CustomField.
3
+ *
4
+ * ⛔ THIS BARREL IS SMALLER THAN THE DIRECTORY ON PURPOSE — see `../netbox/index.ts`'s own
5
+ * header. `matching.ts`'s internals and the raw generated modules are not re-exported; a
6
+ * consumer wanting the same guard a Resource uses gets it through `constraintsFor`/
7
+ * `bodyViolations`, not by importing `generated/` directly.
8
+ */
9
+ export {
10
+ PaperlessCredentials,
11
+ type PaperlessCredentialValue,
12
+ PaperlessCredentialsError,
13
+ environmentLayer as paperlessEnvironmentLayer,
14
+ } from './credentials.ts';
15
+ export {
16
+ PaperlessNotFound,
17
+ PaperlessUnauthorized,
18
+ PaperlessValidation,
19
+ PaperlessUnavailable,
20
+ type PaperlessError,
21
+ } from './errors.ts';
22
+ export {
23
+ PAPERLESS_CONSTRAINTS,
24
+ bodyViolations,
25
+ constraintsFor,
26
+ guardBody,
27
+ } from './constraint-guard.ts';
28
+ export {
29
+ type EndpointConstraints,
30
+ type EndpointKey,
31
+ type ParamConstraint,
32
+ type PaperlessBody,
33
+ refusal,
34
+ violations,
35
+ } from './constraints.ts';
36
+ export { PAPERLESS_CONSTRAINTS_DIGEST } from './generated/constraints/index.ts';
37
+ export { Tag, TagProvider, type TagAttributes, type TagProps } from './tag.ts';
38
+ export {
39
+ DocumentType,
40
+ DocumentTypeProvider,
41
+ type DocumentTypeAttributes,
42
+ type DocumentTypeProps,
43
+ } from './document-type.ts';
44
+ export {
45
+ StoragePath,
46
+ StoragePathProvider,
47
+ type StoragePathAttributes,
48
+ type StoragePathProps,
49
+ } from './storage-path.ts';
50
+ export {
51
+ CustomField,
52
+ CustomFieldProvider,
53
+ type CustomFieldAttributes,
54
+ type CustomFieldProps,
55
+ } from './custom-field.ts';
56
+ export { paperlessProviders } from './providers.ts';