fable 3.1.72 → 3.1.74
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/docs/README.md +30 -6
- package/docs/_brand.json +18 -0
- package/docs/_playground.json +10 -0
- package/docs/_sidebar.md +2 -0
- package/docs/_version.json +3 -3
- package/docs/architecture.md +201 -39
- package/docs/index.html +6 -7
- package/docs/pict-docuserve.min.js +91 -0
- package/docs/pict-docuserve.min.js.map +1 -0
- package/docs/playground.md +38 -0
- package/docs/retold-catalog.json +1 -1
- package/docs/retold-keyword-index.json +8721 -8105
- package/docs/services/README.md +26 -9
- package/docs/services/anticipate.md +104 -40
- package/docs/services/csv-parser.md +63 -35
- package/docs/services/data-format.md +154 -49
- package/docs/services/data-generation.md +77 -16
- package/docs/services/dates.md +103 -36
- package/docs/services/environment-data.md +13 -2
- package/docs/services/expression-parser.md +280 -68
- package/docs/services/file-persistence.md +142 -150
- package/docs/services/logging.md +93 -37
- package/docs/services/logic.md +70 -22
- package/docs/services/manifest.md +114 -26
- package/docs/services/math.md +168 -63
- package/docs/services/meta-template.md +312 -158
- package/docs/services/object-cache.md +94 -11
- package/docs/services/operation.md +68 -6
- package/docs/services/progress-time.md +74 -13
- package/docs/services/progress-tracker-set.md +101 -3
- package/docs/services/rest-client.md +136 -104
- package/docs/services/settings-manager.md +133 -40
- package/docs/services/template.md +71 -22
- package/docs/services/utility.md +121 -29
- package/docs/services/uuid.md +58 -10
- package/package.json +2 -2
- package/source/services/Fable-Service-MetaTemplate/MetaTemplate-StringParser.js +6 -0
- package/test/MetaTemplating_tests.js +77 -0
- package/.claude/settings.local.json +0 -8
- package/docs/css/docuserve.css +0 -327
package/docs/services/dates.md
CHANGED
|
@@ -5,17 +5,23 @@ The Dates service provides date manipulation functionality using [day.js](https:
|
|
|
5
5
|
## Access
|
|
6
6
|
|
|
7
7
|
```javascript
|
|
8
|
+
const libFable = require('fable');
|
|
9
|
+
const fable = new libFable({ Product: 'DatesDemo', ProductVersion: '1.0.0' });
|
|
10
|
+
|
|
8
11
|
// Auto-instantiated, available directly
|
|
9
|
-
fable.Dates
|
|
12
|
+
console.log('fable.Dates:', typeof fable.Dates);
|
|
10
13
|
```
|
|
11
14
|
|
|
12
15
|
## Direct day.js Access
|
|
13
16
|
|
|
14
17
|
```javascript
|
|
18
|
+
const libFable = require('fable');
|
|
19
|
+
const fable = new libFable({ Product: 'DatesDemo', ProductVersion: '1.0.0' });
|
|
20
|
+
|
|
15
21
|
// Access the day.js library directly
|
|
16
|
-
fable.Dates.dayJS();
|
|
17
|
-
fable.Dates.dayJS('2024-01-15');
|
|
18
|
-
fable.Dates.dayJS('2024-01-15').format('YYYY-MM-DD');
|
|
22
|
+
console.log('Now:', fable.Dates.dayJS().toISOString()); // Current date/time
|
|
23
|
+
console.log('Parsed:', fable.Dates.dayJS('2024-01-15').toISOString()); // Parse a date
|
|
24
|
+
console.log('Formatted:', fable.Dates.dayJS('2024-01-15').format('YYYY-MM-DD'));
|
|
19
25
|
```
|
|
20
26
|
|
|
21
27
|
## Pre-loaded Plugins
|
|
@@ -37,56 +43,80 @@ All difference methods accept dates as strings, Date objects, or timestamps.
|
|
|
37
43
|
### Milliseconds
|
|
38
44
|
|
|
39
45
|
```javascript
|
|
40
|
-
|
|
46
|
+
const libFable = require('fable');
|
|
47
|
+
const fable = new libFable({ Product: 'DatesDemo', ProductVersion: '1.0.0' });
|
|
48
|
+
|
|
49
|
+
console.log(fable.Dates.dateMillisecondDifference('2024-01-01', '2024-01-02'));
|
|
41
50
|
// Returns: 86400000
|
|
42
51
|
```
|
|
43
52
|
|
|
44
53
|
### Seconds
|
|
45
54
|
|
|
46
55
|
```javascript
|
|
47
|
-
|
|
56
|
+
const libFable = require('fable');
|
|
57
|
+
const fable = new libFable({ Product: 'DatesDemo', ProductVersion: '1.0.0' });
|
|
58
|
+
|
|
59
|
+
console.log(fable.Dates.dateSecondDifference('2024-01-01 00:00:00', '2024-01-01 00:01:30'));
|
|
48
60
|
// Returns: 90
|
|
49
61
|
```
|
|
50
62
|
|
|
51
63
|
### Minutes
|
|
52
64
|
|
|
53
65
|
```javascript
|
|
54
|
-
|
|
66
|
+
const libFable = require('fable');
|
|
67
|
+
const fable = new libFable({ Product: 'DatesDemo', ProductVersion: '1.0.0' });
|
|
68
|
+
|
|
69
|
+
console.log(fable.Dates.dateMinuteDifference('2024-01-01 00:00', '2024-01-01 02:30'));
|
|
55
70
|
// Returns: 150
|
|
56
71
|
```
|
|
57
72
|
|
|
58
73
|
### Hours
|
|
59
74
|
|
|
60
75
|
```javascript
|
|
61
|
-
|
|
76
|
+
const libFable = require('fable');
|
|
77
|
+
const fable = new libFable({ Product: 'DatesDemo', ProductVersion: '1.0.0' });
|
|
78
|
+
|
|
79
|
+
console.log(fable.Dates.dateHourDifference('2024-01-01', '2024-01-02'));
|
|
62
80
|
// Returns: 24
|
|
63
81
|
```
|
|
64
82
|
|
|
65
83
|
### Days
|
|
66
84
|
|
|
67
85
|
```javascript
|
|
68
|
-
|
|
86
|
+
const libFable = require('fable');
|
|
87
|
+
const fable = new libFable({ Product: 'DatesDemo', ProductVersion: '1.0.0' });
|
|
88
|
+
|
|
89
|
+
console.log(fable.Dates.dateDayDifference('2024-01-01', '2024-01-15'));
|
|
69
90
|
// Returns: 14
|
|
70
91
|
```
|
|
71
92
|
|
|
72
93
|
### Weeks
|
|
73
94
|
|
|
74
95
|
```javascript
|
|
75
|
-
|
|
96
|
+
const libFable = require('fable');
|
|
97
|
+
const fable = new libFable({ Product: 'DatesDemo', ProductVersion: '1.0.0' });
|
|
98
|
+
|
|
99
|
+
console.log(fable.Dates.dateWeekDifference('2024-01-01', '2024-02-01'));
|
|
76
100
|
// Returns: 4
|
|
77
101
|
```
|
|
78
102
|
|
|
79
103
|
### Months
|
|
80
104
|
|
|
81
105
|
```javascript
|
|
82
|
-
|
|
106
|
+
const libFable = require('fable');
|
|
107
|
+
const fable = new libFable({ Product: 'DatesDemo', ProductVersion: '1.0.0' });
|
|
108
|
+
|
|
109
|
+
console.log(fable.Dates.dateMonthDifference('2024-01-01', '2024-06-01'));
|
|
83
110
|
// Returns: 5
|
|
84
111
|
```
|
|
85
112
|
|
|
86
113
|
### Years
|
|
87
114
|
|
|
88
115
|
```javascript
|
|
89
|
-
|
|
116
|
+
const libFable = require('fable');
|
|
117
|
+
const fable = new libFable({ Product: 'DatesDemo', ProductVersion: '1.0.0' });
|
|
118
|
+
|
|
119
|
+
console.log(fable.Dates.dateYearDifference('2020-01-01', '2024-01-01'));
|
|
90
120
|
// Returns: 4
|
|
91
121
|
```
|
|
92
122
|
|
|
@@ -95,8 +125,11 @@ fable.Dates.dateYearDifference('2020-01-01', '2024-01-01');
|
|
|
95
125
|
All difference methods accept an optional third parameter to require the end date:
|
|
96
126
|
|
|
97
127
|
```javascript
|
|
128
|
+
const libFable = require('fable');
|
|
129
|
+
const fable = new libFable({ Product: 'DatesDemo', ProductVersion: '1.0.0' });
|
|
130
|
+
|
|
98
131
|
// Returns NaN if end date is not provided
|
|
99
|
-
fable.Dates.dateDayDifference('2024-01-01', null, true); // Returns NaN
|
|
132
|
+
console.log(fable.Dates.dateDayDifference('2024-01-01', null, true)); // Returns NaN
|
|
100
133
|
```
|
|
101
134
|
|
|
102
135
|
## Date Addition Methods
|
|
@@ -104,68 +137,95 @@ fable.Dates.dateDayDifference('2024-01-01', null, true); // Returns NaN
|
|
|
104
137
|
### Add Milliseconds
|
|
105
138
|
|
|
106
139
|
```javascript
|
|
107
|
-
|
|
140
|
+
const libFable = require('fable');
|
|
141
|
+
const fable = new libFable({ Product: 'DatesDemo', ProductVersion: '1.0.0' });
|
|
142
|
+
|
|
143
|
+
console.log(fable.Dates.dateAddMilliseconds('2024-01-01T00:00:00.000Z', 5000));
|
|
108
144
|
// Returns: '2024-01-01T00:00:05.000Z'
|
|
109
145
|
```
|
|
110
146
|
|
|
111
147
|
### Add Seconds
|
|
112
148
|
|
|
113
149
|
```javascript
|
|
114
|
-
|
|
150
|
+
const libFable = require('fable');
|
|
151
|
+
const fable = new libFable({ Product: 'DatesDemo', ProductVersion: '1.0.0' });
|
|
152
|
+
|
|
153
|
+
console.log(fable.Dates.dateAddSeconds('2024-01-01T00:00:00.000Z', 30));
|
|
115
154
|
// Returns: '2024-01-01T00:00:30.000Z'
|
|
116
155
|
```
|
|
117
156
|
|
|
118
157
|
### Add Minutes
|
|
119
158
|
|
|
120
159
|
```javascript
|
|
121
|
-
|
|
160
|
+
const libFable = require('fable');
|
|
161
|
+
const fable = new libFable({ Product: 'DatesDemo', ProductVersion: '1.0.0' });
|
|
162
|
+
|
|
163
|
+
console.log(fable.Dates.dateAddMinutes('2024-01-01T00:00:00.000Z', 45));
|
|
122
164
|
// Returns: '2024-01-01T00:45:00.000Z'
|
|
123
165
|
```
|
|
124
166
|
|
|
125
167
|
### Add Hours
|
|
126
168
|
|
|
127
169
|
```javascript
|
|
128
|
-
|
|
170
|
+
const libFable = require('fable');
|
|
171
|
+
const fable = new libFable({ Product: 'DatesDemo', ProductVersion: '1.0.0' });
|
|
172
|
+
|
|
173
|
+
console.log(fable.Dates.dateAddHours('2024-01-01T00:00:00.000Z', 3));
|
|
129
174
|
// Returns: '2024-01-01T03:00:00.000Z'
|
|
130
175
|
```
|
|
131
176
|
|
|
132
177
|
### Add Days
|
|
133
178
|
|
|
134
179
|
```javascript
|
|
135
|
-
|
|
180
|
+
const libFable = require('fable');
|
|
181
|
+
const fable = new libFable({ Product: 'DatesDemo', ProductVersion: '1.0.0' });
|
|
182
|
+
|
|
183
|
+
console.log(fable.Dates.dateAddDays('2024-01-01', 10));
|
|
136
184
|
// Returns: '2024-01-11T00:00:00.000Z'
|
|
137
185
|
```
|
|
138
186
|
|
|
139
187
|
### Add Weeks
|
|
140
188
|
|
|
141
189
|
```javascript
|
|
142
|
-
|
|
190
|
+
const libFable = require('fable');
|
|
191
|
+
const fable = new libFable({ Product: 'DatesDemo', ProductVersion: '1.0.0' });
|
|
192
|
+
|
|
193
|
+
console.log(fable.Dates.dateAddWeeks('2024-01-01', 2));
|
|
143
194
|
// Returns: '2024-01-15T00:00:00.000Z'
|
|
144
195
|
```
|
|
145
196
|
|
|
146
197
|
### Add Months
|
|
147
198
|
|
|
148
199
|
```javascript
|
|
149
|
-
|
|
200
|
+
const libFable = require('fable');
|
|
201
|
+
const fable = new libFable({ Product: 'DatesDemo', ProductVersion: '1.0.0' });
|
|
202
|
+
|
|
203
|
+
console.log(fable.Dates.dateAddMonths('2024-01-15', 3));
|
|
150
204
|
// Returns: '2024-04-15T00:00:00.000Z'
|
|
151
205
|
```
|
|
152
206
|
|
|
153
207
|
### Add Years
|
|
154
208
|
|
|
155
209
|
```javascript
|
|
156
|
-
|
|
210
|
+
const libFable = require('fable');
|
|
211
|
+
const fable = new libFable({ Product: 'DatesDemo', ProductVersion: '1.0.0' });
|
|
212
|
+
|
|
213
|
+
console.log(fable.Dates.dateAddYears('2024-01-01', 5));
|
|
157
214
|
// Returns: '2029-01-01T00:00:00.000Z'
|
|
158
215
|
```
|
|
159
216
|
|
|
160
217
|
## Generic Date Math
|
|
161
218
|
|
|
162
219
|
```javascript
|
|
220
|
+
const libFable = require('fable');
|
|
221
|
+
const fable = new libFable({ Product: 'DatesDemo', ProductVersion: '1.0.0' });
|
|
222
|
+
|
|
163
223
|
// Add operation
|
|
164
|
-
fable.Dates.dateMath('2024-01-01', 5, 'day', 'add');
|
|
224
|
+
console.log(fable.Dates.dateMath('2024-01-01', 5, 'day', 'add'));
|
|
165
225
|
// Returns: '2024-01-06T00:00:00.000Z'
|
|
166
226
|
|
|
167
227
|
// Subtract operation
|
|
168
|
-
fable.Dates.dateMath('2024-01-15', 10, 'day', 'subtract');
|
|
228
|
+
console.log(fable.Dates.dateMath('2024-01-15', 10, 'day', 'subtract'));
|
|
169
229
|
// Returns: '2024-01-05T00:00:00.000Z'
|
|
170
230
|
|
|
171
231
|
// Valid units: 'millisecond', 'second', 'minute', 'hour', 'day', 'week', 'month', 'year'
|
|
@@ -174,8 +234,11 @@ fable.Dates.dateMath('2024-01-15', 10, 'day', 'subtract');
|
|
|
174
234
|
## Create Date from Parts
|
|
175
235
|
|
|
176
236
|
```javascript
|
|
177
|
-
|
|
178
|
-
fable
|
|
237
|
+
const libFable = require('fable');
|
|
238
|
+
const fable = new libFable({ Product: 'DatesDemo', ProductVersion: '1.0.0' });
|
|
239
|
+
|
|
240
|
+
console.log(fable.Dates.dateFromParts(2024, 6, 15)); // June 15, 2024
|
|
241
|
+
console.log(fable.Dates.dateFromParts(2024, 6, 15, 14, 30, 0, 0)); // June 15, 2024 2:30 PM
|
|
179
242
|
// Returns: ISO string like '2024-06-15T14:30:00.000Z'
|
|
180
243
|
```
|
|
181
244
|
|
|
@@ -184,23 +247,26 @@ fable.Dates.dateFromParts(2024, 6, 15, 14, 30, 0, 0); // June 15, 2024 2:30
|
|
|
184
247
|
For more complex operations, use the day.js library directly:
|
|
185
248
|
|
|
186
249
|
```javascript
|
|
250
|
+
const libFable = require('fable');
|
|
251
|
+
const fable = new libFable({ Product: 'DatesDemo', ProductVersion: '1.0.0' });
|
|
252
|
+
|
|
187
253
|
const dayjs = fable.Dates.dayJS;
|
|
188
254
|
|
|
189
255
|
// Format dates
|
|
190
|
-
dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
256
|
+
console.log('Formatted now:', dayjs().format('YYYY-MM-DD HH:mm:ss'));
|
|
191
257
|
|
|
192
258
|
// Relative time
|
|
193
|
-
dayjs('2024-01-01').fromNow();
|
|
259
|
+
console.log('fromNow:', dayjs('2024-01-01').fromNow());
|
|
194
260
|
|
|
195
261
|
// Timezone support
|
|
196
|
-
dayjs().tz('America/New_York');
|
|
262
|
+
console.log('NY time:', dayjs().tz('America/New_York').format('YYYY-MM-DD HH:mm:ss z'));
|
|
197
263
|
|
|
198
264
|
// Week operations
|
|
199
|
-
dayjs().week();
|
|
200
|
-
dayjs().isoWeek();
|
|
265
|
+
console.log('Week of year:', dayjs().week());
|
|
266
|
+
console.log('ISO week:', dayjs().isoWeek());
|
|
201
267
|
|
|
202
268
|
// UTC mode
|
|
203
|
-
dayjs.utc('2024-01-01');
|
|
269
|
+
console.log('UTC date:', dayjs.utc('2024-01-01').toISOString());
|
|
204
270
|
```
|
|
205
271
|
|
|
206
272
|
## Adding Locales
|
|
@@ -208,9 +274,10 @@ dayjs.utc('2024-01-01');
|
|
|
208
274
|
Day.js supports localization. You can add locales as needed:
|
|
209
275
|
|
|
210
276
|
```javascript
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
fable.Dates.dayJS().format('MMMM'); //
|
|
277
|
+
// Node.js reference — requires loading dayjs locale packages which are not bundled in the browser playground.
|
|
278
|
+
console.info("In Node.js:");
|
|
279
|
+
console.info(" const localeDE = require('dayjs/locale/de');");
|
|
280
|
+
console.info(" fable.Dates.dayJS.locale('de');");
|
|
281
|
+
console.info(" fable.Dates.dayJS().format('MMMM'); // -> 'Januar'");
|
|
216
282
|
```
|
|
283
|
+
|
|
@@ -5,8 +5,11 @@ The EnvironmentData service identifies the runtime environment (Node.js or brows
|
|
|
5
5
|
## Access
|
|
6
6
|
|
|
7
7
|
```javascript
|
|
8
|
+
const libFable = require('fable');
|
|
9
|
+
const fable = new libFable({ Product: 'EnvironmentDataDemo', ProductVersion: '1.0.0' });
|
|
10
|
+
|
|
8
11
|
// Auto-instantiated, available directly
|
|
9
|
-
fable.EnvironmentData
|
|
12
|
+
console.log('fable.EnvironmentData:', fable.EnvironmentData);
|
|
10
13
|
```
|
|
11
14
|
|
|
12
15
|
## Available Properties
|
|
@@ -14,7 +17,10 @@ fable.EnvironmentData
|
|
|
14
17
|
### Environment
|
|
15
18
|
|
|
16
19
|
```javascript
|
|
17
|
-
fable
|
|
20
|
+
const libFable = require('fable');
|
|
21
|
+
const fable = new libFable({ Product: 'EnvironmentDataDemo', ProductVersion: '1.0.0' });
|
|
22
|
+
|
|
23
|
+
console.log('Environment:', fable.EnvironmentData.Environment);
|
|
18
24
|
// Returns 'node.js' in Node.js
|
|
19
25
|
// Returns 'web' in the browser
|
|
20
26
|
```
|
|
@@ -31,10 +37,15 @@ Fable automatically uses the appropriate implementation:
|
|
|
31
37
|
### Environment-Specific Behavior
|
|
32
38
|
|
|
33
39
|
```javascript
|
|
40
|
+
const libFable = require('fable');
|
|
41
|
+
const fable = new libFable({ Product: 'EnvironmentDataDemo', ProductVersion: '1.0.0' });
|
|
42
|
+
|
|
34
43
|
if (fable.EnvironmentData.Environment === 'node.js') {
|
|
35
44
|
// Node.js-specific code (e.g., file system access)
|
|
45
|
+
console.log('Running in Node.js — file system access available');
|
|
36
46
|
} else {
|
|
37
47
|
// Browser-specific code (e.g., DOM manipulation)
|
|
48
|
+
console.log('Running in browser — Environment is:', fable.EnvironmentData.Environment);
|
|
38
49
|
}
|
|
39
50
|
```
|
|
40
51
|
|