mobiletto-orm-typedef-gen 2.1.20 → 2.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/generate.d.ts
CHANGED
|
@@ -12,5 +12,6 @@ export type GenerateOptions = {
|
|
|
12
12
|
name?: string;
|
|
13
13
|
disclaimer?: string;
|
|
14
14
|
prepareContext?: (typeDef: MobilettoOrmTypeDef, ctx: Record<string, unknown>) => Record<string, unknown>;
|
|
15
|
+
mobilettoOrmObjectPackage?: string;
|
|
15
16
|
};
|
|
16
17
|
export declare const generate: (typeDef: MobilettoOrmTypeDef | MobilettoOrmTypeDefConfig, templatePath: string, opts?: GenerateOptions) => string;
|
package/lib/cjs/generate.js
CHANGED
|
@@ -108,6 +108,7 @@ export const generate = (typeDef, templatePath, opts) => {
|
|
|
108
108
|
typeDef = new MobilettoOrmTypeDef(typeDef);
|
|
109
109
|
}
|
|
110
110
|
const typescript = !opts || opts.typescript !== false;
|
|
111
|
+
const mobilettoOrmObjectPackage = (opts === null || opts === void 0 ? void 0 : opts.mobilettoOrmObjectPackage) || "mobiletto-orm-typedef";
|
|
111
112
|
const disclaimer = (opts === null || opts === void 0 ? void 0 : opts.disclaimer) ? opts.disclaimer : STANDARD_AUTOGEN_FILE_DISCLAIMER;
|
|
112
113
|
const name = (opts === null || opts === void 0 ? void 0 : opts.name) ? opts.name : typeDef.typeName;
|
|
113
114
|
const decls = [...findDecls(name, typeDef.fields), { name, fields: typeDef.fields, root: true }];
|
|
@@ -128,6 +129,7 @@ export const generate = (typeDef, templatePath, opts) => {
|
|
|
128
129
|
first,
|
|
129
130
|
root: decl.root || false,
|
|
130
131
|
typescript,
|
|
132
|
+
mobilettoOrmObjectPackage,
|
|
131
133
|
});
|
|
132
134
|
const preparedContext = (opts === null || opts === void 0 ? void 0 : opts.prepareContext) ? opts.prepareContext(typeDef, typeContext) : typeContext;
|
|
133
135
|
first = false;
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
{{#if disclaimer}}// {{{ disclaimer }}}{{#if header}}
|
|
2
2
|
{{{header}}}{{/if}}
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
version: string;
|
|
7
|
-
removed?: boolean;
|
|
8
|
-
ctime: number;
|
|
9
|
-
mtime: number;
|
|
10
|
-
};
|
|
11
|
-
{{else}}{
|
|
12
|
-
{{/if}}{{#each fields}} {{name}}{{#if optional}}?{{/if}}: {{#if typeIsObject}}{{ ../Name }}_{{name}}Type{{else if typeIsArray}}{{valueType}}[]{{else}}{{type}}{{/if}};
|
|
3
|
+
import { MobilettoOrmObject } from "{{mobilettoOrmObjectPackage}}";
|
|
4
|
+
{{/if}}export type {{ Name }}Type{{#if root}} extends MobilettoOrmObject{{/if}} = {
|
|
5
|
+
{{#each fields}} {{name}}{{#if optional}}?{{/if}}: {{#if typeIsObject}}{{ ../Name }}_{{name}}Type{{else if typeIsArray}}{{valueType}}[]{{else}}{{type}}{{/if}};
|
|
13
6
|
{{/each}}
|
|
14
7
|
};
|
package/lib/esm/generate.d.ts
CHANGED
|
@@ -12,5 +12,6 @@ export type GenerateOptions = {
|
|
|
12
12
|
name?: string;
|
|
13
13
|
disclaimer?: string;
|
|
14
14
|
prepareContext?: (typeDef: MobilettoOrmTypeDef, ctx: Record<string, unknown>) => Record<string, unknown>;
|
|
15
|
+
mobilettoOrmObjectPackage?: string;
|
|
15
16
|
};
|
|
16
17
|
export declare const generate: (typeDef: MobilettoOrmTypeDef | MobilettoOrmTypeDefConfig, templatePath: string, opts?: GenerateOptions) => string;
|
package/lib/esm/generate.js
CHANGED
|
@@ -108,6 +108,7 @@ export const generate = (typeDef, templatePath, opts) => {
|
|
|
108
108
|
typeDef = new MobilettoOrmTypeDef(typeDef);
|
|
109
109
|
}
|
|
110
110
|
const typescript = !opts || opts.typescript !== false;
|
|
111
|
+
const mobilettoOrmObjectPackage = (opts === null || opts === void 0 ? void 0 : opts.mobilettoOrmObjectPackage) || "mobiletto-orm-typedef";
|
|
111
112
|
const disclaimer = (opts === null || opts === void 0 ? void 0 : opts.disclaimer) ? opts.disclaimer : STANDARD_AUTOGEN_FILE_DISCLAIMER;
|
|
112
113
|
const name = (opts === null || opts === void 0 ? void 0 : opts.name) ? opts.name : typeDef.typeName;
|
|
113
114
|
const decls = [...findDecls(name, typeDef.fields), { name, fields: typeDef.fields, root: true }];
|
|
@@ -128,6 +129,7 @@ export const generate = (typeDef, templatePath, opts) => {
|
|
|
128
129
|
first,
|
|
129
130
|
root: decl.root || false,
|
|
130
131
|
typescript,
|
|
132
|
+
mobilettoOrmObjectPackage,
|
|
131
133
|
});
|
|
132
134
|
const preparedContext = (opts === null || opts === void 0 ? void 0 : opts.prepareContext) ? opts.prepareContext(typeDef, typeContext) : typeContext;
|
|
133
135
|
first = false;
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
{{#if disclaimer}}// {{{ disclaimer }}}{{#if header}}
|
|
2
2
|
{{{header}}}{{/if}}
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
version: string;
|
|
7
|
-
removed?: boolean;
|
|
8
|
-
ctime: number;
|
|
9
|
-
mtime: number;
|
|
10
|
-
};
|
|
11
|
-
{{else}}{
|
|
12
|
-
{{/if}}{{#each fields}} {{name}}{{#if optional}}?{{/if}}: {{#if typeIsObject}}{{ ../Name }}_{{name}}Type{{else if typeIsArray}}{{valueType}}[]{{else}}{{type}}{{/if}};
|
|
3
|
+
import { MobilettoOrmObject } from "{{mobilettoOrmObjectPackage}}";
|
|
4
|
+
{{/if}}export type {{ Name }}Type{{#if root}} extends MobilettoOrmObject{{/if}} = {
|
|
5
|
+
{{#each fields}} {{name}}{{#if optional}}?{{/if}}: {{#if typeIsObject}}{{ ../Name }}_{{name}}Type{{else if typeIsArray}}{{valueType}}[]{{else}}{{type}}{{/if}};
|
|
13
6
|
{{/each}}
|
|
14
7
|
};
|