2.0.0 • Published 2 years ago

@deep-foundation/logger v2.0.0

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

npm Gitpod Discord

Deep package that provides handlers for insert/update/delete operations

Usage

Insert a link of type Handle(Insert|Update|Delete) from your type that should be handled to the accroding handler (Insert|Update|Delete)Handler from this package

  • Manually

    const containTypeLinkId = await deep.id("@deep-foundation/core", "Contain");
    
    const handleInsertTypeLinkId = await deep.id(
      "@deep-foundation/core",
      "HandleInsert"
    );
    const handleUpdateTypeLinkId = await deep.id(
      "@deep-foundation/core",
      "HandleUpdate"
    );
    const handleDeleteTypeLinkId = await deep.id(
      "@deep-foundation/core",
      "HandleDelete"
    );
    
    const insertHandlerLinkId = await deep.id(
      "@deep-foundation/logger",
      "InsertHandler"
    );
    const updateHandlerLinkId = await deep.id(
      "@deep-foundation/logger",
      "UpdateHandler"
    );
    const deleteHandlerLinkId = await deep.id(
      "@deep-foundation/logger",
      "DeleteHandler"
    );
    
    const myTypeLinkId = await deep.id(deep.linkId, "MyType");
    const containerLinkId = deep.linkId;
    
    const reservedLinkIds = await deep.reserve(1);
    
    const handleLinkId = reservedLinkIds.pop();
    
    await deep.serial({
      operations: [
        {
          type: "insert",
          table: "links",
          objects: {
            id: handleLinkId,
            type_id:
              handleInsertTypeLinkId /* handleUpdateTypeLinkId, handleDeleteTypeLinkId */,
            from_id: myTypeLinkId,
            to_id:
              insertHandlerLinkId /* updateHandlerLinkId, deleteHandlerLinkId */,
          },
        },
        {
          type: "insert",
          table: "links",
          objects: {
            type_id: containTypeLinkId,
            from_id: containerLinkId,
            to_id: handleLinkId,
          },
        },
      ],
    });

Result

Insert

  • LogInsert with string value that contains timestamp in milliseconds
  • LogId from LogInsert to newLink.link
  • LogType from LogINsert to newLink.type
  • LogFrom from LogInsert to newLink.from
  • LogTo from LogInsert to newLink.to

Update

  • LogInsert with string value that contains timestamp in milliseconds
  • LogId from LogInsert to newLink.link
  • LogType from LogINsert to newLink.type
  • LogFrom from LogInsert to newLink.from
  • LogTo from LogInsert to newLink.to
  • Log(String|Number|Object) from LogUpdate to LogUpdate with string|number|object

Delete

  • LogInsert with string value that contains timestamp in milliseconds
  • LogId from LogInsert to newLink.link
  • LogType from LogINsert to newLink.type
  • LogFrom from LogInsert to newLink.from
  • LogTo from LogInsert to newLink.to
  • Log(String|Number|Object) from LogUpdate to LogUpdate with string|number|object
1.2.0

2 years ago

2.0.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago

0.0.10

2 years ago

0.0.11

2 years ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.14

2 years ago

0.0.15

2 years ago

0.0.9

2 years ago

0.0.16

2 years ago

0.0.8

2 years ago

0.0.17

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago