@antelopejs/dms 0.9.0 → 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 +34 -0
- package/data/module-store/catalog.json +71 -0
- package/dist/config.d.ts +7 -0
- package/dist/config.js +8 -0
- package/dist/config.js.map +1 -1
- package/dist/implementations/dms/frontend-modules.d.ts +2 -0
- package/dist/implementations/dms/frontend-modules.js +29 -1
- package/dist/implementations/dms/frontend-modules.js.map +1 -1
- package/dist/implementations/dms/frontend-ready.d.ts +8 -0
- package/dist/implementations/dms/frontend-ready.js +34 -0
- package/dist/implementations/dms/frontend-ready.js.map +1 -0
- package/dist/implementations/dms/manifest.d.ts +1 -0
- package/dist/implementations/dms/manifest.js.map +1 -1
- package/dist/implementations/dms/page.d.ts +2 -0
- package/dist/implementations/dms/page.js +16 -0
- package/dist/implementations/dms/page.js.map +1 -1
- package/dist/implementations/dms-auth/index.js +1 -1
- package/dist/implementations/dms-auth/index.js.map +1 -1
- package/dist/routes/index.d.ts +1 -0
- package/dist/routes/index.js +1 -0
- package/dist/routes/index.js.map +1 -1
- package/dist/routes/store.d.ts +21 -0
- package/dist/routes/store.js +130 -0
- package/dist/routes/store.js.map +1 -0
- package/dist/store/activity.d.ts +2 -0
- package/dist/store/activity.js +12 -0
- package/dist/store/activity.js.map +1 -0
- package/dist/store/cache.d.ts +8 -0
- package/dist/store/cache.js +29 -0
- package/dist/store/cache.js.map +1 -0
- package/dist/store/catalog.d.ts +4 -0
- package/dist/store/catalog.js +69 -0
- package/dist/store/catalog.js.map +1 -0
- package/dist/store/compatibility.d.ts +3 -0
- package/dist/store/compatibility.js +45 -0
- package/dist/store/compatibility.js.map +1 -0
- package/dist/store/declarations.d.ts +18 -0
- package/dist/store/declarations.js +116 -0
- package/dist/store/declarations.js.map +1 -0
- package/dist/store/frontend-compatibility.d.ts +18 -0
- package/dist/store/frontend-compatibility.js +93 -0
- package/dist/store/frontend-compatibility.js.map +1 -0
- package/dist/store/interfaces.d.ts +6 -0
- package/dist/store/interfaces.js +126 -0
- package/dist/store/interfaces.js.map +1 -0
- package/dist/store/listing.d.ts +2 -0
- package/dist/store/listing.js +180 -0
- package/dist/store/listing.js.map +1 -0
- package/dist/store/operations.d.ts +8 -0
- package/dist/store/operations.js +254 -0
- package/dist/store/operations.js.map +1 -0
- package/dist/store/registry.d.ts +4 -0
- package/dist/store/registry.js +61 -0
- package/dist/store/registry.js.map +1 -0
- package/dist/store/requirements.d.ts +14 -0
- package/dist/store/requirements.js +81 -0
- package/dist/store/requirements.js.map +1 -0
- package/dist/store/runtime.d.ts +11 -0
- package/dist/store/runtime.js +78 -0
- package/dist/store/runtime.js.map +1 -0
- package/dist/store/tarball.d.ts +2 -0
- package/dist/store/tarball.js +80 -0
- package/dist/store/tarball.js.map +1 -0
- package/dist/store/types.d.ts +98 -0
- package/dist/store/types.js +3 -0
- package/dist/store/types.js.map +1 -0
- package/dist/test/unit/interfaces/dms/page-extension-ownership.test.js +1 -1
- package/dist/test/unit/interfaces/dms/page-extension-ownership.test.js.map +1 -1
- package/dist/test/unit/store/store.test.d.ts +1 -0
- package/dist/test/unit/store/store.test.js +127 -0
- package/dist/test/unit/store/store.test.js.map +1 -0
- package/dist/test/unit/utils/user-activity.test.js +4 -12
- package/dist/test/unit/utils/user-activity.test.js.map +1 -1
- package/dist/utils/user-activity.d.ts +1 -1
- package/dist/utils/user-activity.js +6 -3
- package/dist/utils/user-activity.js.map +1 -1
- package/dist/validation/store.schema.d.ts +39 -0
- package/dist/validation/store.schema.js +27 -0
- package/dist/validation/store.schema.js.map +1 -0
- package/frontend-vue/layers/dms-layout/app/build/components/pages/modules/ModuleStoreDependencyPicker.vue +136 -0
- package/frontend-vue/layers/dms-layout/app/build/components/pages/modules/ModuleStoreRequirements.vue +98 -0
- package/frontend-vue/layers/dms-layout/app/build/components/pages/modules/ModuleStoreTile.vue +247 -29
- package/frontend-vue/layers/dms-layout/app/build/components/pages/modules/ModuleTile.vue +19 -2
- package/frontend-vue/layers/dms-layout/app/build/utils/module-store-catalog.ts +186 -120
- package/frontend-vue/layers/dms-layout/app/build/utils/module-store-install.ts +146 -0
- package/frontend-vue/layers/dms-layout/app/composables/page/useModuleStore.ts +109 -0
- package/frontend-vue/layers/dms-layout/app/custom-pages/modules.vue +335 -34
- package/frontend-vue/layers/dms-layout/app/types/module-store.ts +134 -0
- package/frontend-vue/layers/dms-layout/i18n/locales/layout-en-GB.json +107 -9
- package/frontend-vue/layers/dms-layout/i18n/locales/layout-fr-FR.json +107 -9
- package/frontend-vue/package.json +3 -3
- package/frontend-vue/pnpm-lock.yaml +16 -22
- package/frontend-vue/tests/module-store-catalog.test.ts +270 -51
- package/frontend-vue/tests/top-list-card-period-badge-ssr.test.ts +212 -0
- package/package.json +5 -5
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RuntimeModule } from "./types";
|
|
2
|
+
export interface StoreModuleLoad {
|
|
3
|
+
package: string;
|
|
4
|
+
range: string;
|
|
5
|
+
config?: unknown;
|
|
6
|
+
}
|
|
7
|
+
export declare function isLive(module: RuntimeModule | undefined): boolean;
|
|
8
|
+
export declare function listRuntimeModules(): Promise<Map<string, RuntimeModule>>;
|
|
9
|
+
export declare function loadStoreModule(moduleId: string, load: StoreModuleLoad): Promise<void>;
|
|
10
|
+
export declare function unloadStoreModule(moduleId: string): Promise<void>;
|
|
11
|
+
export declare function describeRuntimeModule(moduleId: string): Promise<RuntimeModule | undefined>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isLive = isLive;
|
|
7
|
+
exports.listRuntimeModules = listRuntimeModules;
|
|
8
|
+
exports.loadStoreModule = loadStoreModule;
|
|
9
|
+
exports.unloadStoreModule = unloadStoreModule;
|
|
10
|
+
exports.describeRuntimeModule = describeRuntimeModule;
|
|
11
|
+
const promises_1 = require("node:fs/promises");
|
|
12
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
13
|
+
const modules_1 = require("@antelopejs/interface-core/modules");
|
|
14
|
+
const PACKAGE_SOURCE_TYPE = "package";
|
|
15
|
+
const PACKAGE_JSON = "package.json";
|
|
16
|
+
const LIVE_STATUSES = new Set(["constructed", "active"]);
|
|
17
|
+
function isLive(module) {
|
|
18
|
+
return module !== undefined && LIVE_STATUSES.has(module.status);
|
|
19
|
+
}
|
|
20
|
+
async function loadedVersion(localPath) {
|
|
21
|
+
try {
|
|
22
|
+
const manifest = JSON.parse(await (0, promises_1.readFile)(node_path_1.default.join(localPath, PACKAGE_JSON), "utf-8"));
|
|
23
|
+
return manifest.version;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async function describeModule(moduleId) {
|
|
30
|
+
try {
|
|
31
|
+
const info = await (0, modules_1.GetModuleInfo)(moduleId);
|
|
32
|
+
const source = info.source;
|
|
33
|
+
const isPackage = source.type === PACKAGE_SOURCE_TYPE;
|
|
34
|
+
return {
|
|
35
|
+
id: moduleId,
|
|
36
|
+
packageName: isPackage ? source.package : undefined,
|
|
37
|
+
version: isPackage ? await loadedVersion(info.localPath) : undefined,
|
|
38
|
+
status: info.status,
|
|
39
|
+
localPath: info.localPath,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async function listRuntimeModules() {
|
|
47
|
+
const described = await Promise.all((await (0, modules_1.ListModules)()).map((moduleId) => describeModule(moduleId)));
|
|
48
|
+
return new Map(described
|
|
49
|
+
.filter((module) => module !== undefined)
|
|
50
|
+
.map((module) => [module.id, module]));
|
|
51
|
+
}
|
|
52
|
+
async function loadStoreModule(moduleId, load) {
|
|
53
|
+
try {
|
|
54
|
+
await (0, modules_1.LoadModule)(moduleId, {
|
|
55
|
+
source: {
|
|
56
|
+
type: PACKAGE_SOURCE_TYPE,
|
|
57
|
+
package: load.package,
|
|
58
|
+
version: load.range,
|
|
59
|
+
},
|
|
60
|
+
config: load.config ?? {},
|
|
61
|
+
}, true);
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
await unloadStoreModule(moduleId).catch(() => undefined);
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async function unloadStoreModule(moduleId) {
|
|
69
|
+
const module = await describeModule(moduleId);
|
|
70
|
+
if (!module)
|
|
71
|
+
return;
|
|
72
|
+
await (0, modules_1.StopModule)(moduleId);
|
|
73
|
+
await (0, modules_1.DestroyModule)(moduleId);
|
|
74
|
+
}
|
|
75
|
+
async function describeRuntimeModule(moduleId) {
|
|
76
|
+
return describeModule(moduleId);
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/store/runtime.ts"],"names":[],"mappings":";;;;;AAqCA,wBAEC;AAkCD,gDAWC;AAOD,0CAqBC;AAGD,8CAKC;AAED,sDAIC;AA9HD,+CAA4C;AAC5C,0DAA6B;AAC7B,gEAM4C;AAG5C,MAAM,mBAAmB,GAAG,SAAS,CAAC;AACtC,MAAM,YAAY,GAAG,cAAc,CAAC;AAMpC,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC;AAmBzD,SAAgB,MAAM,CAAC,MAAiC;IACtD,OAAO,MAAM,KAAK,SAAS,IAAI,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAClE,CAAC;AAGD,KAAK,UAAU,aAAa,CAAC,SAAiB;IAC5C,IAAI,CAAC;QACH,MAAM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AM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CACxC,CAAC;AACJ,CAAC;AAOM,KAAK,UAAU,eAAe,CACnC,QAAgB,EAChB,IAAqB;IAErB,IAAI,CAAC;QACH,MAAM,IAAA,oBAAU,EACd,QAAQ,EACR;YACE,MAAM,EAAE;gBACN,IAAI,EAAE,mBAAmB;gBACzB,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,OAAO,EAAE,IAAI,CAAC,KAAK;aACpB;YACD,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,EAAE;SAC1B,EACD,IAAI,CACL,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,iBAAiB,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QACzD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAGM,KAAK,UAAU,iBAAiB,CAAC,QAAgB;IACtD,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC9C,IAAI,CAAC,MAAM;QAAE,OAAO;IACpB,MAAM,IAAA,oBAAU,EAAC,QAAQ,CAAC,CAAC;IAC3B,MAAM,IAAA,uBAAa,EAAC,QAAQ,CAAC,CAAC;AAChC,CAAC;AAEM,KAAK,UAAU,qBAAqB,CACzC,QAAgB;IAEhB,OAAO,cAAc,CAAC,QAAQ,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.readTarFile = readTarFile;
|
|
7
|
+
exports.readPublishedFiles = readPublishedFiles;
|
|
8
|
+
const node_child_process_1 = require("node:child_process");
|
|
9
|
+
const promises_1 = require("node:fs/promises");
|
|
10
|
+
const node_os_1 = require("node:os");
|
|
11
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
12
|
+
const node_util_1 = require("node:util");
|
|
13
|
+
const node_zlib_1 = require("node:zlib");
|
|
14
|
+
const execFileAsync = (0, node_util_1.promisify)(node_child_process_1.execFile);
|
|
15
|
+
const NPM_PACK_TIMEOUT_MS = 60_000;
|
|
16
|
+
const TAR_BLOCK_SIZE = 512;
|
|
17
|
+
const TAR_NAME_LENGTH = 100;
|
|
18
|
+
const TAR_SIZE_OFFSET = 124;
|
|
19
|
+
const TAR_SIZE_LENGTH = 12;
|
|
20
|
+
const TAR_TYPE_OFFSET = 156;
|
|
21
|
+
const TAR_PREFIX_OFFSET = 345;
|
|
22
|
+
const TAR_PREFIX_LENGTH = 155;
|
|
23
|
+
const OCTAL = 8;
|
|
24
|
+
const PACKAGE_ROOT = "package/";
|
|
25
|
+
const TEMP_PREFIX = "dms-store-pack-";
|
|
26
|
+
function readString(block, offset, length) {
|
|
27
|
+
const raw = block.subarray(offset, offset + length);
|
|
28
|
+
const end = raw.indexOf(0);
|
|
29
|
+
return raw.subarray(0, end === -1 ? raw.length : end).toString("utf-8");
|
|
30
|
+
}
|
|
31
|
+
function readHeader(block) {
|
|
32
|
+
const name = readString(block, 0, TAR_NAME_LENGTH);
|
|
33
|
+
if (!name)
|
|
34
|
+
return undefined;
|
|
35
|
+
const prefix = readString(block, TAR_PREFIX_OFFSET, TAR_PREFIX_LENGTH);
|
|
36
|
+
return {
|
|
37
|
+
name: prefix ? `${prefix}/${name}` : name,
|
|
38
|
+
size: Number.parseInt(readString(block, TAR_SIZE_OFFSET, TAR_SIZE_LENGTH).trim(), OCTAL) || 0,
|
|
39
|
+
type: readString(block, TAR_TYPE_OFFSET, 1),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function readTarFile(archive, filePath) {
|
|
43
|
+
const wanted = `${PACKAGE_ROOT}${filePath}`;
|
|
44
|
+
let offset = 0;
|
|
45
|
+
while (offset + TAR_BLOCK_SIZE <= archive.length) {
|
|
46
|
+
const header = readHeader(archive.subarray(offset, offset + TAR_BLOCK_SIZE));
|
|
47
|
+
if (!header)
|
|
48
|
+
return undefined;
|
|
49
|
+
const start = offset + TAR_BLOCK_SIZE;
|
|
50
|
+
if (header.name === wanted) {
|
|
51
|
+
return archive.subarray(start, start + header.size);
|
|
52
|
+
}
|
|
53
|
+
offset = start + Math.ceil(header.size / TAR_BLOCK_SIZE) * TAR_BLOCK_SIZE;
|
|
54
|
+
}
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
async function packRelease(spec, projectPath, destination) {
|
|
58
|
+
await execFileAsync("npm", ["pack", spec, "--pack-destination", destination, "--silent"], { cwd: projectPath, timeout: NPM_PACK_TIMEOUT_MS });
|
|
59
|
+
const [file] = await (0, promises_1.readdir)(destination);
|
|
60
|
+
if (!file)
|
|
61
|
+
throw new Error(`npm pack ${spec} wrote no archive`);
|
|
62
|
+
return (0, node_zlib_1.gunzipSync)(await (0, promises_1.readFile)(node_path_1.default.join(destination, file)));
|
|
63
|
+
}
|
|
64
|
+
async function readPublishedFiles(packageName, version, projectPath, filePaths) {
|
|
65
|
+
const destination = await (0, promises_1.mkdtemp)(node_path_1.default.join((0, node_os_1.tmpdir)(), TEMP_PREFIX));
|
|
66
|
+
try {
|
|
67
|
+
const archive = await packRelease(`${packageName}@${version}`, projectPath, destination);
|
|
68
|
+
const files = new Map();
|
|
69
|
+
for (const filePath of filePaths) {
|
|
70
|
+
const content = readTarFile(archive, filePath);
|
|
71
|
+
if (content)
|
|
72
|
+
files.set(filePath, content.toString("utf-8"));
|
|
73
|
+
}
|
|
74
|
+
return files;
|
|
75
|
+
}
|
|
76
|
+
finally {
|
|
77
|
+
await (0, promises_1.rm)(destination, { recursive: true, force: true });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=tarball.js.map
|
|
@@ -0,0 +1 @@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,EAAE,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
export interface StoreCatalogEntry {
|
|
2
|
+
id: string;
|
|
3
|
+
package: string;
|
|
4
|
+
icon: string;
|
|
5
|
+
category: string;
|
|
6
|
+
}
|
|
7
|
+
export interface StoreCatalog {
|
|
8
|
+
version: number;
|
|
9
|
+
modules: StoreCatalogEntry[];
|
|
10
|
+
}
|
|
11
|
+
export interface StoreDeclaration {
|
|
12
|
+
key: string;
|
|
13
|
+
package: string;
|
|
14
|
+
range: string;
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
config?: unknown;
|
|
17
|
+
}
|
|
18
|
+
export interface PackageRelease {
|
|
19
|
+
version: string;
|
|
20
|
+
interfaceRange?: string;
|
|
21
|
+
dependencies?: Record<string, string>;
|
|
22
|
+
implements?: string[];
|
|
23
|
+
}
|
|
24
|
+
export interface RuntimeModule {
|
|
25
|
+
id: string;
|
|
26
|
+
packageName?: string;
|
|
27
|
+
version?: string;
|
|
28
|
+
status: string;
|
|
29
|
+
localPath: string;
|
|
30
|
+
}
|
|
31
|
+
export type StoreOperationKind = "install" | "update" | "enable" | "disable" | "uninstall" | "apply";
|
|
32
|
+
export type StoreOperationStep = "resolve" | "dependencies" | "unload" | "load" | "save";
|
|
33
|
+
export interface StoreOperation {
|
|
34
|
+
moduleId: string;
|
|
35
|
+
kind: StoreOperationKind;
|
|
36
|
+
step: StoreOperationStep;
|
|
37
|
+
targetVersion?: string;
|
|
38
|
+
startedAt: number;
|
|
39
|
+
}
|
|
40
|
+
export type StoreModuleState = "available" | "busy" | "active" | "disabled" | "error" | "pending";
|
|
41
|
+
export type StoreFrontendState = "none" | "synced" | "pending" | "unknown";
|
|
42
|
+
export interface InterfaceImplementation {
|
|
43
|
+
name: string;
|
|
44
|
+
package: string;
|
|
45
|
+
}
|
|
46
|
+
export interface MissingInterface {
|
|
47
|
+
interfacePackage: string;
|
|
48
|
+
candidates: InterfaceImplementation[];
|
|
49
|
+
}
|
|
50
|
+
export interface FrontendBreak {
|
|
51
|
+
name: string;
|
|
52
|
+
range: string;
|
|
53
|
+
}
|
|
54
|
+
export interface FrontendRequirement {
|
|
55
|
+
range: string;
|
|
56
|
+
running: string;
|
|
57
|
+
target?: string;
|
|
58
|
+
command?: string;
|
|
59
|
+
breaks: FrontendBreak[];
|
|
60
|
+
}
|
|
61
|
+
export type FrontendVersionSource = "reported" | "project";
|
|
62
|
+
export interface StoreListingEntry {
|
|
63
|
+
id: string;
|
|
64
|
+
package: string;
|
|
65
|
+
icon: string;
|
|
66
|
+
category: string;
|
|
67
|
+
title: string;
|
|
68
|
+
description: string;
|
|
69
|
+
state: StoreModuleState;
|
|
70
|
+
installedVersion?: string;
|
|
71
|
+
declaredRange?: string;
|
|
72
|
+
latestVersion?: string;
|
|
73
|
+
updateAvailable: boolean;
|
|
74
|
+
compatible: boolean;
|
|
75
|
+
requiredInterfaceRange?: string;
|
|
76
|
+
error?: string;
|
|
77
|
+
operation?: StoreOperation;
|
|
78
|
+
frontend: StoreFrontendState;
|
|
79
|
+
frontendRange?: string;
|
|
80
|
+
frontendRequirement?: FrontendRequirement;
|
|
81
|
+
missingInterfaces: MissingInterface[];
|
|
82
|
+
dependents: string[];
|
|
83
|
+
}
|
|
84
|
+
export interface StoreListing {
|
|
85
|
+
enabled: boolean;
|
|
86
|
+
modules: StoreListingEntry[];
|
|
87
|
+
busy: boolean;
|
|
88
|
+
interfaceVersion: string;
|
|
89
|
+
dev: boolean;
|
|
90
|
+
configError?: string;
|
|
91
|
+
frontendVersion?: string;
|
|
92
|
+
frontendVersionSource?: FrontendVersionSource;
|
|
93
|
+
}
|
|
94
|
+
export interface StoreDependencyChoice {
|
|
95
|
+
interfacePackage: string;
|
|
96
|
+
package: string;
|
|
97
|
+
config?: Record<string, unknown>;
|
|
98
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/store/types.ts"],"names":[],"mappings":""}
|
|
@@ -56,7 +56,7 @@ function pageId(page) {
|
|
|
56
56
|
return `pages.${page}`;
|
|
57
57
|
}
|
|
58
58
|
function ownerOf(proxy, id) {
|
|
59
|
-
return proxy.
|
|
59
|
+
return proxy.registered.get(id)?.owner;
|
|
60
60
|
}
|
|
61
61
|
function permissionOwner(id) {
|
|
62
62
|
return ownerOf(permissionsInterface.internal.RegisterPermission, id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-extension-ownership.test.js","sourceRoot":"","sources":["../../../../../src/test/unit/interfaces/dms/page-extension-ownership.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+DAA6E;AAC7E,gEAG4C;AAC5C,+BAA8B;AAC9B,+EAAiE;AACjE,6FAA+E;AAC/E,uFAAyE;AACzE,gEAAiE;AACjE,yDAKwC;AACxC,4FAA8E;AAC9E,sFAAwE;AACxE,4DAA+E;AAC/E,8DAMsC;AAStC,MAAM,UAAU,GAAG,mBAAmB,CAAC;AACvC,MAAM,OAAO,GAAG,OAAO,CAAC;AACxB,MAAM,UAAU,GAAG,oBAAoB,CAAC;AACxC,MAAM,WAAW,GAAG,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"page-extension-ownership.test.js","sourceRoot":"","sources":["../../../../../src/test/unit/interfaces/dms/page-extension-ownership.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+DAA6E;AAC7E,gEAG4C;AAC5C,+BAA8B;AAC9B,+EAAiE;AACjE,6FAA+E;AAC/E,uFAAyE;AACzE,gEAAiE;AACjE,yDAKwC;AACxC,4FAA8E;AAC9E,sFAAwE;AACxE,4DAA+E;AAC/E,8DAMsC;AAStC,MAAM,UAAU,GAAG,mBAAmB,CAAC;AACvC,MAAM,OAAO,GAAG,OAAO,CAAC;AACxB,MAAM,UAAU,GAAG,oBAAoB,CAAC;AACxC,MAAM,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AAA,aAAM,EAAC,UAAU,CAAC,IAAI,EAAE,yCAA2B,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YAC1E,IAAA,aAAM,EAAC,CAAC,GAAG,IAAA,wBAAa,EAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;YACrE,IAAA,aAAM,EAAC,eAAe,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const chai_1 = require("chai");
|
|
4
|
+
const config_1 = require("../../../config");
|
|
5
|
+
const catalog_1 = require("../../../store/catalog");
|
|
6
|
+
const compatibility_1 = require("../../../store/compatibility");
|
|
7
|
+
const declarations_1 = require("../../../store/declarations");
|
|
8
|
+
const frontend_compatibility_1 = require("../../../store/frontend-compatibility");
|
|
9
|
+
const runtime_1 = require("../../../store/runtime");
|
|
10
|
+
const tarball_1 = require("../../../store/tarball");
|
|
11
|
+
const store_schema_1 = require("../../../validation/store.schema");
|
|
12
|
+
function runtimeModule(status) {
|
|
13
|
+
return {
|
|
14
|
+
id: "@antelopejs/dms-lang",
|
|
15
|
+
packageName: "@antelopejs/dms-lang",
|
|
16
|
+
status,
|
|
17
|
+
localPath: "/modules/dms-lang",
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
describe("[unit] store/catalog", () => {
|
|
21
|
+
it("reads the bundled catalog, one entry per official module", async () => {
|
|
22
|
+
const catalog = await (0, catalog_1.loadStoreCatalog)();
|
|
23
|
+
const ids = catalog.map((entry) => entry.id);
|
|
24
|
+
(0, chai_1.expect)(ids).to.include.members(["lang", "media", "database"]);
|
|
25
|
+
(0, chai_1.expect)(new Set(ids).size).to.equal(ids.length);
|
|
26
|
+
});
|
|
27
|
+
it("drops an entry missing a field rather than half-reading it", () => {
|
|
28
|
+
const entries = (0, catalog_1.readCatalogDocument)({
|
|
29
|
+
version: 1,
|
|
30
|
+
modules: [
|
|
31
|
+
{
|
|
32
|
+
id: "lang",
|
|
33
|
+
package: "@antelopejs/dms-lang",
|
|
34
|
+
icon: "i",
|
|
35
|
+
category: "content",
|
|
36
|
+
},
|
|
37
|
+
{ id: "nameless", icon: "i", category: "content" },
|
|
38
|
+
],
|
|
39
|
+
});
|
|
40
|
+
(0, chai_1.expect)(entries.map((entry) => entry.id)).to.deep.equal(["lang"]);
|
|
41
|
+
});
|
|
42
|
+
it("refuses a catalog of another version", () => {
|
|
43
|
+
(0, chai_1.expect)(() => (0, catalog_1.readCatalogDocument)({ version: 2, modules: [] })).to.throw(/Unsupported module catalog version/);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
describe("[unit] store/compatibility", () => {
|
|
47
|
+
it("follows the interface range a release depends on", () => {
|
|
48
|
+
const release = { version: "1.0.0", interfaceRange: ">=0.6.0 <1.0.0" };
|
|
49
|
+
(0, chai_1.expect)((0, compatibility_1.isCompatible)(release, "0.6.1")).to.equal(true);
|
|
50
|
+
(0, chai_1.expect)((0, compatibility_1.isCompatible)(release, "0.5.9")).to.equal(false);
|
|
51
|
+
});
|
|
52
|
+
it("does not hold back a release that names no range", () => {
|
|
53
|
+
(0, chai_1.expect)((0, compatibility_1.isCompatible)({ version: "1.0.0" }, "0.6.1")).to.equal(true);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
describe("[unit] store/runtime", () => {
|
|
57
|
+
it("counts a module as running only while it holds an instance", () => {
|
|
58
|
+
(0, chai_1.expect)((0, runtime_1.isLive)(runtimeModule("active"))).to.equal(true);
|
|
59
|
+
(0, chai_1.expect)((0, runtime_1.isLive)(runtimeModule("constructed"))).to.equal(true);
|
|
60
|
+
(0, chai_1.expect)((0, runtime_1.isLive)(runtimeModule("loaded"))).to.equal(false);
|
|
61
|
+
(0, chai_1.expect)((0, runtime_1.isLive)(undefined)).to.equal(false);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
describe("[unit] store/declarations", () => {
|
|
65
|
+
it("writes a package source at the given range", () => {
|
|
66
|
+
(0, chai_1.expect)((0, declarations_1.packageDeclarationSource)("@antelopejs/dms-lang", "^0.1.1")).to.deep.equal({
|
|
67
|
+
type: "package",
|
|
68
|
+
package: "@antelopejs/dms-lang",
|
|
69
|
+
version: "^0.1.1",
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
describe("[unit] store/editable", () => {
|
|
74
|
+
it("follows the runtime mode by default", () => {
|
|
75
|
+
(0, chai_1.expect)((0, config_1.isStoreEditable)(true)).to.equal(true);
|
|
76
|
+
(0, chai_1.expect)((0, config_1.isStoreEditable)(false)).to.equal(false);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
function tarEntry(name, content) {
|
|
80
|
+
const header = Buffer.alloc(512);
|
|
81
|
+
header.write(name, 0);
|
|
82
|
+
header.write(`${content.length.toString(8).padStart(11, "0")}\0`, 124);
|
|
83
|
+
header.write("0", 156);
|
|
84
|
+
const body = Buffer.alloc(Math.ceil(content.length / 512) * 512);
|
|
85
|
+
body.write(content);
|
|
86
|
+
return Buffer.concat([header, body]);
|
|
87
|
+
}
|
|
88
|
+
describe("[unit] store/tarball", () => {
|
|
89
|
+
it("reads one file of an npm archive by its path in the package", () => {
|
|
90
|
+
const archive = Buffer.concat([
|
|
91
|
+
tarEntry("package/package.json", '{"name":"a"}'),
|
|
92
|
+
tarEntry("package/frontend-vue/package.json", '{"engines":{}}'),
|
|
93
|
+
Buffer.alloc(1024),
|
|
94
|
+
]);
|
|
95
|
+
(0, chai_1.expect)((0, tarball_1.readTarFile)(archive, "frontend-vue/package.json")?.toString()).to.equal('{"engines":{}}');
|
|
96
|
+
(0, chai_1.expect)((0, tarball_1.readTarFile)(archive, "missing.json")).to.equal(undefined);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
describe("[unit] store/frontend-compatibility", () => {
|
|
100
|
+
it("checks a prerelease as the release it leads to", () => {
|
|
101
|
+
(0, chai_1.expect)((0, frontend_compatibility_1.supportsFrontend)(">=0.6.0 <0.7.0", "0.6.0")).to.equal(true);
|
|
102
|
+
(0, chai_1.expect)((0, frontend_compatibility_1.supportsFrontend)(">=0.6.0 <0.7.0", "0.7.0-next.1")).to.equal(false);
|
|
103
|
+
(0, chai_1.expect)((0, frontend_compatibility_1.supportsFrontend)("<0.6.0", "0.6.0")).to.equal(false);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
describe("[unit] validation/store", () => {
|
|
107
|
+
const install = (packageName) => store_schema_1.storeInstallSchema.safeParse({
|
|
108
|
+
id: "lang",
|
|
109
|
+
dependencies: [
|
|
110
|
+
{
|
|
111
|
+
interfacePackage: "@antelopejs/interface-redis",
|
|
112
|
+
package: packageName,
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
}).success;
|
|
116
|
+
it("takes an npm package for a dependency", () => {
|
|
117
|
+
(0, chai_1.expect)(install("@antelopejs/redis")).to.equal(true);
|
|
118
|
+
(0, chai_1.expect)(install("redis-module")).to.equal(true);
|
|
119
|
+
});
|
|
120
|
+
it("refuses a git, URL or local source for a dependency", () => {
|
|
121
|
+
(0, chai_1.expect)(install("git+https://github.com/a/b.git")).to.equal(false);
|
|
122
|
+
(0, chai_1.expect)(install("../redis")).to.equal(false);
|
|
123
|
+
(0, chai_1.expect)(install("file:/tmp/redis")).to.equal(false);
|
|
124
|
+
(0, chai_1.expect)(install("github:a/b")).to.equal(false);
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
//# sourceMappingURL=store.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.test.js","sourceRoot":"","sources":["../../../../src/test/unit/store/store.test.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAC9B,4CAAkD;AAClD,oDAA+E;AAC/E,gEAA4D;AAC5D,8DAAuE;AACvE,kFAAyE;AACzE,oDAAgD;AAChD,oDAAqD;AACrD,mEAAsE;AAGtE,SAAS,aAAa,CAAC,MAAc;IACnC,OAAO;QACL,EAAE,EAAE,sBAAsB;QAC1B,WAAW,EAAE,sBAAsB;QACnC,MAAM;QACN,SAAS,EAAE,mBAAmB;KAC/B,CAAC;AACJ,CAAC;AAED,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,EAAE,CAAC,0DAA0D,EAAE,KAAK,IAAI,EAAE;QACxE,MAAM,OAAO,GAAG,MAAM,IAAA,0BAAgB,GAAE,CAAC;QACzC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC7C,IAAA,aAAM,EAAC,GAAG,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;QAC9D,IAAA,aAAM,EAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4DAA4D,EAAE,GAAG,EAAE;QACpE,MAAM,OAAO,GAAG,IAAA,6BAAmB,EAAC;YAClC,OAAO,EAAE,CAAC;YACV,OAAO,EAAE;gBACP;oBACE,EAAE,EAAE,MAAM;oBACV,OAAO,EAAE,sBAAsB;oBAC/B,IAAI,EAAE,GAAG;oBACT,QAAQ,EAAE,SAAS;iBACpB;gBACD,EAAE,EAAE,EAAE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E,CAAC,qDAAqD,EAAE,GAAG,EAAE;QAC7D,IAAA,aAAM,EAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAClE,IAAA,aAAM,EAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC5C,IAAA,aAAM,EAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACnD,IAAA,aAAM,EAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -6,14 +6,10 @@ const db_1 = require("@antelopejs/interface-dms/auth/db");
|
|
|
6
6
|
const chai_1 = require("chai");
|
|
7
7
|
const user_activity_1 = require("../../../utils/user-activity");
|
|
8
8
|
const NOW = new Date("2026-09-30T12:00:00.000Z");
|
|
9
|
-
const SETTLE_MS = 50;
|
|
10
9
|
const PASSWORD = "activity-test-password";
|
|
11
10
|
function msBefore(date, ms) {
|
|
12
11
|
return new Date(date.getTime() - ms);
|
|
13
12
|
}
|
|
14
|
-
function settle() {
|
|
15
|
-
return new Promise((resolve) => setTimeout(resolve, SETTLE_MS));
|
|
16
|
-
}
|
|
17
13
|
describe("[unit] utils/user-activity", () => {
|
|
18
14
|
describe("isActivityWriteDue", () => {
|
|
19
15
|
it("is due for a user never seen", () => {
|
|
@@ -58,25 +54,21 @@ describe("[unit] utils/user-activity", () => {
|
|
|
58
54
|
});
|
|
59
55
|
it("stores the first activity of a user", async () => {
|
|
60
56
|
const model = (0, interface_database_decorators_1.GetModel)(db_1.UserModel);
|
|
61
|
-
(0, user_activity_1.recordUserActivity)(model, user, NOW);
|
|
62
|
-
await settle();
|
|
57
|
+
await (0, user_activity_1.recordUserActivity)(model, user, NOW);
|
|
63
58
|
const stored = await model.get(user._id);
|
|
64
59
|
(0, chai_1.expect)(new Date(stored?.lastActiveAt ?? 0).getTime()).to.equal(NOW.getTime());
|
|
65
60
|
});
|
|
66
61
|
it("keeps the password verifiable", async () => {
|
|
67
62
|
const model = (0, interface_database_decorators_1.GetModel)(db_1.UserModel);
|
|
68
|
-
(0, user_activity_1.recordUserActivity)(model, user, NOW);
|
|
69
|
-
await settle();
|
|
63
|
+
await (0, user_activity_1.recordUserActivity)(model, user, NOW);
|
|
70
64
|
const stored = await model.get(user._id);
|
|
71
65
|
(0, chai_1.expect)(stored?.testHash("password", PASSWORD)).to.equal(true);
|
|
72
66
|
});
|
|
73
67
|
it("skips the write while the last one is recent", async () => {
|
|
74
68
|
const model = (0, interface_database_decorators_1.GetModel)(db_1.UserModel);
|
|
75
|
-
(0, user_activity_1.recordUserActivity)(model, user, NOW);
|
|
76
|
-
await settle();
|
|
69
|
+
await (0, user_activity_1.recordUserActivity)(model, user, NOW);
|
|
77
70
|
const soon = new Date(NOW.getTime() + user_activity_1.USER_ACTIVITY_WRITE_INTERVAL_MS / 2);
|
|
78
|
-
(0, user_activity_1.recordUserActivity)(model, user, soon);
|
|
79
|
-
await settle();
|
|
71
|
+
await (0, user_activity_1.recordUserActivity)(model, user, soon);
|
|
80
72
|
const stored = await model.get(user._id);
|
|
81
73
|
(0, chai_1.expect)(new Date(stored?.lastActiveAt ?? 0).getTime()).to.equal(NOW.getTime());
|
|
82
74
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-activity.test.js","sourceRoot":"","sources":["../../../../src/test/unit/utils/user-activity.test.ts"],"names":[],"mappings":";;AAAA,6CAAyC;AACzC,6FAAqE;AACrE,0DAAyE;AACzE,+BAA8B;AAC9B,gEAIsC;AAEtC,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,0BAA0B,CAAC,CAAC;AACjD,MAAM,
|
|
1
|
+
{"version":3,"file":"user-activity.test.js","sour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AkB,EAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;YAC5C,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACzC,IAAA,aAAM,EAAC,IAAI,IAAI,CAAC,MAAM,EAAE,YAAY,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAC5D,GAAG,CAAC,OAAO,EAAE,CACd,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { User, UserModel } from "@antelopejs/interface-dms/auth/db";
|
|
2
2
|
export declare const USER_ACTIVITY_WRITE_INTERVAL_MS: number;
|
|
3
3
|
export declare function isActivityWriteDue(lastActiveAt: Date | null | undefined, now: Date): boolean;
|
|
4
|
-
export declare function recordUserActivity(userModel: UserModel, user: User, now?: Date): void
|
|
4
|
+
export declare function recordUserActivity(userModel: UserModel, user: User, now?: Date): Promise<void>;
|
|
@@ -11,12 +11,15 @@ function isActivityWriteDue(lastActiveAt, now) {
|
|
|
11
11
|
const elapsed = now.getTime() - new Date(lastActiveAt).getTime();
|
|
12
12
|
return elapsed >= exports.USER_ACTIVITY_WRITE_INTERVAL_MS;
|
|
13
13
|
}
|
|
14
|
-
function recordUserActivity(userModel, user, now = new Date()) {
|
|
14
|
+
async function recordUserActivity(userModel, user, now = new Date()) {
|
|
15
15
|
if (!isActivityWriteDue(user.lastActiveAt, now))
|
|
16
16
|
return;
|
|
17
17
|
user.lastActiveAt = now;
|
|
18
|
-
|
|
18
|
+
try {
|
|
19
|
+
await userModel.update(user);
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
19
22
|
logging_1.Logging.Warn(`[dms] could not record the activity of "${user._id}"`, error);
|
|
20
|
-
}
|
|
23
|
+
}
|
|
21
24
|
}
|
|
22
25
|
//# sourceMappingURL=user-activity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-activity.js","sourceRoot":"","sources":["../../src/utils/user-activity.ts"],"names":[],"mappings":";;;AAgBA,gDAOC;
|
|
1
|
+
{"version":3,"file":"user-activity.js","sourceRoot":"","sources":["../../src/utils/user-activity.ts"],"names":[],"mappings":";;;AAgBA,gDAOC;AAaD,gDAcC;AAlDD,gEAA6D;AAQhD,QAAA,+BAA+B,GAAG,EAAE,GAAG,IAAI,CAAC;AAQzD,SAAgB,kBAAkB,CAChC,YAAqC,EACrC,GAAS;IAET,IAAI,CAAC,YAAY;QAAE,OAAO,IAAI,CAAC;IAC/B,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE,CAAC;IACjE,OAAO,OAAO,IAAI,uCAA+B,CAAC;AACpD,CAAC;AAaM,KAAK,UAAU,kBAAkB,CACtC,SAAoB,EACpB,IAAU,EACV,MAAY,IAAI,IAAI,EAAE;IAEtB,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,CAAC;QAAE,OAAO;IACxD,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC;IAGxB,IAAI,CAAC;QACH,MAAM,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,iBAAO,CAAC,IAAI,CAAC,2CAA2C,IAAI,CAAC,GAAG,GAAG,EAAE,KAAK,CAAC,CAAC;IAC9E,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const storeOperationSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
id: string;
|
|
6
|
+
}, {
|
|
7
|
+
id: string;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const storeInstallSchema: z.ZodObject<{
|
|
10
|
+
id: z.ZodString;
|
|
11
|
+
} & {
|
|
12
|
+
dependencies: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
13
|
+
interfacePackage: z.ZodString;
|
|
14
|
+
package: z.ZodString;
|
|
15
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
package: string;
|
|
18
|
+
interfacePackage: string;
|
|
19
|
+
config?: Record<string, unknown> | undefined;
|
|
20
|
+
}, {
|
|
21
|
+
package: string;
|
|
22
|
+
interfacePackage: string;
|
|
23
|
+
config?: Record<string, unknown> | undefined;
|
|
24
|
+
}>, "many">>;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
id: string;
|
|
27
|
+
dependencies?: {
|
|
28
|
+
package: string;
|
|
29
|
+
interfacePackage: string;
|
|
30
|
+
config?: Record<string, unknown> | undefined;
|
|
31
|
+
}[] | undefined;
|
|
32
|
+
}, {
|
|
33
|
+
id: string;
|
|
34
|
+
dependencies?: {
|
|
35
|
+
package: string;
|
|
36
|
+
interfacePackage: string;
|
|
37
|
+
config?: Record<string, unknown> | undefined;
|
|
38
|
+
}[] | undefined;
|
|
39
|
+
}>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.storeInstallSchema = exports.storeOperationSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const CATALOG_ID_PATTERN = /^[a-z0-9][a-z0-9-]*$/;
|
|
6
|
+
const CATALOG_ID_MAX_LENGTH = 64;
|
|
7
|
+
exports.storeOperationSchema = zod_1.z.object({
|
|
8
|
+
id: zod_1.z.string().max(CATALOG_ID_MAX_LENGTH).regex(CATALOG_ID_PATTERN),
|
|
9
|
+
});
|
|
10
|
+
const NPM_PACKAGE_PATTERN = /^(?:@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*$/;
|
|
11
|
+
const NPM_PACKAGE_MAX_LENGTH = 214;
|
|
12
|
+
const MAX_DEPENDENCIES = 20;
|
|
13
|
+
const npmPackageSchema = zod_1.z
|
|
14
|
+
.string()
|
|
15
|
+
.max(NPM_PACKAGE_MAX_LENGTH)
|
|
16
|
+
.regex(NPM_PACKAGE_PATTERN);
|
|
17
|
+
exports.storeInstallSchema = exports.storeOperationSchema.extend({
|
|
18
|
+
dependencies: zod_1.z
|
|
19
|
+
.array(zod_1.z.object({
|
|
20
|
+
interfacePackage: npmPackageSchema,
|
|
21
|
+
package: npmPackageSchema,
|
|
22
|
+
config: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
23
|
+
}))
|
|
24
|
+
.max(MAX_DEPENDENCIES)
|
|
25
|
+
.optional(),
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=store.schema.js.map
|