@nodetool-ai/base-nodes 0.7.0-rc.22 → 0.8.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.
- package/README.md +21 -0
- package/dist/.nodetool-build-stamp +1 -0
- package/dist/index.d.ts +61 -67
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +179 -173
- package/dist/index.js.map +1 -1
- package/dist/platforms/browser.d.ts +19 -0
- package/dist/platforms/browser.d.ts.map +1 -0
- package/dist/platforms/browser.js +29 -0
- package/dist/platforms/browser.js.map +1 -0
- package/package.json +53 -65
- package/dist/lib/audio-wav.d.ts +0 -66
- package/dist/lib/audio-wav.d.ts.map +0 -1
- package/dist/lib/audio-wav.js +0 -215
- package/dist/lib/audio-wav.js.map +0 -1
- package/dist/nodes/agent-tool-hydration.d.ts +0 -10
- package/dist/nodes/agent-tool-hydration.d.ts.map +0 -1
- package/dist/nodes/agent-tool-hydration.js +0 -43
- package/dist/nodes/agent-tool-hydration.js.map +0 -1
- package/dist/nodes/agents.d.ts +0 -262
- package/dist/nodes/agents.d.ts.map +0 -1
- package/dist/nodes/agents.js +0 -2856
- package/dist/nodes/agents.js.map +0 -1
- package/dist/nodes/anthropic.d.ts +0 -26
- package/dist/nodes/anthropic.d.ts.map +0 -1
- package/dist/nodes/anthropic.js +0 -133
- package/dist/nodes/anthropic.js.map +0 -1
- package/dist/nodes/apify.d.ts +0 -120
- package/dist/nodes/apify.d.ts.map +0 -1
- package/dist/nodes/apify.js +0 -618
- package/dist/nodes/apify.js.map +0 -1
- package/dist/nodes/audio.d.ts +0 -301
- package/dist/nodes/audio.d.ts.map +0 -1
- package/dist/nodes/audio.js +0 -1274
- package/dist/nodes/audio.js.map +0 -1
- package/dist/nodes/code-node.d.ts +0 -34
- package/dist/nodes/code-node.d.ts.map +0 -1
- package/dist/nodes/code-node.js +0 -343
- package/dist/nodes/code-node.js.map +0 -1
- package/dist/nodes/code.d.ts +0 -301
- package/dist/nodes/code.d.ts.map +0 -1
- package/dist/nodes/code.js +0 -850
- package/dist/nodes/code.js.map +0 -1
- package/dist/nodes/compare.d.ts +0 -18
- package/dist/nodes/compare.d.ts.map +0 -1
- package/dist/nodes/compare.js +0 -122
- package/dist/nodes/compare.js.map +0 -1
- package/dist/nodes/constant.d.ts +0 -315
- package/dist/nodes/constant.d.ts.map +0 -1
- package/dist/nodes/constant.js +0 -715
- package/dist/nodes/constant.js.map +0 -1
- package/dist/nodes/control.d.ts +0 -83
- package/dist/nodes/control.d.ts.map +0 -1
- package/dist/nodes/control.js +0 -212
- package/dist/nodes/control.js.map +0 -1
- package/dist/nodes/data.d.ts +0 -369
- package/dist/nodes/data.d.ts.map +0 -1
- package/dist/nodes/data.js +0 -1590
- package/dist/nodes/data.js.map +0 -1
- package/dist/nodes/document.d.ts +0 -134
- package/dist/nodes/document.d.ts.map +0 -1
- package/dist/nodes/document.js +0 -984
- package/dist/nodes/document.js.map +0 -1
- package/dist/nodes/extended-placeholders.d.ts +0 -6
- package/dist/nodes/extended-placeholders.d.ts.map +0 -1
- package/dist/nodes/extended-placeholders.js +0 -19
- package/dist/nodes/extended-placeholders.js.map +0 -1
- package/dist/nodes/gemini.d.ts +0 -110
- package/dist/nodes/gemini.d.ts.map +0 -1
- package/dist/nodes/gemini.js +0 -871
- package/dist/nodes/gemini.js.map +0 -1
- package/dist/nodes/generators.d.ts +0 -84
- package/dist/nodes/generators.d.ts.map +0 -1
- package/dist/nodes/generators.js +0 -968
- package/dist/nodes/generators.js.map +0 -1
- package/dist/nodes/image.d.ts +0 -232
- package/dist/nodes/image.d.ts.map +0 -1
- package/dist/nodes/image.js +0 -1395
- package/dist/nodes/image.js.map +0 -1
- package/dist/nodes/input.d.ts +0 -445
- package/dist/nodes/input.d.ts.map +0 -1
- package/dist/nodes/input.js +0 -1459
- package/dist/nodes/input.js.map +0 -1
- package/dist/nodes/kie-dynamic.d.ts +0 -31
- package/dist/nodes/kie-dynamic.d.ts.map +0 -1
- package/dist/nodes/kie-dynamic.js +0 -270
- package/dist/nodes/kie-dynamic.js.map +0 -1
- package/dist/nodes/lib-audio-dsp.d.ts +0 -85
- package/dist/nodes/lib-audio-dsp.d.ts.map +0 -1
- package/dist/nodes/lib-audio-dsp.js +0 -450
- package/dist/nodes/lib-audio-dsp.js.map +0 -1
- package/dist/nodes/lib-audio-effects.d.ts +0 -116
- package/dist/nodes/lib-audio-effects.d.ts.map +0 -1
- package/dist/nodes/lib-audio-effects.js +0 -905
- package/dist/nodes/lib-audio-effects.js.map +0 -1
- package/dist/nodes/lib-browser.d.ts +0 -99
- package/dist/nodes/lib-browser.d.ts.map +0 -1
- package/dist/nodes/lib-browser.js +0 -692
- package/dist/nodes/lib-browser.js.map +0 -1
- package/dist/nodes/lib-charts.d.ts +0 -20
- package/dist/nodes/lib-charts.d.ts.map +0 -1
- package/dist/nodes/lib-charts.js +0 -245
- package/dist/nodes/lib-charts.js.map +0 -1
- package/dist/nodes/lib-datetime.d.ts +0 -108
- package/dist/nodes/lib-datetime.d.ts.map +0 -1
- package/dist/nodes/lib-datetime.js +0 -421
- package/dist/nodes/lib-datetime.js.map +0 -1
- package/dist/nodes/lib-doc-convert.d.ts +0 -19
- package/dist/nodes/lib-doc-convert.d.ts.map +0 -1
- package/dist/nodes/lib-doc-convert.js +0 -257
- package/dist/nodes/lib-doc-convert.js.map +0 -1
- package/dist/nodes/lib-doc-transform.d.ts +0 -39
- package/dist/nodes/lib-doc-transform.d.ts.map +0 -1
- package/dist/nodes/lib-doc-transform.js +0 -335
- package/dist/nodes/lib-doc-transform.js.map +0 -1
- package/dist/nodes/lib-docx.d.ts +0 -106
- package/dist/nodes/lib-docx.d.ts.map +0 -1
- package/dist/nodes/lib-docx.js +0 -595
- package/dist/nodes/lib-docx.js.map +0 -1
- package/dist/nodes/lib-epub.d.ts +0 -55
- package/dist/nodes/lib-epub.d.ts.map +0 -1
- package/dist/nodes/lib-epub.js +0 -220
- package/dist/nodes/lib-epub.js.map +0 -1
- package/dist/nodes/lib-excel.d.ts +0 -74
- package/dist/nodes/lib-excel.d.ts.map +0 -1
- package/dist/nodes/lib-excel.js +0 -448
- package/dist/nodes/lib-excel.js.map +0 -1
- package/dist/nodes/lib-graphql.d.ts +0 -66
- package/dist/nodes/lib-graphql.d.ts.map +0 -1
- package/dist/nodes/lib-graphql.js +0 -333
- package/dist/nodes/lib-graphql.js.map +0 -1
- package/dist/nodes/lib-grid.d.ts +0 -27
- package/dist/nodes/lib-grid.d.ts.map +0 -1
- package/dist/nodes/lib-grid.js +0 -172
- package/dist/nodes/lib-grid.js.map +0 -1
- package/dist/nodes/lib-html-parse.d.ts +0 -108
- package/dist/nodes/lib-html-parse.d.ts.map +0 -1
- package/dist/nodes/lib-html-parse.js +0 -365
- package/dist/nodes/lib-html-parse.js.map +0 -1
- package/dist/nodes/lib-http.d.ts +0 -98
- package/dist/nodes/lib-http.d.ts.map +0 -1
- package/dist/nodes/lib-http.js +0 -267
- package/dist/nodes/lib-http.js.map +0 -1
- package/dist/nodes/lib-image-color-grading.d.ts +0 -3
- package/dist/nodes/lib-image-color-grading.d.ts.map +0 -1
- package/dist/nodes/lib-image-color-grading.js +0 -1386
- package/dist/nodes/lib-image-color-grading.js.map +0 -1
- package/dist/nodes/lib-image-draw.d.ts +0 -3
- package/dist/nodes/lib-image-draw.d.ts.map +0 -1
- package/dist/nodes/lib-image-draw.js +0 -470
- package/dist/nodes/lib-image-draw.js.map +0 -1
- package/dist/nodes/lib-image-enhance.d.ts +0 -3
- package/dist/nodes/lib-image-enhance.d.ts.map +0 -1
- package/dist/nodes/lib-image-enhance.js +0 -731
- package/dist/nodes/lib-image-enhance.js.map +0 -1
- package/dist/nodes/lib-image-filter.d.ts +0 -3
- package/dist/nodes/lib-image-filter.d.ts.map +0 -1
- package/dist/nodes/lib-image-filter.js +0 -684
- package/dist/nodes/lib-image-filter.js.map +0 -1
- package/dist/nodes/lib-image-utils.d.ts +0 -24
- package/dist/nodes/lib-image-utils.d.ts.map +0 -1
- package/dist/nodes/lib-image-utils.js +0 -150
- package/dist/nodes/lib-image-utils.js.map +0 -1
- package/dist/nodes/lib-mail.d.ts +0 -74
- package/dist/nodes/lib-mail.d.ts.map +0 -1
- package/dist/nodes/lib-mail.js +0 -452
- package/dist/nodes/lib-mail.js.map +0 -1
- package/dist/nodes/lib-markdown.d.ts +0 -70
- package/dist/nodes/lib-markdown.d.ts.map +0 -1
- package/dist/nodes/lib-markdown.js +0 -236
- package/dist/nodes/lib-markdown.js.map +0 -1
- package/dist/nodes/lib-nlp.d.ts +0 -98
- package/dist/nodes/lib-nlp.d.ts.map +0 -1
- package/dist/nodes/lib-nlp.js +0 -374
- package/dist/nodes/lib-nlp.js.map +0 -1
- package/dist/nodes/lib-notion.d.ts +0 -99
- package/dist/nodes/lib-notion.d.ts.map +0 -1
- package/dist/nodes/lib-notion.js +0 -601
- package/dist/nodes/lib-notion.js.map +0 -1
- package/dist/nodes/lib-ocr.d.ts +0 -31
- package/dist/nodes/lib-ocr.d.ts.map +0 -1
- package/dist/nodes/lib-ocr.js +0 -143
- package/dist/nodes/lib-ocr.js.map +0 -1
- package/dist/nodes/lib-os.d.ts +0 -312
- package/dist/nodes/lib-os.d.ts.map +0 -1
- package/dist/nodes/lib-os.js +0 -909
- package/dist/nodes/lib-os.js.map +0 -1
- package/dist/nodes/lib-pdf.d.ts +0 -142
- package/dist/nodes/lib-pdf.d.ts.map +0 -1
- package/dist/nodes/lib-pdf.js +0 -871
- package/dist/nodes/lib-pdf.js.map +0 -1
- package/dist/nodes/lib-pptx.d.ts +0 -29
- package/dist/nodes/lib-pptx.d.ts.map +0 -1
- package/dist/nodes/lib-pptx.js +0 -122
- package/dist/nodes/lib-pptx.js.map +0 -1
- package/dist/nodes/lib-rss.d.ts +0 -31
- package/dist/nodes/lib-rss.d.ts.map +0 -1
- package/dist/nodes/lib-rss.js +0 -163
- package/dist/nodes/lib-rss.js.map +0 -1
- package/dist/nodes/lib-s3.d.ts +0 -112
- package/dist/nodes/lib-s3.d.ts.map +0 -1
- package/dist/nodes/lib-s3.js +0 -521
- package/dist/nodes/lib-s3.js.map +0 -1
- package/dist/nodes/lib-secret.d.ts +0 -15
- package/dist/nodes/lib-secret.d.ts.map +0 -1
- package/dist/nodes/lib-secret.js +0 -42
- package/dist/nodes/lib-secret.js.map +0 -1
- package/dist/nodes/lib-sqlite.d.ts +0 -102
- package/dist/nodes/lib-sqlite.d.ts.map +0 -1
- package/dist/nodes/lib-sqlite.js +0 -532
- package/dist/nodes/lib-sqlite.js.map +0 -1
- package/dist/nodes/lib-supabase.d.ts +0 -86
- package/dist/nodes/lib-supabase.d.ts.map +0 -1
- package/dist/nodes/lib-supabase.js +0 -425
- package/dist/nodes/lib-supabase.js.map +0 -1
- package/dist/nodes/lib-svg.d.ts +0 -199
- package/dist/nodes/lib-svg.d.ts.map +0 -1
- package/dist/nodes/lib-svg.js +0 -1027
- package/dist/nodes/lib-svg.js.map +0 -1
- package/dist/nodes/lib-tensorflow.d.ts +0 -71
- package/dist/nodes/lib-tensorflow.d.ts.map +0 -1
- package/dist/nodes/lib-tensorflow.js +0 -351
- package/dist/nodes/lib-tensorflow.js.map +0 -1
- package/dist/nodes/lib-twilio.d.ts +0 -71
- package/dist/nodes/lib-twilio.d.ts.map +0 -1
- package/dist/nodes/lib-twilio.js +0 -469
- package/dist/nodes/lib-twilio.js.map +0 -1
- package/dist/nodes/lib-validate.d.ts +0 -84
- package/dist/nodes/lib-validate.d.ts.map +0 -1
- package/dist/nodes/lib-validate.js +0 -215
- package/dist/nodes/lib-validate.js.map +0 -1
- package/dist/nodes/lib-video-download.d.ts +0 -26
- package/dist/nodes/lib-video-download.d.ts.map +0 -1
- package/dist/nodes/lib-video-download.js +0 -299
- package/dist/nodes/lib-video-download.js.map +0 -1
- package/dist/nodes/messaging.d.ts +0 -88
- package/dist/nodes/messaging.d.ts.map +0 -1
- package/dist/nodes/messaging.js +0 -418
- package/dist/nodes/messaging.js.map +0 -1
- package/dist/nodes/mistral.d.ts +0 -83
- package/dist/nodes/mistral.d.ts.map +0 -1
- package/dist/nodes/mistral.js +0 -450
- package/dist/nodes/mistral.js.map +0 -1
- package/dist/nodes/model3d/analysis.d.ts +0 -13
- package/dist/nodes/model3d/analysis.d.ts.map +0 -1
- package/dist/nodes/model3d/analysis.js +0 -36
- package/dist/nodes/model3d/analysis.js.map +0 -1
- package/dist/nodes/model3d/base.d.ts +0 -11
- package/dist/nodes/model3d/base.d.ts.map +0 -1
- package/dist/nodes/model3d/base.js +0 -20
- package/dist/nodes/model3d/base.js.map +0 -1
- package/dist/nodes/model3d/boolean-ops.d.ts +0 -2
- package/dist/nodes/model3d/boolean-ops.d.ts.map +0 -1
- package/dist/nodes/model3d/boolean-ops.js +0 -172
- package/dist/nodes/model3d/boolean-ops.js.map +0 -1
- package/dist/nodes/model3d/cleanup.d.ts +0 -47
- package/dist/nodes/model3d/cleanup.d.ts.map +0 -1
- package/dist/nodes/model3d/cleanup.js +0 -136
- package/dist/nodes/model3d/cleanup.js.map +0 -1
- package/dist/nodes/model3d/convert.d.ts +0 -14
- package/dist/nodes/model3d/convert.d.ts.map +0 -1
- package/dist/nodes/model3d/convert.js +0 -64
- package/dist/nodes/model3d/convert.js.map +0 -1
- package/dist/nodes/model3d/defaults.d.ts +0 -34
- package/dist/nodes/model3d/defaults.d.ts.map +0 -1
- package/dist/nodes/model3d/defaults.js +0 -28
- package/dist/nodes/model3d/defaults.js.map +0 -1
- package/dist/nodes/model3d/document-ops.d.ts +0 -4
- package/dist/nodes/model3d/document-ops.d.ts.map +0 -1
- package/dist/nodes/model3d/document-ops.js +0 -40
- package/dist/nodes/model3d/document-ops.js.map +0 -1
- package/dist/nodes/model3d/generation.d.ts +0 -39
- package/dist/nodes/model3d/generation.d.ts.map +0 -1
- package/dist/nodes/model3d/generation.js +0 -179
- package/dist/nodes/model3d/generation.js.map +0 -1
- package/dist/nodes/model3d/glb.d.ts +0 -29
- package/dist/nodes/model3d/glb.d.ts.map +0 -1
- package/dist/nodes/model3d/glb.js +0 -255
- package/dist/nodes/model3d/glb.js.map +0 -1
- package/dist/nodes/model3d/index.d.ts +0 -20
- package/dist/nodes/model3d/index.d.ts.map +0 -1
- package/dist/nodes/model3d/index.js +0 -38
- package/dist/nodes/model3d/index.js.map +0 -1
- package/dist/nodes/model3d/io.d.ts +0 -38
- package/dist/nodes/model3d/io.d.ts.map +0 -1
- package/dist/nodes/model3d/io.js +0 -162
- package/dist/nodes/model3d/io.js.map +0 -1
- package/dist/nodes/model3d/mesh-ops.d.ts +0 -40
- package/dist/nodes/model3d/mesh-ops.d.ts.map +0 -1
- package/dist/nodes/model3d/mesh-ops.js +0 -775
- package/dist/nodes/model3d/mesh-ops.js.map +0 -1
- package/dist/nodes/model3d/nodes.d.ts +0 -2
- package/dist/nodes/model3d/nodes.d.ts.map +0 -1
- package/dist/nodes/model3d/nodes.js +0 -2
- package/dist/nodes/model3d/nodes.js.map +0 -1
- package/dist/nodes/model3d/ops.d.ts +0 -37
- package/dist/nodes/model3d/ops.d.ts.map +0 -1
- package/dist/nodes/model3d/ops.js +0 -137
- package/dist/nodes/model3d/ops.js.map +0 -1
- package/dist/nodes/model3d/transforms.d.ts +0 -49
- package/dist/nodes/model3d/transforms.d.ts.map +0 -1
- package/dist/nodes/model3d/transforms.js +0 -142
- package/dist/nodes/model3d/transforms.js.map +0 -1
- package/dist/nodes/model3d/types.d.ts +0 -81
- package/dist/nodes/model3d/types.d.ts.map +0 -1
- package/dist/nodes/model3d/types.js +0 -2
- package/dist/nodes/model3d/types.js.map +0 -1
- package/dist/nodes/model3d/utils.d.ts +0 -34
- package/dist/nodes/model3d/utils.d.ts.map +0 -1
- package/dist/nodes/model3d/utils.js +0 -185
- package/dist/nodes/model3d/utils.js.map +0 -1
- package/dist/nodes/model3d.d.ts +0 -2
- package/dist/nodes/model3d.d.ts.map +0 -1
- package/dist/nodes/model3d.js +0 -2
- package/dist/nodes/model3d.js.map +0 -1
- package/dist/nodes/openai.d.ts +0 -172
- package/dist/nodes/openai.d.ts.map +0 -1
- package/dist/nodes/openai.js +0 -1294
- package/dist/nodes/openai.js.map +0 -1
- package/dist/nodes/output.d.ts +0 -29
- package/dist/nodes/output.d.ts.map +0 -1
- package/dist/nodes/output.js +0 -87
- package/dist/nodes/output.js.map +0 -1
- package/dist/nodes/sandbox.d.ts +0 -63
- package/dist/nodes/sandbox.d.ts.map +0 -1
- package/dist/nodes/sandbox.js +0 -633
- package/dist/nodes/sandbox.js.map +0 -1
- package/dist/nodes/search.d.ts +0 -117
- package/dist/nodes/search.d.ts.map +0 -1
- package/dist/nodes/search.js +0 -607
- package/dist/nodes/search.js.map +0 -1
- package/dist/nodes/team.d.ts +0 -74
- package/dist/nodes/team.d.ts.map +0 -1
- package/dist/nodes/team.js +0 -309
- package/dist/nodes/team.js.map +0 -1
- package/dist/nodes/text-extra.d.ts +0 -633
- package/dist/nodes/text-extra.d.ts.map +0 -1
- package/dist/nodes/text-extra.js +0 -2226
- package/dist/nodes/text-extra.js.map +0 -1
- package/dist/nodes/tool-agents.d.ts +0 -334
- package/dist/nodes/tool-agents.d.ts.map +0 -1
- package/dist/nodes/tool-agents.js +0 -1861
- package/dist/nodes/tool-agents.js.map +0 -1
- package/dist/nodes/triggers.d.ts +0 -107
- package/dist/nodes/triggers.d.ts.map +0 -1
- package/dist/nodes/triggers.js +0 -706
- package/dist/nodes/triggers.js.map +0 -1
- package/dist/nodes/vector.d.ts +0 -168
- package/dist/nodes/vector.d.ts.map +0 -1
- package/dist/nodes/vector.js +0 -1121
- package/dist/nodes/vector.js.map +0 -1
- package/dist/nodes/video.d.ts +0 -387
- package/dist/nodes/video.d.ts.map +0 -1
- package/dist/nodes/video.js +0 -2383
- package/dist/nodes/video.js.map +0 -1
- package/dist/nodes/workflow.d.ts +0 -24
- package/dist/nodes/workflow.d.ts.map +0 -1
- package/dist/nodes/workflow.js +0 -146
- package/dist/nodes/workflow.js.map +0 -1
- package/dist/nodes/workspace.d.ts +0 -203
- package/dist/nodes/workspace.d.ts.map +0 -1
- package/dist/nodes/workspace.js +0 -795
- package/dist/nodes/workspace.js.map +0 -1
package/dist/nodes/lib-os.js
DELETED
|
@@ -1,909 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { BaseNode, prop } from "@nodetool-ai/node-sdk";
|
|
8
|
-
import { promises as fs } from "node:fs";
|
|
9
|
-
import { existsSync } from "node:fs";
|
|
10
|
-
import os from "node:os";
|
|
11
|
-
import path from "node:path";
|
|
12
|
-
import { spawn } from "node:child_process";
|
|
13
|
-
function expandUser(p) {
|
|
14
|
-
if (!p)
|
|
15
|
-
return p;
|
|
16
|
-
if (p === "~")
|
|
17
|
-
return os.homedir();
|
|
18
|
-
if (p.startsWith("~/"))
|
|
19
|
-
return path.join(os.homedir(), p.slice(2));
|
|
20
|
-
return p;
|
|
21
|
-
}
|
|
22
|
-
function toDateTimeValue(date) {
|
|
23
|
-
const offsetMin = -date.getTimezoneOffset();
|
|
24
|
-
const sign = offsetMin >= 0 ? "+" : "-";
|
|
25
|
-
const abs = Math.abs(offsetMin);
|
|
26
|
-
const hh = String(Math.floor(abs / 60)).padStart(2, "0");
|
|
27
|
-
const mm = String(abs % 60).padStart(2, "0");
|
|
28
|
-
return {
|
|
29
|
-
year: date.getFullYear(),
|
|
30
|
-
month: date.getMonth() + 1,
|
|
31
|
-
day: date.getDate(),
|
|
32
|
-
hour: date.getHours(),
|
|
33
|
-
minute: date.getMinutes(),
|
|
34
|
-
second: date.getSeconds(),
|
|
35
|
-
millisecond: date.getMilliseconds(),
|
|
36
|
-
tzinfo: date.toString().match(/\(([^)]+)\)$/)?.[1] ?? "",
|
|
37
|
-
utc_offset: `${sign}${hh}${mm}`
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
function wildcardToRegExp(pattern, caseSensitive) {
|
|
41
|
-
const escaped = pattern
|
|
42
|
-
.replace(/[.+^${}()|[\]\\]/g, "\\$&")
|
|
43
|
-
.replace(/\*/g, ".*")
|
|
44
|
-
.replace(/\?/g, ".");
|
|
45
|
-
return new RegExp(`^${escaped}$`, caseSensitive ? "" : "i");
|
|
46
|
-
}
|
|
47
|
-
async function walk(dir, recursive) {
|
|
48
|
-
const out = [];
|
|
49
|
-
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
50
|
-
for (const entry of entries) {
|
|
51
|
-
const full = path.join(dir, entry.name);
|
|
52
|
-
out.push(full);
|
|
53
|
-
if (recursive && entry.isDirectory()) {
|
|
54
|
-
out.push(...(await walk(full, recursive)));
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return out;
|
|
58
|
-
}
|
|
59
|
-
function openPath(target) {
|
|
60
|
-
const cmd = process.platform === "darwin"
|
|
61
|
-
? "open"
|
|
62
|
-
: process.platform === "win32"
|
|
63
|
-
? "explorer"
|
|
64
|
-
: "xdg-open";
|
|
65
|
-
return new Promise((resolve, reject) => {
|
|
66
|
-
const child = spawn(cmd, [target], { stdio: "ignore" });
|
|
67
|
-
child.on("error", reject);
|
|
68
|
-
child.on("close", (code) => {
|
|
69
|
-
if (code === 0)
|
|
70
|
-
resolve();
|
|
71
|
-
else
|
|
72
|
-
reject(new Error(`Failed to open path: exit ${code}`));
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
export class WorkspaceDirectoryLibNode extends BaseNode {
|
|
77
|
-
static nodeType = "lib.os.WorkspaceDirectory";
|
|
78
|
-
static title = "Workspace Directory";
|
|
79
|
-
static description = "Get the workspace directory.\n files, workspace, directory";
|
|
80
|
-
static metadataOutputTypes = {
|
|
81
|
-
output: "str"
|
|
82
|
-
};
|
|
83
|
-
async process(context) {
|
|
84
|
-
return { output: context?.workspaceDir ?? "" };
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
export class OpenWorkspaceDirectoryLibNode extends BaseNode {
|
|
88
|
-
static nodeType = "lib.os.OpenWorkspaceDirectory";
|
|
89
|
-
static title = "Open Workspace Directory";
|
|
90
|
-
static description = "Open the workspace directory.\n files, workspace, directory";
|
|
91
|
-
static metadataOutputTypes = {
|
|
92
|
-
output: "none"
|
|
93
|
-
};
|
|
94
|
-
async process(context) {
|
|
95
|
-
const dir = context?.workspaceDir;
|
|
96
|
-
if (!dir)
|
|
97
|
-
return {};
|
|
98
|
-
await openPath(dir);
|
|
99
|
-
return {};
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
export class FileExistsLibNode extends BaseNode {
|
|
103
|
-
static nodeType = "lib.os.FileExists";
|
|
104
|
-
static title = "File Exists";
|
|
105
|
-
static description = "Check if a file or directory exists at the specified path.\n files, check, exists\n\n Use cases:\n - Validate file presence before processing\n - Implement conditional logic based on file existence";
|
|
106
|
-
static metadataOutputTypes = {
|
|
107
|
-
output: "bool"
|
|
108
|
-
};
|
|
109
|
-
async process() {
|
|
110
|
-
const p = String(this.path ?? "");
|
|
111
|
-
if (!p)
|
|
112
|
-
throw new Error("'path' field cannot be empty");
|
|
113
|
-
return { output: existsSync(expandUser(p)) };
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
__decorate([
|
|
117
|
-
prop({
|
|
118
|
-
type: "str",
|
|
119
|
-
default: "",
|
|
120
|
-
title: "Path",
|
|
121
|
-
description: "Path to check for existence"
|
|
122
|
-
})
|
|
123
|
-
], FileExistsLibNode.prototype, "path", void 0);
|
|
124
|
-
export class ListFilesLibNode extends BaseNode {
|
|
125
|
-
static nodeType = "lib.os.ListFiles";
|
|
126
|
-
static title = "List Files";
|
|
127
|
-
static description = "list files in a directory matching a pattern.\n files, list, directory\n\n Use cases:\n - Get files for batch processing\n - Filter files by extension or pattern";
|
|
128
|
-
static metadataOutputTypes = {
|
|
129
|
-
file: "str",
|
|
130
|
-
files: "list"
|
|
131
|
-
};
|
|
132
|
-
static isStreamingOutput = true;
|
|
133
|
-
async process() {
|
|
134
|
-
const folder = expandUser(String(this.folder ?? "~"));
|
|
135
|
-
const pattern = String(this.pattern ?? "*");
|
|
136
|
-
const includeSubdirectories = Boolean(this.include_subdirectories ?? false);
|
|
137
|
-
if (!folder)
|
|
138
|
-
throw new Error("directory cannot be empty");
|
|
139
|
-
const rx = wildcardToRegExp(pattern, true);
|
|
140
|
-
const results = [];
|
|
141
|
-
for (const p of await walk(folder, includeSubdirectories)) {
|
|
142
|
-
if (rx.test(path.basename(p))) {
|
|
143
|
-
results.push(p);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
return {
|
|
147
|
-
file: results[0] ?? "",
|
|
148
|
-
files: results
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
async *genProcess() {
|
|
152
|
-
const folder = expandUser(String(this.folder ?? "~"));
|
|
153
|
-
const pattern = String(this.pattern ?? "*");
|
|
154
|
-
const includeSubdirectories = Boolean(this.include_subdirectories ?? false);
|
|
155
|
-
if (!folder)
|
|
156
|
-
throw new Error("directory cannot be empty");
|
|
157
|
-
const rx = wildcardToRegExp(pattern, true);
|
|
158
|
-
const results = [];
|
|
159
|
-
for (const p of await walk(folder, includeSubdirectories)) {
|
|
160
|
-
if (rx.test(path.basename(p))) {
|
|
161
|
-
results.push(p);
|
|
162
|
-
yield { file: p };
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
yield { files: results };
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
__decorate([
|
|
169
|
-
prop({
|
|
170
|
-
type: "str",
|
|
171
|
-
default: "~",
|
|
172
|
-
title: "Folder",
|
|
173
|
-
description: "Directory to scan"
|
|
174
|
-
})
|
|
175
|
-
], ListFilesLibNode.prototype, "folder", void 0);
|
|
176
|
-
__decorate([
|
|
177
|
-
prop({
|
|
178
|
-
type: "str",
|
|
179
|
-
default: "*",
|
|
180
|
-
title: "Pattern",
|
|
181
|
-
description: "File pattern to match (e.g. *.txt)"
|
|
182
|
-
})
|
|
183
|
-
], ListFilesLibNode.prototype, "pattern", void 0);
|
|
184
|
-
__decorate([
|
|
185
|
-
prop({
|
|
186
|
-
type: "bool",
|
|
187
|
-
default: false,
|
|
188
|
-
title: "Include Subdirectories",
|
|
189
|
-
description: "Search subdirectories"
|
|
190
|
-
})
|
|
191
|
-
], ListFilesLibNode.prototype, "include_subdirectories", void 0);
|
|
192
|
-
export class CopyFileLibNode extends BaseNode {
|
|
193
|
-
static nodeType = "lib.os.CopyFile";
|
|
194
|
-
static title = "Copy File";
|
|
195
|
-
static description = "Copy a file from source to destination path.\n files, copy, manage\n\n Use cases:\n - Create file backups\n - Duplicate files for processing\n - Copy files to new locations";
|
|
196
|
-
static metadataOutputTypes = {
|
|
197
|
-
output: "str"
|
|
198
|
-
};
|
|
199
|
-
async process() {
|
|
200
|
-
const src = expandUser(String(this.source_path ?? ""));
|
|
201
|
-
const dst = expandUser(String(this.destination_path ?? ""));
|
|
202
|
-
if (!src)
|
|
203
|
-
throw new Error("'source_path' field cannot be empty");
|
|
204
|
-
if (!dst)
|
|
205
|
-
throw new Error("'destination_path' field cannot be empty");
|
|
206
|
-
await fs.mkdir(path.dirname(dst), { recursive: true });
|
|
207
|
-
const stat = await fs.stat(src);
|
|
208
|
-
if (stat.isDirectory()) {
|
|
209
|
-
await fs.cp(src, dst, { recursive: true });
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
212
|
-
await fs.copyFile(src, dst);
|
|
213
|
-
}
|
|
214
|
-
return { output: String(this.destination_path ?? "") };
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
__decorate([
|
|
218
|
-
prop({
|
|
219
|
-
type: "str",
|
|
220
|
-
default: "",
|
|
221
|
-
title: "Source Path",
|
|
222
|
-
description: "Source file path"
|
|
223
|
-
})
|
|
224
|
-
], CopyFileLibNode.prototype, "source_path", void 0);
|
|
225
|
-
__decorate([
|
|
226
|
-
prop({
|
|
227
|
-
type: "str",
|
|
228
|
-
default: "",
|
|
229
|
-
title: "Destination Path",
|
|
230
|
-
description: "Destination file path"
|
|
231
|
-
})
|
|
232
|
-
], CopyFileLibNode.prototype, "destination_path", void 0);
|
|
233
|
-
export class MoveFileLibNode extends BaseNode {
|
|
234
|
-
static nodeType = "lib.os.MoveFile";
|
|
235
|
-
static title = "Move File";
|
|
236
|
-
static description = "Move a file from source to destination path.\n files, move, manage\n\n Use cases:\n - Organize files into directories\n - Process and archive files\n - Relocate completed files";
|
|
237
|
-
async process() {
|
|
238
|
-
const src = expandUser(String(this.source_path ?? ""));
|
|
239
|
-
const dst = expandUser(String(this.destination_path ?? ""));
|
|
240
|
-
await fs.mkdir(path.dirname(dst), { recursive: true });
|
|
241
|
-
await fs.rename(src, dst);
|
|
242
|
-
return {};
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
__decorate([
|
|
246
|
-
prop({
|
|
247
|
-
type: "str",
|
|
248
|
-
default: "",
|
|
249
|
-
title: "Source Path",
|
|
250
|
-
description: "Source file path"
|
|
251
|
-
})
|
|
252
|
-
], MoveFileLibNode.prototype, "source_path", void 0);
|
|
253
|
-
__decorate([
|
|
254
|
-
prop({
|
|
255
|
-
type: "str",
|
|
256
|
-
default: "",
|
|
257
|
-
title: "Destination Path",
|
|
258
|
-
description: "Destination file path"
|
|
259
|
-
})
|
|
260
|
-
], MoveFileLibNode.prototype, "destination_path", void 0);
|
|
261
|
-
export class CreateDirectoryLibNode extends BaseNode {
|
|
262
|
-
static nodeType = "lib.os.CreateDirectory";
|
|
263
|
-
static title = "Create Directory";
|
|
264
|
-
static description = "Create a new directory at specified path.\n files, directory, create\n\n Use cases:\n - Set up directory structure for file organization\n - Create output directories for processed files";
|
|
265
|
-
async process() {
|
|
266
|
-
const p = expandUser(String(this.path ?? ""));
|
|
267
|
-
if (!p)
|
|
268
|
-
throw new Error("'path' field cannot be empty");
|
|
269
|
-
await fs.mkdir(p, { recursive: Boolean(this.exist_ok ?? true) });
|
|
270
|
-
return {};
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
__decorate([
|
|
274
|
-
prop({
|
|
275
|
-
type: "str",
|
|
276
|
-
default: "",
|
|
277
|
-
title: "Path",
|
|
278
|
-
description: "Directory path to create"
|
|
279
|
-
})
|
|
280
|
-
], CreateDirectoryLibNode.prototype, "path", void 0);
|
|
281
|
-
__decorate([
|
|
282
|
-
prop({
|
|
283
|
-
type: "bool",
|
|
284
|
-
default: true,
|
|
285
|
-
title: "Exist Ok",
|
|
286
|
-
description: "Don't error if directory already exists"
|
|
287
|
-
})
|
|
288
|
-
], CreateDirectoryLibNode.prototype, "exist_ok", void 0);
|
|
289
|
-
export class GetFileSizeLibNode extends BaseNode {
|
|
290
|
-
static nodeType = "lib.os.GetFileSize";
|
|
291
|
-
static title = "Get File Size";
|
|
292
|
-
static description = "Get file size in bytes.\n files, metadata, size";
|
|
293
|
-
static metadataOutputTypes = {
|
|
294
|
-
output: "int"
|
|
295
|
-
};
|
|
296
|
-
async process() {
|
|
297
|
-
const p = expandUser(String(this.path ?? ""));
|
|
298
|
-
if (!p)
|
|
299
|
-
throw new Error("'path' field cannot be empty");
|
|
300
|
-
const stat = await fs.stat(p);
|
|
301
|
-
return { output: stat.size };
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
__decorate([
|
|
305
|
-
prop({
|
|
306
|
-
type: "str",
|
|
307
|
-
default: "",
|
|
308
|
-
title: "Path",
|
|
309
|
-
description: "Path to file"
|
|
310
|
-
})
|
|
311
|
-
], GetFileSizeLibNode.prototype, "path", void 0);
|
|
312
|
-
class FileTimeBase extends BaseNode {
|
|
313
|
-
async getTime(kind) {
|
|
314
|
-
const p = expandUser(String(this.path ?? ""));
|
|
315
|
-
if (!p)
|
|
316
|
-
throw new Error("'path' field cannot be empty");
|
|
317
|
-
const stat = await fs.stat(p);
|
|
318
|
-
const d = kind === "atime"
|
|
319
|
-
? stat.atime
|
|
320
|
-
: kind === "ctime"
|
|
321
|
-
? stat.ctime
|
|
322
|
-
: stat.mtime;
|
|
323
|
-
return { output: toDateTimeValue(d) };
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
export class CreatedTimeLibNode extends FileTimeBase {
|
|
327
|
-
static nodeType = "lib.os.CreatedTime";
|
|
328
|
-
static title = "Created Time";
|
|
329
|
-
static description = "Get file creation timestamp.\n files, metadata, created, time";
|
|
330
|
-
static metadataOutputTypes = {
|
|
331
|
-
output: "datetime"
|
|
332
|
-
};
|
|
333
|
-
async process() {
|
|
334
|
-
return this.getTime("ctime");
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
__decorate([
|
|
338
|
-
prop({
|
|
339
|
-
type: "str",
|
|
340
|
-
default: "",
|
|
341
|
-
title: "Path",
|
|
342
|
-
description: "Path to file"
|
|
343
|
-
})
|
|
344
|
-
], CreatedTimeLibNode.prototype, "path", void 0);
|
|
345
|
-
export class ModifiedTimeLibNode extends FileTimeBase {
|
|
346
|
-
static nodeType = "lib.os.ModifiedTime";
|
|
347
|
-
static title = "Modified Time";
|
|
348
|
-
static description = "Get file last modified timestamp.\n files, metadata, modified, time";
|
|
349
|
-
static metadataOutputTypes = {
|
|
350
|
-
output: "datetime"
|
|
351
|
-
};
|
|
352
|
-
async process() {
|
|
353
|
-
return this.getTime("mtime");
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
__decorate([
|
|
357
|
-
prop({
|
|
358
|
-
type: "str",
|
|
359
|
-
default: "",
|
|
360
|
-
title: "Path",
|
|
361
|
-
description: "Path to file"
|
|
362
|
-
})
|
|
363
|
-
], ModifiedTimeLibNode.prototype, "path", void 0);
|
|
364
|
-
export class AccessedTimeLibNode extends FileTimeBase {
|
|
365
|
-
static nodeType = "lib.os.AccessedTime";
|
|
366
|
-
static title = "Accessed Time";
|
|
367
|
-
static description = "Get file last accessed timestamp.\n files, metadata, accessed, time";
|
|
368
|
-
static metadataOutputTypes = {
|
|
369
|
-
output: "datetime"
|
|
370
|
-
};
|
|
371
|
-
async process() {
|
|
372
|
-
return this.getTime("atime");
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
__decorate([
|
|
376
|
-
prop({
|
|
377
|
-
type: "str",
|
|
378
|
-
default: "",
|
|
379
|
-
title: "Path",
|
|
380
|
-
description: "Path to file"
|
|
381
|
-
})
|
|
382
|
-
], AccessedTimeLibNode.prototype, "path", void 0);
|
|
383
|
-
class PathBoolNode extends BaseNode {
|
|
384
|
-
readPath() {
|
|
385
|
-
const p = expandUser(String(this.path ?? ""));
|
|
386
|
-
if (!p)
|
|
387
|
-
throw new Error("'path' field cannot be empty");
|
|
388
|
-
return p;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
__decorate([
|
|
392
|
-
prop({ type: "str", default: "" })
|
|
393
|
-
], PathBoolNode.prototype, "path", void 0);
|
|
394
|
-
export class IsFileLibNode extends PathBoolNode {
|
|
395
|
-
static nodeType = "lib.os.IsFile";
|
|
396
|
-
static title = "Is File";
|
|
397
|
-
static description = "Check if path is a file.\n files, metadata, type";
|
|
398
|
-
static metadataOutputTypes = {
|
|
399
|
-
output: "bool"
|
|
400
|
-
};
|
|
401
|
-
async process() {
|
|
402
|
-
const p = this.readPath();
|
|
403
|
-
try {
|
|
404
|
-
return { output: (await fs.stat(p)).isFile() };
|
|
405
|
-
}
|
|
406
|
-
catch {
|
|
407
|
-
return { output: false };
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
__decorate([
|
|
412
|
-
prop({
|
|
413
|
-
type: "str",
|
|
414
|
-
default: "",
|
|
415
|
-
title: "Path",
|
|
416
|
-
description: "Path to check"
|
|
417
|
-
})
|
|
418
|
-
], IsFileLibNode.prototype, "path", void 0);
|
|
419
|
-
export class IsDirectoryLibNode extends PathBoolNode {
|
|
420
|
-
static nodeType = "lib.os.IsDirectory";
|
|
421
|
-
static title = "Is Directory";
|
|
422
|
-
static description = "Check if path is a directory.\n files, metadata, type";
|
|
423
|
-
static metadataOutputTypes = {
|
|
424
|
-
output: "bool"
|
|
425
|
-
};
|
|
426
|
-
async process() {
|
|
427
|
-
const p = this.readPath();
|
|
428
|
-
try {
|
|
429
|
-
return { output: (await fs.stat(p)).isDirectory() };
|
|
430
|
-
}
|
|
431
|
-
catch {
|
|
432
|
-
return { output: false };
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
__decorate([
|
|
437
|
-
prop({
|
|
438
|
-
type: "str",
|
|
439
|
-
default: "",
|
|
440
|
-
title: "Path",
|
|
441
|
-
description: "Path to check"
|
|
442
|
-
})
|
|
443
|
-
], IsDirectoryLibNode.prototype, "path", void 0);
|
|
444
|
-
export class FileExtensionLibNode extends PathBoolNode {
|
|
445
|
-
static nodeType = "lib.os.FileExtension";
|
|
446
|
-
static title = "File Extension";
|
|
447
|
-
static description = "Get file extension.\n files, metadata, extension";
|
|
448
|
-
static metadataOutputTypes = {
|
|
449
|
-
output: "str"
|
|
450
|
-
};
|
|
451
|
-
async process() {
|
|
452
|
-
return { output: path.extname(this.readPath()) };
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
__decorate([
|
|
456
|
-
prop({
|
|
457
|
-
type: "str",
|
|
458
|
-
default: "",
|
|
459
|
-
title: "Path",
|
|
460
|
-
description: "Path to file"
|
|
461
|
-
})
|
|
462
|
-
], FileExtensionLibNode.prototype, "path", void 0);
|
|
463
|
-
export class FileNameLibNode extends PathBoolNode {
|
|
464
|
-
static nodeType = "lib.os.FileName";
|
|
465
|
-
static title = "File Name";
|
|
466
|
-
static description = "Get file name without path.\n files, metadata, name";
|
|
467
|
-
static metadataOutputTypes = {
|
|
468
|
-
output: "str"
|
|
469
|
-
};
|
|
470
|
-
async process() {
|
|
471
|
-
return { output: path.basename(this.readPath()) };
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
__decorate([
|
|
475
|
-
prop({
|
|
476
|
-
type: "str",
|
|
477
|
-
default: "",
|
|
478
|
-
title: "Path",
|
|
479
|
-
description: "Path to file"
|
|
480
|
-
})
|
|
481
|
-
], FileNameLibNode.prototype, "path", void 0);
|
|
482
|
-
export class GetDirectoryLibNode extends PathBoolNode {
|
|
483
|
-
static nodeType = "lib.os.GetDirectory";
|
|
484
|
-
static title = "Get Directory";
|
|
485
|
-
static description = "Get directory containing the file.\n files, metadata, directory";
|
|
486
|
-
static metadataOutputTypes = {
|
|
487
|
-
output: "str"
|
|
488
|
-
};
|
|
489
|
-
async process() {
|
|
490
|
-
return { output: path.dirname(this.readPath()) };
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
__decorate([
|
|
494
|
-
prop({
|
|
495
|
-
type: "str",
|
|
496
|
-
default: "",
|
|
497
|
-
title: "Path",
|
|
498
|
-
description: "Path to file"
|
|
499
|
-
})
|
|
500
|
-
], GetDirectoryLibNode.prototype, "path", void 0);
|
|
501
|
-
export class FileNameMatchLibNode extends BaseNode {
|
|
502
|
-
static nodeType = "lib.os.FileNameMatch";
|
|
503
|
-
static title = "File Name Match";
|
|
504
|
-
static description = "Match a filename against a pattern using Unix shell-style wildcards.\n files, pattern, match, filter\n\n Use cases:\n - Filter files by name pattern\n - Validate file naming conventions\n - Match file extensions";
|
|
505
|
-
static metadataOutputTypes = {
|
|
506
|
-
output: "bool"
|
|
507
|
-
};
|
|
508
|
-
async process() {
|
|
509
|
-
const filename = String(this.filename ?? "");
|
|
510
|
-
const pattern = String(this.pattern ?? "*");
|
|
511
|
-
const caseSensitive = Boolean(this.case_sensitive ?? true);
|
|
512
|
-
return {
|
|
513
|
-
output: wildcardToRegExp(pattern, caseSensitive).test(caseSensitive ? filename : filename.toLowerCase())
|
|
514
|
-
};
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
__decorate([
|
|
518
|
-
prop({
|
|
519
|
-
type: "str",
|
|
520
|
-
default: "",
|
|
521
|
-
title: "Filename",
|
|
522
|
-
description: "Filename to check"
|
|
523
|
-
})
|
|
524
|
-
], FileNameMatchLibNode.prototype, "filename", void 0);
|
|
525
|
-
__decorate([
|
|
526
|
-
prop({
|
|
527
|
-
type: "str",
|
|
528
|
-
default: "*",
|
|
529
|
-
title: "Pattern",
|
|
530
|
-
description: "Pattern to match against (e.g. *.txt, data_*.csv)"
|
|
531
|
-
})
|
|
532
|
-
], FileNameMatchLibNode.prototype, "pattern", void 0);
|
|
533
|
-
__decorate([
|
|
534
|
-
prop({
|
|
535
|
-
type: "bool",
|
|
536
|
-
default: true,
|
|
537
|
-
title: "Case Sensitive",
|
|
538
|
-
description: "Whether the pattern matching should be case-sensitive"
|
|
539
|
-
})
|
|
540
|
-
], FileNameMatchLibNode.prototype, "case_sensitive", void 0);
|
|
541
|
-
export class FilterFileNamesLibNode extends BaseNode {
|
|
542
|
-
static nodeType = "lib.os.FilterFileNames";
|
|
543
|
-
static title = "Filter File Names";
|
|
544
|
-
static description = "Filter a list of filenames using Unix shell-style wildcards.\n files, pattern, filter, list\n\n Use cases:\n - Filter multiple files by pattern\n - Batch process files matching criteria\n - Select files by extension";
|
|
545
|
-
static metadataOutputTypes = {
|
|
546
|
-
output: "list[str]"
|
|
547
|
-
};
|
|
548
|
-
async process() {
|
|
549
|
-
const filenames = Array.isArray(this.filenames)
|
|
550
|
-
? (this.filenames ?? []).map(String)
|
|
551
|
-
: [];
|
|
552
|
-
const pattern = String(this.pattern ?? "*");
|
|
553
|
-
const caseSensitive = Boolean(this.case_sensitive ?? true);
|
|
554
|
-
const rx = wildcardToRegExp(pattern, caseSensitive);
|
|
555
|
-
const output = filenames.filter((name) => rx.test(caseSensitive ? name : name.toLowerCase()));
|
|
556
|
-
return { output };
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
__decorate([
|
|
560
|
-
prop({
|
|
561
|
-
type: "list[str]",
|
|
562
|
-
default: [],
|
|
563
|
-
title: "Filenames",
|
|
564
|
-
description: "list of filenames to filter"
|
|
565
|
-
})
|
|
566
|
-
], FilterFileNamesLibNode.prototype, "filenames", void 0);
|
|
567
|
-
__decorate([
|
|
568
|
-
prop({
|
|
569
|
-
type: "str",
|
|
570
|
-
default: "*",
|
|
571
|
-
title: "Pattern",
|
|
572
|
-
description: "Pattern to filter by (e.g. *.txt, data_*.csv)"
|
|
573
|
-
})
|
|
574
|
-
], FilterFileNamesLibNode.prototype, "pattern", void 0);
|
|
575
|
-
__decorate([
|
|
576
|
-
prop({
|
|
577
|
-
type: "bool",
|
|
578
|
-
default: true,
|
|
579
|
-
title: "Case Sensitive",
|
|
580
|
-
description: "Whether the pattern matching should be case-sensitive"
|
|
581
|
-
})
|
|
582
|
-
], FilterFileNamesLibNode.prototype, "case_sensitive", void 0);
|
|
583
|
-
export class BasenameLibNode extends BaseNode {
|
|
584
|
-
static nodeType = "lib.os.Basename";
|
|
585
|
-
static title = "Basename";
|
|
586
|
-
static description = "Get the base name component of a file path.\n files, path, basename\n\n Use cases:\n - Extract filename from full path\n - Get file name without directory\n - Process file names independently";
|
|
587
|
-
static metadataOutputTypes = {
|
|
588
|
-
output: "str"
|
|
589
|
-
};
|
|
590
|
-
async process() {
|
|
591
|
-
const p = expandUser(String(this.path ?? ""));
|
|
592
|
-
if (p.trim() === "")
|
|
593
|
-
throw new Error("path is empty");
|
|
594
|
-
const basename = path.basename(p);
|
|
595
|
-
if (this.remove_extension ?? false) {
|
|
596
|
-
return { output: path.parse(basename).name };
|
|
597
|
-
}
|
|
598
|
-
return { output: basename };
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
__decorate([
|
|
602
|
-
prop({
|
|
603
|
-
type: "str",
|
|
604
|
-
default: "",
|
|
605
|
-
title: "Path",
|
|
606
|
-
description: "File path to get basename from"
|
|
607
|
-
})
|
|
608
|
-
], BasenameLibNode.prototype, "path", void 0);
|
|
609
|
-
__decorate([
|
|
610
|
-
prop({
|
|
611
|
-
type: "bool",
|
|
612
|
-
default: false,
|
|
613
|
-
title: "Remove Extension",
|
|
614
|
-
description: "Remove file extension from basename"
|
|
615
|
-
})
|
|
616
|
-
], BasenameLibNode.prototype, "remove_extension", void 0);
|
|
617
|
-
export class DirnameLibNode extends BaseNode {
|
|
618
|
-
static nodeType = "lib.os.Dirname";
|
|
619
|
-
static title = "Dirname";
|
|
620
|
-
static description = "Get the directory name component of a file path.\n files, path, dirname\n\n Use cases:\n - Extract directory path from full path\n - Get parent directory\n - Process directory paths";
|
|
621
|
-
static metadataOutputTypes = {
|
|
622
|
-
output: "str"
|
|
623
|
-
};
|
|
624
|
-
async process() {
|
|
625
|
-
return { output: path.dirname(expandUser(String(this.path ?? ""))) };
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
__decorate([
|
|
629
|
-
prop({
|
|
630
|
-
type: "str",
|
|
631
|
-
default: "",
|
|
632
|
-
title: "Path",
|
|
633
|
-
description: "File path to get dirname from"
|
|
634
|
-
})
|
|
635
|
-
], DirnameLibNode.prototype, "path", void 0);
|
|
636
|
-
export class JoinPathsLibNode extends BaseNode {
|
|
637
|
-
static nodeType = "lib.os.JoinPaths";
|
|
638
|
-
static title = "Join Paths";
|
|
639
|
-
static description = "Joins path components.\n path, join, combine\n\n Use cases:\n - Build file paths\n - Create cross-platform paths";
|
|
640
|
-
static metadataOutputTypes = {
|
|
641
|
-
output: "str"
|
|
642
|
-
};
|
|
643
|
-
async process() {
|
|
644
|
-
const parts = Array.isArray(this.paths)
|
|
645
|
-
? (this.paths ?? []).map(String)
|
|
646
|
-
: [];
|
|
647
|
-
if (parts.length === 0)
|
|
648
|
-
throw new Error("paths cannot be empty");
|
|
649
|
-
return { output: path.join(...parts) };
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
__decorate([
|
|
653
|
-
prop({
|
|
654
|
-
type: "list[str]",
|
|
655
|
-
default: [],
|
|
656
|
-
title: "Paths",
|
|
657
|
-
description: "Path components to join"
|
|
658
|
-
})
|
|
659
|
-
], JoinPathsLibNode.prototype, "paths", void 0);
|
|
660
|
-
export class NormalizePathLibNode extends BaseNode {
|
|
661
|
-
static nodeType = "lib.os.NormalizePath";
|
|
662
|
-
static title = "Normalize Path";
|
|
663
|
-
static description = "Normalizes a path.\n path, normalize, clean\n\n Use cases:\n - Standardize paths\n - Remove redundant separators";
|
|
664
|
-
static metadataOutputTypes = {
|
|
665
|
-
output: "str"
|
|
666
|
-
};
|
|
667
|
-
async process() {
|
|
668
|
-
const p = String(this.path ?? "");
|
|
669
|
-
if (!p)
|
|
670
|
-
throw new Error("path cannot be empty");
|
|
671
|
-
return { output: path.normalize(p) };
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
__decorate([
|
|
675
|
-
prop({
|
|
676
|
-
type: "str",
|
|
677
|
-
default: "",
|
|
678
|
-
title: "Path",
|
|
679
|
-
description: "Path to normalize"
|
|
680
|
-
})
|
|
681
|
-
], NormalizePathLibNode.prototype, "path", void 0);
|
|
682
|
-
export class GetPathInfoLibNode extends BaseNode {
|
|
683
|
-
static nodeType = "lib.os.GetPathInfo";
|
|
684
|
-
static title = "Get Path Info";
|
|
685
|
-
static description = "Gets information about a path.\n path, info, metadata\n\n Use cases:\n - Extract path components\n - Parse file paths";
|
|
686
|
-
static metadataOutputTypes = {
|
|
687
|
-
output: "dict"
|
|
688
|
-
};
|
|
689
|
-
async process() {
|
|
690
|
-
const p = String(this.path ?? "");
|
|
691
|
-
const abs = path.resolve(p);
|
|
692
|
-
let stat = null;
|
|
693
|
-
try {
|
|
694
|
-
stat = await fs.lstat(p);
|
|
695
|
-
}
|
|
696
|
-
catch {
|
|
697
|
-
/* stat stays null if path doesn't exist */
|
|
698
|
-
}
|
|
699
|
-
return {
|
|
700
|
-
output: {
|
|
701
|
-
dirname: path.dirname(p),
|
|
702
|
-
basename: path.basename(p),
|
|
703
|
-
extension: path.extname(p),
|
|
704
|
-
absolute: abs,
|
|
705
|
-
exists: existsSync(p),
|
|
706
|
-
is_file: stat?.isFile() ?? false,
|
|
707
|
-
is_dir: stat?.isDirectory() ?? false,
|
|
708
|
-
is_symlink: stat?.isSymbolicLink() ?? false
|
|
709
|
-
}
|
|
710
|
-
};
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
__decorate([
|
|
714
|
-
prop({
|
|
715
|
-
type: "str",
|
|
716
|
-
default: "",
|
|
717
|
-
title: "Path",
|
|
718
|
-
description: "Path to analyze"
|
|
719
|
-
})
|
|
720
|
-
], GetPathInfoLibNode.prototype, "path", void 0);
|
|
721
|
-
export class AbsolutePathLibNode extends BaseNode {
|
|
722
|
-
static nodeType = "lib.os.AbsolutePath";
|
|
723
|
-
static title = "Absolute Path";
|
|
724
|
-
static description = "Return the absolute path of a file or directory.\n files, path, absolute\n\n Use cases:\n - Convert relative paths to absolute\n - Get full system path\n - Resolve path references";
|
|
725
|
-
static metadataOutputTypes = {
|
|
726
|
-
output: "str"
|
|
727
|
-
};
|
|
728
|
-
async process() {
|
|
729
|
-
const p = expandUser(String(this.path ?? ""));
|
|
730
|
-
if (!p)
|
|
731
|
-
throw new Error("path cannot be empty");
|
|
732
|
-
return { output: path.resolve(p) };
|
|
733
|
-
}
|
|
734
|
-
}
|
|
735
|
-
__decorate([
|
|
736
|
-
prop({
|
|
737
|
-
type: "str",
|
|
738
|
-
default: "",
|
|
739
|
-
title: "Path",
|
|
740
|
-
description: "Path to convert to absolute"
|
|
741
|
-
})
|
|
742
|
-
], AbsolutePathLibNode.prototype, "path", void 0);
|
|
743
|
-
export class SplitPathLibNode extends BaseNode {
|
|
744
|
-
static nodeType = "lib.os.SplitPath";
|
|
745
|
-
static title = "Split Path";
|
|
746
|
-
static description = "Split a path into directory and file components.\n files, path, split\n\n Use cases:\n - Separate directory from filename\n - Process path components separately\n - Extract path parts";
|
|
747
|
-
static metadataOutputTypes = {
|
|
748
|
-
output: "dict"
|
|
749
|
-
};
|
|
750
|
-
async process() {
|
|
751
|
-
const p = expandUser(String(this.path ?? ""));
|
|
752
|
-
return { dirname: path.dirname(p), basename: path.basename(p) };
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
__decorate([
|
|
756
|
-
prop({
|
|
757
|
-
type: "str",
|
|
758
|
-
default: "",
|
|
759
|
-
title: "Path",
|
|
760
|
-
description: "Path to split"
|
|
761
|
-
})
|
|
762
|
-
], SplitPathLibNode.prototype, "path", void 0);
|
|
763
|
-
export class SplitExtensionLibNode extends BaseNode {
|
|
764
|
-
static nodeType = "lib.os.SplitExtension";
|
|
765
|
-
static title = "Split Extension";
|
|
766
|
-
static description = "Split a path into root and extension components.\n files, path, extension, split\n\n Use cases:\n - Extract file extension\n - Process filename without extension\n - Handle file types";
|
|
767
|
-
static metadataOutputTypes = {
|
|
768
|
-
output: "dict"
|
|
769
|
-
};
|
|
770
|
-
async process() {
|
|
771
|
-
const p = expandUser(String(this.path ?? ""));
|
|
772
|
-
const parsed = path.parse(p);
|
|
773
|
-
return { root: path.join(parsed.dir, parsed.name), extension: parsed.ext };
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
__decorate([
|
|
777
|
-
prop({
|
|
778
|
-
type: "str",
|
|
779
|
-
default: "",
|
|
780
|
-
title: "Path",
|
|
781
|
-
description: "Path to split"
|
|
782
|
-
})
|
|
783
|
-
], SplitExtensionLibNode.prototype, "path", void 0);
|
|
784
|
-
export class RelativePathLibNode extends BaseNode {
|
|
785
|
-
static nodeType = "lib.os.RelativePath";
|
|
786
|
-
static title = "Relative Path";
|
|
787
|
-
static description = "Return a relative path to a target from a start directory.\n files, path, relative\n\n Use cases:\n - Create relative path references\n - Generate portable paths\n - Compare file locations";
|
|
788
|
-
static metadataOutputTypes = {
|
|
789
|
-
output: "str"
|
|
790
|
-
};
|
|
791
|
-
async process() {
|
|
792
|
-
const target = expandUser(String(this.target_path ?? ""));
|
|
793
|
-
const start = expandUser(String(this.start_path ?? "."));
|
|
794
|
-
if (!target)
|
|
795
|
-
throw new Error("target_path cannot be empty");
|
|
796
|
-
return { output: path.relative(start, target) };
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
__decorate([
|
|
800
|
-
prop({
|
|
801
|
-
type: "str",
|
|
802
|
-
default: "",
|
|
803
|
-
title: "Target Path",
|
|
804
|
-
description: "Target path to convert to relative"
|
|
805
|
-
})
|
|
806
|
-
], RelativePathLibNode.prototype, "target_path", void 0);
|
|
807
|
-
__decorate([
|
|
808
|
-
prop({
|
|
809
|
-
type: "str",
|
|
810
|
-
default: ".",
|
|
811
|
-
title: "Start Path",
|
|
812
|
-
description: "Start path for relative conversion"
|
|
813
|
-
})
|
|
814
|
-
], RelativePathLibNode.prototype, "start_path", void 0);
|
|
815
|
-
export class PathToStringLibNode extends BaseNode {
|
|
816
|
-
static nodeType = "lib.os.PathToString";
|
|
817
|
-
static title = "Path To String";
|
|
818
|
-
static description = "Convert a FilePath object to a string.\n files, path, string, convert\n\n Use cases:\n - Get raw string path from FilePath object\n - Convert FilePath for string operations\n - Extract path string for external use";
|
|
819
|
-
static metadataOutputTypes = {
|
|
820
|
-
output: "str"
|
|
821
|
-
};
|
|
822
|
-
async process() {
|
|
823
|
-
const filePath = String(this.file_path ?? "");
|
|
824
|
-
if (!filePath)
|
|
825
|
-
throw new Error("file_path cannot be empty");
|
|
826
|
-
return { output: filePath };
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
__decorate([
|
|
830
|
-
prop({
|
|
831
|
-
type: "str",
|
|
832
|
-
default: "",
|
|
833
|
-
title: "File Path",
|
|
834
|
-
description: "File path to convert to string"
|
|
835
|
-
})
|
|
836
|
-
], PathToStringLibNode.prototype, "file_path", void 0);
|
|
837
|
-
export class ShowNotificationLibNode extends BaseNode {
|
|
838
|
-
static nodeType = "lib.os.ShowNotification";
|
|
839
|
-
static title = "Show Notification";
|
|
840
|
-
static description = "Shows a system notification.\n notification, system, alert\n\n Use cases:\n - Alert user of completed tasks\n - Show process status\n - Display important messages";
|
|
841
|
-
static metadataOutputTypes = {
|
|
842
|
-
output: "none"
|
|
843
|
-
};
|
|
844
|
-
async process() {
|
|
845
|
-
const title = String(this.title ?? "");
|
|
846
|
-
const message = String(this.message ?? "");
|
|
847
|
-
if (!title)
|
|
848
|
-
throw new Error("title cannot be empty");
|
|
849
|
-
if (!message)
|
|
850
|
-
throw new Error("message cannot be empty");
|
|
851
|
-
return {};
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
__decorate([
|
|
855
|
-
prop({
|
|
856
|
-
type: "str",
|
|
857
|
-
default: "",
|
|
858
|
-
title: "Title",
|
|
859
|
-
description: "Title of the notification"
|
|
860
|
-
})
|
|
861
|
-
], ShowNotificationLibNode.prototype, "title", void 0);
|
|
862
|
-
__decorate([
|
|
863
|
-
prop({
|
|
864
|
-
type: "str",
|
|
865
|
-
default: "",
|
|
866
|
-
title: "Message",
|
|
867
|
-
description: "Content of the notification"
|
|
868
|
-
})
|
|
869
|
-
], ShowNotificationLibNode.prototype, "message", void 0);
|
|
870
|
-
__decorate([
|
|
871
|
-
prop({
|
|
872
|
-
type: "int",
|
|
873
|
-
default: 10,
|
|
874
|
-
title: "Timeout",
|
|
875
|
-
description: "How long the notification should stay visible (in seconds)"
|
|
876
|
-
})
|
|
877
|
-
], ShowNotificationLibNode.prototype, "timeout", void 0);
|
|
878
|
-
export const LIB_OS_NODES = [
|
|
879
|
-
WorkspaceDirectoryLibNode,
|
|
880
|
-
OpenWorkspaceDirectoryLibNode,
|
|
881
|
-
FileExistsLibNode,
|
|
882
|
-
ListFilesLibNode,
|
|
883
|
-
CopyFileLibNode,
|
|
884
|
-
MoveFileLibNode,
|
|
885
|
-
CreateDirectoryLibNode,
|
|
886
|
-
GetFileSizeLibNode,
|
|
887
|
-
CreatedTimeLibNode,
|
|
888
|
-
ModifiedTimeLibNode,
|
|
889
|
-
AccessedTimeLibNode,
|
|
890
|
-
IsFileLibNode,
|
|
891
|
-
IsDirectoryLibNode,
|
|
892
|
-
FileExtensionLibNode,
|
|
893
|
-
FileNameLibNode,
|
|
894
|
-
GetDirectoryLibNode,
|
|
895
|
-
FileNameMatchLibNode,
|
|
896
|
-
FilterFileNamesLibNode,
|
|
897
|
-
BasenameLibNode,
|
|
898
|
-
DirnameLibNode,
|
|
899
|
-
JoinPathsLibNode,
|
|
900
|
-
NormalizePathLibNode,
|
|
901
|
-
GetPathInfoLibNode,
|
|
902
|
-
AbsolutePathLibNode,
|
|
903
|
-
SplitPathLibNode,
|
|
904
|
-
SplitExtensionLibNode,
|
|
905
|
-
RelativePathLibNode,
|
|
906
|
-
PathToStringLibNode,
|
|
907
|
-
ShowNotificationLibNode
|
|
908
|
-
];
|
|
909
|
-
//# sourceMappingURL=lib-os.js.map
|