toml | eslint | esm
This commit is contained in:
parent
ce12be9ea3
commit
2c1e67f3ad
151
packages/commons/dist/component.cjs
vendored
Normal file
151
packages/commons/dist/component.cjs
vendored
Normal file
@ -0,0 +1,151 @@
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var component_exports = {};
|
||||
__export(component_exports, {
|
||||
AssetsSchema: () => AssetsSchema,
|
||||
AuthorSchema: () => AuthorSchema,
|
||||
ComponentConfigSchema: () => ComponentConfigSchema,
|
||||
ContentSchema: () => ContentSchema,
|
||||
ProductionSchema: () => ProductionSchema,
|
||||
get: () => get
|
||||
});
|
||||
module.exports = __toCommonJS(component_exports);
|
||||
var path = __toESM(require("path"), 1);
|
||||
var import_zod = require("zod");
|
||||
var import_filter = require("./filter.js");
|
||||
var import_glob = require("./fs/_glob.js");
|
||||
var import_variables = require("./variables.js");
|
||||
var import_config = require("./config.js");
|
||||
const AuthorSchema = import_zod.z.object({
|
||||
name: import_zod.z.string(),
|
||||
url: import_zod.z.string()
|
||||
});
|
||||
const ContentSchema = import_zod.z.object({
|
||||
body: import_zod.z.string().optional(),
|
||||
features: import_zod.z.string().optional(),
|
||||
highlights: import_zod.z.string().optional(),
|
||||
specs: import_zod.z.string().optional(),
|
||||
license: import_zod.z.string().optional()
|
||||
});
|
||||
const AssetsSchema = import_zod.z.object({
|
||||
gallery: import_zod.z.array(import_zod.z.string()).optional(),
|
||||
renderings: import_zod.z.array(import_zod.z.string()).optional(),
|
||||
components: import_zod.z.array(import_zod.z.string()).optional()
|
||||
});
|
||||
const ProductionSchema = import_zod.z.object({
|
||||
"fusion-folder": import_zod.z.string(),
|
||||
"nc-folder": import_zod.z.string(),
|
||||
cam: import_zod.z.array(AuthorSchema)
|
||||
});
|
||||
const ComponentConfigSchema = import_zod.z.object({
|
||||
// shop
|
||||
cart_id: import_zod.z.string().optional(),
|
||||
code: import_zod.z.string(),
|
||||
price: import_zod.z.number().optional(),
|
||||
cscartCats: import_zod.z.array(import_zod.z.number()).optional(),
|
||||
cscartId: import_zod.z.number().optional(),
|
||||
vendorId: import_zod.z.number().optional(),
|
||||
//internal
|
||||
version: import_zod.z.string().optional(),
|
||||
status: import_zod.z.string().optional(),
|
||||
authors: import_zod.z.array(AuthorSchema).optional(),
|
||||
replaced_by: import_zod.z.string().optional(),
|
||||
alternatives: import_zod.z.array(import_zod.z.string()).optional(),
|
||||
flags: import_zod.z.number().optional(),
|
||||
// public
|
||||
download: import_zod.z.boolean().optional(),
|
||||
name: import_zod.z.string(),
|
||||
edrawings: import_zod.z.string().optional(),
|
||||
showDimensions: import_zod.z.boolean().optional(),
|
||||
showParts: import_zod.z.boolean().optional(),
|
||||
slug: import_zod.z.string(),
|
||||
score: import_zod.z.number().optional(),
|
||||
Preview3d: import_zod.z.boolean().optional(),
|
||||
keywords: import_zod.z.string().optional(),
|
||||
meta_keywords: import_zod.z.string().optional(),
|
||||
content: ContentSchema.optional(),
|
||||
assets: AssetsSchema.optional(),
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
howto_categories: import_zod.z.union([import_zod.z.string(), import_zod.z.array(import_zod.z.string())]).optional(),
|
||||
steps: import_zod.z.any().optional(),
|
||||
sourceLanguage: import_zod.z.string().optional(),
|
||||
category: import_zod.z.string(),
|
||||
product_dimensions: import_zod.z.string().optional(),
|
||||
production: ProductionSchema.optional()
|
||||
}).passthrough();
|
||||
const find_items = (nodes, options) => {
|
||||
nodes = nodes.filter(options.filter);
|
||||
return nodes.map((c) => {
|
||||
const root = (0, import_variables.resolve)(options.root, false, {});
|
||||
return {
|
||||
rel: (0, import_glob.forward_slash)(`${path.relative(root, path.parse(c).dir)}`),
|
||||
path: (0, import_glob.forward_slash)(`${options.root}/${path.relative(root, c)}`),
|
||||
config: (0, import_config.readOSRConfig)(c)
|
||||
};
|
||||
});
|
||||
};
|
||||
const get = (src, root, type) => {
|
||||
const srcInfo = (0, import_glob.pathInfoEx)(src, false, {
|
||||
absolute: true
|
||||
});
|
||||
switch (type) {
|
||||
case import_filter.PFilterValid.marketplace_component: {
|
||||
const options = {
|
||||
filter: import_filter.isValidMarketplaceComponent,
|
||||
root
|
||||
};
|
||||
return find_items(srcInfo.FILES, options);
|
||||
}
|
||||
case import_filter.PFilterValid.library_component: {
|
||||
const options = {
|
||||
filter: import_filter.isValidLibraryComponent,
|
||||
root
|
||||
};
|
||||
return find_items(srcInfo.FILES, options);
|
||||
}
|
||||
case import_filter.PFilterInvalid.marketplace_component: {
|
||||
const options = {
|
||||
filter: import_filter.isInvalidMarketplaceComponent,
|
||||
root
|
||||
};
|
||||
return find_items(srcInfo.FILES, options);
|
||||
}
|
||||
}
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
AssetsSchema,
|
||||
AuthorSchema,
|
||||
ComponentConfigSchema,
|
||||
ContentSchema,
|
||||
ProductionSchema,
|
||||
get
|
||||
});
|
||||
//# sourceMappingURL=component.cjs.map
|
||||
1
packages/commons/dist/component.cjs.map
vendored
Normal file
1
packages/commons/dist/component.cjs.map
vendored
Normal file
File diff suppressed because one or more lines are too long
381
packages/commons/dist/component.d.cts
vendored
Normal file
381
packages/commons/dist/component.d.cts
vendored
Normal file
@ -0,0 +1,381 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
declare const AuthorSchema: z.ZodObject<{
|
||||
name: z.ZodString;
|
||||
url: z.ZodString;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
name?: string;
|
||||
url?: string;
|
||||
}, {
|
||||
name?: string;
|
||||
url?: string;
|
||||
}>;
|
||||
declare const ContentSchema: z.ZodObject<{
|
||||
body: z.ZodOptional<z.ZodString>;
|
||||
features: z.ZodOptional<z.ZodString>;
|
||||
highlights: z.ZodOptional<z.ZodString>;
|
||||
specs: z.ZodOptional<z.ZodString>;
|
||||
license: z.ZodOptional<z.ZodString>;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
body?: string;
|
||||
features?: string;
|
||||
highlights?: string;
|
||||
specs?: string;
|
||||
license?: string;
|
||||
}, {
|
||||
body?: string;
|
||||
features?: string;
|
||||
highlights?: string;
|
||||
specs?: string;
|
||||
license?: string;
|
||||
}>;
|
||||
declare const AssetsSchema: z.ZodObject<{
|
||||
gallery: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
||||
renderings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
||||
components: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
gallery?: string[];
|
||||
renderings?: string[];
|
||||
components?: string[];
|
||||
}, {
|
||||
gallery?: string[];
|
||||
renderings?: string[];
|
||||
components?: string[];
|
||||
}>;
|
||||
declare const ProductionSchema: z.ZodObject<{
|
||||
"fusion-folder": z.ZodString;
|
||||
"nc-folder": z.ZodString;
|
||||
cam: z.ZodArray<z.ZodObject<{
|
||||
name: z.ZodString;
|
||||
url: z.ZodString;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
name?: string;
|
||||
url?: string;
|
||||
}, {
|
||||
name?: string;
|
||||
url?: string;
|
||||
}>, "many">;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
"fusion-folder"?: string;
|
||||
"nc-folder"?: string;
|
||||
cam?: {
|
||||
name?: string;
|
||||
url?: string;
|
||||
}[];
|
||||
}, {
|
||||
"fusion-folder"?: string;
|
||||
"nc-folder"?: string;
|
||||
cam?: {
|
||||
name?: string;
|
||||
url?: string;
|
||||
}[];
|
||||
}>;
|
||||
declare const ComponentConfigSchema: z.ZodObject<{
|
||||
cart_id: z.ZodOptional<z.ZodString>;
|
||||
code: z.ZodString;
|
||||
price: z.ZodOptional<z.ZodNumber>;
|
||||
cscartCats: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
||||
cscartId: z.ZodOptional<z.ZodNumber>;
|
||||
vendorId: z.ZodOptional<z.ZodNumber>;
|
||||
version: z.ZodOptional<z.ZodString>;
|
||||
status: z.ZodOptional<z.ZodString>;
|
||||
authors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
||||
name: z.ZodString;
|
||||
url: z.ZodString;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
name?: string;
|
||||
url?: string;
|
||||
}, {
|
||||
name?: string;
|
||||
url?: string;
|
||||
}>, "many">>;
|
||||
replaced_by: z.ZodOptional<z.ZodString>;
|
||||
alternatives: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
||||
flags: z.ZodOptional<z.ZodNumber>;
|
||||
download: z.ZodOptional<z.ZodBoolean>;
|
||||
name: z.ZodString;
|
||||
edrawings: z.ZodOptional<z.ZodString>;
|
||||
showDimensions: z.ZodOptional<z.ZodBoolean>;
|
||||
showParts: z.ZodOptional<z.ZodBoolean>;
|
||||
slug: z.ZodString;
|
||||
score: z.ZodOptional<z.ZodNumber>;
|
||||
Preview3d: z.ZodOptional<z.ZodBoolean>;
|
||||
keywords: z.ZodOptional<z.ZodString>;
|
||||
meta_keywords: z.ZodOptional<z.ZodString>;
|
||||
content: z.ZodOptional<z.ZodObject<{
|
||||
body: z.ZodOptional<z.ZodString>;
|
||||
features: z.ZodOptional<z.ZodString>;
|
||||
highlights: z.ZodOptional<z.ZodString>;
|
||||
specs: z.ZodOptional<z.ZodString>;
|
||||
license: z.ZodOptional<z.ZodString>;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
body?: string;
|
||||
features?: string;
|
||||
highlights?: string;
|
||||
specs?: string;
|
||||
license?: string;
|
||||
}, {
|
||||
body?: string;
|
||||
features?: string;
|
||||
highlights?: string;
|
||||
specs?: string;
|
||||
license?: string;
|
||||
}>>;
|
||||
assets: z.ZodOptional<z.ZodObject<{
|
||||
gallery: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
||||
renderings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
||||
components: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
gallery?: string[];
|
||||
renderings?: string[];
|
||||
components?: string[];
|
||||
}, {
|
||||
gallery?: string[];
|
||||
renderings?: string[];
|
||||
components?: string[];
|
||||
}>>;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
howto_categories: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
||||
steps: z.ZodOptional<z.ZodAny>;
|
||||
sourceLanguage: z.ZodOptional<z.ZodString>;
|
||||
category: z.ZodString;
|
||||
product_dimensions: z.ZodOptional<z.ZodString>;
|
||||
production: z.ZodOptional<z.ZodObject<{
|
||||
"fusion-folder": z.ZodString;
|
||||
"nc-folder": z.ZodString;
|
||||
cam: z.ZodArray<z.ZodObject<{
|
||||
name: z.ZodString;
|
||||
url: z.ZodString;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
name?: string;
|
||||
url?: string;
|
||||
}, {
|
||||
name?: string;
|
||||
url?: string;
|
||||
}>, "many">;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
"fusion-folder"?: string;
|
||||
"nc-folder"?: string;
|
||||
cam?: {
|
||||
name?: string;
|
||||
url?: string;
|
||||
}[];
|
||||
}, {
|
||||
"fusion-folder"?: string;
|
||||
"nc-folder"?: string;
|
||||
cam?: {
|
||||
name?: string;
|
||||
url?: string;
|
||||
}[];
|
||||
}>>;
|
||||
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
||||
cart_id: z.ZodOptional<z.ZodString>;
|
||||
code: z.ZodString;
|
||||
price: z.ZodOptional<z.ZodNumber>;
|
||||
cscartCats: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
||||
cscartId: z.ZodOptional<z.ZodNumber>;
|
||||
vendorId: z.ZodOptional<z.ZodNumber>;
|
||||
version: z.ZodOptional<z.ZodString>;
|
||||
status: z.ZodOptional<z.ZodString>;
|
||||
authors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
||||
name: z.ZodString;
|
||||
url: z.ZodString;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
name?: string;
|
||||
url?: string;
|
||||
}, {
|
||||
name?: string;
|
||||
url?: string;
|
||||
}>, "many">>;
|
||||
replaced_by: z.ZodOptional<z.ZodString>;
|
||||
alternatives: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
||||
flags: z.ZodOptional<z.ZodNumber>;
|
||||
download: z.ZodOptional<z.ZodBoolean>;
|
||||
name: z.ZodString;
|
||||
edrawings: z.ZodOptional<z.ZodString>;
|
||||
showDimensions: z.ZodOptional<z.ZodBoolean>;
|
||||
showParts: z.ZodOptional<z.ZodBoolean>;
|
||||
slug: z.ZodString;
|
||||
score: z.ZodOptional<z.ZodNumber>;
|
||||
Preview3d: z.ZodOptional<z.ZodBoolean>;
|
||||
keywords: z.ZodOptional<z.ZodString>;
|
||||
meta_keywords: z.ZodOptional<z.ZodString>;
|
||||
content: z.ZodOptional<z.ZodObject<{
|
||||
body: z.ZodOptional<z.ZodString>;
|
||||
features: z.ZodOptional<z.ZodString>;
|
||||
highlights: z.ZodOptional<z.ZodString>;
|
||||
specs: z.ZodOptional<z.ZodString>;
|
||||
license: z.ZodOptional<z.ZodString>;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
body?: string;
|
||||
features?: string;
|
||||
highlights?: string;
|
||||
specs?: string;
|
||||
license?: string;
|
||||
}, {
|
||||
body?: string;
|
||||
features?: string;
|
||||
highlights?: string;
|
||||
specs?: string;
|
||||
license?: string;
|
||||
}>>;
|
||||
assets: z.ZodOptional<z.ZodObject<{
|
||||
gallery: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
||||
renderings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
||||
components: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
gallery?: string[];
|
||||
renderings?: string[];
|
||||
components?: string[];
|
||||
}, {
|
||||
gallery?: string[];
|
||||
renderings?: string[];
|
||||
components?: string[];
|
||||
}>>;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
howto_categories: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
||||
steps: z.ZodOptional<z.ZodAny>;
|
||||
sourceLanguage: z.ZodOptional<z.ZodString>;
|
||||
category: z.ZodString;
|
||||
product_dimensions: z.ZodOptional<z.ZodString>;
|
||||
production: z.ZodOptional<z.ZodObject<{
|
||||
"fusion-folder": z.ZodString;
|
||||
"nc-folder": z.ZodString;
|
||||
cam: z.ZodArray<z.ZodObject<{
|
||||
name: z.ZodString;
|
||||
url: z.ZodString;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
name?: string;
|
||||
url?: string;
|
||||
}, {
|
||||
name?: string;
|
||||
url?: string;
|
||||
}>, "many">;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
"fusion-folder"?: string;
|
||||
"nc-folder"?: string;
|
||||
cam?: {
|
||||
name?: string;
|
||||
url?: string;
|
||||
}[];
|
||||
}, {
|
||||
"fusion-folder"?: string;
|
||||
"nc-folder"?: string;
|
||||
cam?: {
|
||||
name?: string;
|
||||
url?: string;
|
||||
}[];
|
||||
}>>;
|
||||
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
||||
cart_id: z.ZodOptional<z.ZodString>;
|
||||
code: z.ZodString;
|
||||
price: z.ZodOptional<z.ZodNumber>;
|
||||
cscartCats: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
||||
cscartId: z.ZodOptional<z.ZodNumber>;
|
||||
vendorId: z.ZodOptional<z.ZodNumber>;
|
||||
version: z.ZodOptional<z.ZodString>;
|
||||
status: z.ZodOptional<z.ZodString>;
|
||||
authors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
||||
name: z.ZodString;
|
||||
url: z.ZodString;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
name?: string;
|
||||
url?: string;
|
||||
}, {
|
||||
name?: string;
|
||||
url?: string;
|
||||
}>, "many">>;
|
||||
replaced_by: z.ZodOptional<z.ZodString>;
|
||||
alternatives: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
||||
flags: z.ZodOptional<z.ZodNumber>;
|
||||
download: z.ZodOptional<z.ZodBoolean>;
|
||||
name: z.ZodString;
|
||||
edrawings: z.ZodOptional<z.ZodString>;
|
||||
showDimensions: z.ZodOptional<z.ZodBoolean>;
|
||||
showParts: z.ZodOptional<z.ZodBoolean>;
|
||||
slug: z.ZodString;
|
||||
score: z.ZodOptional<z.ZodNumber>;
|
||||
Preview3d: z.ZodOptional<z.ZodBoolean>;
|
||||
keywords: z.ZodOptional<z.ZodString>;
|
||||
meta_keywords: z.ZodOptional<z.ZodString>;
|
||||
content: z.ZodOptional<z.ZodObject<{
|
||||
body: z.ZodOptional<z.ZodString>;
|
||||
features: z.ZodOptional<z.ZodString>;
|
||||
highlights: z.ZodOptional<z.ZodString>;
|
||||
specs: z.ZodOptional<z.ZodString>;
|
||||
license: z.ZodOptional<z.ZodString>;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
body?: string;
|
||||
features?: string;
|
||||
highlights?: string;
|
||||
specs?: string;
|
||||
license?: string;
|
||||
}, {
|
||||
body?: string;
|
||||
features?: string;
|
||||
highlights?: string;
|
||||
specs?: string;
|
||||
license?: string;
|
||||
}>>;
|
||||
assets: z.ZodOptional<z.ZodObject<{
|
||||
gallery: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
||||
renderings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
||||
components: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
gallery?: string[];
|
||||
renderings?: string[];
|
||||
components?: string[];
|
||||
}, {
|
||||
gallery?: string[];
|
||||
renderings?: string[];
|
||||
components?: string[];
|
||||
}>>;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
howto_categories: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
||||
steps: z.ZodOptional<z.ZodAny>;
|
||||
sourceLanguage: z.ZodOptional<z.ZodString>;
|
||||
category: z.ZodString;
|
||||
product_dimensions: z.ZodOptional<z.ZodString>;
|
||||
production: z.ZodOptional<z.ZodObject<{
|
||||
"fusion-folder": z.ZodString;
|
||||
"nc-folder": z.ZodString;
|
||||
cam: z.ZodArray<z.ZodObject<{
|
||||
name: z.ZodString;
|
||||
url: z.ZodString;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
name?: string;
|
||||
url?: string;
|
||||
}, {
|
||||
name?: string;
|
||||
url?: string;
|
||||
}>, "many">;
|
||||
}, "strip", z.ZodTypeAny, {
|
||||
"fusion-folder"?: string;
|
||||
"nc-folder"?: string;
|
||||
cam?: {
|
||||
name?: string;
|
||||
url?: string;
|
||||
}[];
|
||||
}, {
|
||||
"fusion-folder"?: string;
|
||||
"nc-folder"?: string;
|
||||
cam?: {
|
||||
name?: string;
|
||||
url?: string;
|
||||
}[];
|
||||
}>>;
|
||||
}, z.ZodTypeAny, "passthrough">>;
|
||||
type IComponentConfig = z.infer<typeof ComponentConfigSchema>;
|
||||
declare const get: (src: any, root: any, type: any) => {
|
||||
rel: any;
|
||||
path: any;
|
||||
config: any;
|
||||
}[];
|
||||
|
||||
export { AssetsSchema, AuthorSchema, ComponentConfigSchema, ContentSchema, type IComponentConfig, ProductionSchema, get };
|
||||
148
packages/commons/dist/config.cjs
vendored
Normal file
148
packages/commons/dist/config.cjs
vendored
Normal file
@ -0,0 +1,148 @@
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var config_exports = {};
|
||||
__export(config_exports, {
|
||||
CONFIG_DEFAULT: () => CONFIG_DEFAULT,
|
||||
CONFIG_DEFAULT_PATH: () => CONFIG_DEFAULT_PATH,
|
||||
DEFAULT_ROOTS: () => DEFAULT_ROOTS,
|
||||
HOME: () => HOME,
|
||||
KB_ROOT: () => KB_ROOT,
|
||||
OA_ROOT: () => OA_ROOT,
|
||||
OSR_CACHE: () => OSR_CACHE,
|
||||
OSR_CUSTOMER_DRIVE: () => OSR_CUSTOMER_DRIVE,
|
||||
OSR_LIBRARY: () => OSR_LIBRARY,
|
||||
OSR_LIBRARY_DIRECTORY: () => OSR_LIBRARY_DIRECTORY,
|
||||
OSR_LIBRARY_MACHINES: () => OSR_LIBRARY_MACHINES,
|
||||
OSR_PRIVATE: () => OSR_PRIVATE,
|
||||
OSR_ROOT: () => OSR_ROOT,
|
||||
OSR_SUB_DEFAULT: () => OSR_SUB_DEFAULT,
|
||||
OSR_TEMP: () => OSR_TEMP,
|
||||
OSR_USER_ASSETS: () => OSR_USER_ASSETS,
|
||||
POLYMECH_ROOT: () => POLYMECH_ROOT,
|
||||
PRODUCT_ROOT: () => PRODUCT_ROOT,
|
||||
get_var: () => get_var,
|
||||
readNPMMeta: () => readNPMMeta,
|
||||
readOSRConfig: () => readOSRConfig,
|
||||
readOSRMeta: () => readOSRMeta,
|
||||
readPackage: () => readPackage
|
||||
});
|
||||
module.exports = __toCommonJS(config_exports);
|
||||
var path = __toESM(require("path"), 1);
|
||||
var import_env_var = __toESM(require("env-var"), 1);
|
||||
var import_read = require("@polymech/fs/read");
|
||||
var import_exists = require("@polymech/fs/exists");
|
||||
var import_primitives = require("@polymech/core/primitives");
|
||||
var import_constants = require("./constants.js");
|
||||
const { get } = import_env_var.default;
|
||||
const HOME = (sub = "") => path.join(process.env[process.platform == "win32" ? "USERPROFILE" : "HOME"], sub);
|
||||
const get_var = (key = "") => get(key).asString() || get(key.replace(/-/g, "_")).asString() || get(key.replace(/_/g, "-")).asString();
|
||||
const OSR_ROOT = (key = "OSR-ROOT") => get_var(key) || path.join(HOME("desktop"), import_constants.API_PREFIX);
|
||||
const OSR_SUB_DEFAULT = (key = "") => get_var(key) || path.join(OSR_ROOT(), key);
|
||||
const CONFIG_DEFAULT_PATH = (key = "OSR-CONFIG") => get_var(key) || path.join(HOME(`${import_constants.API_PREFIX}`), ".config.json");
|
||||
const OSR_TEMP = (key = "OSR-TEMP") => get_var(key) || OSR_SUB_DEFAULT(`.${import_constants.API_PREFIX}/temp`);
|
||||
const OSR_CACHE = (key = "OSR-CACHE") => get_var(key) || OSR_SUB_DEFAULT(`.${import_constants.API_PREFIX}/cache`);
|
||||
const OSR_PRIVATE = (key = "OSR-PRIVATE") => get_var(key);
|
||||
const KB_ROOT = (key = "OSR-KB") => get_var(key);
|
||||
const OSR_LIBRARY = (key = "OSR-LIBRARY") => get_var(key);
|
||||
const OSR_LIBRARY_MACHINES = (key = "OSR-LIBRARY-MACHINES") => get_var(key);
|
||||
const OSR_LIBRARY_DIRECTORY = (key = "OSR-LIBRARY-DIRECTORY") => get_var(key);
|
||||
const PRODUCT_ROOT = (key = "PRODUCT-ROOT") => get_var(key);
|
||||
const OSR_CUSTOMER_DRIVE = (key = "OSR-CUSTOMER-DRIVE") => get_var(key);
|
||||
const OA_ROOT = (key = "OA-ROOT") => get_var(key);
|
||||
const OSR_USER_ASSETS = (key = "OSR-USER-ASSETS") => get_var(key);
|
||||
const POLYMECH_ROOT = (key = "POLYMECH-ROOT") => get_var(key) || path.join(HOME("desktop"), import_constants.API_PREFIX_NEXT);
|
||||
const DEFAULT_ROOTS = {
|
||||
OSR_ROOT: OSR_ROOT(),
|
||||
OSR_TEMP: OSR_TEMP(),
|
||||
PRODUCT_ROOT: PRODUCT_ROOT(),
|
||||
OA_ROOT: OA_ROOT(),
|
||||
KB_ROOT: KB_ROOT(),
|
||||
OSR_CACHE: OSR_CACHE(),
|
||||
OSR_LIBRARY: OSR_LIBRARY(),
|
||||
OSR_LIBRARY_MACHINES: OSR_LIBRARY_MACHINES(),
|
||||
OSR_LIBRARY_DIRECTORY: OSR_LIBRARY_DIRECTORY(),
|
||||
OSR_USER_ASSETS: OSR_USER_ASSETS(),
|
||||
OSR_PRIVATE: OSR_PRIVATE(),
|
||||
OSR_TEMPLATES: path.join(OSR_SUB_DEFAULT("osr-templates")),
|
||||
OSR_CONTENT: path.join(OSR_SUB_DEFAULT("osr-content")),
|
||||
OSR_PROFILES: path.join(OSR_SUB_DEFAULT("osr-profiles")),
|
||||
OSR_CUSTOMER_DRIVE: OSR_CUSTOMER_DRIVE(),
|
||||
POLYMECH_ROOT: POLYMECH_ROOT()
|
||||
};
|
||||
const CONFIG_DEFAULT = (key = "OSR-CONFIG") => {
|
||||
const cPath = path.resolve(CONFIG_DEFAULT_PATH(key));
|
||||
if ((0, import_exists.sync)(cPath)) {
|
||||
return (0, import_read.sync)(cPath, "json");
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const readNPMMeta = (_path) => (0, import_read.sync)(_path, "json") || {};
|
||||
const readPackage = (val) => {
|
||||
if ((0, import_primitives.isString)(val)) {
|
||||
return readNPMMeta(val);
|
||||
} else if ((0, import_primitives.isObject)(val)) {
|
||||
return val;
|
||||
}
|
||||
return {};
|
||||
};
|
||||
const readOSRMeta = (_path) => (0, import_read.sync)(_path, "json");
|
||||
const readOSRConfig = (val) => {
|
||||
if ((0, import_primitives.isString)(val)) {
|
||||
return readOSRMeta(val);
|
||||
} else if ((0, import_primitives.isObject)(val)) {
|
||||
return val;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
CONFIG_DEFAULT,
|
||||
CONFIG_DEFAULT_PATH,
|
||||
DEFAULT_ROOTS,
|
||||
HOME,
|
||||
KB_ROOT,
|
||||
OA_ROOT,
|
||||
OSR_CACHE,
|
||||
OSR_CUSTOMER_DRIVE,
|
||||
OSR_LIBRARY,
|
||||
OSR_LIBRARY_DIRECTORY,
|
||||
OSR_LIBRARY_MACHINES,
|
||||
OSR_PRIVATE,
|
||||
OSR_ROOT,
|
||||
OSR_SUB_DEFAULT,
|
||||
OSR_TEMP,
|
||||
OSR_USER_ASSETS,
|
||||
POLYMECH_ROOT,
|
||||
PRODUCT_ROOT,
|
||||
get_var,
|
||||
readNPMMeta,
|
||||
readOSRConfig,
|
||||
readOSRMeta,
|
||||
readPackage
|
||||
});
|
||||
//# sourceMappingURL=config.cjs.map
|
||||
1
packages/commons/dist/config.cjs.map
vendored
Normal file
1
packages/commons/dist/config.cjs.map
vendored
Normal file
File diff suppressed because one or more lines are too long
47
packages/commons/dist/config.d.cts
vendored
Normal file
47
packages/commons/dist/config.d.cts
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
import { JSONSchemaForNPMPackageJsonFiles } from '@schemastore/package';
|
||||
import { IComponentConfig } from './component.cjs';
|
||||
import 'zod';
|
||||
|
||||
declare const HOME: (sub?: string) => string;
|
||||
declare const get_var: (key?: string) => string;
|
||||
declare const OSR_ROOT: (key?: string) => string;
|
||||
declare const OSR_SUB_DEFAULT: (key?: string) => string;
|
||||
declare const CONFIG_DEFAULT_PATH: (key?: string) => string;
|
||||
declare const OSR_TEMP: (key?: string) => string;
|
||||
declare const OSR_CACHE: (key?: string) => string;
|
||||
declare const OSR_PRIVATE: (key?: string) => string;
|
||||
declare const KB_ROOT: (key?: string) => string;
|
||||
declare const OSR_LIBRARY: (key?: string) => string;
|
||||
declare const OSR_LIBRARY_MACHINES: (key?: string) => string;
|
||||
declare const OSR_LIBRARY_DIRECTORY: (key?: string) => string;
|
||||
declare const PRODUCT_ROOT: (key?: string) => string;
|
||||
declare const OSR_CUSTOMER_DRIVE: (key?: string) => string;
|
||||
declare const OA_ROOT: (key?: string) => string;
|
||||
declare const OSR_USER_ASSETS: (key?: string) => string;
|
||||
declare const POLYMECH_ROOT: (key?: string) => string;
|
||||
declare const DEFAULT_ROOTS: {
|
||||
OSR_ROOT: string;
|
||||
OSR_TEMP: string;
|
||||
PRODUCT_ROOT: string;
|
||||
OA_ROOT: string;
|
||||
KB_ROOT: string;
|
||||
OSR_CACHE: string;
|
||||
OSR_LIBRARY: string;
|
||||
OSR_LIBRARY_MACHINES: string;
|
||||
OSR_LIBRARY_DIRECTORY: string;
|
||||
OSR_USER_ASSETS: string;
|
||||
OSR_PRIVATE: string;
|
||||
OSR_TEMPLATES: string;
|
||||
OSR_CONTENT: string;
|
||||
OSR_PROFILES: string;
|
||||
OSR_CUSTOMER_DRIVE: string;
|
||||
POLYMECH_ROOT: string;
|
||||
};
|
||||
declare const CONFIG_DEFAULT: (key?: string) => string | false | object;
|
||||
|
||||
declare const readNPMMeta: (_path: string) => JSONSchemaForNPMPackageJsonFiles;
|
||||
declare const readPackage: (val: any) => JSONSchemaForNPMPackageJsonFiles;
|
||||
declare const readOSRMeta: (_path: string) => IComponentConfig;
|
||||
declare const readOSRConfig: (val: any) => any;
|
||||
|
||||
export { CONFIG_DEFAULT, CONFIG_DEFAULT_PATH, DEFAULT_ROOTS, HOME, KB_ROOT, OA_ROOT, OSR_CACHE, OSR_CUSTOMER_DRIVE, OSR_LIBRARY, OSR_LIBRARY_DIRECTORY, OSR_LIBRARY_MACHINES, OSR_PRIVATE, OSR_ROOT, OSR_SUB_DEFAULT, OSR_TEMP, OSR_USER_ASSETS, POLYMECH_ROOT, PRODUCT_ROOT, get_var, readNPMMeta, readOSRConfig, readOSRMeta, readPackage };
|
||||
58
packages/commons/dist/constants.cjs
vendored
Normal file
58
packages/commons/dist/constants.cjs
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var constants_exports = {};
|
||||
__export(constants_exports, {
|
||||
API_NAMESPACE: () => API_NAMESPACE,
|
||||
API_PREFIX: () => API_PREFIX,
|
||||
API_PREFIX_NEXT: () => API_PREFIX_NEXT,
|
||||
MODULE_NAME: () => MODULE_NAME,
|
||||
OA_LATEST: () => OA_LATEST,
|
||||
OA_LATEST_CENSORED: () => OA_LATEST_CENSORED,
|
||||
OA_LATEST_INVALID: () => OA_LATEST_INVALID,
|
||||
OA_LATEST_MERGED: () => OA_LATEST_MERGED,
|
||||
PP_BAZAR_LATEST_INDEX: () => PP_BAZAR_LATEST_INDEX,
|
||||
PP_BAZAR_LATEST_INDEX_MERGED: () => PP_BAZAR_LATEST_INDEX_MERGED,
|
||||
PROFILE_FILE_NAME: () => PROFILE_FILE_NAME
|
||||
});
|
||||
module.exports = __toCommonJS(constants_exports);
|
||||
const MODULE_NAME = `OSR-Commons`;
|
||||
const PROFILE_FILE_NAME = `.osrl.json`;
|
||||
const OA_LATEST = "${OSR_ROOT}/osr-directory/pp/${YYYY}_${MM}.json";
|
||||
const OA_LATEST_INVALID = "${OSR_ROOT}/osr-directory/pp/${YYYY}_${MM}_INVALID.json";
|
||||
const OA_LATEST_CENSORED = "${OSR_ROOT}/osr-directory/pp/${YYYY}_${MM}_CENSORED.json";
|
||||
const OA_LATEST_MERGED = "${OSR_ROOT}/osr-directory/pp/${YYYY}_${MM}_MERGED.json";
|
||||
const PP_BAZAR_LATEST_INDEX = "${OSR_ROOT}/pp-bazar/${YYYY}/${MM}/index.json";
|
||||
const PP_BAZAR_LATEST_INDEX_MERGED = "${OSR_ROOT}/pp-bazar/${YYYY}/${MM}/index_merged.json";
|
||||
const API_NAMESPACE = "@polymech";
|
||||
const API_PREFIX = "polymech";
|
||||
const API_PREFIX_NEXT = "polymech";
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
API_NAMESPACE,
|
||||
API_PREFIX,
|
||||
API_PREFIX_NEXT,
|
||||
MODULE_NAME,
|
||||
OA_LATEST,
|
||||
OA_LATEST_CENSORED,
|
||||
OA_LATEST_INVALID,
|
||||
OA_LATEST_MERGED,
|
||||
PP_BAZAR_LATEST_INDEX,
|
||||
PP_BAZAR_LATEST_INDEX_MERGED,
|
||||
PROFILE_FILE_NAME
|
||||
});
|
||||
//# sourceMappingURL=constants.cjs.map
|
||||
1
packages/commons/dist/constants.cjs.map
vendored
Normal file
1
packages/commons/dist/constants.cjs.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/constants.ts"],"sourcesContent":["export const MODULE_NAME = `OSR-Commons`\r\nexport const PROFILE_FILE_NAME = `.osrl.json`\r\n////////////////////////////////////////\r\n//\r\n// OA Migration\r\n\r\nexport const OA_LATEST = '${OSR_ROOT}/osr-directory/pp/${YYYY}_${MM}.json'\r\nexport const OA_LATEST_INVALID = '${OSR_ROOT}/osr-directory/pp/${YYYY}_${MM}_INVALID.json'\r\nexport const OA_LATEST_CENSORED = '${OSR_ROOT}/osr-directory/pp/${YYYY}_${MM}_CENSORED.json'\r\nexport const OA_LATEST_MERGED = '${OSR_ROOT}/osr-directory/pp/${YYYY}_${MM}_MERGED.json'\r\n\r\n// fecking bazar\r\nexport const PP_BAZAR_LATEST_INDEX = '${OSR_ROOT}/pp-bazar/${YYYY}/${MM}/index.json'\r\nexport const PP_BAZAR_LATEST_INDEX_MERGED = '${OSR_ROOT}/pp-bazar/${YYYY}/${MM}/index_merged.json'\r\n\r\n// Namespaces\r\nexport const API_NAMESPACE = '@polymech'\r\nexport const API_PREFIX = 'polymech'\r\nexport const API_PREFIX_NEXT = 'polymech'"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,cAAc;AACpB,MAAM,oBAAoB;AAK1B,MAAM,YAAY;AAClB,MAAM,oBAAoB;AAC1B,MAAM,qBAAqB;AAC3B,MAAM,mBAAmB;AAGzB,MAAM,wBAAwB;AAC9B,MAAM,+BAA+B;AAGrC,MAAM,gBAAgB;AACtB,MAAM,aAAa;AACnB,MAAM,kBAAkB;","names":[]}
|
||||
13
packages/commons/dist/constants.d.cts
vendored
Normal file
13
packages/commons/dist/constants.d.cts
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
declare const MODULE_NAME = "OSR-Commons";
|
||||
declare const PROFILE_FILE_NAME = ".osrl.json";
|
||||
declare const OA_LATEST = "${OSR_ROOT}/osr-directory/pp/${YYYY}_${MM}.json";
|
||||
declare const OA_LATEST_INVALID = "${OSR_ROOT}/osr-directory/pp/${YYYY}_${MM}_INVALID.json";
|
||||
declare const OA_LATEST_CENSORED = "${OSR_ROOT}/osr-directory/pp/${YYYY}_${MM}_CENSORED.json";
|
||||
declare const OA_LATEST_MERGED = "${OSR_ROOT}/osr-directory/pp/${YYYY}_${MM}_MERGED.json";
|
||||
declare const PP_BAZAR_LATEST_INDEX = "${OSR_ROOT}/pp-bazar/${YYYY}/${MM}/index.json";
|
||||
declare const PP_BAZAR_LATEST_INDEX_MERGED = "${OSR_ROOT}/pp-bazar/${YYYY}/${MM}/index_merged.json";
|
||||
declare const API_NAMESPACE = "@polymech";
|
||||
declare const API_PREFIX = "polymech";
|
||||
declare const API_PREFIX_NEXT = "polymech";
|
||||
|
||||
export { API_NAMESPACE, API_PREFIX, API_PREFIX_NEXT, MODULE_NAME, OA_LATEST, OA_LATEST_CENSORED, OA_LATEST_INVALID, OA_LATEST_MERGED, PP_BAZAR_LATEST_INDEX, PP_BAZAR_LATEST_INDEX_MERGED, PROFILE_FILE_NAME };
|
||||
101
packages/commons/dist/filter.cjs
vendored
Normal file
101
packages/commons/dist/filter.cjs
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var filter_exports = {};
|
||||
__export(filter_exports, {
|
||||
FiltersValid: () => FiltersValid,
|
||||
PFilterInvalid: () => PFilterInvalid,
|
||||
PFilterValid: () => PFilterValid,
|
||||
hasDependency: () => hasDependency,
|
||||
isAPIPackage: () => isAPIPackage,
|
||||
isInvalidMarketplaceComponent: () => isInvalidMarketplaceComponent,
|
||||
isValidLibraryComponent: () => isValidLibraryComponent,
|
||||
isValidMarketplaceComponent: () => isValidMarketplaceComponent
|
||||
});
|
||||
module.exports = __toCommonJS(filter_exports);
|
||||
var path = __toESM(require("path"), 1);
|
||||
var import_exists = require("@polymech/fs/exists");
|
||||
var import_constants = require("./constants.js");
|
||||
var import_config = require("./config.js");
|
||||
const isAPIPackage = (_path) => {
|
||||
const pkg = (0, import_config.readPackage)(_path);
|
||||
return (pkg.name || "").startsWith(`${import_constants.API_NAMESPACE}/${import_constants.API_PREFIX}`) ? pkg : null;
|
||||
};
|
||||
const hasDependency = (pkg, dep) => {
|
||||
pkg = (0, import_config.readPackage)(pkg);
|
||||
return Object.keys(pkg.dependencies || {}).concat(Object.keys(pkg.devDependencies || {})).find((d) => d === dep);
|
||||
};
|
||||
const isValidMarketplaceComponent = (_path) => {
|
||||
const pkg = (0, import_config.readOSRConfig)(_path);
|
||||
if (!pkg || !pkg.name || !pkg.slug || !pkg.code) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
const isInvalidMarketplaceComponent = (_path) => {
|
||||
const pkg = (0, import_config.readOSRConfig)(_path);
|
||||
if (pkg && !pkg.name || !pkg.slug || !pkg.code) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const isValidLibraryComponent = (_path) => {
|
||||
const pkg = (0, import_config.readOSRConfig)(_path);
|
||||
if (!pkg || !pkg.name) {
|
||||
return false;
|
||||
}
|
||||
const templatePath = path.resolve(`${path.parse(_path).dir}/templates/shared/body.md`);
|
||||
if (!(0, import_exists.sync)(templatePath)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
const PFilterInvalid = {
|
||||
marketplace_component: "invalid_marketplace_component"
|
||||
};
|
||||
const PFilterValid = {
|
||||
marketplace_component: "marketplace_component",
|
||||
library_component: "library_component",
|
||||
package: "package"
|
||||
};
|
||||
const FiltersValid = {
|
||||
"marketplace_component": isValidMarketplaceComponent,
|
||||
"library_component": isValidLibraryComponent,
|
||||
"package": isAPIPackage
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
FiltersValid,
|
||||
PFilterInvalid,
|
||||
PFilterValid,
|
||||
hasDependency,
|
||||
isAPIPackage,
|
||||
isInvalidMarketplaceComponent,
|
||||
isValidLibraryComponent,
|
||||
isValidMarketplaceComponent
|
||||
});
|
||||
//# sourceMappingURL=filter.cjs.map
|
||||
1
packages/commons/dist/filter.cjs.map
vendored
Normal file
1
packages/commons/dist/filter.cjs.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/filter.ts"],"sourcesContent":["import * as path from 'path'\r\nimport { JSONSchemaForNPMPackageJsonFiles } from '@schemastore/package'\r\nimport { sync as exists } from '@polymech/fs/exists'\r\n\r\nimport {\r\n API_NAMESPACE,\r\n API_PREFIX \r\n} from './constants.js'\r\n\r\nimport {\r\n readPackage,\r\n readOSRConfig\r\n} from './config.js'\r\n\r\n//////////////////////////////////////////////////////\r\n//\r\n// NPM related\r\n\r\nexport const isAPIPackage = (_path: string) => {\r\n const pkg = readPackage(_path)\r\n return (pkg.name || '').startsWith(`${API_NAMESPACE}/${API_PREFIX}`) ? pkg : null\r\n}\r\n\r\nexport const hasDependency = (pkg: string | JSONSchemaForNPMPackageJsonFiles, dep: string) => {\r\n pkg = readPackage(pkg)\r\n return Object.keys((pkg.dependencies || {})).\r\n concat( Object.keys(pkg.devDependencies || {})).\r\n find((d:string)=> d === dep)\r\n}\r\n\r\n//////////////////////////////////////////////////////\r\n//\r\n// OSR related\r\n\r\nexport const isValidMarketplaceComponent = (_path: string) => {\r\n const pkg = readOSRConfig(_path)\r\n if( !pkg ||\r\n !pkg.name ||\r\n !pkg.slug ||\r\n !pkg.code){\r\n return false\r\n }\r\n return true \r\n}\r\n\r\nexport const isInvalidMarketplaceComponent = (_path: string) => {\r\n const pkg = readOSRConfig(_path)\r\n if( pkg &&\r\n !pkg.name ||\r\n !pkg.slug ||\r\n !pkg.code){\r\n return true\r\n }\r\n return false\r\n}\r\n\r\nexport const isValidLibraryComponent = (_path: string) => {\r\n const pkg = readOSRConfig(_path)\r\n if( !pkg || !pkg.name){\r\n return false\r\n }\r\n const templatePath = path.resolve(`${path.parse(_path).dir}/templates/shared/body.md`)\r\n if(!exists(templatePath)){\r\n return false\r\n }\r\n return true\r\n}\r\n\r\nexport const PFilterInvalid = {\r\n marketplace_component: 'invalid_marketplace_component'\r\n}\r\n\r\nexport const PFilterValid = {\r\n marketplace_component: 'marketplace_component',\r\n library_component: 'library_component',\r\n package: 'package'\r\n}\r\n\r\nexport const FiltersValid =\r\n{\r\n 'marketplace_component': isValidMarketplaceComponent,\r\n 'library_component': isValidLibraryComponent,\r\n 'package' : isAPIPackage\r\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAAsB;AAEtB,oBAA+B;AAE/B,uBAGO;AAEP,oBAGO;AAMA,MAAM,eAAe,CAAC,UAAkB;AAC3C,QAAM,UAAM,2BAAY,KAAK;AAC7B,UAAQ,IAAI,QAAQ,IAAI,WAAW,GAAG,8BAAa,IAAI,2BAAU,EAAE,IAAI,MAAM;AACjF;AAEO,MAAM,gBAAgB,CAAC,KAAgD,QAAgB;AAC1F,YAAM,2BAAY,GAAG;AACrB,SAAQ,OAAO,KAAM,IAAI,gBAAgB,CAAC,CAAE,EACpC,OAAQ,OAAO,KAAK,IAAI,mBAAmB,CAAC,CAAC,CAAC,EAC9C,KAAK,CAAC,MAAY,MAAM,GAAG;AACvC;AAMO,MAAM,8BAA8B,CAAC,UAAkB;AAC1D,QAAM,UAAM,6BAAc,KAAK;AAC/B,MAAI,CAAC,OACD,CAAC,IAAI,QACL,CAAC,IAAI,QACL,CAAC,IAAI,MAAK;AACV,WAAO;AAAA,EACX;AACA,SAAO;AACX;AAEO,MAAM,gCAAgC,CAAC,UAAkB;AAC5D,QAAM,UAAM,6BAAc,KAAK;AAC/B,MAAI,OACA,CAAC,IAAI,QACL,CAAC,IAAI,QACL,CAAC,IAAI,MAAK;AACV,WAAO;AAAA,EACX;AACA,SAAO;AACX;AAEO,MAAM,0BAA0B,CAAC,UAAkB;AACtD,QAAM,UAAM,6BAAc,KAAK;AAC/B,MAAI,CAAC,OAAO,CAAC,IAAI,MAAK;AAClB,WAAO;AAAA,EACX;AACA,QAAM,eAAgB,KAAK,QAAQ,GAAG,KAAK,MAAM,KAAK,EAAE,GAAG,2BAA2B;AACtF,MAAG,KAAC,cAAAA,MAAO,YAAY,GAAE;AACrB,WAAO;AAAA,EACX;AACA,SAAO;AACX;AAEO,MAAM,iBAAiB;AAAA,EAC1B,uBAAuB;AAC3B;AAEO,MAAM,eAAe;AAAA,EACxB,uBAAuB;AAAA,EACvB,mBAAmB;AAAA,EACnB,SAAS;AACb;AAEO,MAAM,eACb;AAAA,EACI,yBAAyB;AAAA,EACzB,qBAAqB;AAAA,EACrB,WAAY;AAChB;","names":["exists"]}
|
||||
22
packages/commons/dist/filter.d.cts
vendored
Normal file
22
packages/commons/dist/filter.d.cts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
import { JSONSchemaForNPMPackageJsonFiles } from '@schemastore/package';
|
||||
|
||||
declare const isAPIPackage: (_path: string) => JSONSchemaForNPMPackageJsonFiles;
|
||||
declare const hasDependency: (pkg: string | JSONSchemaForNPMPackageJsonFiles, dep: string) => string;
|
||||
declare const isValidMarketplaceComponent: (_path: string) => boolean;
|
||||
declare const isInvalidMarketplaceComponent: (_path: string) => boolean;
|
||||
declare const isValidLibraryComponent: (_path: string) => boolean;
|
||||
declare const PFilterInvalid: {
|
||||
marketplace_component: string;
|
||||
};
|
||||
declare const PFilterValid: {
|
||||
marketplace_component: string;
|
||||
library_component: string;
|
||||
package: string;
|
||||
};
|
||||
declare const FiltersValid: {
|
||||
marketplace_component: (_path: string) => boolean;
|
||||
library_component: (_path: string) => boolean;
|
||||
package: (_path: string) => JSONSchemaForNPMPackageJsonFiles;
|
||||
};
|
||||
|
||||
export { FiltersValid, PFilterInvalid, PFilterValid, hasDependency, isAPIPackage, isInvalidMarketplaceComponent, isValidLibraryComponent, isValidMarketplaceComponent };
|
||||
77
packages/commons/dist/fs.cjs
vendored
Normal file
77
packages/commons/dist/fs.cjs
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var fs_exports = {};
|
||||
__export(fs_exports, {
|
||||
UNC_REGEX: () => UNC_REGEX,
|
||||
WIN32_PATH_REGEX: () => WIN32_PATH_REGEX,
|
||||
isFile: () => isFile,
|
||||
isFolder: () => isFolder,
|
||||
is_absolute: () => is_absolute
|
||||
});
|
||||
module.exports = __toCommonJS(fs_exports);
|
||||
var fs = __toESM(require("fs"), 1);
|
||||
var import_os = require("./os.js");
|
||||
const UNC_REGEX = /^[\\\/]{2,}[^\\\/]+[\\\/]+[^\\\/]+/;
|
||||
const WIN32_PATH_REGEX = /^([a-z]:)?[\\\/]/i;
|
||||
const isFile = (src) => {
|
||||
let srcIsFile = false;
|
||||
try {
|
||||
srcIsFile = fs.lstatSync(src).isFile();
|
||||
} catch (e) {
|
||||
}
|
||||
return srcIsFile;
|
||||
};
|
||||
const isFolder = (src) => {
|
||||
let srcIsFolder = false;
|
||||
try {
|
||||
srcIsFolder = fs.lstatSync(src).isDirectory();
|
||||
} catch (e) {
|
||||
}
|
||||
return srcIsFolder;
|
||||
};
|
||||
const is_relative_win32 = (fp) => !fp.test(UNC_REGEX) && !WIN32_PATH_REGEX.test(fp);
|
||||
const is_absolute_posix = (fp) => fp.charAt(0) === "/";
|
||||
const is_absolute_win32 = (fp) => {
|
||||
if (/[a-z]/i.test(fp.charAt(0)) && fp.charAt(1) === ":" && fp.charAt(2) === "\\") {
|
||||
return true;
|
||||
}
|
||||
if (fp.slice(0, 2) === "\\\\") {
|
||||
return true;
|
||||
}
|
||||
return !is_relative_win32(fp);
|
||||
};
|
||||
const is_absolute = (fp) => (0, import_os.is_windows)() ? is_absolute_win32(fp) : is_absolute_posix(fp);
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
UNC_REGEX,
|
||||
WIN32_PATH_REGEX,
|
||||
isFile,
|
||||
isFolder,
|
||||
is_absolute
|
||||
});
|
||||
//# sourceMappingURL=fs.cjs.map
|
||||
1
packages/commons/dist/fs.cjs.map
vendored
Normal file
1
packages/commons/dist/fs.cjs.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/fs.ts"],"sourcesContent":["import * as fs from 'fs'\r\n\r\n// https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#namespaces\r\n// https://github.com/isaacs/node-glob/blob/main/src/pattern.ts\r\n\r\nexport const UNC_REGEX = /^[\\\\\\/]{2,}[^\\\\\\/]+[\\\\\\/]+[^\\\\\\/]+/\r\nexport const WIN32_PATH_REGEX = /^([a-z]:)?[\\\\\\/]/i\r\n\r\nimport { is_windows } from './os.js'\r\n\r\n\r\nexport const isFile = (src: string) => {\r\n let srcIsFile = false;\r\n try {\r\n srcIsFile = fs.lstatSync(src).isFile()\r\n } catch (e) { }\r\n return srcIsFile\r\n}\r\n\r\nexport const isFolder = (src: string) => {\r\n let srcIsFolder = false;\r\n try {\r\n srcIsFolder = fs.lstatSync(src).isDirectory()\r\n } catch (e) { }\r\n return srcIsFolder;\r\n}\r\n\r\nconst is_relative_win32 = (fp) => !fp.test(UNC_REGEX) && !WIN32_PATH_REGEX.test(fp)\r\nconst is_absolute_posix = (fp) => fp.charAt(0) === '/'\r\nconst is_absolute_win32 = (fp) => {\r\n if (/[a-z]/i.test(fp.charAt(0)) && fp.charAt(1) === ':' && fp.charAt(2) === '\\\\') {\r\n return true\r\n }\r\n // Microsoft Azure absolute filepath\r\n if (fp.slice(0, 2) === '\\\\\\\\') {\r\n return true;\r\n }\r\n return !is_relative_win32(fp)\r\n}\r\nexport const is_absolute = (fp) => is_windows() ? is_absolute_win32(fp) : is_absolute_posix(fp)\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAoB;AAQpB,gBAA2B;AAHpB,MAAM,YAAY;AAClB,MAAM,mBAAmB;AAKzB,MAAM,SAAS,CAAC,QAAgB;AACnC,MAAI,YAAY;AAChB,MAAI;AACA,gBAAY,GAAG,UAAU,GAAG,EAAE,OAAO;AAAA,EACzC,SAAS,GAAG;AAAA,EAAE;AACd,SAAO;AACX;AAEO,MAAM,WAAW,CAAC,QAAgB;AACrC,MAAI,cAAc;AAClB,MAAI;AACA,kBAAc,GAAG,UAAU,GAAG,EAAE,YAAY;AAAA,EAChD,SAAS,GAAG;AAAA,EAAE;AACd,SAAO;AACX;AAEA,MAAM,oBAAoB,CAAC,OAAO,CAAC,GAAG,KAAK,SAAS,KAAK,CAAC,iBAAiB,KAAK,EAAE;AAClF,MAAM,oBAAoB,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM;AACnD,MAAM,oBAAoB,CAAC,OAAO;AAC9B,MAAI,SAAS,KAAK,GAAG,OAAO,CAAC,CAAC,KAAK,GAAG,OAAO,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,MAAM;AAC9E,WAAO;AAAA,EACX;AAEA,MAAI,GAAG,MAAM,GAAG,CAAC,MAAM,QAAQ;AAC3B,WAAO;AAAA,EACX;AACA,SAAO,CAAC,kBAAkB,EAAE;AAChC;AACO,MAAM,cAAc,CAAC,WAAQ,sBAAW,IAAI,kBAAkB,EAAE,IAAI,kBAAkB,EAAE;","names":[]}
|
||||
7
packages/commons/dist/fs.d.cts
vendored
Normal file
7
packages/commons/dist/fs.d.cts
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
declare const UNC_REGEX: RegExp;
|
||||
declare const WIN32_PATH_REGEX: RegExp;
|
||||
declare const isFile: (src: string) => boolean;
|
||||
declare const isFolder: (src: string) => boolean;
|
||||
declare const is_absolute: (fp: any) => boolean;
|
||||
|
||||
export { UNC_REGEX, WIN32_PATH_REGEX, isFile, isFolder, is_absolute };
|
||||
40
packages/commons/dist/index.cjs
vendored
Normal file
40
packages/commons/dist/index.cjs
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var index_exports = {};
|
||||
module.exports = __toCommonJS(index_exports);
|
||||
__reExport(index_exports, require("./fs.js"), module.exports);
|
||||
__reExport(index_exports, require("./config.js"), module.exports);
|
||||
__reExport(index_exports, require("./os.js"), module.exports);
|
||||
__reExport(index_exports, require("./paths.js"), module.exports);
|
||||
__reExport(index_exports, require("./variables.js"), module.exports);
|
||||
__reExport(index_exports, require("./profile.js"), module.exports);
|
||||
__reExport(index_exports, require("./types.js"), module.exports);
|
||||
__reExport(index_exports, require("./constants.js"), module.exports);
|
||||
__reExport(index_exports, require("./fs/_glob.js"), module.exports);
|
||||
__reExport(index_exports, require("./component.js"), module.exports);
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
...require("./fs.js"),
|
||||
...require("./config.js"),
|
||||
...require("./os.js"),
|
||||
...require("./paths.js"),
|
||||
...require("./variables.js"),
|
||||
...require("./profile.js"),
|
||||
...require("./types.js"),
|
||||
...require("./constants.js"),
|
||||
...require("./fs/_glob.js"),
|
||||
...require("./component.js")
|
||||
});
|
||||
//# sourceMappingURL=index.cjs.map
|
||||
1
packages/commons/dist/index.cjs.map
vendored
Normal file
1
packages/commons/dist/index.cjs.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './fs.js'\r\nexport * from './config.js'\r\nexport * from './os.js'\r\nexport * from './paths.js'\r\nexport * from './variables.js'\r\nexport * from './profile.js'\r\nexport * from './types.js'\r\nexport * from './constants.js'\r\nexport * from './fs/_glob.js'\r\nexport * from './component.js'\r\n\r\n\r\n\r\n\r\n\r\n\r\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,oBAAd;AACA,0BAAc,wBADd;AAEA,0BAAc,oBAFd;AAGA,0BAAc,uBAHd;AAIA,0BAAc,2BAJd;AAKA,0BAAc,yBALd;AAMA,0BAAc,uBANd;AAOA,0BAAc,2BAPd;AAQA,0BAAc,0BARd;AASA,0BAAc,2BATd;","names":[]}
|
||||
42
packages/commons/dist/index.d.cts
vendored
Normal file
42
packages/commons/dist/index.d.cts
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
export { UNC_REGEX, WIN32_PATH_REGEX, isFile, isFolder, is_absolute } from './fs.cjs';
|
||||
export { CONFIG_DEFAULT, CONFIG_DEFAULT_PATH, DEFAULT_ROOTS, HOME, KB_ROOT, OA_ROOT, OSR_CACHE, OSR_CUSTOMER_DRIVE, OSR_LIBRARY, OSR_LIBRARY_DIRECTORY, OSR_LIBRARY_MACHINES, OSR_PRIVATE, OSR_ROOT, OSR_SUB_DEFAULT, OSR_TEMP, OSR_USER_ASSETS, POLYMECH_ROOT, PRODUCT_ROOT, get_var, readNPMMeta, readOSRConfig, readOSRMeta, readPackage } from './config.cjs';
|
||||
export { EArch, EPlatform, is_windows } from './os.cjs';
|
||||
export { DATE_VARS, DEFAULT_VARS, _substitute, resolve, resolveVariables, substitute } from './variables.cjs';
|
||||
export { IProfile, parse, resolveConfig } from './profile.cjs';
|
||||
export { IConvertedFileMeta, IDiscourseUser, IGeo, IGeoLocation, IGeo_Administrative, IGeo_Informative, IGeo_LocalityInfo, IImage, IMAchineBuilderXp, IModerable, IModerationStatus, INotification, IOA_Service, IOA_UserDetail, IOSRUserData, IOpeningHours, IPlasticType, IProduct, IProfileType, ISODateString, IUploadedFileMeta, IUrl, IUser, IUserDB, IUserPP, IUserPPDB, IUserState, IWorkspaceType, I_OSR_USER, I_USER_SHORT, MachineBuilderXpLabel, NotificationType, PlasticTypeLabel, TOSR_User_Type, WorkspaceType } from './types.cjs';
|
||||
export { API_NAMESPACE, API_PREFIX, API_PREFIX_NEXT, MODULE_NAME, OA_LATEST, OA_LATEST_CENSORED, OA_LATEST_INVALID, OA_LATEST_MERGED, PP_BAZAR_LATEST_INDEX, PP_BAZAR_LATEST_INDEX_MERGED, PROFILE_FILE_NAME } from './constants.cjs';
|
||||
import { GlobOptions } from 'glob';
|
||||
import { PATH_INFO } from './types_common.cjs';
|
||||
export { DST_VARIABLES, GeoPos, ICsCartConfig, ICsCartConfigMySQL, IDeeplConfig, IDiscourseConfig, IGiteaConfig, IIgConfig, IOSRConfig, IOptionsBase, IScaleserp, PATH_VARIABLES, SRC_VARIABLES } from './types_common.cjs';
|
||||
export { AssetsSchema, AuthorSchema, ComponentConfigSchema, ContentSchema, IComponentConfig, ProductionSchema, get } from './component.cjs';
|
||||
export { IKBotOptions } from './types_kbot.cjs';
|
||||
import '@schemastore/package';
|
||||
import 'zod';
|
||||
|
||||
/*!
|
||||
* glob-base <https://github.com/jonschlinkert/glob-base>
|
||||
*
|
||||
* Copyright (c) 2015, Jon Schlinkert.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
interface GlobBaseResult {
|
||||
base: string;
|
||||
isGlob: boolean;
|
||||
glob: string;
|
||||
}
|
||||
declare const globBase: (pattern: string) => GlobBaseResult;
|
||||
|
||||
interface Options {
|
||||
flipBackslashes?: boolean;
|
||||
}
|
||||
declare const globParent: (str: string, opts?: Options) => string;
|
||||
|
||||
declare const files: (cwd: any, glob: any, options?: any) => [];
|
||||
declare const filesEx: (cwd: any, glob: any, options?: GlobOptions) => [];
|
||||
|
||||
declare const getExtensions: (glob: string) => string[];
|
||||
declare const forward_slash: (path: any) => any;
|
||||
declare const pathInfoEx: (src: string, altToken?: boolean, globOptions?: GlobOptions) => PATH_INFO;
|
||||
declare const pathInfo: (src: string, altToken?: boolean, cwd?: string) => PATH_INFO;
|
||||
|
||||
export { PATH_INFO, files, filesEx, forward_slash, getExtensions, globBase, globParent, pathInfo, pathInfoEx };
|
||||
47
packages/commons/dist/logger.cjs
vendored
Normal file
47
packages/commons/dist/logger.cjs
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var logger_exports = {};
|
||||
__export(logger_exports, {
|
||||
MODULE_NAME: () => import_constants2.MODULE_NAME,
|
||||
createLogger: () => createLogger,
|
||||
defaultLogger: () => defaultLogger,
|
||||
logger: () => logger
|
||||
});
|
||||
module.exports = __toCommonJS(logger_exports);
|
||||
var import_tslog = require("tslog");
|
||||
var import_constants = require("./constants.js");
|
||||
var import_constants2 = require("./constants.js");
|
||||
function createLogger(name, options) {
|
||||
return new import_tslog.Logger({
|
||||
name,
|
||||
type: "pretty",
|
||||
...options
|
||||
});
|
||||
}
|
||||
const defaultLogger = createLogger("DefaultLogger", {
|
||||
minLevel: 1
|
||||
});
|
||||
const logger = createLogger(import_constants.MODULE_NAME, {});
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
MODULE_NAME,
|
||||
createLogger,
|
||||
defaultLogger,
|
||||
logger
|
||||
});
|
||||
//# sourceMappingURL=logger.cjs.map
|
||||
1
packages/commons/dist/logger.cjs.map
vendored
Normal file
1
packages/commons/dist/logger.cjs.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/logger.ts"],"sourcesContent":["import { ISettingsParam, Logger } from \"tslog\"\r\n\r\nexport function createLogger(name: string, options?: any) {\r\n return new Logger({\r\n name,\r\n type: 'pretty',\r\n ...options,\r\n })\r\n}\r\nexport const defaultLogger = createLogger('DefaultLogger', {\r\n minLevel: 1\r\n})\r\n\r\nimport { MODULE_NAME } from './constants.js'\r\nexport { MODULE_NAME } from './constants.js'\r\n\r\nexport const logger = createLogger(MODULE_NAME, {})\r\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAwC;AAaxC,uBAA4B;AAC5B,IAAAA,oBAA4B;AAZrB,SAAS,aAAa,MAAc,SAAe;AACtD,SAAO,IAAI,oBAAO;AAAA,IACd;AAAA,IACA,MAAM;AAAA,IACN,GAAG;AAAA,EACP,CAAC;AACL;AACO,MAAM,gBAAgB,aAAa,iBAAiB;AAAA,EACvD,UAAU;AACd,CAAC;AAKM,MAAM,SAAS,aAAa,8BAAa,CAAC,CAAC;","names":["import_constants"]}
|
||||
9
packages/commons/dist/logger.d.cts
vendored
Normal file
9
packages/commons/dist/logger.d.cts
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
import { Logger } from 'tslog';
|
||||
export { MODULE_NAME } from './constants.cjs';
|
||||
|
||||
declare function createLogger(name: string, options?: any): Logger;
|
||||
declare const defaultLogger: Logger;
|
||||
|
||||
declare const logger: Logger;
|
||||
|
||||
export { createLogger, defaultLogger, logger };
|
||||
43
packages/commons/dist/os.cjs
vendored
Normal file
43
packages/commons/dist/os.cjs
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var os_exports = {};
|
||||
__export(os_exports, {
|
||||
EArch: () => EArch,
|
||||
EPlatform: () => EPlatform,
|
||||
is_windows: () => is_windows
|
||||
});
|
||||
module.exports = __toCommonJS(os_exports);
|
||||
var EPlatform = /* @__PURE__ */ ((EPlatform2) => {
|
||||
EPlatform2["Linux"] = "linux";
|
||||
EPlatform2["Windows"] = "win32";
|
||||
EPlatform2["OSX"] = "darwin";
|
||||
return EPlatform2;
|
||||
})(EPlatform || {});
|
||||
var EArch = /* @__PURE__ */ ((EArch2) => {
|
||||
EArch2["x64"] = "64";
|
||||
EArch2["x32"] = "32";
|
||||
return EArch2;
|
||||
})(EArch || {});
|
||||
const is_windows = () => process && process.platform === "win32";
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
EArch,
|
||||
EPlatform,
|
||||
is_windows
|
||||
});
|
||||
//# sourceMappingURL=os.cjs.map
|
||||
1
packages/commons/dist/os.cjs.map
vendored
Normal file
1
packages/commons/dist/os.cjs.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/os.ts"],"sourcesContent":["export enum EPlatform {\r\n\tLinux = 'linux',\r\n\tWindows = 'win32',\r\n\tOSX = 'darwin'\r\n}\r\nexport enum EArch {\r\n\tx64 = '64',\r\n\tx32 = '32'\r\n}\r\nexport const is_windows = () => process && (process.platform === 'win32')\r\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAK,YAAL,kBAAKA,eAAL;AACN,EAAAA,WAAA,WAAQ;AACR,EAAAA,WAAA,aAAU;AACV,EAAAA,WAAA,SAAM;AAHK,SAAAA;AAAA,GAAA;AAKL,IAAK,QAAL,kBAAKC,WAAL;AACN,EAAAA,OAAA,SAAM;AACN,EAAAA,OAAA,SAAM;AAFK,SAAAA;AAAA,GAAA;AAIL,MAAM,aAAa,MAAM,WAAY,QAAQ,aAAa;","names":["EPlatform","EArch"]}
|
||||
12
packages/commons/dist/os.d.cts
vendored
Normal file
12
packages/commons/dist/os.d.cts
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
declare enum EPlatform {
|
||||
Linux = "linux",
|
||||
Windows = "win32",
|
||||
OSX = "darwin"
|
||||
}
|
||||
declare enum EArch {
|
||||
x64 = "64",
|
||||
x32 = "32"
|
||||
}
|
||||
declare const is_windows: () => boolean;
|
||||
|
||||
export { EArch, EPlatform, is_windows };
|
||||
1
packages/commons/dist/paths.cjs
vendored
Normal file
1
packages/commons/dist/paths.cjs
vendored
Normal file
@ -0,0 +1 @@
|
||||
//# sourceMappingURL=paths.cjs.map
|
||||
1
packages/commons/dist/paths.cjs.map
vendored
Normal file
1
packages/commons/dist/paths.cjs.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
||||
2
packages/commons/dist/paths.d.cts
vendored
Normal file
2
packages/commons/dist/paths.d.cts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
export { }
|
||||
112
packages/commons/dist/profile.cjs
vendored
Normal file
112
packages/commons/dist/profile.cjs
vendored
Normal file
@ -0,0 +1,112 @@
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var profile_exports = {};
|
||||
__export(profile_exports, {
|
||||
parse: () => parse,
|
||||
resolveConfig: () => resolveConfig
|
||||
});
|
||||
module.exports = __toCommonJS(profile_exports);
|
||||
var path = __toESM(require("path"), 1);
|
||||
var import_constants = require("@polymech/core/constants");
|
||||
var import_read = require("@polymech/fs/read");
|
||||
var import_exists = require("@polymech/fs/exists");
|
||||
var import_types = require("@polymech/core/types");
|
||||
var import_variables = require("./variables.js");
|
||||
const _resolve = (config) => {
|
||||
for (const key in config) {
|
||||
if (config[key] && typeof config[key] == "string") {
|
||||
const resolved = (0, import_variables.substitute)(false, config[key], config);
|
||||
config[key] = resolved;
|
||||
}
|
||||
}
|
||||
return config;
|
||||
};
|
||||
const resolveConfig = (config) => {
|
||||
config = _resolve(config);
|
||||
config = _resolve(config);
|
||||
return config;
|
||||
};
|
||||
const parse = (profilePath, profile, options = { env: "default" }, rel) => {
|
||||
profilePath = path.resolve((0, import_variables.resolve)(profilePath, false, profile.variables));
|
||||
if (!(0, import_exists.sync)(profilePath)) {
|
||||
return;
|
||||
}
|
||||
const _profile = (0, import_read.sync)(profilePath, "json") || { includes: [], variables: {} };
|
||||
_profile.includes = _profile.includes || [];
|
||||
_profile.variables = _profile.variables || {};
|
||||
if (options.env && _profile.env && _profile.env[options.env] && _profile.env[options.env].includes) {
|
||||
profile.includes = [
|
||||
...profile.includes,
|
||||
..._profile.includes,
|
||||
..._profile.env[options.env].includes
|
||||
];
|
||||
} else {
|
||||
profile.includes = [
|
||||
...profile.includes,
|
||||
..._profile.includes
|
||||
];
|
||||
}
|
||||
if (options.env && _profile.env && _profile.env[options.env] && _profile.env[options.env].variables) {
|
||||
profile.variables = {
|
||||
...profile.variables,
|
||||
..._profile.variables,
|
||||
..._profile.env[options.env].variables
|
||||
};
|
||||
}
|
||||
for (const k in _profile.variables) {
|
||||
if ((0, import_types.isString)(_profile.variables[k])) {
|
||||
_profile.variables[k] = (0, import_variables.substitute)(false, _profile.variables[k], profile.variables);
|
||||
}
|
||||
}
|
||||
profile.variables = { ...profile.variables, ..._profile.variables, ..._profile.env[options.env]?.variables || {} };
|
||||
for (const k in profile.variables) {
|
||||
if ((0, import_types.isString)(profile.variables[k])) {
|
||||
profile.variables[k] = (0, import_variables.substitute)(false, profile.variables[k], profile.variables);
|
||||
}
|
||||
}
|
||||
profile.includes = Array.from(new Set(profile.includes));
|
||||
profile.includes = [
|
||||
...profile.includes.map((i) => {
|
||||
if (!path.isAbsolute(i) && rel && !i.match(import_constants.REGEX_VAR)) {
|
||||
return path.resolve(`${rel}/${i}`);
|
||||
}
|
||||
let ret = (0, import_variables.resolve)(i, false, profile.variables);
|
||||
ret = path.resolve((0, import_variables.substitute)(false, ret, profile.variables));
|
||||
return ret;
|
||||
})
|
||||
];
|
||||
profile.includes = profile.includes.filter((include) => include !== null && include !== "");
|
||||
profile.includes = Array.from(new Set(profile.includes));
|
||||
return profile;
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
parse,
|
||||
resolveConfig
|
||||
});
|
||||
//# sourceMappingURL=profile.cjs.map
|
||||
1
packages/commons/dist/profile.cjs.map
vendored
Normal file
1
packages/commons/dist/profile.cjs.map
vendored
Normal file
File diff suppressed because one or more lines are too long
20
packages/commons/dist/profile.d.cts
vendored
Normal file
20
packages/commons/dist/profile.d.cts
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
interface EnvVariables {
|
||||
[key: string]: string;
|
||||
}
|
||||
interface EnvConfig {
|
||||
includes: string[];
|
||||
variables: EnvVariables;
|
||||
}
|
||||
interface IProfile {
|
||||
includes: string[];
|
||||
variables: EnvVariables;
|
||||
env?: {
|
||||
[key: string]: EnvConfig;
|
||||
};
|
||||
}
|
||||
declare const resolveConfig: (config: any) => any;
|
||||
declare const parse: (profilePath: string, profile: IProfile, options?: {
|
||||
env: string;
|
||||
}, rel?: string) => IProfile;
|
||||
|
||||
export { type IProfile, parse, resolveConfig };
|
||||
24
packages/commons/dist/types.cjs
vendored
Normal file
24
packages/commons/dist/types.cjs
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var types_exports = {};
|
||||
module.exports = __toCommonJS(types_exports);
|
||||
__reExport(types_exports, require("./types_kbot.js"), module.exports);
|
||||
__reExport(types_exports, require("./types_common.js"), module.exports);
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
...require("./types_kbot.js"),
|
||||
...require("./types_common.js")
|
||||
});
|
||||
//# sourceMappingURL=types.cjs.map
|
||||
1
packages/commons/dist/types.cjs.map
vendored
Normal file
1
packages/commons/dist/types.cjs.map
vendored
Normal file
File diff suppressed because one or more lines are too long
267
packages/commons/dist/types.d.cts
vendored
Normal file
267
packages/commons/dist/types.d.cts
vendored
Normal file
@ -0,0 +1,267 @@
|
||||
export { IKBotOptions } from './types_kbot.cjs';
|
||||
export { DST_VARIABLES, GeoPos, ICsCartConfig, ICsCartConfigMySQL, IDeeplConfig, IDiscourseConfig, IGiteaConfig, IIgConfig, IOSRConfig, IOptionsBase, IScaleserp, PATH_INFO, PATH_VARIABLES, SRC_VARIABLES } from './types_common.cjs';
|
||||
|
||||
interface IConvertedFileMeta {
|
||||
photoData: Blob;
|
||||
objectUrl: string;
|
||||
name: string;
|
||||
type: string;
|
||||
}
|
||||
interface IUploadedFileMeta {
|
||||
downloadUrl: string;
|
||||
contentType?: string | null;
|
||||
fullPath: string;
|
||||
name: string;
|
||||
type: string;
|
||||
size: number;
|
||||
timeCreated: string;
|
||||
updated: string;
|
||||
data: any;
|
||||
}
|
||||
type IModerationStatus = 'draft' | 'awaiting-moderation' | 'rejected' | 'accepted';
|
||||
interface IModerable {
|
||||
moderation: IModerationStatus;
|
||||
_createdBy?: string;
|
||||
_id?: string;
|
||||
}
|
||||
type ISODateString = string;
|
||||
interface IUserState {
|
||||
user?: IUser;
|
||||
}
|
||||
interface IUser {
|
||||
_authID: string;
|
||||
_lastActive?: ISODateString;
|
||||
userName: string;
|
||||
displayName: string;
|
||||
moderation: IModerationStatus;
|
||||
verified: boolean;
|
||||
badges?: IUserBadges;
|
||||
coverImages: IUploadedFileMeta[] | IConvertedFileMeta[];
|
||||
links: IExternalLink[];
|
||||
userRoles?: string[];
|
||||
about?: string | null;
|
||||
DHSite_id?: number;
|
||||
DHSite_mention_name?: string;
|
||||
country?: string | null;
|
||||
year?: ISODateString;
|
||||
stats?: IUserStats;
|
||||
/** keep a map of all howto ids that a user has voted as useful */
|
||||
votedUsefulHowtos?: {
|
||||
[howtoId: string]: boolean;
|
||||
};
|
||||
/** keep a map of all Research ids that a user has voted as useful */
|
||||
votedUsefulResearch?: {
|
||||
[researchId: string]: boolean;
|
||||
};
|
||||
notifications?: INotification[];
|
||||
}
|
||||
interface IUserBadges {
|
||||
verified: boolean;
|
||||
}
|
||||
interface IExternalLink {
|
||||
url: string;
|
||||
label: 'email' | 'website' | 'discord' | 'bazar' | 'forum' | 'social media' | 'facebook' | 'instagram' | 'github' | 'linkedin' | 'map' | 'forum' | 'marketplace' | 'other' | 'other-2';
|
||||
}
|
||||
/**
|
||||
* Track the ids and moderation status as summary for user stats
|
||||
*/
|
||||
interface IUserStats {
|
||||
userCreatedHowtos: {
|
||||
[id: string]: IModerationStatus;
|
||||
};
|
||||
userCreatedResearch: {
|
||||
[id: string]: IModerationStatus;
|
||||
};
|
||||
userCreatedEvents: {
|
||||
[id: string]: IModerationStatus;
|
||||
};
|
||||
}
|
||||
type IUserDB = IUser;
|
||||
interface INotification {
|
||||
_id: string;
|
||||
_created: string;
|
||||
triggeredBy: {
|
||||
displayName: string;
|
||||
userId: string;
|
||||
};
|
||||
relevantUrl?: string;
|
||||
type: NotificationType;
|
||||
read: boolean;
|
||||
}
|
||||
type NotificationType = 'new_comment' | 'howto_useful' | 'new_comment_research' | 'research_useful';
|
||||
type PlasticTypeLabel = 'pet' | 'hdpe' | 'pvc' | 'ldpe' | 'pp' | 'ps' | 'other';
|
||||
type MachineBuilderXpLabel = 'electronics' | 'machining' | 'welding' | 'assembling' | 'mould-making' | 'development';
|
||||
type WorkspaceType = 'shredder' | 'sheetpress' | 'extrusion' | 'injection' | 'mix' | 'machine shop' | 'service' | 'educational' | 'supplier' | '3dprint';
|
||||
type TOSR_User_Type = 'Precious Plastic' | 'OSR-Plastic' | 'Unknown' | 'User Contact' | 'Crawler' | 'Fablab' | 'OSE' | 'Meetup';
|
||||
interface IPlasticType {
|
||||
label: PlasticTypeLabel;
|
||||
number: string;
|
||||
imageSrc?: string;
|
||||
}
|
||||
interface IProfileType {
|
||||
label: string;
|
||||
imageSrc?: string;
|
||||
cleanImageSrc?: string;
|
||||
cleanImageVerifiedSrc?: string;
|
||||
textLabel?: string;
|
||||
}
|
||||
interface IWorkspaceType {
|
||||
label: WorkspaceType;
|
||||
imageSrc?: string;
|
||||
textLabel?: string;
|
||||
subText?: string;
|
||||
}
|
||||
interface IMAchineBuilderXp {
|
||||
label: MachineBuilderXpLabel;
|
||||
}
|
||||
interface IOpeningHours {
|
||||
day: string;
|
||||
openFrom: string;
|
||||
openTo: string;
|
||||
}
|
||||
/**
|
||||
* PP users can have a bunch of custom meta fields depending on profile type
|
||||
*/
|
||||
interface IUserPP extends IUser {
|
||||
profileType: string;
|
||||
workspaceType?: WorkspaceType | null;
|
||||
mapPinDescription?: string | null;
|
||||
openingHours?: IOpeningHours[];
|
||||
collectedPlasticTypes?: PlasticTypeLabel[] | null;
|
||||
machineBuilderXp?: IMAchineBuilderXp[] | null;
|
||||
isExpert?: boolean | null;
|
||||
isV4Member?: boolean | null;
|
||||
}
|
||||
type IUserPPDB = IUserPP;
|
||||
interface IGeoLocation {
|
||||
lng: number;
|
||||
lat: number;
|
||||
}
|
||||
interface IOA_UserDetail {
|
||||
lastActive: Date;
|
||||
profilePicUrl: string;
|
||||
shortDescription: string;
|
||||
heroImageUrl: string;
|
||||
name: string;
|
||||
profileUrl: string;
|
||||
}
|
||||
interface IGeo_Administrative {
|
||||
name: string;
|
||||
description: string;
|
||||
isoName: string;
|
||||
order: number;
|
||||
adminLevel: number;
|
||||
isoCode: string;
|
||||
wikidataId: string;
|
||||
geonameId: number;
|
||||
}
|
||||
interface IGeo_Informative {
|
||||
name: string;
|
||||
description: string;
|
||||
order: number;
|
||||
isoCode: string;
|
||||
wikidataId: string;
|
||||
geonameId: number;
|
||||
}
|
||||
interface IGeo_LocalityInfo {
|
||||
administrative: IGeo_Administrative[];
|
||||
informative: IGeo_Informative[];
|
||||
}
|
||||
interface IGeo {
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
continent: string;
|
||||
lookupSource: string;
|
||||
continentCode: string;
|
||||
localityLanguageRequested: string;
|
||||
city: string;
|
||||
countryName: string;
|
||||
postcode: string;
|
||||
countryCode: string;
|
||||
principalSubdivision: string;
|
||||
principalSubdivisionCode: string;
|
||||
plusCode: string;
|
||||
locality: string;
|
||||
localityInfo: IGeo_LocalityInfo;
|
||||
}
|
||||
interface IUrl {
|
||||
name: string;
|
||||
url: string;
|
||||
}
|
||||
interface IOA_Service {
|
||||
welding: boolean;
|
||||
assembling: boolean;
|
||||
machining: boolean;
|
||||
electronics: boolean;
|
||||
molds: boolean;
|
||||
}
|
||||
interface IImage {
|
||||
url: string;
|
||||
}
|
||||
interface IOSRUserData {
|
||||
urls: IUrl[];
|
||||
description: string;
|
||||
services: IOA_Service[];
|
||||
title: string;
|
||||
images: IImage[];
|
||||
jsError?: boolean;
|
||||
}
|
||||
interface I_OSR_USER {
|
||||
_created: Date;
|
||||
location: IGeoLocation;
|
||||
_modified: Date;
|
||||
_id: string;
|
||||
detail: IOA_UserDetail;
|
||||
type: string;
|
||||
_deleted: boolean;
|
||||
moderation: string;
|
||||
geo: IGeo;
|
||||
data: IOSRUserData;
|
||||
}
|
||||
interface I_USER_SHORT {
|
||||
name: string;
|
||||
email: string;
|
||||
bazar: string;
|
||||
web: string;
|
||||
social: string;
|
||||
censored: string;
|
||||
lastActive: Date;
|
||||
ig: string;
|
||||
}
|
||||
type IProduct = {
|
||||
slug: string;
|
||||
name: string;
|
||||
category: string;
|
||||
code: string;
|
||||
forum?: string;
|
||||
forumCategory?: string;
|
||||
version?: string;
|
||||
cart_id?: string;
|
||||
};
|
||||
interface IDiscourseUser {
|
||||
id: number;
|
||||
username: string;
|
||||
name: string;
|
||||
avatar_template: string;
|
||||
active: boolean;
|
||||
admin: boolean;
|
||||
moderator: boolean;
|
||||
last_seen_at: any;
|
||||
last_emailed_at: string;
|
||||
created_at: string;
|
||||
last_seen_age: any;
|
||||
last_emailed_age: number;
|
||||
created_at_age: number;
|
||||
trust_level: number;
|
||||
manual_locked_trust_level: any;
|
||||
flag_level: number;
|
||||
title: any;
|
||||
time_read: number;
|
||||
staged: boolean;
|
||||
days_visited: number;
|
||||
posts_read_count: number;
|
||||
topics_entered: number;
|
||||
post_count: number;
|
||||
}
|
||||
|
||||
export type { IConvertedFileMeta, IDiscourseUser, IGeo, IGeoLocation, IGeo_Administrative, IGeo_Informative, IGeo_LocalityInfo, IImage, IMAchineBuilderXp, IModerable, IModerationStatus, INotification, IOA_Service, IOA_UserDetail, IOSRUserData, IOpeningHours, IPlasticType, IProduct, IProfileType, ISODateString, IUploadedFileMeta, IUrl, IUser, IUserDB, IUserPP, IUserPPDB, IUserState, IWorkspaceType, I_OSR_USER, I_USER_SHORT, MachineBuilderXpLabel, NotificationType, PlasticTypeLabel, TOSR_User_Type, WorkspaceType };
|
||||
16
packages/commons/dist/types_cache.cjs
vendored
Normal file
16
packages/commons/dist/types_cache.cjs
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var types_cache_exports = {};
|
||||
module.exports = __toCommonJS(types_cache_exports);
|
||||
//# sourceMappingURL=types_cache.cjs.map
|
||||
1
packages/commons/dist/types_cache.cjs.map
vendored
Normal file
1
packages/commons/dist/types_cache.cjs.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/types_cache.ts"],"sourcesContent":["export interface IOptionsCache {\r\n skip?: boolean\r\n clear?: boolean\r\n namespace?: string\r\n cacheRoot?: string\r\n}\r\n"],"mappings":";;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
||||
8
packages/commons/dist/types_cache.d.cts
vendored
Normal file
8
packages/commons/dist/types_cache.d.cts
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
interface IOptionsCache {
|
||||
skip?: boolean;
|
||||
clear?: boolean;
|
||||
namespace?: string;
|
||||
cacheRoot?: string;
|
||||
}
|
||||
|
||||
export type { IOptionsCache };
|
||||
16
packages/commons/dist/types_common.cjs
vendored
Normal file
16
packages/commons/dist/types_common.cjs
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var types_common_exports = {};
|
||||
module.exports = __toCommonJS(types_common_exports);
|
||||
//# sourceMappingURL=types_common.cjs.map
|
||||
1
packages/commons/dist/types_common.cjs.map
vendored
Normal file
1
packages/commons/dist/types_common.cjs.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/types_common.ts"],"sourcesContent":["export interface GeoPos {\n\tlon: number\n\tlat: number\n}\n\nexport interface PATH_INFO {\n DIR?: string\n NAME?: string\n FILE_NAME?: string\n FILE_EXT?: string\n PATH?: string\n IS_FILE?: boolean\n IS_FOLDER?: boolean\n IS_EXPRESSION?: boolean\n IS_GLOB?: boolean\n path: string\n GLOB: string\n GLOB_EXTENSIONS: string[]\n FILES: string[]\n}\n\nexport interface IDeeplConfig {\n auth_key: string\n free_api: boolean\n}\n\nexport interface IIgConfig {\n username: string\n password: string\n}\n\n\nexport interface ICsCartConfigMySQL {\n host: string\n user: string\n database: string\n password: string\n}\nexport interface ICsCartConfig {\n token: string\n url: string\n username: string\n\n siteUrl?: string\n timeout?: number\n language?: string\n userToken?: string\n\n mysql?: ICsCartConfigMySQL\n}\nexport interface IGiteaConfig {\n token: string\n url: string\n}\nexport interface IDiscourseConfig {\n host: string\n key: string\n username: string\n rateLimitConcurrency: number\n}\n\nexport interface IScaleserp {\n key: string\n}\n\nexport interface IOSRConfig {\n deepl: IDeeplConfig\n ig: IIgConfig\n cscart: ICsCartConfig\n discourse: IDiscourseConfig\n discourse_admin: IDiscourseConfig\n instagram: IIgConfig\n urls: any\n scaleserp?: IScaleserp\n gitea?: IGiteaConfig\n}\n\nexport interface SRC_VARIABLES {\n SRC_PATH: string\n SRC_DIR: string\n SRC_NAME: string\n SRC_FILE_NAME: string\n SRC_FILE_EXT: string\n SRC_IS_FILE: boolean\n SRC_IS_FOLDER: boolean\n SRC_IS_EXPRESSION: boolean\n SRC_IS_GLOB: boolean\n SRC_GLOB: string\n SRC_GLOB_EXTENSIONS: string[]\n SRC_FILES: string[]\n}\n\nexport interface DST_VARIABLES {\n DST_PATH: string\n DST_DIR: string\n DST_NAME: string\n DST_FILE_NAME: string\n DST_FILE_EXT: string\n DST_IS_FILE: boolean\n DST_IS_FOLDER: boolean\n DST_IS_EXPRESSION: boolean\n DST_IS_GLOB: boolean\n DST_GLOB: string\n DST_GLOB_EXTENSIONS: string[]\n DST_FILES: string[]\n}\n\nexport type PATH_VARIABLES = SRC_VARIABLES & DST_VARIABLES\n\nexport interface IOptionsBase {\n variables: PATH_VARIABLES\n}\n\nexport interface PATH_INFO {\n DIR?: string\n FILE_EXT?: string\n FILE_NAME?: string\n FILES: string[]\n GLOB_EXTENSIONS: string[]\n GLOB: string\n IS_EXPRESSION?: boolean\n IS_FILE?: boolean\n IS_FOLDER?: boolean\n IS_GLOB?: boolean\n NAME?: string\n path: string\n PATH?: string\n}\n\n"],"mappings":";;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
||||
116
packages/commons/dist/types_common.d.cts
vendored
Normal file
116
packages/commons/dist/types_common.d.cts
vendored
Normal file
@ -0,0 +1,116 @@
|
||||
interface GeoPos {
|
||||
lon: number;
|
||||
lat: number;
|
||||
}
|
||||
interface IDeeplConfig {
|
||||
auth_key: string;
|
||||
free_api: boolean;
|
||||
}
|
||||
interface IIgConfig {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
interface ICsCartConfigMySQL {
|
||||
host: string;
|
||||
user: string;
|
||||
database: string;
|
||||
password: string;
|
||||
}
|
||||
interface ICsCartConfig {
|
||||
token: string;
|
||||
url: string;
|
||||
username: string;
|
||||
siteUrl?: string;
|
||||
timeout?: number;
|
||||
language?: string;
|
||||
userToken?: string;
|
||||
mysql?: ICsCartConfigMySQL;
|
||||
}
|
||||
interface IGiteaConfig {
|
||||
token: string;
|
||||
url: string;
|
||||
}
|
||||
interface IDiscourseConfig {
|
||||
host: string;
|
||||
key: string;
|
||||
username: string;
|
||||
rateLimitConcurrency: number;
|
||||
}
|
||||
interface IScaleserp {
|
||||
key: string;
|
||||
}
|
||||
interface IOSRConfig {
|
||||
deepl: IDeeplConfig;
|
||||
ig: IIgConfig;
|
||||
cscart: ICsCartConfig;
|
||||
discourse: IDiscourseConfig;
|
||||
discourse_admin: IDiscourseConfig;
|
||||
instagram: IIgConfig;
|
||||
urls: any;
|
||||
scaleserp?: IScaleserp;
|
||||
gitea?: IGiteaConfig;
|
||||
}
|
||||
interface SRC_VARIABLES {
|
||||
SRC_PATH: string;
|
||||
SRC_DIR: string;
|
||||
SRC_NAME: string;
|
||||
SRC_FILE_NAME: string;
|
||||
SRC_FILE_EXT: string;
|
||||
SRC_IS_FILE: boolean;
|
||||
SRC_IS_FOLDER: boolean;
|
||||
SRC_IS_EXPRESSION: boolean;
|
||||
SRC_IS_GLOB: boolean;
|
||||
SRC_GLOB: string;
|
||||
SRC_GLOB_EXTENSIONS: string[];
|
||||
SRC_FILES: string[];
|
||||
}
|
||||
interface DST_VARIABLES {
|
||||
DST_PATH: string;
|
||||
DST_DIR: string;
|
||||
DST_NAME: string;
|
||||
DST_FILE_NAME: string;
|
||||
DST_FILE_EXT: string;
|
||||
DST_IS_FILE: boolean;
|
||||
DST_IS_FOLDER: boolean;
|
||||
DST_IS_EXPRESSION: boolean;
|
||||
DST_IS_GLOB: boolean;
|
||||
DST_GLOB: string;
|
||||
DST_GLOB_EXTENSIONS: string[];
|
||||
DST_FILES: string[];
|
||||
}
|
||||
type PATH_VARIABLES = SRC_VARIABLES & DST_VARIABLES;
|
||||
interface IOptionsBase {
|
||||
variables: PATH_VARIABLES;
|
||||
}
|
||||
interface PATH_INFO {
|
||||
DIR?: string;
|
||||
NAME?: string;
|
||||
FILE_NAME?: string;
|
||||
FILE_EXT?: string;
|
||||
PATH?: string;
|
||||
IS_FILE?: boolean;
|
||||
IS_FOLDER?: boolean;
|
||||
IS_EXPRESSION?: boolean;
|
||||
IS_GLOB?: boolean;
|
||||
path: string;
|
||||
GLOB: string;
|
||||
GLOB_EXTENSIONS: string[];
|
||||
FILES: string[];
|
||||
}
|
||||
interface PATH_INFO {
|
||||
DIR?: string;
|
||||
FILE_EXT?: string;
|
||||
FILE_NAME?: string;
|
||||
FILES: string[];
|
||||
GLOB_EXTENSIONS: string[];
|
||||
GLOB: string;
|
||||
IS_EXPRESSION?: boolean;
|
||||
IS_FILE?: boolean;
|
||||
IS_FOLDER?: boolean;
|
||||
IS_GLOB?: boolean;
|
||||
NAME?: string;
|
||||
path: string;
|
||||
PATH?: string;
|
||||
}
|
||||
|
||||
export type { DST_VARIABLES, GeoPos, ICsCartConfig, ICsCartConfigMySQL, IDeeplConfig, IDiscourseConfig, IGiteaConfig, IIgConfig, IOSRConfig, IOptionsBase, IScaleserp, PATH_INFO, PATH_VARIABLES, SRC_VARIABLES };
|
||||
184
packages/commons/dist/types_gui.cjs
vendored
Normal file
184
packages/commons/dist/types_gui.cjs
vendored
Normal file
@ -0,0 +1,184 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var types_gui_exports = {};
|
||||
__export(types_gui_exports, {
|
||||
BLOCK_GROUPS: () => BLOCK_GROUPS,
|
||||
BLOCK_MODE: () => BLOCK_MODE,
|
||||
BLOCK_OUTLET: () => BLOCK_OUTLET,
|
||||
BlockType: () => BlockType,
|
||||
CIFLAG: () => CIFLAG,
|
||||
COMMAND_TYPES: () => COMMAND_TYPES,
|
||||
EVENTS: () => EVENTS,
|
||||
EXECUTION_STATE: () => EXECUTION_STATE,
|
||||
RUN_FLAGS: () => RUN_FLAGS,
|
||||
VARIABLE_FLAGS: () => VARIABLE_FLAGS
|
||||
});
|
||||
module.exports = __toCommonJS(types_gui_exports);
|
||||
var RUN_FLAGS = /* @__PURE__ */ ((RUN_FLAGS2) => {
|
||||
RUN_FLAGS2[RUN_FLAGS2["CHILDREN"] = 32] = "CHILDREN";
|
||||
RUN_FLAGS2[RUN_FLAGS2["WAIT"] = 32768] = "WAIT";
|
||||
return RUN_FLAGS2;
|
||||
})(RUN_FLAGS || {});
|
||||
;
|
||||
var EXECUTION_STATE = /* @__PURE__ */ ((EXECUTION_STATE2) => {
|
||||
EXECUTION_STATE2[EXECUTION_STATE2["NONE"] = 0] = "NONE";
|
||||
EXECUTION_STATE2[EXECUTION_STATE2["RUNNING"] = 1] = "RUNNING";
|
||||
EXECUTION_STATE2[EXECUTION_STATE2["ERROR"] = 2] = "ERROR";
|
||||
EXECUTION_STATE2[EXECUTION_STATE2["PAUSED"] = 4] = "PAUSED";
|
||||
EXECUTION_STATE2[EXECUTION_STATE2["FINISH"] = 8] = "FINISH";
|
||||
EXECUTION_STATE2[EXECUTION_STATE2["STOPPED"] = 16] = "STOPPED";
|
||||
EXECUTION_STATE2[EXECUTION_STATE2["ONCE"] = 2147483648] = "ONCE";
|
||||
EXECUTION_STATE2[EXECUTION_STATE2["RESET_NEXT_FRAME"] = 8388608] = "RESET_NEXT_FRAME";
|
||||
EXECUTION_STATE2[EXECUTION_STATE2["LOCKED"] = 536870912] = "LOCKED";
|
||||
return EXECUTION_STATE2;
|
||||
})(EXECUTION_STATE || {});
|
||||
var BLOCK_MODE = /* @__PURE__ */ ((BLOCK_MODE2) => {
|
||||
BLOCK_MODE2[BLOCK_MODE2["NORMAL"] = 0] = "NORMAL";
|
||||
BLOCK_MODE2[BLOCK_MODE2["UPDATE_WIDGET_PROPERTY"] = 1] = "UPDATE_WIDGET_PROPERTY";
|
||||
return BLOCK_MODE2;
|
||||
})(BLOCK_MODE || {});
|
||||
;
|
||||
var BLOCK_OUTLET = /* @__PURE__ */ ((BLOCK_OUTLET2) => {
|
||||
BLOCK_OUTLET2[BLOCK_OUTLET2["NONE"] = 0] = "NONE";
|
||||
BLOCK_OUTLET2[BLOCK_OUTLET2["PROGRESS"] = 1] = "PROGRESS";
|
||||
BLOCK_OUTLET2[BLOCK_OUTLET2["ERROR"] = 2] = "ERROR";
|
||||
BLOCK_OUTLET2[BLOCK_OUTLET2["PAUSED"] = 4] = "PAUSED";
|
||||
BLOCK_OUTLET2[BLOCK_OUTLET2["FINISH"] = 8] = "FINISH";
|
||||
BLOCK_OUTLET2[BLOCK_OUTLET2["STOPPED"] = 16] = "STOPPED";
|
||||
return BLOCK_OUTLET2;
|
||||
})(BLOCK_OUTLET || {});
|
||||
;
|
||||
var EVENTS = /* @__PURE__ */ ((EVENTS2) => {
|
||||
EVENTS2["ON_RUN_BLOCK"] = "onRunBlock";
|
||||
EVENTS2["ON_RUN_BLOCK_FAILED"] = "onRunBlockFailed";
|
||||
EVENTS2["ON_RUN_BLOCK_SUCCESS"] = "onRunBlockSuccess";
|
||||
EVENTS2["ON_BLOCK_SELECTED"] = "onItemSelected";
|
||||
EVENTS2["ON_BLOCK_UNSELECTED"] = "onBlockUnSelected";
|
||||
EVENTS2["ON_BLOCK_EXPRESSION_FAILED"] = "onExpressionFailed";
|
||||
EVENTS2["ON_BUILD_BLOCK_INFO_LIST"] = "onBuildBlockInfoList";
|
||||
EVENTS2["ON_BUILD_BLOCK_INFO_LIST_END"] = "onBuildBlockInfoListEnd";
|
||||
EVENTS2["ON_BLOCK_PROPERTY_CHANGED"] = "onBlockPropertyChanged";
|
||||
EVENTS2["ON_SCOPE_CREATED"] = "onScopeCreated";
|
||||
EVENTS2["ON_VARIABLE_CHANGED"] = "onVariableChanged";
|
||||
EVENTS2["ON_CREATE_VARIABLE_CI"] = "onCreateVariableCI";
|
||||
return EVENTS2;
|
||||
})(EVENTS || {});
|
||||
var BlockType = /* @__PURE__ */ ((BlockType2) => {
|
||||
BlockType2["AssignmentExpression"] = "AssignmentExpression";
|
||||
BlockType2["ArrayExpression"] = "ArrayExpression";
|
||||
BlockType2["BlockStatement"] = "BlockStatement";
|
||||
BlockType2["BinaryExpression"] = "BinaryExpression";
|
||||
BlockType2["BreakStatement"] = "BreakStatement";
|
||||
BlockType2["CallExpression"] = "CallExpression";
|
||||
BlockType2["CatchClause"] = "CatchClause";
|
||||
BlockType2["ConditionalExpression"] = "ConditionalExpression";
|
||||
BlockType2["ContinueStatement"] = "ContinueStatement";
|
||||
BlockType2["DoWhileStatement"] = "DoWhileStatement";
|
||||
BlockType2["DebuggerStatement"] = "DebuggerStatement";
|
||||
BlockType2["EmptyStatement"] = "EmptyStatement";
|
||||
BlockType2["ExpressionStatement"] = "ExpressionStatement";
|
||||
BlockType2["ForStatement"] = "ForStatement";
|
||||
BlockType2["ForInStatement"] = "ForInStatement";
|
||||
BlockType2["FunctionDeclaration"] = "FunctionDeclaration";
|
||||
BlockType2["FunctionExpression"] = "FunctionExpression";
|
||||
BlockType2["Identifier"] = "Identifier";
|
||||
BlockType2["IfStatement"] = "IfStatement";
|
||||
BlockType2["Literal"] = "Literal";
|
||||
BlockType2["LabeledStatement"] = "LabeledStatement";
|
||||
BlockType2["LogicalExpression"] = "LogicalExpression";
|
||||
BlockType2["MemberExpression"] = "MemberExpression";
|
||||
BlockType2["NewExpression"] = "NewExpression";
|
||||
BlockType2["ObjectExpression"] = "ObjectExpression";
|
||||
BlockType2["Program"] = "Program";
|
||||
BlockType2["Property"] = "Property";
|
||||
BlockType2["ReturnStatement"] = "ReturnStatement";
|
||||
BlockType2["SequenceExpression"] = "SequenceExpression";
|
||||
BlockType2["SwitchStatement"] = "SwitchStatement";
|
||||
BlockType2["SwitchCase"] = "SwitchCase";
|
||||
BlockType2["ThisExpression"] = "ThisExpression";
|
||||
BlockType2["ThrowStatement"] = "ThrowStatement";
|
||||
BlockType2["TryStatement"] = "TryStatement";
|
||||
BlockType2["UnaryExpression"] = "UnaryExpression";
|
||||
BlockType2["UpdateExpression"] = "UpdateExpression";
|
||||
BlockType2["VariableDeclaration"] = "VariableDeclaration";
|
||||
BlockType2["VariableDeclarator"] = "VariableDeclarator";
|
||||
BlockType2["WhileStatement"] = "WhileStatement";
|
||||
BlockType2["WithStatement"] = "WithStatement";
|
||||
return BlockType2;
|
||||
})(BlockType || {});
|
||||
;
|
||||
var VARIABLE_FLAGS = /* @__PURE__ */ ((VARIABLE_FLAGS2) => {
|
||||
VARIABLE_FLAGS2[VARIABLE_FLAGS2["PUBLISH"] = 2] = "PUBLISH";
|
||||
VARIABLE_FLAGS2[VARIABLE_FLAGS2["PUBLISH_IF_SERVER"] = 4] = "PUBLISH_IF_SERVER";
|
||||
return VARIABLE_FLAGS2;
|
||||
})(VARIABLE_FLAGS || {});
|
||||
;
|
||||
var BLOCK_GROUPS = /* @__PURE__ */ ((BLOCK_GROUPS2) => {
|
||||
BLOCK_GROUPS2["VARIABLE"] = "DriverVariable";
|
||||
BLOCK_GROUPS2["BASIC_COMMAND"] = "DriverBasicCommand";
|
||||
BLOCK_GROUPS2["CONDITIONAL_COMMAND"] = "DriverConditionalCommand";
|
||||
BLOCK_GROUPS2["RESPONSE_VARIABLE"] = "DriverResponseVariable";
|
||||
BLOCK_GROUPS2["RESPONSE_BLOCKS"] = "conditionalProcess";
|
||||
BLOCK_GROUPS2["RESPONSE_VARIABLES"] = "processVariables";
|
||||
BLOCK_GROUPS2["BASIC_VARIABLES"] = "basicVariables";
|
||||
return BLOCK_GROUPS2;
|
||||
})(BLOCK_GROUPS || {});
|
||||
;
|
||||
var COMMAND_TYPES = /* @__PURE__ */ ((COMMAND_TYPES2) => {
|
||||
COMMAND_TYPES2["BASIC_COMMAND"] = "basic";
|
||||
COMMAND_TYPES2["CONDITIONAL_COMMAND"] = "conditional";
|
||||
COMMAND_TYPES2["INIT_COMMAND"] = "init";
|
||||
return COMMAND_TYPES2;
|
||||
})(COMMAND_TYPES || {});
|
||||
;
|
||||
var CIFLAG = /* @__PURE__ */ ((CIFLAG2) => {
|
||||
CIFLAG2[CIFLAG2["NONE"] = 0] = "NONE";
|
||||
CIFLAG2[CIFLAG2["BASE_64"] = 1] = "BASE_64";
|
||||
CIFLAG2[CIFLAG2["USE_FUNCTION"] = 2] = "USE_FUNCTION";
|
||||
CIFLAG2[CIFLAG2["REPLACE_VARIABLES"] = 4] = "REPLACE_VARIABLES";
|
||||
CIFLAG2[CIFLAG2["REPLACE_VARIABLES_EVALUATED"] = 8] = "REPLACE_VARIABLES_EVALUATED";
|
||||
CIFLAG2[CIFLAG2["ESCAPE"] = 16] = "ESCAPE";
|
||||
CIFLAG2[CIFLAG2["REPLACE_BLOCK_CALLS"] = 32] = "REPLACE_BLOCK_CALLS";
|
||||
CIFLAG2[CIFLAG2["REMOVE_DELIMTTERS"] = 64] = "REMOVE_DELIMTTERS";
|
||||
CIFLAG2[CIFLAG2["ESCAPE_SPECIAL_CHARS"] = 128] = "ESCAPE_SPECIAL_CHARS";
|
||||
CIFLAG2[CIFLAG2["USE_REGEX"] = 256] = "USE_REGEX";
|
||||
CIFLAG2[CIFLAG2["USE_FILTREX"] = 512] = "USE_FILTREX";
|
||||
CIFLAG2[CIFLAG2["CASCADE"] = 1024] = "CASCADE";
|
||||
CIFLAG2[CIFLAG2["EXPRESSION"] = 2048] = "EXPRESSION";
|
||||
CIFLAG2[CIFLAG2["DONT_PARSE"] = 4096] = "DONT_PARSE";
|
||||
CIFLAG2[CIFLAG2["TO_HEX"] = 8192] = "TO_HEX";
|
||||
CIFLAG2[CIFLAG2["REPLACE_HEX"] = 16384] = "REPLACE_HEX";
|
||||
CIFLAG2[CIFLAG2["WAIT"] = 32768] = "WAIT";
|
||||
CIFLAG2[CIFLAG2["DONT_ESCAPE"] = 65536] = "DONT_ESCAPE";
|
||||
CIFLAG2[CIFLAG2["END"] = 131072] = "END";
|
||||
return CIFLAG2;
|
||||
})(CIFLAG || {});
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
BLOCK_GROUPS,
|
||||
BLOCK_MODE,
|
||||
BLOCK_OUTLET,
|
||||
BlockType,
|
||||
CIFLAG,
|
||||
COMMAND_TYPES,
|
||||
EVENTS,
|
||||
EXECUTION_STATE,
|
||||
RUN_FLAGS,
|
||||
VARIABLE_FLAGS
|
||||
});
|
||||
//# sourceMappingURL=types_gui.cjs.map
|
||||
1
packages/commons/dist/types_gui.cjs.map
vendored
Normal file
1
packages/commons/dist/types_gui.cjs.map
vendored
Normal file
File diff suppressed because one or more lines are too long
298
packages/commons/dist/types_gui.d.cts
vendored
Normal file
298
packages/commons/dist/types_gui.d.cts
vendored
Normal file
@ -0,0 +1,298 @@
|
||||
/**
|
||||
* Flags to describe a block's execution behavior.
|
||||
*
|
||||
* @enum {integer} module=xide/types/RUN_FLAGS
|
||||
* @memberOf module=xide/types
|
||||
*/
|
||||
declare enum RUN_FLAGS {
|
||||
/**
|
||||
* The block can execute child blocks.
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
CHILDREN = 32,
|
||||
/**
|
||||
* Block is waiting for a message => EXECUTION_STATE==RUNNING
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
WAIT = 32768
|
||||
}
|
||||
/**
|
||||
* Flags to describe a block's execution state.
|
||||
*
|
||||
* @enum {integer} module=xide/types/EXECUTION_STATE
|
||||
* @memberOf module=xide/types
|
||||
*/
|
||||
declare enum EXECUTION_STATE {
|
||||
/**
|
||||
* The block is doing nothing and also has done nothing. The is the default state
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
NONE = 0,
|
||||
/**
|
||||
* The block is running.
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
RUNNING = 1,
|
||||
/**
|
||||
* The block is an error state.
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
ERROR = 2,
|
||||
/**
|
||||
* The block is in an paused state.
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
PAUSED = 4,
|
||||
/**
|
||||
* The block is an finished state, ready to be cleared to "NONE" at the next frame.
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
FINISH = 8,
|
||||
/**
|
||||
* The block is an stopped state, ready to be cleared to "NONE" at the next frame.
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
STOPPED = 16,
|
||||
/**
|
||||
* The block has been launched once...
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
ONCE = 2147483648,
|
||||
/**
|
||||
* Block will be reseted next frame
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
RESET_NEXT_FRAME = 8388608,
|
||||
/**
|
||||
* Block is locked and so no further inputs can be activated.
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
LOCKED = 536870912
|
||||
}
|
||||
declare enum BLOCK_MODE {
|
||||
NORMAL = 0,
|
||||
UPDATE_WIDGET_PROPERTY = 1
|
||||
}
|
||||
/**
|
||||
* Flags to describe a block's belonging to a standard signal.
|
||||
* @enum {integer} module=xblox/types/BLOCK_OUTLET
|
||||
* @memberOf module=xblox/types
|
||||
*/
|
||||
declare enum BLOCK_OUTLET {
|
||||
NONE = 0,
|
||||
PROGRESS = 1,
|
||||
ERROR = 2,
|
||||
PAUSED = 4,
|
||||
FINISH = 8,
|
||||
STOPPED = 16
|
||||
}
|
||||
declare enum EVENTS {
|
||||
ON_RUN_BLOCK = "onRunBlock",
|
||||
ON_RUN_BLOCK_FAILED = "onRunBlockFailed",
|
||||
ON_RUN_BLOCK_SUCCESS = "onRunBlockSuccess",
|
||||
ON_BLOCK_SELECTED = "onItemSelected",
|
||||
ON_BLOCK_UNSELECTED = "onBlockUnSelected",
|
||||
ON_BLOCK_EXPRESSION_FAILED = "onExpressionFailed",
|
||||
ON_BUILD_BLOCK_INFO_LIST = "onBuildBlockInfoList",
|
||||
ON_BUILD_BLOCK_INFO_LIST_END = "onBuildBlockInfoListEnd",
|
||||
ON_BLOCK_PROPERTY_CHANGED = "onBlockPropertyChanged",
|
||||
ON_SCOPE_CREATED = "onScopeCreated",
|
||||
ON_VARIABLE_CHANGED = "onVariableChanged",
|
||||
ON_CREATE_VARIABLE_CI = "onCreateVariableCI"
|
||||
}
|
||||
declare enum BlockType {
|
||||
AssignmentExpression = "AssignmentExpression",
|
||||
ArrayExpression = "ArrayExpression",
|
||||
BlockStatement = "BlockStatement",
|
||||
BinaryExpression = "BinaryExpression",
|
||||
BreakStatement = "BreakStatement",
|
||||
CallExpression = "CallExpression",
|
||||
CatchClause = "CatchClause",
|
||||
ConditionalExpression = "ConditionalExpression",
|
||||
ContinueStatement = "ContinueStatement",
|
||||
DoWhileStatement = "DoWhileStatement",
|
||||
DebuggerStatement = "DebuggerStatement",
|
||||
EmptyStatement = "EmptyStatement",
|
||||
ExpressionStatement = "ExpressionStatement",
|
||||
ForStatement = "ForStatement",
|
||||
ForInStatement = "ForInStatement",
|
||||
FunctionDeclaration = "FunctionDeclaration",
|
||||
FunctionExpression = "FunctionExpression",
|
||||
Identifier = "Identifier",
|
||||
IfStatement = "IfStatement",
|
||||
Literal = "Literal",
|
||||
LabeledStatement = "LabeledStatement",
|
||||
LogicalExpression = "LogicalExpression",
|
||||
MemberExpression = "MemberExpression",
|
||||
NewExpression = "NewExpression",
|
||||
ObjectExpression = "ObjectExpression",
|
||||
Program = "Program",
|
||||
Property = "Property",
|
||||
ReturnStatement = "ReturnStatement",
|
||||
SequenceExpression = "SequenceExpression",
|
||||
SwitchStatement = "SwitchStatement",
|
||||
SwitchCase = "SwitchCase",
|
||||
ThisExpression = "ThisExpression",
|
||||
ThrowStatement = "ThrowStatement",
|
||||
TryStatement = "TryStatement",
|
||||
UnaryExpression = "UnaryExpression",
|
||||
UpdateExpression = "UpdateExpression",
|
||||
VariableDeclaration = "VariableDeclaration",
|
||||
VariableDeclarator = "VariableDeclarator",
|
||||
WhileStatement = "WhileStatement",
|
||||
WithStatement = "WithStatement"
|
||||
}
|
||||
/**
|
||||
* Variable Flags
|
||||
*
|
||||
* @enum {int} VARIABLE_FLAGS
|
||||
* @global
|
||||
*/
|
||||
declare enum VARIABLE_FLAGS {
|
||||
PUBLISH = 2,
|
||||
PUBLISH_IF_SERVER = 4
|
||||
}
|
||||
declare enum BLOCK_GROUPS {
|
||||
VARIABLE = "DriverVariable",
|
||||
BASIC_COMMAND = "DriverBasicCommand",
|
||||
CONDITIONAL_COMMAND = "DriverConditionalCommand",
|
||||
RESPONSE_VARIABLE = "DriverResponseVariable",
|
||||
RESPONSE_BLOCKS = "conditionalProcess",
|
||||
RESPONSE_VARIABLES = "processVariables",
|
||||
BASIC_VARIABLES = "basicVariables"
|
||||
}
|
||||
declare enum COMMAND_TYPES {
|
||||
BASIC_COMMAND = "basic",
|
||||
CONDITIONAL_COMMAND = "conditional",
|
||||
INIT_COMMAND = "init"
|
||||
}
|
||||
declare enum CIFLAG {
|
||||
/**
|
||||
* Instruct for no additional extra processing
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
NONE = 0,
|
||||
/**
|
||||
* Will instruct the pre/post processor to base-64 decode or encode
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
BASE_64 = 1,
|
||||
/**
|
||||
* Post/Pre process the value with a user function
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
USE_FUNCTION = 2,
|
||||
/**
|
||||
* Replace variables with local scope's variables during the post/pre process
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
REPLACE_VARIABLES = 4,
|
||||
/**
|
||||
* Replace variables with local scope's variables during the post/pre process but evaluate the whole string
|
||||
* as Javascript
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
REPLACE_VARIABLES_EVALUATED = 8,
|
||||
/**
|
||||
* Will instruct the pre/post processor to escpape evaluated or replaced variables or expressions
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
ESCAPE = 16,
|
||||
/**
|
||||
* Will instruct the pre/post processor to replace block calls with oridinary vanilla script
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
REPLACE_BLOCK_CALLS = 32,
|
||||
/**
|
||||
* Will instruct the pre/post processor to remove variable delimitters/placeholders from the final string
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
REMOVE_DELIMTTERS = 64,
|
||||
/**
|
||||
* Will instruct the pre/post processor to remove "[" ,"]" , "(" , ")" , "{", "}" , "*" , "+" , "."
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
ESCAPE_SPECIAL_CHARS = 128,
|
||||
/**
|
||||
* Will instruct the pre/post processor to use regular expressions over string substitution
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
USE_REGEX = 256,
|
||||
/**
|
||||
* Will instruct the pre/post processor to use Filtrex (custom bison parser, needs xexpression) over string substitution
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
USE_FILTREX = 512,
|
||||
/**
|
||||
* Cascade entry. There are cases where #USE_FUNCTION is not enough or we'd like to avoid further type checking.
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
CASCADE = 1024,
|
||||
/**
|
||||
* Cascade entry. There are cases where #USE_FUNCTION is not enough or we'd like to avoid further type checking.
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
EXPRESSION = 2048,
|
||||
/**
|
||||
* Dont parse anything
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
DONT_PARSE = 4096,
|
||||
/**
|
||||
* Convert to hex
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
TO_HEX = 8192,
|
||||
/**
|
||||
* Convert to hex
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
REPLACE_HEX = 16384,
|
||||
/**
|
||||
* Wait for finish
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
WAIT = 32768,
|
||||
/**
|
||||
* Wait for finish
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
DONT_ESCAPE = 65536,
|
||||
/**
|
||||
* Flag to mark the maximum core bit mask, after here its user land
|
||||
* @constant
|
||||
* @type int
|
||||
*/
|
||||
END = 131072
|
||||
}
|
||||
|
||||
export { BLOCK_GROUPS, BLOCK_MODE, BLOCK_OUTLET, BlockType, CIFLAG, COMMAND_TYPES, EVENTS, EXECUTION_STATE, RUN_FLAGS, VARIABLE_FLAGS };
|
||||
16
packages/commons/dist/types_kbot.cjs
vendored
Normal file
16
packages/commons/dist/types_kbot.cjs
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var types_kbot_exports = {};
|
||||
module.exports = __toCommonJS(types_kbot_exports);
|
||||
//# sourceMappingURL=types_kbot.cjs.map
|
||||
1
packages/commons/dist/types_kbot.cjs.map
vendored
Normal file
1
packages/commons/dist/types_kbot.cjs.map
vendored
Normal file
File diff suppressed because one or more lines are too long
194
packages/commons/dist/types_kbot.d.cts
vendored
Normal file
194
packages/commons/dist/types_kbot.d.cts
vendored
Normal file
@ -0,0 +1,194 @@
|
||||
interface IKBotOptions {
|
||||
/** Path to the project directory */
|
||||
path?: string;
|
||||
/** Description of the modifications to make to the project. Supports file paths. */
|
||||
query?: string;
|
||||
/** Optional output path for modified files */
|
||||
output?: string | undefined;
|
||||
/** Optional destination path for the result, will substitute ${MODEL} and ${ROUTER} in the path */
|
||||
dst?: string | undefined;
|
||||
/** Template (typescript) or path to use for processing, see https://git.polymech.io/polymech/ai-template-typescript */
|
||||
template?: (("typescript") | string) | undefined;
|
||||
/** Template root directory. When specified, templates are loaded with a prefix, eg: ${POLYMECH-ROOT}/ai-template-${options.template} */
|
||||
templateRoot?: string;
|
||||
/** List of template parts to disable. Addionally, tools categories can be disabled, eg: --disable=fs,git,interact,terminal,search,web,email,user */
|
||||
disable?: string[];
|
||||
/** List of specific tools to disable */
|
||||
disableTools?: string[];
|
||||
/** Glob patterns to match files for processing, comma separated, eg: src/*.tsx,src/*.ts */
|
||||
glob?: string[] | undefined;
|
||||
/** AI model to use for processing. Available models:
|
||||
[35m[1m[22m[39m
|
||||
[35m[1m OpenRouter models:[22m[39m
|
||||
[35m[1m[22m[39m
|
||||
google/gemini-pro-1.5-exp | paid
|
||||
meta-llama/llama-3.2-11b-vision-instruct:free | free
|
||||
google/gemini-flash-1.5-exp | paid
|
||||
google/gemini-flash-1.5-8b-exp | paid
|
||||
microsoft/phi-3-medium-128k-instruct:free | free
|
||||
microsoft/phi-3-mini-128k-instruct:free | free
|
||||
google/gemini-2.0-flash-thinking-exp:free | free
|
||||
google/gemini-2.0-flash-exp:free | free
|
||||
meta-llama/llama-3.2-1b-instruct | paid
|
||||
meta-llama/llama-3.2-3b-instruct | paid
|
||||
meta-llama/llama-3.1-8b-instruct | paid
|
||||
mistralai/mistral-7b-instruct | paid
|
||||
mistralai/mistral-7b-instruct-v0.3 | paid
|
||||
meta-llama/llama-3-8b-instruct | paid
|
||||
amazon/nova-micro-v1 | paid
|
||||
google/gemini-flash-1.5-8b | paid
|
||||
mistralai/ministral-3b | paid
|
||||
meta-llama/llama-3.2-11b-vision-instruct | paid
|
||||
amazon/nova-lite-v1 | paid
|
||||
google/gemini-flash-1.5 | paid
|
||||
mistralai/ministral-8b | paid
|
||||
microsoft/phi-3-mini-128k-instruct | paid
|
||||
microsoft/phi-3.5-mini-128k-instruct | paid
|
||||
meta-llama/llama-3.1-70b-instruct | paid
|
||||
nvidia/llama-3.1-nemotron-70b-instruct | paid
|
||||
deepseek/deepseek-chat | paid
|
||||
cohere/command-r-08-2024 | paid
|
||||
mistralai/mistral-nemo | paid
|
||||
mistralai/pixtral-12b | paid
|
||||
openai/gpt-4o-mini | paid
|
||||
openai/gpt-4o-mini-2024-07-18 | paid
|
||||
mistralai/mistral-7b-instruct-v0.1 | paid
|
||||
ai21/jamba-1-5-mini | paid
|
||||
mistralai/mistral-small | paid
|
||||
qwen/qwen-2.5-72b-instruct | paid
|
||||
meta-llama/llama-3-70b-instruct | paid
|
||||
mistralai/mixtral-8x7b-instruct | paid
|
||||
mistralai/mistral-tiny | paid
|
||||
mistralai/codestral-mamba | paid
|
||||
anthropic/claude-3-haiku:beta | paid
|
||||
anthropic/claude-3-haiku | paid
|
||||
nousresearch/hermes-3-llama-3.1-70b | paid
|
||||
cohere/command-r-03-2024 | paid
|
||||
cohere/command-r | paid
|
||||
openai/gpt-3.5-turbo-0125 | paid
|
||||
google/gemini-pro | paid
|
||||
openai/gpt-3.5-turbo | paid
|
||||
mistralai/mixtral-8x7b-instruct:nitro | paid
|
||||
meta-llama/llama-3.1-405b-instruct | paid
|
||||
amazon/nova-pro-v1 | paid
|
||||
anthropic/claude-3.5-haiku:beta | paid
|
||||
anthropic/claude-3.5-haiku | paid
|
||||
anthropic/claude-3.5-haiku-20241022:beta | paid
|
||||
anthropic/claude-3.5-haiku-20241022 | paid
|
||||
microsoft/phi-3-medium-128k-instruct | paid
|
||||
openai/gpt-3.5-turbo-1106 | paid
|
||||
openai/gpt-3.5-turbo-0613 | paid
|
||||
meta-llama/llama-3.2-90b-vision-instruct | paid
|
||||
google/gemini-pro-1.5 | paid
|
||||
mistralai/mixtral-8x22b-instruct | paid
|
||||
mistralai/mistral-large | paid
|
||||
mistralai/mistral-large-2407 | paid
|
||||
mistralai/mistral-large-2411 | paid
|
||||
mistralai/pixtral-large-2411 | paid
|
||||
ai21/jamba-1-5-large | paid
|
||||
x-ai/grok-2-1212 | paid
|
||||
cohere/command-r-plus-08-2024 | paid
|
||||
openai/gpt-4o | paid
|
||||
openai/gpt-4o-2024-08-06 | paid
|
||||
openai/gpt-4o-2024-11-20 | paid
|
||||
mistralai/mistral-medium | paid
|
||||
cohere/command-r-plus | paid
|
||||
cohere/command-r-plus-04-2024 | paid
|
||||
openai/gpt-3.5-turbo-16k | paid
|
||||
anthropic/claude-3.5-sonnet:beta | paid
|
||||
anthropic/claude-3.5-sonnet | paid
|
||||
anthropic/claude-3-sonnet:beta | paid
|
||||
anthropic/claude-3-sonnet | paid
|
||||
anthropic/claude-3.5-sonnet-20240620:beta | paid
|
||||
anthropic/claude-3.5-sonnet-20240620 | paid
|
||||
openai/gpt-4o-2024-05-13 | paid
|
||||
x-ai/grok-beta | paid
|
||||
x-ai/grok-vision-beta | paid
|
||||
openai/gpt-4o:extended | paid
|
||||
openai/gpt-4-turbo | paid
|
||||
openai/gpt-4-1106-preview | paid
|
||||
openai/gpt-4-turbo-preview | paid
|
||||
openai/o1 | paid
|
||||
anthropic/claude-3-opus:beta | paid
|
||||
anthropic/claude-3-opus | paid
|
||||
openai/gpt-4 | paid
|
||||
openai/gpt-4-0314 | paid
|
||||
openai/gpt-4-32k-0314 | paid
|
||||
openai/gpt-4-32k | paid
|
||||
[35m[1m[22m[39m
|
||||
[35m[1m OpenAI models:[22m[39m
|
||||
[35m[1m[22m[39m
|
||||
gpt-4o-audio-preview-2024-10-01
|
||||
gpt-4o-realtime-preview
|
||||
gpt-4o-realtime-preview-2024-10-01
|
||||
o1-mini-2024-09-12
|
||||
dall-e-2
|
||||
gpt-4-turbo
|
||||
gpt-4-1106-preview
|
||||
gpt-3.5-turbo
|
||||
gpt-3.5-turbo-0125
|
||||
gpt-3.5-turbo-instruct
|
||||
gpt-4-1106-vision-preview
|
||||
babbage-002
|
||||
davinci-002
|
||||
whisper-1
|
||||
dall-e-3
|
||||
gpt-4o-mini-2024-07-18
|
||||
text-embedding-3-small
|
||||
gpt-4o-mini
|
||||
gpt-3.5-turbo-16k
|
||||
gpt-4-0125-preview
|
||||
gpt-4-turbo-preview
|
||||
omni-moderation-latest
|
||||
gpt-4o-2024-05-13
|
||||
omni-moderation-2024-09-26
|
||||
tts-1-hd-1106
|
||||
chatgpt-4o-latest
|
||||
gpt-4
|
||||
gpt-4-0613
|
||||
o1-mini
|
||||
o1-preview
|
||||
o1-preview-2024-09-12
|
||||
tts-1-hd
|
||||
gpt-4-vision-preview
|
||||
text-embedding-ada-002
|
||||
gpt-3.5-turbo-1106
|
||||
gpt-4o-audio-preview
|
||||
tts-1
|
||||
tts-1-1106
|
||||
gpt-3.5-turbo-instruct-0914
|
||||
text-embedding-3-large
|
||||
gpt-4o-realtime-preview-2024-12-17
|
||||
gpt-4o-mini-realtime-preview
|
||||
gpt-4o-mini-realtime-preview-2024-12-17
|
||||
gpt-4o-2024-11-20
|
||||
gpt-4o-audio-preview-2024-12-17
|
||||
gpt-4o-mini-audio-preview
|
||||
gpt-4o-2024-08-06
|
||||
gpt-4o-mini-audio-preview-2024-12-17
|
||||
gpt-4o
|
||||
gpt-4-turbo-2024-04-09
|
||||
-----
|
||||
*/
|
||||
model?: string;
|
||||
/** Router to use: openai or openrouter */
|
||||
router?: string;
|
||||
/** Chat completion type - completion (without tools) or tools (with function calling) */
|
||||
type?: "completion" | "tools";
|
||||
/** Logging level for the application */
|
||||
logLevel?: unknown;
|
||||
/** Profile for constants */
|
||||
profile?: string;
|
||||
/** Environment (in profile) */
|
||||
env?: string;
|
||||
/** Configuration as JSON string or path to JSON file, eg: {"openrouter":{"key":"your-key"}} or path/to/config.json */
|
||||
config?: string | undefined;
|
||||
/** Write out as script */
|
||||
dump?: string | undefined;
|
||||
/** Path to preferences file */
|
||||
preferences?: string;
|
||||
/** Logging directory */
|
||||
logs?: string;
|
||||
}
|
||||
|
||||
export type { IKBotOptions };
|
||||
59
packages/commons/dist/uri.cjs
vendored
Normal file
59
packages/commons/dist/uri.cjs
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var uri_exports = {};
|
||||
__export(uri_exports, {
|
||||
parseForDownload: () => parseForDownload
|
||||
});
|
||||
module.exports = __toCommonJS(uri_exports);
|
||||
var import_url = require("url");
|
||||
var path = __toESM(require("path"), 1);
|
||||
const filenamify = require("filenamify");
|
||||
const _sanitize = require("sanitize-filename");
|
||||
const sanitize_ex = (f) => {
|
||||
let str = filenamify(_sanitize(f)).replace(/[^\x00-\x7F]/g, "").replace("_", "");
|
||||
return str;
|
||||
};
|
||||
const parseForDownload = (url, dst) => {
|
||||
const parsed = new import_url.URL(url);
|
||||
const parts = path.parse(parsed.pathname);
|
||||
const filename = sanitize_ex(decodeURI(parts.base));
|
||||
const downloadPath = path.resolve(`${dst}/${filename}`);
|
||||
const downloadUrl = parsed.origin + parsed.pathname;
|
||||
return {
|
||||
urlParts: parsed,
|
||||
pathParts: parts,
|
||||
filename,
|
||||
path: downloadPath,
|
||||
url: downloadUrl
|
||||
};
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
parseForDownload
|
||||
});
|
||||
//# sourceMappingURL=uri.cjs.map
|
||||
1
packages/commons/dist/uri.cjs.map
vendored
Normal file
1
packages/commons/dist/uri.cjs.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/uri.ts"],"sourcesContent":["import { URL } from 'url'\r\nimport * as path from 'path'\r\n\r\nconst filenamify = require('filenamify')\r\nconst _sanitize = require(\"sanitize-filename\")\r\n\r\nconst sanitize_ex = (f) => {\r\n let str: string = filenamify(_sanitize(f)).replace(/[^\\x00-\\x7F]/g, \"\").replace('_', '');\r\n return str;\r\n}\r\n\r\nexport interface IDownloadUrl{\r\n urlParts: URL\r\n pathParts: path.ParsedPath\r\n filename: string\r\n path:string\r\n url: string\r\n}\r\n\r\nexport const parseForDownload = (url: string, dst: string) : IDownloadUrl => {\r\n\r\n const parsed = new URL(url);\r\n const parts = path.parse(parsed.pathname)\r\n\r\n const filename = sanitize_ex(decodeURI(parts.base))\r\n const downloadPath = path.resolve(`${dst}/${filename}`)\r\n const downloadUrl = parsed.origin + parsed.pathname\r\n \r\n return {\r\n urlParts:parsed,\r\n pathParts: parts,\r\n filename: filename,\r\n path: downloadPath,\r\n url: downloadUrl\r\n }\r\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAoB;AACpB,WAAsB;AAEtB,MAAM,aAAa,QAAQ,YAAY;AACvC,MAAM,YAAY,QAAQ,mBAAmB;AAE7C,MAAM,cAAc,CAAC,MAAM;AACvB,MAAI,MAAc,WAAW,UAAU,CAAC,CAAC,EAAE,QAAQ,iBAAiB,EAAE,EAAE,QAAQ,KAAK,EAAE;AACvF,SAAO;AACX;AAUO,MAAM,mBAAmB,CAAC,KAAa,QAA+B;AAEzE,QAAM,SAAS,IAAI,eAAI,GAAG;AAC1B,QAAM,QAAQ,KAAK,MAAM,OAAO,QAAQ;AAExC,QAAM,WAAW,YAAY,UAAU,MAAM,IAAI,CAAC;AAClD,QAAM,eAAe,KAAK,QAAQ,GAAG,GAAG,IAAI,QAAQ,EAAE;AACtD,QAAM,cAAc,OAAO,SAAS,OAAO;AAE3C,SAAO;AAAA,IACH,UAAS;AAAA,IACT,WAAW;AAAA,IACX;AAAA,IACA,MAAM;AAAA,IACN,KAAK;AAAA,EACT;AACJ;","names":[]}
|
||||
13
packages/commons/dist/uri.d.cts
vendored
Normal file
13
packages/commons/dist/uri.d.cts
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
import { URL } from 'url';
|
||||
import * as path from 'path';
|
||||
|
||||
interface IDownloadUrl {
|
||||
urlParts: URL;
|
||||
pathParts: path.ParsedPath;
|
||||
filename: string;
|
||||
path: string;
|
||||
url: string;
|
||||
}
|
||||
declare const parseForDownload: (url: string, dst: string) => IDownloadUrl;
|
||||
|
||||
export { type IDownloadUrl, parseForDownload };
|
||||
72
packages/commons/dist/variables.cjs
vendored
Normal file
72
packages/commons/dist/variables.cjs
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var variables_exports = {};
|
||||
__export(variables_exports, {
|
||||
DATE_VARS: () => DATE_VARS,
|
||||
DEFAULT_VARS: () => DEFAULT_VARS,
|
||||
_substitute: () => _substitute,
|
||||
resolve: () => resolve,
|
||||
resolveVariables: () => resolveVariables,
|
||||
substitute: () => substitute
|
||||
});
|
||||
module.exports = __toCommonJS(variables_exports);
|
||||
var import_constants = require("@polymech/core/constants");
|
||||
var import_config = require("./config.js");
|
||||
const DATE_VARS = () => {
|
||||
return {
|
||||
YYYY: new Date(Date.now()).getFullYear(),
|
||||
MM: new Date(Date.now()).getMonth() + 1,
|
||||
DD: new Date(Date.now()).getDate(),
|
||||
HH: new Date(Date.now()).getHours(),
|
||||
SS: new Date(Date.now()).getSeconds()
|
||||
};
|
||||
};
|
||||
const _substitute = (template, map, keep = true, alt = false) => {
|
||||
const transform = (k) => k || "";
|
||||
return template.replace(alt ? import_constants.REGEX_VAR_ALT : import_constants.REGEX_VAR, (match, key, format) => {
|
||||
if (map[key]) {
|
||||
return transform(map[key]).toString();
|
||||
} else if (map[key.replace(/-/g, "_")]) {
|
||||
return transform(map[key.replace(/-/g, "_")]).toString();
|
||||
} else if (keep) {
|
||||
return "${" + key + "}";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
};
|
||||
const substitute = (alt, template, vars = {}, keep = true) => alt ? _substitute(template, vars, keep, alt) : _substitute(template, vars, keep, alt);
|
||||
const DEFAULT_VARS = (vars) => {
|
||||
return {
|
||||
...import_config.DEFAULT_ROOTS,
|
||||
...DATE_VARS(),
|
||||
...vars
|
||||
};
|
||||
};
|
||||
const resolveVariables = (_path, alt = false, vars = {}) => substitute(alt, _path, DEFAULT_VARS(vars));
|
||||
const resolve = (_path, alt = false, vars = {}) => resolveVariables(_path, alt, vars);
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
DATE_VARS,
|
||||
DEFAULT_VARS,
|
||||
_substitute,
|
||||
resolve,
|
||||
resolveVariables,
|
||||
substitute
|
||||
});
|
||||
//# sourceMappingURL=variables.cjs.map
|
||||
1
packages/commons/dist/variables.cjs.map
vendored
Normal file
1
packages/commons/dist/variables.cjs.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/variables.ts"],"sourcesContent":["import { REGEX_VAR, REGEX_VAR_ALT } from \"@polymech/core/constants\"\r\n\r\nimport { DEFAULT_ROOTS } from './config.js'\r\n\r\nexport const DATE_VARS = () => {\r\n return {\r\n YYYY: new Date(Date.now()).getFullYear(),\r\n MM: new Date(Date.now()).getMonth() + 1,\r\n DD: new Date(Date.now()).getDate(),\r\n HH: new Date(Date.now()).getHours(),\r\n SS: new Date(Date.now()).getSeconds()\r\n }\r\n}\r\n\r\nexport const _substitute = (template, map: Record<string, any>, keep: boolean = true, alt: boolean = false) => {\r\n const transform = (k) => k || ''\r\n return template.replace(alt ? REGEX_VAR_ALT : REGEX_VAR, (match, key, format) => {\r\n if (map[key]) {\r\n return transform(map[key]).toString()\r\n } else if (map[key.replace(/-/g, '_')]) {\r\n return transform(map[key.replace(/-/g, '_')]).toString()\r\n } else if (keep) {\r\n return \"${\" + key + \"}\"\r\n } else {\r\n return \"\"\r\n }\r\n })\r\n}\r\nexport const substitute = (alt: boolean, template: string, vars: Record<string, any> = {}, keep: boolean = true) => alt ? _substitute(template, vars, keep, alt) : _substitute(template, vars, keep, alt)\r\nexport const DEFAULT_VARS = (vars: any) => {\r\n return {\r\n ...DEFAULT_ROOTS,\r\n ...DATE_VARS(),\r\n ...vars\r\n }\r\n}\r\nexport const resolveVariables = (_path: string, alt: boolean = false, vars: Record<string, string> = {}) =>\r\n substitute(alt, _path, DEFAULT_VARS(vars))\r\n\r\nexport const resolve = (_path: string, alt: boolean = false, vars: Record<string, string> = {}) =>\r\n resolveVariables(_path, alt, vars)\r\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAyC;AAEzC,oBAA8B;AAEvB,MAAM,YAAY,MAAM;AAC3B,SAAO;AAAA,IACH,MAAM,IAAI,KAAK,KAAK,IAAI,CAAC,EAAE,YAAY;AAAA,IACvC,IAAI,IAAI,KAAK,KAAK,IAAI,CAAC,EAAE,SAAS,IAAI;AAAA,IACtC,IAAI,IAAI,KAAK,KAAK,IAAI,CAAC,EAAE,QAAQ;AAAA,IACjC,IAAI,IAAI,KAAK,KAAK,IAAI,CAAC,EAAE,SAAS;AAAA,IAClC,IAAI,IAAI,KAAK,KAAK,IAAI,CAAC,EAAE,WAAW;AAAA,EACxC;AACJ;AAEO,MAAM,cAAc,CAAC,UAAU,KAA0B,OAAgB,MAAM,MAAe,UAAU;AAC3G,QAAM,YAAY,CAAC,MAAM,KAAK;AAC9B,SAAO,SAAS,QAAQ,MAAM,iCAAgB,4BAAW,CAAC,OAAO,KAAK,WAAW;AAC7E,QAAI,IAAI,GAAG,GAAG;AACV,aAAO,UAAU,IAAI,GAAG,CAAC,EAAE,SAAS;AAAA,IACxC,WAAW,IAAI,IAAI,QAAQ,MAAM,GAAG,CAAC,GAAG;AACpC,aAAO,UAAU,IAAI,IAAI,QAAQ,MAAM,GAAG,CAAC,CAAC,EAAE,SAAS;AAAA,IAC3D,WAAW,MAAM;AACb,aAAO,OAAO,MAAM;AAAA,IACxB,OAAO;AACH,aAAO;AAAA,IACX;AAAA,EACJ,CAAC;AACL;AACO,MAAM,aAAa,CAAC,KAAc,UAAkB,OAA4B,CAAC,GAAG,OAAgB,SAAS,MAAM,YAAY,UAAU,MAAM,MAAM,GAAG,IAAI,YAAY,UAAU,MAAM,MAAM,GAAG;AACjM,MAAM,eAAe,CAAC,SAAc;AACvC,SAAO;AAAA,IACH,GAAG;AAAA,IACH,GAAG,UAAU;AAAA,IACb,GAAG;AAAA,EACP;AACJ;AACO,MAAM,mBAAmB,CAAC,OAAe,MAAe,OAAO,OAA+B,CAAC,MAClG,WAAW,KAAK,OAAO,aAAa,IAAI,CAAC;AAEtC,MAAM,UAAU,CAAC,OAAe,MAAe,OAAO,OAA+B,CAAC,MACzF,iBAAiB,OAAO,KAAK,IAAI;","names":[]}
|
||||
14
packages/commons/dist/variables.d.cts
vendored
Normal file
14
packages/commons/dist/variables.d.cts
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
declare const DATE_VARS: () => {
|
||||
YYYY: number;
|
||||
MM: number;
|
||||
DD: number;
|
||||
HH: number;
|
||||
SS: number;
|
||||
};
|
||||
declare const _substitute: (template: any, map: Record<string, any>, keep?: boolean, alt?: boolean) => any;
|
||||
declare const substitute: (alt: boolean, template: string, vars?: Record<string, any>, keep?: boolean) => any;
|
||||
declare const DEFAULT_VARS: (vars: any) => any;
|
||||
declare const resolveVariables: (_path: string, alt?: boolean, vars?: Record<string, string>) => any;
|
||||
declare const resolve: (_path: string, alt?: boolean, vars?: Record<string, string>) => any;
|
||||
|
||||
export { DATE_VARS, DEFAULT_VARS, _substitute, resolve, resolveVariables, substitute };
|
||||
29
packages/i18n/dist/lib/translate copy.d.ts
vendored
Normal file
29
packages/i18n/dist/lib/translate copy.d.ts
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
import * as TOML from 'smol-toml';
|
||||
import { IOptions } from '../types.js';
|
||||
import * as deepl from './deepl.js';
|
||||
export declare const clean: (text?: string) => string;
|
||||
export declare const hash: (text: string) => string;
|
||||
export declare const translateObjectAIT: (obj: any, src: string, options: IOptions) => Promise<any>;
|
||||
export declare const translateXLS: (src: string, dst: string, options: IOptions) => Promise<any>;
|
||||
export declare const translateDeepL: (text: string, srcLang: string, dstLang: string, dOptions: deepl.IDeepLOptions, options?: IOptions, file?: string) => Promise<any>;
|
||||
export declare const translateObject: (obj: any, src: string, options: IOptions) => Promise<any>;
|
||||
export declare const getTranslation: (translations: any, all?: boolean) => any;
|
||||
export declare const translateMarkup: (src: string, dst: string, options: IOptions) => Promise<any>;
|
||||
export declare const translateJSON: (src: string, dst: string, options: IOptions) => Promise<any>;
|
||||
export declare const translateTOML: (src: string, dst: string, options: IOptions) => Promise<any>;
|
||||
export declare const translateYAML: (src: string, dst: string, options: IOptions) => Promise<string | Record<string, TOML.TomlPrimitive>>;
|
||||
export declare const translateFiles: (file: any, targets: string[], options: IOptions) => Promise<false | any[]>;
|
||||
export declare const translate: (opts: IOptions) => Promise<any[]>;
|
||||
export declare const translateText: (text: string, srcLang: string, dstLang: string, options?: IOptions) => Promise<any>;
|
||||
export declare const storeSet: (storePath: string, text: string, translation: string, file?: string) => void;
|
||||
export declare const storeGet: (storePath: string, text: string, file?: string) => any;
|
||||
export declare const TRANSLATORS: {
|
||||
'.md': (src: string, dst: string, options: IOptions) => Promise<any>;
|
||||
'.html': (src: string, dst: string, options: IOptions) => Promise<any>;
|
||||
'.json': (src: string, dst: string, options: IOptions) => Promise<any>;
|
||||
'.toml': (src: string, dst: string, options: IOptions) => Promise<any>;
|
||||
'.yaml': (src: string, dst: string, options: IOptions) => Promise<string | Record<string, TOML.TomlPrimitive>>;
|
||||
'.xlsx': (src: string, dst: string, options: IOptions) => Promise<any>;
|
||||
'.xls': (src: string, dst: string, options: IOptions) => Promise<any>;
|
||||
};
|
||||
export declare const getTranslator: (file: string) => any;
|
||||
441
packages/i18n/dist/lib/translate copy.js
vendored
Normal file
441
packages/i18n/dist/lib/translate copy.js
vendored
Normal file
File diff suppressed because one or more lines are too long
6
packages/i18n/dist/lib/translate_ex.d.ts
vendored
Normal file
6
packages/i18n/dist/lib/translate_ex.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import { IOptions } from '../types.js';
|
||||
import * as deepl from './deepl.js';
|
||||
export declare const clean: (text?: string) => string;
|
||||
export declare const hash: (text: string) => string;
|
||||
export declare const translateDeepL: (text: string, srcLang: string, dstLang: string, dOptions: deepl.IDeepLOptions, options?: IOptions, file?: string) => Promise<any>;
|
||||
export declare const translateText: (text: string, srcLang: string, dstLang: string, options?: IOptions) => Promise<string>;
|
||||
84
packages/i18n/dist/lib/translate_ex.js
vendored
Normal file
84
packages/i18n/dist/lib/translate_ex.js
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
import { createHash } from 'crypto';
|
||||
import * as deepl from './deepl.js';
|
||||
import { createLogger } from '@polymech/log';
|
||||
let logger = createLogger('i18n');
|
||||
import { update } from './glossary.js';
|
||||
export const clean = (text = "") => text.trim();
|
||||
export const hash = (text) => createHash('md5').update(clean(text)).digest('base64');
|
||||
export const translateDeepL = async (text, srcLang = 'EN', dstLang = 'DE', dOptions, options = {}, file = '') => {
|
||||
const glossary = await update(srcLang.toLowerCase(), dstLang.toLowerCase(), options);
|
||||
const deeplOptions = {
|
||||
preserve_formatting: '1',
|
||||
tag_handling: ["xml"],
|
||||
...dOptions,
|
||||
text: text,
|
||||
target_lang: dstLang,
|
||||
source_lang: srcLang,
|
||||
glossary_id: glossary?.glossaryId,
|
||||
formality: options.formality || 'default',
|
||||
};
|
||||
let ret = await deepl.translate_deepl(deeplOptions);
|
||||
if (!ret) {
|
||||
logger.error('Translate failed : ' + text, file);
|
||||
return false;
|
||||
}
|
||||
ret = ret?.data;
|
||||
if (options.filters) {
|
||||
(ret.translations).forEach((t, i) => {
|
||||
options.filters.forEach((f) => {
|
||||
ret.translations[i].text = f(text, t.text, file);
|
||||
});
|
||||
});
|
||||
}
|
||||
return ret.translations;
|
||||
};
|
||||
export const translateText = async (text, srcLang, dstLang, options = {}) => {
|
||||
/*
|
||||
if (!text || text.length === 0) {
|
||||
return ''
|
||||
}
|
||||
if (srcLang === dstLang) {
|
||||
return text
|
||||
}
|
||||
if (!options.store) {
|
||||
logger.error('No store provided')
|
||||
return text
|
||||
}
|
||||
const store = path.resolve(resolve(options.store, false))
|
||||
if (!exists(store)) {
|
||||
logger.warn(`Invalid store root : ${store}`)
|
||||
}
|
||||
const config: any = CONFIG_DEFAULT()
|
||||
text = clean(text)
|
||||
if (exists(options.store)) {
|
||||
const stored = storeGet(options.store, text)
|
||||
if (stored) {
|
||||
return stored
|
||||
}
|
||||
}
|
||||
if(!options.storeRoot){
|
||||
options.storeRoot = "${OSR_ROOT}/i18n-store"
|
||||
}
|
||||
if(!options.api_key){
|
||||
if(!config || !config.deepl || !config.deepl.auth_key){
|
||||
logger.error('i18n:translateText: No API key provided')
|
||||
return text
|
||||
}
|
||||
options.api_key = config.deepl.auth_key
|
||||
}
|
||||
const out: string[] = await translateDeepL(text, srcLang, dstLang,
|
||||
{
|
||||
...config.deepl
|
||||
}, options, "")
|
||||
|
||||
const translation = getTranslation(out, false)
|
||||
if (translation) {
|
||||
// storeSet(options.store, text, translation)
|
||||
return translation
|
||||
} else {
|
||||
logger.warn('Error translating : ', text)
|
||||
}
|
||||
*/
|
||||
return text;
|
||||
};
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNsYXRlX2V4LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2xpYi90cmFuc2xhdGVfZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLFFBQVEsQ0FBQTtBQVNuQyxPQUFPLEtBQUssS0FBSyxNQUFNLFlBQVksQ0FBQTtBQUVuQyxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sZUFBZSxDQUFBO0FBQzVDLElBQUksTUFBTSxHQUFHLFlBQVksQ0FBQyxNQUFNLENBQUMsQ0FBQTtBQUVqQyxPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0sZUFBZSxDQUFBO0FBRXRDLE1BQU0sQ0FBQyxNQUFNLEtBQUssR0FBRyxDQUFDLE9BQWUsRUFBRSxFQUFFLEVBQUUsQ0FBQyxJQUFJLENBQUMsSUFBSSxFQUFFLENBQUE7QUFDdkQsTUFBTSxDQUFDLE1BQU0sSUFBSSxHQUFHLENBQUMsSUFBWSxFQUFFLEVBQUUsQ0FBQyxVQUFVLENBQUMsS0FBSyxDQUFDLENBQUMsTUFBTSxDQUFDLEtBQUssQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLE1BQU0sQ0FBQyxRQUFRLENBQUMsQ0FBQTtBQUM1RixNQUFNLENBQUMsTUFBTSxjQUFjLEdBQUcsS0FBSyxFQUMvQixJQUFZLEVBQ1osVUFBa0IsSUFBSSxFQUN0QixVQUFrQixJQUFJLEVBQ3RCLFFBQTZCLEVBQzdCLFVBQW9CLEVBQUUsRUFDdEIsT0FBZSxFQUFFLEVBQUUsRUFBRTtJQUNyQixNQUFNLFFBQVEsR0FBRyxNQUFNLE1BQU0sQ0FBQyxPQUFPLENBQUMsV0FBVyxFQUFFLEVBQUUsT0FBTyxDQUFDLFdBQVcsRUFBRSxFQUFFLE9BQU8sQ0FBQyxDQUFBO0lBQ3BGLE1BQU0sWUFBWSxHQUFHO1FBQ2pCLG1CQUFtQixFQUFFLEdBQUc7UUFDeEIsWUFBWSxFQUFFLENBQUMsS0FBSyxDQUFDO1FBQ3JCLEdBQUcsUUFBUTtRQUNYLElBQUksRUFBRSxJQUFJO1FBQ1YsV0FBVyxFQUFFLE9BQStCO1FBQzVDLFdBQVcsRUFBRSxPQUErQjtRQUM1QyxXQUFXLEVBQUUsUUFBUSxFQUFFLFVBQVU7UUFDakMsU0FBUyxFQUFFLE9BQU8sQ0FBQyxTQUFTLElBQUksU0FBUztLQUNyQixDQUFBO0lBRXhCLElBQUksR0FBRyxHQUFRLE1BQU0sS0FBSyxDQUFDLGVBQWUsQ0FBQyxZQUFZLENBQXlCLENBQUE7SUFDaEYsSUFBSSxDQUFDLEdBQUcsRUFBRSxDQUFDO1FBQ1AsTUFBTSxDQUFDLEtBQUssQ0FBQyxxQkFBcUIsR0FBRyxJQUFJLEVBQUUsSUFBSSxDQUFDLENBQUE7UUFDaEQsT0FBTyxLQUFLLENBQUE7SUFDaEIsQ0FBQztJQUNELEdBQUcsR0FBRyxHQUFHLEVBQUUsSUFBSSxDQUFBO0lBQ2YsSUFBSSxPQUFPLENBQUMsT0FBTyxFQUFFLENBQUM7UUFDbEIsQ0FBQyxHQUFHLENBQUMsWUFBWSxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUMsRUFBRSxFQUFFO1lBQy9CLE9BQU8sQ0FBQyxPQUE2QixDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsRUFBRSxFQUFFO2dCQUNqRCxHQUFHLENBQUMsWUFBWSxDQUFDLENBQUMsQ0FBQyxDQUFDLElBQUksR0FBRyxDQUFDLENBQUMsSUFBSSxFQUFFLENBQUMsQ0FBQyxJQUFJLEVBQUUsSUFBSSxDQUFDLENBQUE7WUFDcEQsQ0FBQyxDQUFDLENBQUE7UUFDTixDQUFDLENBQUMsQ0FBQTtJQUNOLENBQUM7SUFDRCxPQUFPLEdBQUcsQ0FBQyxZQUFZLENBQUE7QUFDM0IsQ0FBQyxDQUFBO0FBSUQsTUFBTSxDQUFDLE1BQU0sYUFBYSxHQUFHLEtBQUssRUFBRSxJQUFZLEVBQUUsT0FBZSxFQUFFLE9BQWUsRUFBRSxVQUFvQixFQUFFLEVBQUUsRUFBRTtJQUMxRzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O01BNkNFO0lBQ0YsT0FBTyxJQUFJLENBQUE7QUFDZixDQUFDLENBQUEifQ==
|
||||
105
packages/i18n/src/lib/translate_ex.ts
Normal file
105
packages/i18n/src/lib/translate_ex.ts
Normal file
@ -0,0 +1,105 @@
|
||||
import * as path from 'path'
|
||||
import { createHash } from 'crypto'
|
||||
import { CONFIG_DEFAULT } from '@polymech/commons'
|
||||
|
||||
import { resolve } from '@polymech/commons'
|
||||
import { sync as read } from "@polymech/fs/read"
|
||||
import { sync as write } from "@polymech/fs/write"
|
||||
import { sync as exists } from "@polymech/fs/exists"
|
||||
import { IOptions, TranslateFilter } from '../types.js'
|
||||
import { store, get } from './store.js'
|
||||
import * as deepl from './deepl.js'
|
||||
|
||||
import { createLogger } from '@polymech/log'
|
||||
let logger = createLogger('i18n')
|
||||
|
||||
import { update } from './glossary.js'
|
||||
|
||||
export const clean = (text: string = "") => text.trim()
|
||||
export const hash = (text: string) => createHash('md5').update(clean(text)).digest('base64')
|
||||
export const translateDeepL = async (
|
||||
text: string,
|
||||
srcLang: string = 'EN',
|
||||
dstLang: string = 'DE',
|
||||
dOptions: deepl.IDeepLOptions,
|
||||
options: IOptions = {},
|
||||
file: string = '') => {
|
||||
const glossary = await update(srcLang.toLowerCase(), dstLang.toLowerCase(), options)
|
||||
const deeplOptions = {
|
||||
preserve_formatting: '1',
|
||||
tag_handling: ["xml"],
|
||||
...dOptions,
|
||||
text: text,
|
||||
target_lang: dstLang as deepl.DeepLLanguages,
|
||||
source_lang: srcLang as deepl.DeepLLanguages,
|
||||
glossary_id: glossary?.glossaryId,
|
||||
formality: options.formality || 'default',
|
||||
} as deepl.IDeepLOptions
|
||||
|
||||
let ret: any = await deepl.translate_deepl(deeplOptions) as deepl.IDeepLResponse
|
||||
if (!ret) {
|
||||
logger.error('Translate failed : ' + text, file)
|
||||
return false
|
||||
}
|
||||
ret = ret?.data
|
||||
if (options.filters) {
|
||||
(ret.translations).forEach((t, i) => {
|
||||
(options.filters as TranslateFilter[]).forEach((f) => {
|
||||
ret.translations[i].text = f(text, t.text, file)
|
||||
})
|
||||
})
|
||||
}
|
||||
return ret.translations
|
||||
}
|
||||
|
||||
|
||||
|
||||
export const translateText = async (text: string, srcLang: string, dstLang: string, options: IOptions = {}) => {
|
||||
/*
|
||||
if (!text || text.length === 0) {
|
||||
return ''
|
||||
}
|
||||
if (srcLang === dstLang) {
|
||||
return text
|
||||
}
|
||||
if (!options.store) {
|
||||
logger.error('No store provided')
|
||||
return text
|
||||
}
|
||||
const store = path.resolve(resolve(options.store, false))
|
||||
if (!exists(store)) {
|
||||
logger.warn(`Invalid store root : ${store}`)
|
||||
}
|
||||
const config: any = CONFIG_DEFAULT()
|
||||
text = clean(text)
|
||||
if (exists(options.store)) {
|
||||
const stored = storeGet(options.store, text)
|
||||
if (stored) {
|
||||
return stored
|
||||
}
|
||||
}
|
||||
if(!options.storeRoot){
|
||||
options.storeRoot = "${OSR_ROOT}/i18n-store"
|
||||
}
|
||||
if(!options.api_key){
|
||||
if(!config || !config.deepl || !config.deepl.auth_key){
|
||||
logger.error('i18n:translateText: No API key provided')
|
||||
return text
|
||||
}
|
||||
options.api_key = config.deepl.auth_key
|
||||
}
|
||||
const out: string[] = await translateDeepL(text, srcLang, dstLang,
|
||||
{
|
||||
...config.deepl
|
||||
}, options, "")
|
||||
|
||||
const translation = getTranslation(out, false)
|
||||
if (translation) {
|
||||
// storeSet(options.store, text, translation)
|
||||
return translation
|
||||
} else {
|
||||
logger.warn('Error translating : ', text)
|
||||
}
|
||||
*/
|
||||
return text
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user