@samet-it/be-couchbase-common 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/LICENSE +24 -0
  2. package/README.md +90 -0
  3. package/dist/adapter/cb-adapter.module.d.ts +2 -0
  4. package/dist/adapter/cb-adapter.module.js +23 -0
  5. package/dist/adapter/cb-adapter.service.d.ts +70 -0
  6. package/dist/adapter/cb-adapter.service.js +447 -0
  7. package/dist/adapter/index.d.ts +3 -0
  8. package/dist/adapter/index.js +19 -0
  9. package/dist/adapter/index.types.d.ts +163 -0
  10. package/dist/adapter/index.types.js +2 -0
  11. package/dist/assets/.gitkeep +0 -0
  12. package/dist/assets/source.MD +1 -0
  13. package/dist/config/couchbase-common.config.d.ts +2 -0
  14. package/dist/config/couchbase-common.config.js +13 -0
  15. package/dist/config/index.d.ts +2 -0
  16. package/dist/config/index.js +18 -0
  17. package/dist/config/index.types.d.ts +31 -0
  18. package/dist/config/index.types.js +2 -0
  19. package/dist/filter/cb-filter-util.impl.d.ts +2 -0
  20. package/dist/filter/cb-filter-util.impl.js +88 -0
  21. package/dist/filter/index.d.ts +2 -0
  22. package/dist/filter/index.js +18 -0
  23. package/dist/filter/index.types.d.ts +32 -0
  24. package/dist/filter/index.types.js +2 -0
  25. package/dist/index.d.ts +6 -0
  26. package/dist/index.js +25 -0
  27. package/dist/line/cb-line.impl.d.ts +2 -0
  28. package/dist/line/cb-line.impl.js +90 -0
  29. package/dist/line/index.d.ts +2 -0
  30. package/dist/line/index.js +18 -0
  31. package/dist/line/index.types.d.ts +58 -0
  32. package/dist/line/index.types.js +2 -0
  33. package/dist/repo/cb.repo.d.ts +95 -0
  34. package/dist/repo/cb.repo.js +375 -0
  35. package/dist/repo/index.d.ts +2 -0
  36. package/dist/repo/index.js +18 -0
  37. package/dist/repo/index.types.d.ts +144 -0
  38. package/dist/repo/index.types.js +2 -0
  39. package/package.json +75 -0
@@ -0,0 +1,163 @@
1
+ import type { Scope, Cluster, Collection, QueryResult, QueryOptions } from "couchbase";
2
+ import type { IgnoreFieldsByType, ReplaceType } from "@leyyo/common";
3
+ import type { CbRepoDef } from "../repo";
4
+ export interface CbAdapterServiceLike {
5
+ /**
6
+ * Field name
7
+ * */
8
+ field(field: string): string;
9
+ /**
10
+ * Field name
11
+ * */
12
+ f(field: string): string;
13
+ /**
14
+ * Basic value: string
15
+ * */
16
+ string(value: string): string;
17
+ /**
18
+ * Basic value: string
19
+ * */
20
+ s(value: string): string;
21
+ /**
22
+ * Complex value
23
+ * */
24
+ value(value: unknown): string;
25
+ /**
26
+ * Complex value
27
+ * */
28
+ v(value: unknown): string;
29
+ /**
30
+ * Flatten query result to rows
31
+ * */
32
+ flatten<T>(result: QueryResult<T>): Array<T>;
33
+ /**
34
+ * Check rows and discard trashed
35
+ * */
36
+ rows<T>(rows: Array<T>): Array<T>;
37
+ /**
38
+ * Check row and discard trashed
39
+ * */
40
+ row<T>(row: T): T | undefined;
41
+ /**
42
+ * Return first row of rows
43
+ * */
44
+ first<T>(rows: Array<T>): T | undefined;
45
+ /**
46
+ * Check error
47
+ * */
48
+ checkError(err: Error): void;
49
+ /**
50
+ * Check error with operation
51
+ * */
52
+ checkError(op: string, err: Error): void;
53
+ /**
54
+ * Create index for multiple fields
55
+ * */
56
+ createIndex<T = Record<string, unknown>>(coll: Collection, fields: Array<keyof T | string>, name: string): Promise<void>;
57
+ /**
58
+ * Create index for a field
59
+ * */
60
+ createIndex<T = Record<string, unknown>>(coll: Collection, field: keyof T | string, name?: string): Promise<void>;
61
+ /**
62
+ * Create base indices for system fields
63
+ * */
64
+ createBaseIndices(coll: Collection, ...keys: Array<keyof CbEntity>): Promise<void>;
65
+ /**
66
+ * Create primary key
67
+ * */
68
+ createPk(coll: Collection): Promise<void>;
69
+ /**
70
+ * Cast dates
71
+ * */
72
+ castDates<T>(given: ReplaceType<T, Date, string> | T, ...fields: Array<IgnoreFieldsByType<T, Date>>): void;
73
+ /**
74
+ * Cast dates for an array
75
+ * */
76
+ castDatesForList<T>(given: Array<ReplaceType<T, Date, string> | T>, ...fields: Array<IgnoreFieldsByType<T, Date>>): void;
77
+ /**
78
+ * Execute an sql
79
+ * */
80
+ exec<T>(opt: CbExecRec<T>): Promise<T>;
81
+ /**
82
+ * Execute an sql
83
+ * */
84
+ exec2<T>(repo: CbRepoDef, sql: string, opt?: CbExecOpt): Promise<Array<T>>;
85
+ exec2First<T>(repo: CbRepoDef, sql: string, opt?: CbExecOpt): Promise<T | undefined>;
86
+ execExtended<T>(repo: CbRepoDef, sql: string, query: QueryOptions, opt?: CbExecOpt): Promise<Array<T>>;
87
+ execFirstExtended<T>(repo: CbRepoDef, sql: string, query: QueryOptions, opt?: CbExecOpt): Promise<T | undefined>;
88
+ /**
89
+ * Connect to DB
90
+ * */
91
+ connectDb(): Promise<Cluster>;
92
+ }
93
+ export interface CbEntity {
94
+ /**
95
+ * Id
96
+ * */
97
+ id: string;
98
+ /**
99
+ * Created at
100
+ * */
101
+ createdAt: string;
102
+ /**
103
+ * Updated at
104
+ * */
105
+ updatedAt: string;
106
+ /**
107
+ * Urn
108
+ * */
109
+ _urn?: string;
110
+ /**
111
+ * Trash id if it's trashed
112
+ * */
113
+ _trashId?: string;
114
+ }
115
+ export interface CbErrorRec {
116
+ count: number;
117
+ log: boolean;
118
+ known?: boolean;
119
+ }
120
+ type CbIgnoreFields<T, I> = {
121
+ [K in keyof T]: T[K] extends I ? K : never;
122
+ }[keyof T];
123
+ type CbReplaceType<T, O, N> = {
124
+ [P in keyof T]: T[P] extends O ? N : T[P];
125
+ };
126
+ export interface CbExecRec<T> {
127
+ /**
128
+ * Promise function
129
+ * */
130
+ promise: Promise<T>;
131
+ /**
132
+ * Name of SQL
133
+ * */
134
+ name?: string;
135
+ /**
136
+ * Ignored errors
137
+ * */
138
+ ignoredErrors?: Omit<Error, 'message'> | Array<Omit<Error, 'message'>>;
139
+ }
140
+ export interface CbExecMutationOpt {
141
+ /**
142
+ * Name of SQL
143
+ * */
144
+ name?: string;
145
+ /**
146
+ * Ignored errors
147
+ * */
148
+ ignoredErrors?: CbError[];
149
+ }
150
+ export interface CbExecOpt extends CbExecMutationOpt {
151
+ /**
152
+ * Name of SQL
153
+ * */
154
+ printSql?: string;
155
+ }
156
+ export interface CbExecTrashOpt extends CbExecOpt {
157
+ trashId?: string;
158
+ }
159
+ export type CbIgnoreDate<T> = CbReplaceType<T, Date, string>;
160
+ export type CbIgnoreDateKeys<T> = CbIgnoreFields<T, Date>;
161
+ export type CbScopeCollection = [Scope, Collection];
162
+ export type CbError = Omit<Error, 'message'>;
163
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
File without changes
@@ -0,0 +1 @@
1
+ https://medium.com/@ozkersemih/connect-to-couchbase-via-nestjs-2a3087cfef43
@@ -0,0 +1,2 @@
1
+ import type { CouchbaseCommonConf } from "./index.types";
2
+ export declare const couchbaseCommonConfig: import("@leyyo/env").EnvScopeRuntime<CouchbaseCommonConf>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.couchbaseCommonConfig = void 0;
4
+ const env_1 = require("@leyyo/env");
5
+ exports.couchbaseCommonConfig = env_1.envCore.configure
6
+ .scope('CouchbaseCommon')
7
+ .field('CB_HOST').text().required().end
8
+ .field('CB_USER').text().required().end
9
+ .field('CB_PASS').text().required().end
10
+ .field('CB_BUCKET').text().required().end
11
+ .field('CB_SCOPE').text().required().end
12
+ .field('CB_CREATE_INDICES').boolean().def(false).end
13
+ .runtime;
@@ -0,0 +1,2 @@
1
+ export * from './couchbase-common.config';
2
+ export * from './index.types';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./couchbase-common.config"), exports);
18
+ __exportStar(require("./index.types"), exports);
@@ -0,0 +1,31 @@
1
+ import type { EnvBase } from "@leyyo/env";
2
+ export declare namespace NodeJS {
3
+ interface ProcessEnv extends CouchbaseCommonConf {
4
+ }
5
+ }
6
+ export interface CouchbaseCommonConf extends EnvBase {
7
+ /**
8
+ * DB Host
9
+ * */
10
+ readonly CB_HOST: string;
11
+ /**
12
+ * DB User
13
+ * */
14
+ readonly CB_USER: string;
15
+ /**
16
+ * DB Password
17
+ * */
18
+ readonly CB_PASS: string;
19
+ /**
20
+ * Current bucket (database name)
21
+ * */
22
+ readonly CB_BUCKET: string;
23
+ /**
24
+ * Current scope (schema name)
25
+ * */
26
+ readonly CB_SCOPE: string;
27
+ /**
28
+ * Create indices when it's started
29
+ * */
30
+ readonly CB_CREATE_INDICES: boolean;
31
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ import type { CbFilterUtil } from "./index.types";
2
+ export declare const cbFilterUtil: CbFilterUtil;
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cbFilterUtil = void 0;
4
+ const common_1 = require("@leyyo/common");
5
+ class CbFilterUtilImpl {
6
+ _where(opt) {
7
+ const result = opt.whereUsed ? 'AND' : 'WHERE';
8
+ opt.whereUsed = true;
9
+ return result;
10
+ }
11
+ /** @inheritDoc */
12
+ readOne(value, fn) {
13
+ if (!common_1.$is.text(value)) {
14
+ return undefined;
15
+ }
16
+ if (typeof fn === 'function') {
17
+ return fn(value);
18
+ }
19
+ return value;
20
+ }
21
+ /** @inheritDoc */
22
+ readArray(value, fn) {
23
+ if (!common_1.$is.text(value)) {
24
+ return undefined;
25
+ }
26
+ if (typeof fn !== 'function') {
27
+ fn = v => (v === '') ? undefined : v;
28
+ }
29
+ const arr = value.split(',')
30
+ .map(v => fn(v.trim()))
31
+ .filter(v => v !== undefined);
32
+ return arr.length > 0 ? arr : undefined;
33
+ }
34
+ /** @inheritDoc */
35
+ readBetween(value, fn) {
36
+ if (!common_1.$is.text(value)) {
37
+ return undefined;
38
+ }
39
+ if (typeof fn !== 'function') {
40
+ fn = v => (v === '') ? undefined : v;
41
+ }
42
+ const arr = value.split(',')
43
+ .map(v => fn(v.trim()));
44
+ let min = fn(arr[0]);
45
+ let max = fn(arr[1]);
46
+ if (min === undefined && max === undefined) {
47
+ return undefined;
48
+ }
49
+ return [min, max];
50
+ }
51
+ /** @inheritDoc */
52
+ sqlArrays(opt, field, items) {
53
+ if (Array.isArray(items) && items.length > 0) {
54
+ items = items.map(v => (v instanceof Date) ? v.toISOString() : v);
55
+ if (items.length === 1) {
56
+ return `${this._where(opt)} ${field} = "${items[0]}"`;
57
+ }
58
+ else {
59
+ return `${this._where(opt)} ${field} IN [${items.map(c => `"${c}"`).join(',')}]`;
60
+ }
61
+ }
62
+ }
63
+ /** @inheritDoc */
64
+ sqlBool(opt, field, value) {
65
+ if (typeof value === 'boolean') {
66
+ return `${this._where(opt)} ${field} = ${value ? 'true' : 'false'}`;
67
+ }
68
+ return undefined;
69
+ }
70
+ /** @inheritDoc */
71
+ sqlBetween(opt, field, value) {
72
+ if (Array.isArray(value) && value.length === 2) {
73
+ const [first, last] = value.map(v => (v instanceof Date) ? v.toISOString() : v);
74
+ if (first !== undefined && last !== undefined) {
75
+ return `${this._where(opt)} ${field} BETWEEN "${first}" AND "${last}"`;
76
+ }
77
+ else if (first !== undefined && last === undefined) {
78
+ return `${this._where(opt)} ${field} >= "${first}"`;
79
+ }
80
+ else if (first === undefined && last !== undefined) {
81
+ return `${this._where(opt)} ${field} <= "${last}"`;
82
+ }
83
+ }
84
+ return undefined;
85
+ }
86
+ }
87
+ // noinspection JSUnusedGlobalSymbols
88
+ exports.cbFilterUtil = new CbFilterUtilImpl();
@@ -0,0 +1,2 @@
1
+ export * from './index.types';
2
+ export * from './cb-filter-util.impl';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./index.types"), exports);
18
+ __exportStar(require("./cb-filter-util.impl"), exports);
@@ -0,0 +1,32 @@
1
+ import type { CbLine } from "../line";
2
+ export type FilterCastLambda<T> = (v: unknown) => T;
3
+ export interface CbFilterUtil {
4
+ /**
5
+ * Read one query parameter
6
+ * */
7
+ readOne<T = string>(value: unknown, fn?: FilterCastLambda<T>): T | undefined;
8
+ /**
9
+ * Read an array query parameter
10
+ * */
11
+ readArray<T = string>(value: unknown, fn?: FilterCastLambda<T>): Array<T> | undefined;
12
+ /**
13
+ * Read range query parameter
14
+ * */
15
+ readBetween<T = string>(value: unknown, fn?: FilterCastLambda<T>): [T | undefined, T | undefined] | undefined;
16
+ /**
17
+ * Builds a sql for array
18
+ * */
19
+ sqlArrays(opt: CbFilterUtilWhereOpt, field: string, items: Array<string>): string | undefined;
20
+ /**
21
+ * Builds a sql for boolean
22
+ * */
23
+ sqlBool(opt: CbFilterUtilWhereOpt, field: string, value: boolean | undefined): string | undefined;
24
+ /**
25
+ * Builds a sql for between
26
+ * */
27
+ sqlBetween(opt: CbFilterUtilWhereOpt, field: string, value: [unknown, unknown]): string | undefined;
28
+ }
29
+ export interface CbFilterUtilWhereOpt {
30
+ lines: CbLine;
31
+ whereUsed: boolean;
32
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ export * from './adapter';
2
+ export * from './config';
3
+ export * from './filter';
4
+ export * from './line';
5
+ export * from './repo';
6
+ export { QueryResult as CbResult } from 'couchbase';
package/dist/index.js ADDED
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.CbResult = void 0;
18
+ __exportStar(require("./adapter"), exports);
19
+ __exportStar(require("./config"), exports);
20
+ __exportStar(require("./filter"), exports);
21
+ __exportStar(require("./line"), exports);
22
+ __exportStar(require("./repo"), exports);
23
+ // noinspection JSUnusedGlobalSymbols
24
+ var couchbase_1 = require("couchbase");
25
+ Object.defineProperty(exports, "CbResult", { enumerable: true, get: function () { return couchbase_1.QueryResult; } });
@@ -0,0 +1,2 @@
1
+ import type { CbLine } from "./index.types";
2
+ export declare const cbLine: () => CbLine;
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ // ~~console.log(__filename);
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.cbLine = void 0;
5
+ class CbLineImpl {
6
+ constructor() {
7
+ this._lines = [];
8
+ }
9
+ /**
10
+ * Add line for normal, marked, or optional with padding or without padding
11
+ * */
12
+ _add(mark, parts, optional) {
13
+ if (parts.length < 1) {
14
+ return this;
15
+ }
16
+ let filledParts = parts.filter(p => p !== undefined);
17
+ if (optional) {
18
+ filledParts = filledParts.map((p) => p.trim()).filter(p => p !== '');
19
+ }
20
+ this._lines.push({ mark, content: filledParts.join(' ') });
21
+ return this;
22
+ }
23
+ /** @inheritDoc */
24
+ marked(mark, ...parts) {
25
+ if (typeof mark !== 'string') {
26
+ return this._add(undefined, parts, false);
27
+ }
28
+ return this._add(mark, parts, false);
29
+ }
30
+ /** @inheritDoc */
31
+ add(...parts) {
32
+ return this._add(undefined, parts, false);
33
+ }
34
+ /** @inheritDoc */
35
+ optional(...parts) {
36
+ return this._add(undefined, parts, true);
37
+ }
38
+ /** @inheritDoc */
39
+ remove(mark) {
40
+ if (typeof mark !== 'string') {
41
+ return false;
42
+ }
43
+ const index = this._lines.findIndex(line => line.mark === mark);
44
+ if (index < 0) {
45
+ return false;
46
+ }
47
+ this._lines.splice(index, 1);
48
+ return true;
49
+ }
50
+ /** @inheritDoc */
51
+ replace(mark, line) {
52
+ if (typeof mark !== 'string') {
53
+ return false;
54
+ }
55
+ const index = this._lines.findIndex(line => line.mark === mark);
56
+ if (index < 0) {
57
+ return false;
58
+ }
59
+ if (typeof line !== 'string') {
60
+ line = '';
61
+ }
62
+ this._lines[index] = { mark, content: line };
63
+ return true;
64
+ }
65
+ /** @inheritDoc */
66
+ clear() {
67
+ this._lines.splice(0, this._lines.length);
68
+ return this;
69
+ }
70
+ /** @inheritDoc */
71
+ end() {
72
+ return this.lines.join('\n');
73
+ }
74
+ /** @inheritDoc */
75
+ get lines() {
76
+ return this._lines.map(line => line.content);
77
+ }
78
+ /** @inheritDoc */
79
+ get size() {
80
+ return this._lines.length;
81
+ }
82
+ /** @inheritDoc */
83
+ toString() {
84
+ return this.end();
85
+ }
86
+ }
87
+ const cbLine = () => {
88
+ return new CbLineImpl();
89
+ };
90
+ exports.cbLine = cbLine;
@@ -0,0 +1,2 @@
1
+ export * from './index.types';
2
+ export * from './cb-line.impl';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./index.types"), exports);
18
+ __exportStar(require("./cb-line.impl"), exports);
@@ -0,0 +1,58 @@
1
+ export interface CbLineItem {
2
+ mark?: string;
3
+ content: string;
4
+ }
5
+ export interface CbLine {
6
+ /**
7
+ * Add marked line with padding
8
+ */
9
+ marked(mark: string, padding: number, ...parts: Array<string>): CbLine;
10
+ /**
11
+ * Add marked line
12
+ */
13
+ marked(mark: string, ...parts: Array<string>): CbLine;
14
+ /**
15
+ * Add line with padding
16
+ */
17
+ add(padding: number, ...parts: Array<string>): CbLine;
18
+ /**
19
+ * Add line with padding
20
+ */
21
+ add(...parts: Array<string>): CbLine;
22
+ /**
23
+ * Add optional line with padding
24
+ */
25
+ optional(padding: number, ...parts: Array<string>): CbLine;
26
+ /**
27
+ * Add optional line
28
+ */
29
+ optional(...parts: Array<string>): CbLine;
30
+ /**
31
+ * Clear all lines
32
+ */
33
+ clear(): CbLine;
34
+ /**
35
+ * Add marked line
36
+ */
37
+ remove(mark: string): boolean;
38
+ /**
39
+ * Replace marked line
40
+ */
41
+ replace(mark: string, line: string): boolean;
42
+ /**
43
+ * Builds an string from lines
44
+ */
45
+ end(): string;
46
+ /**
47
+ * Return all lines
48
+ */
49
+ get lines(): Array<string>;
50
+ /**
51
+ * Return size of lines
52
+ */
53
+ get size(): number;
54
+ /**
55
+ * Alis for end() method
56
+ */
57
+ toString(): string;
58
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });