@adminiumjs/manifest 0.3.48 → 0.3.50
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/dist/app-requires.d.ts +66 -0
- package/dist/app-requires.d.ts.map +1 -0
- package/dist/app-requires.js +98 -0
- package/dist/app-requires.js.map +1 -0
- package/dist/automations.d.ts +346 -2
- package/dist/automations.d.ts.map +1 -1
- package/dist/automations.js +64 -7
- package/dist/automations.js.map +1 -1
- package/dist/compose.d.ts.map +1 -1
- package/dist/compose.js +5 -0
- package/dist/compose.js.map +1 -1
- package/dist/documents.d.ts +49 -0
- package/dist/documents.d.ts.map +1 -1
- package/dist/documents.js +41 -1
- package/dist/documents.js.map +1 -1
- package/dist/formula.js +1 -1
- package/dist/formula.js.map +1 -1
- package/dist/index.d.ts +12 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -5
- package/dist/index.js.map +1 -1
- package/dist/instance.d.ts +133 -0
- package/dist/instance.d.ts.map +1 -0
- package/dist/instance.js +157 -0
- package/dist/instance.js.map +1 -0
- package/dist/outbox.d.ts +79 -0
- package/dist/outbox.d.ts.map +1 -1
- package/dist/outbox.js +37 -2
- package/dist/outbox.js.map +1 -1
- package/dist/plan-context.d.ts +9 -0
- package/dist/plan-context.d.ts.map +1 -1
- package/dist/plan-context.js +74 -9
- package/dist/plan-context.js.map +1 -1
- package/dist/plan-model.d.ts +9 -2
- package/dist/plan-model.d.ts.map +1 -1
- package/dist/plan-types.d.ts.map +1 -1
- package/dist/plan-types.js +2 -0
- package/dist/plan-types.js.map +1 -1
- package/dist/public-access.d.ts +23 -0
- package/dist/public-access.d.ts.map +1 -1
- package/dist/public-access.js +51 -5
- package/dist/public-access.js.map +1 -1
- package/dist/refs.d.ts +12 -1
- package/dist/refs.d.ts.map +1 -1
- package/dist/refs.js +23 -2
- package/dist/refs.js.map +1 -1
- package/dist/roles.d.ts +1 -0
- package/dist/roles.d.ts.map +1 -1
- package/dist/roles.js +3 -0
- package/dist/roles.js.map +1 -1
- package/dist/saved-apps.d.ts +132 -0
- package/dist/saved-apps.d.ts.map +1 -0
- package/dist/saved-apps.js +215 -0
- package/dist/saved-apps.js.map +1 -0
- package/dist/saved-parts.d.ts +368 -0
- package/dist/saved-parts.d.ts.map +1 -0
- package/dist/saved-parts.js +232 -0
- package/dist/saved-parts.js.map +1 -0
- package/dist/schema.d.ts +1433 -50
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +131 -5
- package/dist/schema.js.map +1 -1
- package/dist/shapes.js +2 -1
- package/dist/shapes.js.map +1 -1
- package/dist/states.d.ts +49 -0
- package/dist/states.d.ts.map +1 -1
- package/dist/states.js +101 -0
- package/dist/states.js.map +1 -1
- package/dist/table-names.d.ts +82 -0
- package/dist/table-names.d.ts.map +1 -0
- package/dist/table-names.js +145 -0
- package/dist/table-names.js.map +1 -0
- package/dist/words.d.ts +1 -1
- package/dist/words.d.ts.map +1 -1
- package/dist/words.js +212 -0
- package/dist/words.js.map +1 -1
- package/dist/workspace-file.d.ts +115 -0
- package/dist/workspace-file.d.ts.map +1 -0
- package/dist/workspace-file.js +130 -0
- package/dist/workspace-file.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `apps.requires` — the other apps a self-made app needs on its database.
|
|
3
|
+
*
|
|
4
|
+
* ```json
|
|
5
|
+
* "apps": {
|
|
6
|
+
* "requires": [{ "publisher": "adminium", "key": "point-of-sale", "range": ">=1.2.0",
|
|
7
|
+
* "tables": ["orders", "order_lines"] }]
|
|
8
|
+
* }
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* A dashboard saved with pages on a catalogue app's tables never carries that
|
|
12
|
+
* app: it names it here, and the install needs it already installed on the
|
|
13
|
+
* same database, by the same publisher, at a version in `range` (any version
|
|
14
|
+
* when there is none). Publisher AND key: a key alone is matched by any file
|
|
15
|
+
* that says it is `pos`, a self-made one among them.
|
|
16
|
+
*
|
|
17
|
+
* `tables` names the app's own `requiredSchema.tables` that are the required
|
|
18
|
+
* app's, by the same ref. The install makes none of them: it uses the
|
|
19
|
+
* required app's tables and records its use of them, so the required app's
|
|
20
|
+
* uninstall never drops a table this app still reads.
|
|
21
|
+
*
|
|
22
|
+
* A self-made app (`publisher: local`) is never a requirement: `local` says
|
|
23
|
+
* where a file was made, not which app it is, so it proves nothing.
|
|
24
|
+
*
|
|
25
|
+
* Only a self-made app carries the block; the published catalogue never does.
|
|
26
|
+
*/
|
|
27
|
+
import { z } from 'zod';
|
|
28
|
+
/** The most apps one app may require. */
|
|
29
|
+
export declare const REQUIRED_APPS_MAX = 8;
|
|
30
|
+
export declare const requiredAppSchema: z.ZodObject<{
|
|
31
|
+
publisher: z.ZodString;
|
|
32
|
+
key: z.ZodString;
|
|
33
|
+
range: z.ZodOptional<z.ZodString>;
|
|
34
|
+
tables: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
35
|
+
}, z.core.$strict>;
|
|
36
|
+
export type RequiredApp = z.infer<typeof requiredAppSchema>;
|
|
37
|
+
export declare const appsBlockSchema: z.ZodObject<{
|
|
38
|
+
requires: z.ZodArray<z.ZodObject<{
|
|
39
|
+
publisher: z.ZodString;
|
|
40
|
+
key: z.ZodString;
|
|
41
|
+
range: z.ZodOptional<z.ZodString>;
|
|
42
|
+
tables: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
43
|
+
}, z.core.$strict>>;
|
|
44
|
+
}, z.core.$strict>;
|
|
45
|
+
export type AppsBlock = z.infer<typeof appsBlockSchema>;
|
|
46
|
+
interface Issue {
|
|
47
|
+
path: (string | number)[];
|
|
48
|
+
message: string;
|
|
49
|
+
}
|
|
50
|
+
/** Everything wrong with an app's `apps` block that its shape alone cannot see. */
|
|
51
|
+
export declare function requiredAppIssues(m: {
|
|
52
|
+
key: string;
|
|
53
|
+
publisher: {
|
|
54
|
+
id: string;
|
|
55
|
+
};
|
|
56
|
+
apps?: AppsBlock | undefined;
|
|
57
|
+
requiredSchema?: {
|
|
58
|
+
tables: readonly {
|
|
59
|
+
ref: string;
|
|
60
|
+
}[];
|
|
61
|
+
} | undefined;
|
|
62
|
+
}): Issue[];
|
|
63
|
+
/** This app's tables that are another app's, by ref, with the app they belong to. */
|
|
64
|
+
export declare function requiredAppTables(apps: AppsBlock | undefined): Map<string, RequiredApp>;
|
|
65
|
+
export {};
|
|
66
|
+
//# sourceMappingURL=app-requires.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-requires.d.ts","sourceRoot":"","sources":["../src/app-requires.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,yCAAyC;AACzC,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAQnC,eAAO,MAAM,iBAAiB;;;;;kBAUnB,CAAC;AACZ,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,eAAe;;;;;;;kBAIjB,CAAC;AACZ,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,UAAU,KAAK;IACb,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,mFAAmF;AACnF,wBAAgB,iBAAiB,CAAC,CAAC,EAAE;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC7B,cAAc,CAAC,EAAE;QAAE,MAAM,EAAE,SAAS;YAAE,GAAG,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAAE,GAAG,SAAS,CAAC;CACrE,GAAG,KAAK,EAAE,CA4BV;AAED,qFAAqF;AACrF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAIvF"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
/**
|
|
3
|
+
* `apps.requires` — the other apps a self-made app needs on its database.
|
|
4
|
+
*
|
|
5
|
+
* ```json
|
|
6
|
+
* "apps": {
|
|
7
|
+
* "requires": [{ "publisher": "adminium", "key": "point-of-sale", "range": ">=1.2.0",
|
|
8
|
+
* "tables": ["orders", "order_lines"] }]
|
|
9
|
+
* }
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* A dashboard saved with pages on a catalogue app's tables never carries that
|
|
13
|
+
* app: it names it here, and the install needs it already installed on the
|
|
14
|
+
* same database, by the same publisher, at a version in `range` (any version
|
|
15
|
+
* when there is none). Publisher AND key: a key alone is matched by any file
|
|
16
|
+
* that says it is `pos`, a self-made one among them.
|
|
17
|
+
*
|
|
18
|
+
* `tables` names the app's own `requiredSchema.tables` that are the required
|
|
19
|
+
* app's, by the same ref. The install makes none of them: it uses the
|
|
20
|
+
* required app's tables and records its use of them, so the required app's
|
|
21
|
+
* uninstall never drops a table this app still reads.
|
|
22
|
+
*
|
|
23
|
+
* A self-made app (`publisher: local`) is never a requirement: `local` says
|
|
24
|
+
* where a file was made, not which app it is, so it proves nothing.
|
|
25
|
+
*
|
|
26
|
+
* Only a self-made app carries the block; the published catalogue never does.
|
|
27
|
+
*/
|
|
28
|
+
import { z } from 'zod';
|
|
29
|
+
import { refSchema } from './refs.js';
|
|
30
|
+
import { parseSemverRange } from './semver.js';
|
|
31
|
+
const LOCAL_PUBLISHER_ID = 'local';
|
|
32
|
+
/** The most apps one app may require. */
|
|
33
|
+
export const REQUIRED_APPS_MAX = 8;
|
|
34
|
+
const rangeSchema = z
|
|
35
|
+
.string()
|
|
36
|
+
.min(1)
|
|
37
|
+
.max(120)
|
|
38
|
+
.refine((range) => parseSemverRange(range) !== null, { message: 'a semver range such as ">=1.1.0" or "^1.1.0"' });
|
|
39
|
+
export const requiredAppSchema = z
|
|
40
|
+
.object({
|
|
41
|
+
/** The publisher's id, as the required app's own manifest gives it. */
|
|
42
|
+
publisher: z.string().regex(/^[a-z][a-z0-9-]{1,39}$/, 'a publisher id'),
|
|
43
|
+
key: z.string().regex(/^[a-z][a-z0-9-]{1,79}$/, 'an app key'),
|
|
44
|
+
/** The versions that will do: any, when absent. */
|
|
45
|
+
range: rangeSchema.optional(),
|
|
46
|
+
/** This app's tables that are the required app's own, by the same ref. */
|
|
47
|
+
tables: z.array(refSchema).min(1).max(64).optional(),
|
|
48
|
+
})
|
|
49
|
+
.strict();
|
|
50
|
+
export const appsBlockSchema = z
|
|
51
|
+
.object({
|
|
52
|
+
requires: z.array(requiredAppSchema).min(1).max(REQUIRED_APPS_MAX),
|
|
53
|
+
})
|
|
54
|
+
.strict();
|
|
55
|
+
/** Everything wrong with an app's `apps` block that its shape alone cannot see. */
|
|
56
|
+
export function requiredAppIssues(m) {
|
|
57
|
+
const out = [];
|
|
58
|
+
if (m.apps === undefined)
|
|
59
|
+
return out;
|
|
60
|
+
if (m.publisher.id !== LOCAL_PUBLISHER_ID) {
|
|
61
|
+
out.push({ path: ['apps'], message: `"apps" is carried only by a self-made app (publisher "${LOCAL_PUBLISHER_ID}")` });
|
|
62
|
+
}
|
|
63
|
+
const own = new Set((m.requiredSchema?.tables ?? []).map((table) => table.ref));
|
|
64
|
+
const keys = new Set();
|
|
65
|
+
const named = new Map();
|
|
66
|
+
m.apps.requires.forEach((need, n) => {
|
|
67
|
+
const at = ['apps', 'requires', n];
|
|
68
|
+
if (need.key === m.key)
|
|
69
|
+
out.push({ path: [...at, 'key'], message: 'an app does not require itself' });
|
|
70
|
+
if (keys.has(need.key))
|
|
71
|
+
out.push({ path: [...at, 'key'], message: `"${need.key}" is required twice` });
|
|
72
|
+
keys.add(need.key);
|
|
73
|
+
if (need.publisher === LOCAL_PUBLISHER_ID) {
|
|
74
|
+
out.push({
|
|
75
|
+
path: [...at, 'publisher'],
|
|
76
|
+
message: `a self-made app cannot be required: "${LOCAL_PUBLISHER_ID}" says where a file was made, not which app it is`,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
(need.tables ?? []).forEach((ref, t) => {
|
|
80
|
+
if (!own.has(ref))
|
|
81
|
+
out.push({ path: [...at, 'tables', t], message: `"${ref}" is not one of the app's tables (requiredSchema.tables)` });
|
|
82
|
+
const earlier = named.get(ref);
|
|
83
|
+
if (earlier !== undefined)
|
|
84
|
+
out.push({ path: [...at, 'tables', t], message: `"${ref}" is already "${earlier}"'s table` });
|
|
85
|
+
named.set(ref, need.key);
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
return out;
|
|
89
|
+
}
|
|
90
|
+
/** This app's tables that are another app's, by ref, with the app they belong to. */
|
|
91
|
+
export function requiredAppTables(apps) {
|
|
92
|
+
const out = new Map();
|
|
93
|
+
for (const need of apps?.requires ?? [])
|
|
94
|
+
for (const ref of need.tables ?? [])
|
|
95
|
+
out.set(ref, need);
|
|
96
|
+
return out;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=app-requires.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-requires.js","sourceRoot":"","sources":["../src/app-requires.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAEnC,yCAAyC;AACzC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAEnC,MAAM,WAAW,GA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