@imbricate/core 2.5.0 → 2.6.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.
@@ -3,6 +3,7 @@
3
3
  * @namespace Collection
4
4
  * @description Base
5
5
  */
6
+ import { ImbricateAuthor } from "../author/definition";
6
7
  import { ImbricateCapabilityBuilder } from "../capability/builder";
7
8
  import { ImbricateCapability } from "../capability/definition";
8
9
  import { IImbricateCollectionOperationManager } from "../collection-operation-manager/interface";
@@ -20,7 +21,7 @@ export declare abstract class ImbricateCollectionBase implements IImbricateColle
20
21
  abstract readonly collectionName: string;
21
22
  abstract readonly uniqueIdentifier: string;
22
23
  abstract readonly capabilities: ImbricateCollectionCapability;
23
- createPage(_directories: string[], _title: string, _variant: ImbricatePageVariant, _initialContent: string, _description?: string): PromiseOr<IImbricatePage>;
24
+ createPage(_directories: string[], _title: string, _variant: ImbricatePageVariant, _author: ImbricateAuthor, _initialContent: string, _description?: string): PromiseOr<IImbricatePage>;
24
25
  putPage(_pageMetadata: ImbricatePageMetadata, _content: string): PromiseOr<IImbricatePage>;
25
26
  retitlePage(_identifier: string, _newTitle: string): PromiseOr<void>;
26
27
  deletePage(_identifier: string): PromiseOr<void>;
