Node-Red Based Low-Code Server to Dynamically Create TiddlyWiki's

I will be putting it out on GitHub in about a month (tho thought that about a month ago :slight_smile: - is a Node-Red server using bidirectional and broadcast capable socket.io network to communicate with TiddlyWiki web clients. Tiddlers are the fundamental unit of data throughout the whole system. TiddlyWiki Database on the server side is last major component which is getting close to done.

Cleaning up the flotsam floating around and some cruft, drafting some documentation - then will showcase it here once I publish on GitHub.

2 Likes

That’s very cool. Node-red is really fun. Is the idea that users could create serverside functionality using the Node-red editor?

Probably more than you want to know…

The client side TiddlyWikis are single-file wikis saved on and delivered by the server. TiddlyWiki has one javascript macro that does all the work client side. (drag/drop macro into empty.html (or any TiddlyWiki) - save on server/reload page) By default the server delivers a ‘welcome’ tiddler to the story river.

Server side has an express.js server at the core with socket.io, node-json-db, Node-Red, and TiddlyWiki embedded. The socket.io network and database activities are maintained automatically under-the-hood by the express server. TiddlyWiki and Node-Red have access to both if needed or desired.


TiddlyWiki client-side

A couple global macros are defined: <<node-red-tostory 'topic'>> and <<node-red-emit 'topic'>>. These macros send currentTiddler to the server to be processed. Seems to play well with TW widgets. <$list> for example can be used to send a list of tiddlers to the server for processing. Topic names are determined when you build the Node-Red flows.

Tiddlers from the server are added/updated to $tw.wiki. The <<node-red-tostory>> macro will open/navigate to the received tiddlers. If no topic given, the title of currentTiddler is the topic. There are a bunch of ways to specify a topic along with any options.

The typical exchange is TiddlyWiki sends one or more tiddlers as a request and the server replies with one or more tiddlers as a response. However, Node-Red can send messages containing tiddlers at any time, possibly with TiddlyWiki generating a response message back to the server.

What makes Node-Red the server is that Node-Red flows can broadcast to all or to a subset of connected TiddlyWiki clients. Only the client-side socket.io library is loaded in the browser, while Node-Red has both socket.io client and server installed. If desired, two or more TiddlyWiki’s can exchange tiddlers - but only through Node-Red.


Node-Red flows

Node-Red flows are the boss when it comes to server-side processing of topics. You make flows by drag/drop and wiring ‘wiki in/out’ nodes to receive and send messages, similar to the standard Node-Red ‘http in/out’ nodes. A ‘switch’ node is used to examine the msg.topic to route the message containing tiddlers to the proper flow. Node-Red ‘template’ and ‘read file’ nodes can contain/access .tid formatted tiddlers for delivery to client TiddlyWikis.

A ‘wiki dir’ (directory) node reads all files with a .tid extension from a given server directory path. Wire it up to a ‘wiki out’ node to deliver the tiddlers to the client.

Multiple ‘wiki out’ nodes can be in the same flow. Helps deliver a large number of tiddlers into smaller bite-sized chunks, can throttle message throughput when used with Node-Red ‘delay’ node, among many other uses.

There is also a ‘wiki client’ node which allow flows to act like it was a TiddlyWiki client (well, it is a TiddlyWiki client - remember TW is embedded with Node-Red). Good for setting up flows for bots as well as implementing and monitoring ‘rooms’ where clients can share tiddlers.

That’s just a few examples of nodes and packaged sub-flows for common tasks. Some are created from scratch, some made from standard nodes adapted to work using tiddlers as a fundamental unit of data.


Server-side developers:

Tiddlers can be tiddler instances, field values, .tid format - anything a tiddler can carry. Tiddlers can be organized into multiple TW Wiki instances (from $:/core/modules/wiki.js) These "wiki"s are automatically saved to JSON database(s) when any tiddler they contain is updated. TW Wiki instances are a good organizational tool - maintain different stories, or into categories - images, PDF’s, etc. With the benefit can use TW filters to select tiddlers from the wiki.

The standard Node-Red ‘function’ node has access to TiddlyWiki $tw functions. So developers have access to all TW5 boot and core methods from within the node. To create a tiddler in Node-Red is var myTiddler = new $tw.Tiddler(myFields);. In many places I have just copy/pasted segments of code from a TiddlyWiki JavaScript module into a ‘function’ node. Once created, the function node can be packaged up as a custom node and shared with others.


That should give you a feel for it. The Node-Red low-code, drag/drop building of server-side processes coupled with the presentation capabilities of TiddlyWiki makes it quite a system.


Been working on it off and on for a over a year. Is ugly in places and in dire need of a fresh coat of paint. Doing that now. Will put a demo on the web so people can kick the tires. Read access will be given to the Node-Red editor so people can open the flows and poke around. Upload to GitHub.

As my usual; documentation is a train wreck, floating around, some lost, some found; either non-existent or lagging way behind. But trying to get organized and make a dent in it. You wouldn’t happen to know of a good note taking app? :wink:

3 Likes

Thank you @poc2go that’s fascinating. I hope you’ll be able to share more of your experiences, and I am sure many people will be looking forwards to trying it out.

The most challenging part of building Node-Red nodes is to try and make the node usable by a non-technical person. Even a ‘simple’ node from perspective of the non-tech ‘flow designer’ - can be very difficult to implement. TiddlyWiki core has the same issue - keeping it simple to use - is not so easy.

The TiddlyWiki client side is done. Working on the Node-Red server side. Hope in next month to publish.

1 Like

@poc2go … Any progress info about your project?

Been offline for months and months doing this project - but almost at beta release stage - for years have been using Node-RED as backend server to TiddlyWiki front-ends - but was held together with band-aids, bailing wire, and bubblegum - now is looking like a real package - pretty solid too. Excited to find out how it survives in the wild.

Looking at around Christmas to commit to GitHub.

Here is a copy of one of the doc tiddlers - (has a bunch of links to other tiddlers to that give more info) which wouldn’t work here - but here is a summary:

The system uses single file TiddlyWikis stored on and delivered by the server. The purpose is to add server functionality to TiddlyWiki single page application where tiddlers are dynamically added, changed, and removed on the client by the server - based on user interaction.

Any single file TiddlyWiki Release 5.2.1 or greater is a candidate to use the server

  • Drag-n-Drop $:/plugins/potofcoffee2go/tw5-node-red/network.js macro and save wiki on server as ‘mywiki.html’ for example.
  • Go to http://localhost:1880/uibtw/mywiki.html and wiki will load up connected to the server.
  • TiddlyWikis saved locally will retain any tiddlers fetched from the server.

A single macro <<node-red 'topic' '[tag[redrum]]'>> is used to communicate with the server

  • The first required parameter is the topic used for routing to the proper flow on the server
  • The second optional parameter is a filter of the tiddlers to be sent to the server for processing - tiddlers tagged ‘redrum’ in this case.
  • Reply tiddlers (if any) update the client tiddler store and if appropriate the story river
  • The server can request and send tiddlers to clients at any time should the need arise.
  • The server is impartial to tiddler content type.
  • Tiddlers are ubiquitous in TiddlyWiki - tiddlywiki.com
  • Of course, the server can handle multiple clients concurrently
  • Tiddler broadcasting and exchange between clients is working, but as of this writing, still needs work before release :frowning:

Leverage the use of existing TiddlyWikis

  • Server Applications developed to work with ‘empty.html’ (ie: all the tiddlers are from the server) will generally work well with a variety of client TiddlyWikis from the community.

  • I frequently use “Wikilabs” by @pmario connected to the server as it has toys helpful during application development.

  • An application may be designed to work with a specific client TiddlyWiki.

  • “Tix 0.10.0” by @telmiger has specific config tiddlers the server can easily change which in turn changes the story layout on-the-fly.

  • The TW ‘RefreshMechanism’ makes all the magic happen - server updates the ‘title: $:/SiteSubtitle’ tiddler and it just happens.

The TW5-Node-RED Server will operate without the TW5-Node-RED application.

  • The application has Node-Red flows for learning, experimenting, and handy tools and utilities.
  • Application flows are created, changed, removed as new ideas surface.
  • The settings for the server itself - that runs the Node-Red flows - is rarely changed.

Applications are written using Node-RED ‘Low-code programming’ system.

  • A set of ‘Tiddlers’ nodes have been added to the Node-Red node palette
  • A server-side ‘Network’ tab contains the flows required to communicate with the TiddlyWiki client
  • Some TW5-Node-RED application flows have been designed to assist first time flow developers and others that are more advanced

The ‘TW5-Node-RED Flow Editor’ is the standard ‘Node-Red Flow Editor’ with custom configuration settings.

  • Is at address http://localhost:1880/red.
  • or can use tiddler ‘TW5-Node-Red Flow Editor’ to open in the story river.
  • Must be logged in as Node-Red user ‘admin’ password ‘password’ to deploy changes to the server.
  • Recommended for localhost / local network use.
  • See “Consider Safely accessing Node-RED over the Internet” thread on Node-RED forum if thinking of publishing to web!
  • Runs on “Android Termux” for those on-the-go
  • Am :pinching_hand: close to having it run from a stick drive

The ‘Tiddler Editor’ is a custom text editor found in the Node-Red ‘Tiddlers’ nodes.

  • JSON or .tid formatted tiddlers are allowed by the editor
  • multiple ‘.tid’ formatted tiddlers are allowed by separating them with a line +======+.
  • The editor uses the Mustache template system.
  • The Mustache delimiters are <% / %> since {{ / }} are used everywhere in WikiText. See Node-Red Mustache.

tiddlywiki module (‘npm install tiddlywiki’) is embedded, booted, and running server-side.

  • Is Not ‘TiddlyWiki on Node.js’ - has a different design, architecture, and purpose.
  • Node-Red has access to the TiddlyWiki JavaScript codebase
  • ‘$tw.wiki’ is loaded with all the normal TiddlyWiki toys.
  • Node-Red considers TiddlyWiki to be a database (no DOM) with nodes to create, read, update, delete, and store collections of $tw.Wiki instances.
  • TW plugins can be installed server-side
  • Tiddlers are imported using the ‘preloadTiddlers’ feature of the tiddlywiki boot process
  • ‘$tw’ functions are available for use in ‘Node-Red function’ node.
  • The sky is the limit for server side TiddlyWiki JavaScript developers to design and implement their own nodes.

All tiddlers from server are tagged ¡node-red¡. (configurable)

  • All Tags starting with Middle-Dot ¡ are removed in-flight when sent to the server - has it’s uses
  • The ‘fetched’ field is set to date/time a tiddler was last fetched from server
  • Both the ¡node-red¡ tag and fetched field are removed in-flight when tiddler(s) are sent to server.

There is a lot more - with pictures and everything - but hopefully gives an idea.

Speaking of pictures , the logo I was going to use is:

Which is a composite of the three main packages being used; Node-RED in the background, Tiddly kitty playing with a ball of uibuilder (comm system) string.

@jeremyruston by naming the package ‘TW5-Node-RED’ and the using variation of these logos am I looking at jail time in my future?

Seriously, what procedure would I use to get it approved. I do say in the credits

Copyright and Trademarks are property of respective packages.

No company is affiliated with or endorses TW5-Node-RED.

4 Likes

Hi @poc2go that is not a problem at all. We should have clearer guidelines about this stuff, but in brief, TiddlyWiki itself, the docs, the Motovun Jack mascot etc are all published under a BSD license which means that anyone can use and modify them for any purpose. We request an acknowledgement, but it is not required.

So, from a jail time perspective you’re automatically in the clear, and from a good citizen perspective, you’re in the clear by acknowledging TiddlyWiki.

Anyhow, I’m delighted you’re getting close to publication. These are very powerful capabilities that will enable users to explore new applications for TiddlyWiki.

1 Like

hmmm, This may cause a problem with the new “conditional shortcut” syntax that comes up with TW v5.3.2

Does this imply that it could also do multi-user TW? I’ll be looking sometime in the next few months at how TW could work for me multi-user. I’ve been planning on looking at how to extend the Node.js version to support multi-user, and am not looking forward to it. I’m curious if this might help fill that gap. Bob.exe may one-day fit my needs here, but at the moment,

  • under consideration Security and authentication to limit access and editing

access control is only “under consideration”.

Also, is the database of tiddlers in-memory or stored to the filesystem or to some DBMS? If it’s stored, is it updated on every change, or only on stop/start, or on some other cadence? Part of my reason for preferring Node implementation is that I like frequent git backups of my data; this is easy and inexpensive if I’m only backing up a few (or a few dozen) tiddlers at a time, not duplicating entire wikis on every change. If this is saved in a text format (as Node stores tiddlers as text .tid files), then this would fit together well with that workflow.

Even if it doesn’t fit these needs, I’m very excited to see this coming together!

1 Like

Hi @Scott_Sauyet

The server is designed from the get go to be multi-user, so the short answer is yes. I will be posting more on TW Talk about the design of the server with some teasers about what it can do and how it does it. Putting together a demo.

TW5-Node-RED has two standard Node-RED installed storage systems - a memory store and a file store. The file store has options for buffering, retain in memory after write, throttling, etc. The default is physical write every 30 seconds which is fine for me. Can set it to whatever you want. The writes are not usually expensive as explained below.

Can use JSON, but almost all of the tiddlers are stored in .tid format. There is a twist - instead of having a separate file for each .tid - the servers file reader / writer takes a bunch of tiddlers and separates them with a line ‘+======+’ (exactly) between them. I have some files with 1000’s of .tid formatted tiddlers from csv data downloaded from the web in a single file.

For one - can just edit the file to fix a tiddler. Plus can just append to it to add more tiddlers - appends are fast cheap writes so easy on disk i/o. Another advantage is that if two or more tiddlers have the same title - the last one (ie: most current) wins. So have a history of all the updates to that tiddler in the file. Also simplifies resolving collisions that are bound to occur in the multi-user universe. So have both of the tiddlers that are in conflict - can be merged or whatever. The files are pruned daily by importing into TiddlyWiki (which handles duplicate tiddler titles as discussed - last wins) and export back out. And finally don’t have 1000’s upon 1000’s of files clogging and messing up my precious directories.

The server does have git version control built in. There is a mechanism to store tiddlers in Node-Red flow files which are under version control - just need to turn it on - give it a git repo, credentials, etc. I haven’t used it that much because the whole project directory which includes all the stuff is already under version control.

It might be a fit - The main issue is probably Node-RED. Flows need to be designed and wired up, move tiddlers here, store it there, publish to multiple clients - do the task you need done. There are nodes in Node-RED that will do that - and much more. There a learning curve to figure out Node-Red. You already know the TiddlyWiki side, the server needs to know what to do as well.

1 Like

Seems this is going to be a continuing issue. Thanks for the heads up.

I brought it up half a year ago hoping could find a sequence of two delimiting characters that are not used by
WikiText. Is a challenge.

I’m going to use section sign ‘§’ and broken bar ‘¦’ which are valid HTMLCharset characters - one at 166 and the other at 167 - well above the normal characters on a keyboard.

What I’m thinking, the tiddlers are undoubtably going to be created/edited in either TiddlyWiki or Node-RED. Both being web editors - is fairly easy to add formatting buttons like the [[]] button that TiddlyWiki has and will work the same. I’ll make a shortcut key - should work fairly smooth

So would look something like this - where a view template tiddler is changed based on the ‘mdUrl’ field:

title: $:/poc2go/tw5-node-red/redrum/toc/template/view

§Œ#mdUrlŒ§
<p>'§ŒbookNameŒ§' has been exported as Markdown to '§ŒfilenameŒ§'.</p>
§Œ/mdUrlŒ§

§Œ^mdUrlŒ§
<$transclude mode="block" tiddler="$:/core/ui/ViewTemplate/body"/>
§Œ/mdUrlŒ§

I think would be fairly safe to say not going to be using those characters in WikiText any time soon.

Open to other ideas.

Perhaps it would be worth us choosing and documenting an official “escape syntax” that will never be used by the core so that it’s guaranteed to be clear for extensions/addons to use.

We could use {% foobar %}, which was one of the earlier options we considered for the conditional shortcut syntax.

@poc2go this looks like a revolutionary extension of tiddlywiki server configurations. Thanks very much for sharing this work, which no doubt has consumed many hours. I would like to adopt it enthuiasticaly.

If you can at some point give instructions for a “dumb user” to install and do some basic setup, it would be appreciated. Personaly I have intentionaly taken the role of a superuser of tiddlywiki, avoiding straying into Developer teritory, although I do occasionaly, and I am sure I can contribute on testing, documentation and feature and usage development,

  • This maintining a "superuser only rol"e is I belive a useful to test tiddlywikis native capabilities because unlike many developers I don’t, or can’t revert to javascript code solutions when I find a gap in tiddlywiki, thus I tend to champion the filling of gaps in such a way a broader audience can make use of these. Did I ever tell you this @jeremyruston ?
  • I can contribute a lot more but only once I have a working server/wiki platform in my hands and at least a rudimentaty understanding.
  • The truth is once I get my hands on this I expect to drive it as far as I can.
    • There are substantial stratigic benifits to this model that could solve many problems we face making tiddlywiki solutions more broadly available.

Of course if we could safely put it on the internet it would be another revolution, however it has become clear now days that a lot of home users and remote workers use a VPN to connect into a trusted Network, and in that private network we have application servers, that is Intranet installs, behind a VPN can be used safely and effectivly. It sounds like this is easy with TW5-Node-RED.

  • This would open up many of the organisation, team or business solutions if not yet public internet solutions.

Perhaps later I could elaborate on how we may make use of this in the real world.

Great!

I’m very excited to see this!

That would be plenty often for me. If I lose a few minutes work, it’s not the end of the world. A few hours is scary, and a few days is terrifying! 30 seconds would be fine.

Is this a whole wiki or some subset created by internal means that are either configurable or entirely irrelevant to the user? Also, what happens to binary tiddlers such as PNGs or PDFs? Do they simply get their own separate files as done in the Node version?

It sounds very much like it could be, which is very exciting to me. I was not looking forward to trying many of the things I would need for this.

I’m a programmer by profession. That part doesn’t scare me at all.

One more question: Is there authentication/authorization built in? I would love to publish wikis in read-only mode, but allow authorized users to access edit mode and be able to save changes.

I’m thrilled to hear this is coming, and anxious to see where you go with it.

I don’t have it out on GitHub yet, one of the reasons is have not decided on the license - Apache License 2.0. is being used by most of the packages. What I’ll do is zip it up and put on one of my servers. Can download, unzip, ‘cd tw5-node-red’, ‘npm install’, ‘npm start’ - go to ‘http://localhost:1880/uibtw/hello.html’. It has buttons to do things - open the server look at the flows. I have a writeup.

Thats it. Or it’s broke. Give me a few days and will post a link…

I don’t have a Windows system - died a few years back and never got around to get another one. So - has never been installed on Windows. Should work.

I got some documentation - markdown documents running on docsify. ‘http:/localhost:1880/docs’ - some old, some missing, some in TiddlyWiki. Will dig around and see what I can find.

It runs on Express server so about as good as can get. I put my servers on a hosted site, so if someone breaks into it and crashes them - their problem not mine. IBM uses it. Your right - set it up right and will be fine

The server becomes an extension of your TiddlyWiki. I mostly use three tiddlywikis, ‘empty’, ‘WikiLabs’ by pmario and Tix by telmiger. When they load there is hardly anything in them. The server sends a tiddler to the story that has buttons to get stuff from the server. It doesn’t matter if I use ‘empty’, ‘WikiLabs’, or ‘Tix’ the server always sends that tiddler so I can press buttons to get stuff. Has 8 years of financial records - 300+ meg.

Server side it needs to know how to get stuff. That is done by drag-n-dropping nodes (they are like little black boxes with a wire going in, a wire coming out) that you can open up and change parameters. These boxes are wired together called a ‘flow’ to perform tasks.

So who is involved in making this stuff. To make a new node that does a task requires a JavaScript developer. Just like making a new filter operator in TiddlyWiki requires a JavaScript developer. So who wires the flows - an application developer, would be someone that knows how these black boxes interact with each other. In TiddlyWiki would be like someone that makes view or editor templates - got know how nested widgets <$let><$wikify><$view> interact with each other.

On the TiddlyWiki cient is a button ‘get subtitle’. This is a flow on the server. The first ‘green’ colored node is where messages come in from the client TiddlyWikis → the yellow ‘get subtitle’ node is a command → the node named $:/SiteSubtitle has a tiddler in it → the ‘blue?ish’ node sends the message back to the client TiddlyWiki. This flow changes the wiki subtitle. Double click the $:/SiteSubtitle node and would see a tiddler in it. Change the text, close it and save - press the button again and subtitle would change to new text.

Although trivial, is pretty simple to do. My question would be ‘How many tiddlers can I put in that node?’ As many as you want. Send stylesheets, macros, templates, datatiddlers, image tiddlers, HTML, WikiText, Markdown. And with just a few nodes. Haven’t even scratched the surface.

So your not dumb - now your an expert :slight_smile:

On startup TiddlyWiki has a boot function
it knows it is runnning on node.js (not the browser) so it handles some things differently
for example, $tw.Commander - the commandline processor (the browser can’t use that)

  • loads utilities module - $tw.utils
  • constructors for tiddler $tw.Tiddler and wiki $tw.Wiki
  • creates a main wiki (active tiddler store) $tw.wiki = new $tw.Wiki
  • into $tw.wiki loads JavaScript modules, system and shadow tiddlers, buncha stuff, all stuff

The active tiddler store is where all the TW JavaScript module code lives and executes.
Indirectly being used whenever a TiddlyWiki function is called.

I stay away from it. - but “Fools rush in where angels fear to tread” - Alexander Pope (1688-1744)
So, yeah, I do sometimes - to overload a shadow tiddler, or get tiddlers from it.

Here is a little bit of JS code - but just skim over it.

So to store a collection of tiddlers a $tw.Wiki instance needs to be created.
To keep the little bit of sanity I got left, lets call it a - ‘twiki’ - an empty tiny wiki

const twiki = new $tw.Wiki

Now an array of objects containing fields shows up

var fromSomewhere = [ { title: 'hello', text: 'surprise!' }, { title: 'Im lost', tag: 'help!' } ];

Could been read from a file, from another twiki, Node-Red flow, or a client TiddlyWiki (network)
who cares, we got put them somewhere before they get lost

twiki.addTiddlers(fromSomewhere);

Now need to put it where everybody can get to it

RED.global.set('Lost and Found', twiki);

‘RED’ is a global variable created before the express server is even created - seen by all

Meanwhile - Deep in the shadows of code forgotten a long time ago:

var hiLittleBuddy = RED.global.get('Lost and Found');

hiLittleBuddy.addTiddler({ title: 'got ya', text: 'milk and cookies!' });

Use TW filter to get all lost and found tiddlers

var lostAndFound = hiLittleBuddy.getTiddlersAsJson('[all[]]');
console.log(JSON.parse(lostAndFound));

Displays:

[
  { title: 'got ya', text: 'milk and cookies!' },
  { title: 'hello', text: 'surprise!' },
  { title: 'Im lost', tag: 'help!', text:'' }
]


Ut-oh, forgot all about no JavaScript @TW_Tones can’t do that! Would do it the Node-Red way

All of this could be done with two nodes, well the display, so three. The point is can get down to a pretty low level using nodes.

So is a full blown TiddlyWiki system.

1 Like

Thank you. I’ve been spending some time seeing how Node TW functions so parts of this are familiar.

I was asking a much more simple, specific question. When you have a file full of ‘+======+’-separated tiddlers, does it include all the tiddlers for a given wiki, some specific subset of them, or multiple wikis in one? Is this behavior configurable?

Depends on the filter you use when selecting from the given twiki.

lets say we have a given twiki ‘givenTwiki’ loaded up with image tiddlers. Now in givenTwiki the objects are not native JavaScript - they are all instances of $tw.Tiddler - they are their own animal.

The images are at URL `http://localhost:1880/my/images’ on the server.

So a bunch of png image tiddlers that look similar to this - different titles/_canonical_uri’s
you got 10 of them

title: bluesky
tags: images
type: image/png
_canonical_uri: /my/images/bluesky.png

and a bunch jpeg like this - with different titles and _canonical_uri’s
you got 5 of them

title: dirtydog
tags: images
type: image/jpeg
_canonical_uri: /my/images/dirtydog.jpeg

Get them out of the givenTwiki - use a TW filter - while convertng to native JS objects.
(the JSON parse part is habit - I always want a real copy - none of this implicit referencing stuff)

var all = JSON.parse(givenTwiki.getTiddlersAsJson(’[all[]]’));
var allAgain = JSON.parse(givenTwiki.getTiddlersAsJson(’[tag[images]]’));
var onlypngs = JSON.parse(givenTwiki.getTiddlersAsJson(’[type[images/png]]’));
var onlyjpegs = JSON.parse(givenTwiki.getTiddlersAsJson(’[type[images/jpeg]]’));
var bluesky = JSON.parse(givenTwiki.getTiddlersAsJson(’[[bluesky]]’));
var emptyArray = JSON.parse(givenTwiki.getTiddlersAsJson(’[type[text/plain]]’));

all - will have 15 tiddlers - if you write them to disk .tid or JSON will get 15 tiddlers in the file
same - with allagain 15
onlypngs - will have 10 - if you write them to disk .tid or JSON will get 10 tiddlers in the file
onlyjpeg - will have 5
bluesky - will have 1
and empty - will have none - will get JSON will be ‘[]’ 2 bytes empty array - .tid 0 bytes empty file

There is another twiki ‘aDifferentGivenTwiki’ with 22 regular tiddlers

var fromDiffTwiki = JSON.parse(aDifferentGivenTwiki.getTiddlersAsJson(’[all[]]’));

var combined = onlypngs.concat(fromDiffTwiki);

combined - will have 32 tiddlers, 10 png tiddlers plus the 22 regular tiddlers

If written .tid or JSON will get 32 tiddlers

Hopefully, answers your question?

1 Like