@@ -20,7 +20,7 @@ class ImbricateCollectionBase {
20
20
  static allDenyCapability() {
21
21
  return this.buildCapability((0, definition_1.createDenyImbricateCapability)()).build();
22
22
  }
23
- createPage(_directories, _title, _variant, _initialContent, _description) {
23
+ createPage(_directories, _title, _variant, _author, _initialContent, _description) {
24
24
  throw not_implemented_1.ImbricateNotImplemented.create("CreatePage", definition_2.IMBRICATE_COLLECTION_CAPABILITY_KEY.CREATE_PAGE);
25
25
  }
26
26
  putPage(_pageMetadata, _content) {
@@ -3,6 +3,7 @@
3
3
  * @namespace Collection
4
4
  * @description Interface
5
5
  */
6
+ import { ImbricateAuthor } from "../author/definition";
6
7
  import { IImbricateCollectionOperationManager } from "../collection-operation-manager/interface";
7
8
  import type { PromiseOr } from "../definition/promise";
8
9
  import { ImbricatePageVariant } from "../page-variant/definition";
@@ -15,7 +16,19 @@ export interface IImbricateCollection {
15
16
  readonly uniqueIdentifier: string;
16
17
  readonly description?: string;
17
18
  readonly capabilities: ImbricateCollectionCapability;
18
- createPage(directories: string[], title: string, variant: ImbricatePageVariant, initialContent: string, description?: string): PromiseOr<IImbricatePage>;
19
+ /**
20
+ * Create a page
21
+ *
22
+ * @param directories Directories
23
+ * @param title Title
24
+ * @param variant Variant
25
+ * @param author Author
26
+ * @param initialContent Initial content
27
+ * @param description Description
28
+ *
29
+ * @returns Created page
30
+ */
31
+ createPage(directories: string[], title: string, variant: ImbricatePageVariant, author: ImbricateAuthor, initialContent: string, description?: string): PromiseOr<IImbricatePage>;
19
32
  putPage(pageMetadata: ImbricatePageMetadata, content: string): PromiseOr<IImbricatePage>;
20
33
  retitlePage(identifier: string, newTitle: string): PromiseOr<void>;
21
34
  deletePage(identifier: string): PromiseOr<void>;
package/index.d.ts CHANGED
@@ -39,6 +39,7 @@ export * from "./origin/base";
39
39
  export * from "./origin/definition";
40
40
  export * from "./origin/interface";
41
41
  export * from "./page-variant/definition";
42
+ export * from "./page-variant/extension";
42
43
  export * from "./page/base";
43
44
  export * from "./page/definition";
44
45
  export * from "./page/interface";
@@ -49,7 +50,6 @@ export * from "./script-manager/base";
49
50
  export * from "./script-manager/definition";
50
51
  export * from "./script-manager/interface";
51
52
  export * from "./script-variant/definition";
52
- export * from "./script-variant/extension";
53
53
  export * from "./script/base";
54
54
  export * from "./script/definition";
55
55
  export * from "./script/interface";
package/index.js CHANGED
@@ -55,6 +55,7 @@ __exportStar(require("./origin/base"), exports);
55
55
  __exportStar(require("./origin/definition"), exports);
56
56
  __exportStar(require("./origin/interface"), exports);
57
57
  __exportStar(require("./page-variant/definition"), exports);
58
+ __exportStar(require("./page-variant/extension"), exports);
58
59
  __exportStar(require("./page/base"), exports);
59
60
  __exportStar(require("./page/definition"), exports);
60
61
  __exportStar(require("./page/interface"), exports);
@@ -65,7 +66,6 @@ __exportStar(require("./script-manager/base"), exports);
65
66
  __exportStar(require("./script-manager/definition"), exports);
66
67
  __exportStar(require("./script-manager/interface"), exports);
67
68
  __exportStar(require("./script-variant/definition"), exports);
68
- __exportStar(require("./script-variant/extension"), exports);
69
69
  __exportStar(require("./script/base"), exports);
70
70
  __exportStar(require("./script/definition"), exports);
71
71
  __exportStar(require("./script/interface"), exports);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@imbricate/core",
3
3
  "main": "index.js",
4
- "version": "2.5.0",
4
+ "version": "2.6.1",
5
5
  "description": "Imbricate Core, Notebook for Engineers",
6
6
  "repository": {
7
7
  "type": "git",
package/page/base.d.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  * @namespace Page
4
4
  * @description Base
5
5
  */
6
+ import { ImbricateAuthor } from "../author/definition";
6
7
  import { ImbricateCapabilityBuilder } from "../capability/builder";
7
8
  import { ImbricateCapability } from "../capability/definition";
8
9
  import type { PromiseOr } from "../definition/promise";
@@ -27,7 +28,7 @@ export declare abstract class ImbricatePageBase implements IImbricatePage {
27
28
  writeContent(_content: string): PromiseOr<void>;
28
29
  readAttributes(): PromiseOr<Record<string, string>>;
29
30
  writeAttribute(_key: string, _value: string): PromiseOr<void>;
30
- refreshUpdateMetadata(_updatedAt: Date, _digest: string): PromiseOr<void>;
31
+ refreshUpdateMetadata(_updatedAt: Date, _digest: string, _author: ImbricateAuthor): PromiseOr<void>;
31
32
  refreshUpdatedAt(_updatedAt: Date): PromiseOr<void>;
32
33
  refreshDigest(_digest: string): PromiseOr<void>;
33
34
  addHistoryRecord(_record: ImbricatePageHistoryRecord): PromiseOr<void>;
package/page/base.js CHANGED
@@ -32,7 +32,7 @@ class ImbricatePageBase {
32
32
  writeAttribute(_key, _value) {
33
33
  throw not_implemented_1.ImbricateNotImplemented.create("WriteAttribute", definition_2.IMBRICATE_PAGE_CAPABILITY_KEY.WRITE_ATTRIBUTE);
34
34
  }
35
- refreshUpdateMetadata(_updatedAt, _digest) {
35
+ refreshUpdateMetadata(_updatedAt, _digest, _author) {
36
36
  throw not_implemented_1.ImbricateNotImplemented.create("RefreshUpdateMetadata", definition_2.IMBRICATE_PAGE_CAPABILITY_KEY.UPDATE_METADATA);
37
37
  }
38
38
  refreshUpdatedAt(_updatedAt) {
@@ -3,6 +3,7 @@
3
3
  * @namespace Page
4
4
  * @description Interface
5
5
  */
6
+ import { ImbricateAuthor } from "../author/definition";
6
7
  import { PromiseOr } from "../definition/promise";
7
8
  import { ImbricatePageVariant } from "../page-variant/definition";
8
9
  import { ImbricatePageAttributes, ImbricatePageCapability, ImbricatePageHistoryRecord } from "./definition";
@@ -27,8 +28,9 @@ export interface IImbricatePage {
27
28
  *
28
29
  * @param updatedAt Updated At
29
30
  * @param digest Content Digest
31
+ * @param author Author
30
32
  */
31
- refreshUpdateMetadata(updatedAt: Date, digest: string): PromiseOr<void>;
33
+ refreshUpdateMetadata(updatedAt: Date, digest: string, author: ImbricateAuthor): PromiseOr<void>;
32
34
  /**
33
35
  * Refresh Updated At
34
36
  * Prefer `refreshUpdateMetadata` in most cases
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace PageVariant
4
+ * @description Extension
5
+ */
6
+ import { IMBRICATE_PAGE_VARIANT_LANGUAGE } from "./definition";
7
+ export declare const getImbricateScriptLanguageExtension: (language: IMBRICATE_PAGE_VARIANT_LANGUAGE, withDot?: boolean) => string;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace PageVariant
5
+ * @description Extension
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.getImbricateScriptLanguageExtension = void 0;
9
+ const definition_1 = require("./definition");
10
+ const fixExtension = (extension, withDot) => {
11
+ if (withDot) {
12
+ return `.${extension}`;
13
+ }
14
+ return extension;
15
+ };
16
+ const getImbricateScriptLanguageExtension = (language, withDot = true) => {
17
+ switch (language) {
18
+ case definition_1.IMBRICATE_PAGE_VARIANT_LANGUAGE.TEXT: return fixExtension("txt", withDot);
19
+ case definition_1.IMBRICATE_PAGE_VARIANT_LANGUAGE.MARKDOWN: return fixExtension("md", withDot);
20
+ case definition_1.IMBRICATE_PAGE_VARIANT_LANGUAGE.LATEX: return fixExtension("tex", withDot);
21
+ }
22
+ return fixExtension("unknown", withDot);
23
+ };
24
+ exports.getImbricateScriptLanguageExtension = getImbricateScriptLanguageExtension;
package/script/base.d.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  * @namespace Script
4
4
  * @description Base
5
5
  */
6
+ import { ImbricateAuthor } from "../author/definition";
6
7
  import { ImbricateCapabilityBuilder } from "../capability/builder";
7
8
  import { ImbricateCapability } from "../capability/definition";
8
9
  import type { PromiseOr } from "../definition/promise";
@@ -26,7 +27,7 @@ export declare abstract class ImbricateScriptBase implements IImbricateScript {
26
27
  writeScript(_script: string): PromiseOr<void>;
27
28
  readAttributes(): PromiseOr<ImbricateScriptAttributes>;
28
29
  writeAttribute(_key: string, _value: string): PromiseOr<void>;
29
- refreshUpdateMetadata(_updatedAt: Date, _digest: string): PromiseOr<void>;
30
+ refreshUpdateMetadata(_updatedAt: Date, _digest: string, _author: ImbricateAuthor): PromiseOr<void>;
30
31
  refreshUpdatedAt(_updatedAt: Date): PromiseOr<void>;
31
32
  refreshDigest(_digest: string): PromiseOr<void>;
32
33
  addHistoryRecord(_record: ImbricateScriptHistoryRecord): PromiseOr<void>;
package/script/base.js CHANGED
@@ -32,7 +32,7 @@ class ImbricateScriptBase {
32
32
  writeAttribute(_key, _value) {
33
33
  throw not_implemented_1.ImbricateNotImplemented.create("WriteAttribute", definition_2.IMBRICATE_SCRIPT_CAPABILITY_KEY.WRITE_ATTRIBUTE);
34
34
  }
35
- refreshUpdateMetadata(_updatedAt, _digest) {
35
+ refreshUpdateMetadata(_updatedAt, _digest, _author) {
36
36
  throw not_implemented_1.ImbricateNotImplemented.create("RefreshUpdateMetadata", definition_2.IMBRICATE_SCRIPT_CAPABILITY_KEY.UPDATE_METADATA);
37
37
  }
38
38
  refreshUpdatedAt(_updatedAt) {
@@ -3,6 +3,7 @@
3
3
  * @namespace Script
4
4
  * @description Interface
5
5
  */
6
+ import { ImbricateAuthor } from "../author/definition";
6
7
  import { PromiseOr } from "../definition/promise";
7
8
  import { ImbricateScriptVariant } from "../script-variant/definition";
8
9
  import { ImbricateScriptAttributes, ImbricateScriptCapability, ImbricateScriptHistoryRecord } from "./definition";
@@ -26,8 +27,9 @@ export interface IImbricateScript {
26
27
  *
27
28
  * @param updatedAt Updated At
28
29
  * @param digest Content Digest
30
+ * @param author Author
29
31
  */
30
- refreshUpdateMetadata(updatedAt: Date, digest: string): PromiseOr<void>;
32
+ refreshUpdateMetadata(updatedAt: Date, digest: string, author: ImbricateAuthor): PromiseOr<void>;
31
33
  /**
32
34
  * Refresh Updated At
33
35
  * Prefer `refreshUpdateMetadata` in most cases
@@ -3,6 +3,7 @@
3
3
  * @namespace ScriptManager
4
4
  * @description Base
5
5
  */
6
+ import { ImbricateAuthor } from "../author/definition";
6
7
  import { ImbricateCapabilityBuilder } from "../capability/builder";
7
8
  import { ImbricateCapability } from "../capability/definition";
8
9
  import type { PromiseOr } from "../definition/promise";
@@ -17,7 +18,7 @@ export declare abstract class ImbricateScriptManagerBase implements IImbricateSc
17
18
  static allAllowCapability(): ImbricateScriptManagerCapability;
18
19
  static allDenyCapability(): ImbricateScriptManagerCapability;
19
20
  abstract readonly capabilities: ImbricateScriptManagerCapability;
20
- createScript(_scriptName: string, _variant: ImbricateScriptVariant, _initialScript: string, _description?: string): PromiseOr<IImbricateScript>;
21
+ createScript(_scriptName: string, _variant: ImbricateScriptVariant, _author: ImbricateAuthor, _initialScript: string, _description?: string): PromiseOr<IImbricateScript>;
21
22
  putScript(_scriptMetadata: ImbricateScriptMetadata, _script: string): PromiseOr<IImbricateScript>;
22
23
  renameScript(_identifier: string, _newScriptName: string): PromiseOr<void>;
23
24
  deleteScript(_identifier: string): PromiseOr<void>;
@@ -20,7 +20,7 @@ class ImbricateScriptManagerBase {
20
20
  static allDenyCapability() {
21
21
  return this.buildCapability((0, definition_1.createDenyImbricateCapability)()).build();
22
22
  }
23
- createScript(_scriptName, _variant, _initialScript, _description) {
23
+ createScript(_scriptName, _variant, _author, _initialScript, _description) {
24
24
  throw not_implemented_1.ImbricateNotImplemented.create("CreateScript", definition_2.IMBRICATE_SCRIPT_MANAGER_CAPABILITY_KEY.CREATE_SCRIPT);
25
25
  }
26
26
  putScript(_scriptMetadata, _script) {
@@ -3,6 +3,7 @@
3
3
  * @namespace ScriptManager
4
4
  * @description Interface
5
5
  */
6
+ import { ImbricateAuthor } from "../author/definition";
6
7
  import { PromiseOr } from "../definition/promise";
7
8
  import { ImbricateScriptQuery, ImbricateScriptQueryConfig, ImbricateSearchScriptConfig } from "../query/script";
8
9
  import { ImbricateScriptVariant } from "../script-variant/definition";
@@ -18,12 +19,14 @@ export interface IImbricateScriptManager {
18
19
  * Create a script
19
20
  *
20
21
  * @param scriptName Script name
22
+ * @param variant Script variant
23
+ * @param author Author
21
24
  * @param initialScript Initial script content
22
25
  * @param description Script description
23
26
  *
24
27
  * @returns Created script
25
28
  */
26
- createScript(scriptName: string, variant: ImbricateScriptVariant, initialScript: string, description?: string): PromiseOr<IImbricateScript>;
29
+ createScript(scriptName: string, variant: ImbricateScriptVariant, author: ImbricateAuthor, initialScript: string, description?: string): PromiseOr<IImbricateScript>;
27
30
  /**
28
31
  * Put a script
29
32
  *