n8n-nodes-artefaktum 0.1.0

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.
Files changed (58) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +144 -0
  3. package/dist/credentials/ArtefaktumApi.credentials.d.ts +13 -0
  4. package/dist/credentials/ArtefaktumApi.credentials.js +38 -0
  5. package/dist/credentials/ArtefaktumApi.credentials.js.map +1 -0
  6. package/dist/nodes/Artefaktum/Artefaktum.node.d.ts +10 -0
  7. package/dist/nodes/Artefaktum/Artefaktum.node.js +92 -0
  8. package/dist/nodes/Artefaktum/Artefaktum.node.js.map +1 -0
  9. package/dist/nodes/Artefaktum/Artefaktum.node.json +10 -0
  10. package/dist/nodes/Artefaktum/actions/artifact/del.d.ts +3 -0
  11. package/dist/nodes/Artefaktum/actions/artifact/del.js +13 -0
  12. package/dist/nodes/Artefaktum/actions/artifact/del.js.map +1 -0
  13. package/dist/nodes/Artefaktum/actions/artifact/download.d.ts +3 -0
  14. package/dist/nodes/Artefaktum/actions/artifact/download.js +40 -0
  15. package/dist/nodes/Artefaktum/actions/artifact/download.js.map +1 -0
  16. package/dist/nodes/Artefaktum/actions/artifact/get.d.ts +3 -0
  17. package/dist/nodes/Artefaktum/actions/artifact/get.js +23 -0
  18. package/dist/nodes/Artefaktum/actions/artifact/get.js.map +1 -0
  19. package/dist/nodes/Artefaktum/actions/artifact/getMany.d.ts +3 -0
  20. package/dist/nodes/Artefaktum/actions/artifact/getMany.js +48 -0
  21. package/dist/nodes/Artefaktum/actions/artifact/getMany.js.map +1 -0
  22. package/dist/nodes/Artefaktum/actions/artifact/getOrUpload.d.ts +3 -0
  23. package/dist/nodes/Artefaktum/actions/artifact/getOrUpload.js +36 -0
  24. package/dist/nodes/Artefaktum/actions/artifact/getOrUpload.js.map +1 -0
  25. package/dist/nodes/Artefaktum/actions/artifact/update.d.ts +3 -0
  26. package/dist/nodes/Artefaktum/actions/artifact/update.js +30 -0
  27. package/dist/nodes/Artefaktum/actions/artifact/update.js.map +1 -0
  28. package/dist/nodes/Artefaktum/actions/artifact/upload.d.ts +3 -0
  29. package/dist/nodes/Artefaktum/actions/artifact/upload.js +18 -0
  30. package/dist/nodes/Artefaktum/actions/artifact/upload.js.map +1 -0
  31. package/dist/nodes/Artefaktum/actions/common.d.ts +18 -0
  32. package/dist/nodes/Artefaktum/actions/common.js +62 -0
  33. package/dist/nodes/Artefaktum/actions/common.js.map +1 -0
  34. package/dist/nodes/Artefaktum/actions/project/getMany.d.ts +3 -0
  35. package/dist/nodes/Artefaktum/actions/project/getMany.js +10 -0
  36. package/dist/nodes/Artefaktum/actions/project/getMany.js.map +1 -0
  37. package/dist/nodes/Artefaktum/artefaktum.dark.svg +1 -0
  38. package/dist/nodes/Artefaktum/artefaktum.svg +1 -0
  39. package/dist/nodes/Artefaktum/content.d.ts +8 -0
  40. package/dist/nodes/Artefaktum/content.js +33 -0
  41. package/dist/nodes/Artefaktum/content.js.map +1 -0
  42. package/dist/nodes/Artefaktum/descriptions/artifact.d.ts +4 -0
  43. package/dist/nodes/Artefaktum/descriptions/artifact.js +263 -0
  44. package/dist/nodes/Artefaktum/descriptions/artifact.js.map +1 -0
  45. package/dist/nodes/Artefaktum/descriptions/project.d.ts +3 -0
  46. package/dist/nodes/Artefaktum/descriptions/project.js +14 -0
  47. package/dist/nodes/Artefaktum/descriptions/project.js.map +1 -0
  48. package/dist/nodes/Artefaktum/projects.d.ts +8 -0
  49. package/dist/nodes/Artefaktum/projects.js +38 -0
  50. package/dist/nodes/Artefaktum/projects.js.map +1 -0
  51. package/dist/nodes/Artefaktum/transport.d.ts +17 -0
  52. package/dist/nodes/Artefaktum/transport.js +76 -0
  53. package/dist/nodes/Artefaktum/transport.js.map +1 -0
  54. package/dist/nodes/Artefaktum/upload.d.ts +4 -0
  55. package/dist/nodes/Artefaktum/upload.js +14 -0
  56. package/dist/nodes/Artefaktum/upload.js.map +1 -0
  57. package/dist/package.json +58 -0
  58. package/package.json +58 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 artefaktum.dev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,144 @@
1
+ # n8n-nodes-artefaktum
2
+
3
+ This is an n8n community node for [Artefaktum](https://artefaktum.dev), a
4
+ service that stores artifacts — files plus the metadata needed to find them
5
+ and judge whether they are still current — so workflows and AI agents can
6
+ hand results to each other instead of recomputing them.
7
+
8
+ [n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/sustainable-use-license/) workflow automation platform.
9
+
10
+ ## Install
11
+
12
+ **Self-hosted n8n**: run `npm install n8n-nodes-artefaktum` in your n8n
13
+ custom nodes directory, or install it from n8n's UI under
14
+ **Settings → Community Nodes**. See the
15
+ [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/)
16
+ for details.
17
+
18
+ **n8n Cloud**: the node will be installable directly from the Cloud node
19
+ panel once it has passed n8n's community node verification.
20
+
21
+ ## Credentials
22
+
23
+ Mint an API key in the [Artefaktum console](https://artefaktum.dev/console/)
24
+ and paste it into the node credential's **API Key** field. Choose the scopes
25
+ the workflow actually needs: `read`, `write`, `search`, and `delete` — only
26
+ grant `delete` if the workflow deletes artifacts.
27
+
28
+ **Base URL** defaults to `https://api.artefaktum.dev` and only needs to
29
+ change for a self-hosted Artefaktum instance.
30
+
31
+ ## Operations
32
+
33
+ ### Artifact
34
+
35
+ | Parameter | Applies to | Description |
36
+ | --- | --- | --- |
37
+ | Project | Upload, Get or Upload, Get Many, Get | The project the artifact belongs to. Every tenant has a project with slug `default`. |
38
+ | External Key | Get or Upload | The key that identifies this result. If an artifact with this key exists and is fresh enough, it is returned instead of uploading. |
39
+ | Max Age (Seconds) | Get or Upload | Reuse the stored artifact only if it is younger than this. `0` accepts any age. |
40
+ | Input Data Source | Upload, Get or Upload | Upload the file held in a binary property of the input item, or text/JSON built with an expression. |
41
+ | Input Binary Field | Upload, Get or Upload (binary source) | Name of the binary property that holds the file. |
42
+ | Content | Upload, Get or Upload (text source) | The text to store, built with an expression if needed. |
43
+ | File Name | Upload, Get or Upload | Stored file name. Defaults to the binary file name, or a generated name for text. |
44
+ | Content Type | Upload, Get or Upload | MIME type. Defaults to the binary file type, or `text/plain` for text. |
45
+ | Title | Upload, Get or Upload | What the artifact is. Searched by other agents. Defaults to the file name. |
46
+ | Options → Description | Upload, Get or Upload | Longer description; searched semantically. |
47
+ | Options → Expires In (Hours) | Upload | Delete the artifact automatically after this many hours. `0` keeps it. |
48
+ | Options → External Key | Upload | Your own unique key for this artifact within the project, e.g. a source URL or a hash. |
49
+ | Options → Metadata (JSON) | Upload, Get or Upload | Structured metadata, searchable by filters. |
50
+ | Options → Summary | Upload | A short summary of the content for search; leave empty to let the server derive one for text files. |
51
+ | Options → Tags | Upload, Get or Upload | Comma-separated tags. |
52
+ | Lookup | Get | Find the artifact by ID or by External Key. |
53
+ | Artifact ID | Download, Update, Delete, Get (Lookup = By ID) | The artifact ID, e.g. from a previous Artefaktum node in this workflow. |
54
+ | External Key | Get (Lookup = By External Key) | The external key to look up. |
55
+ | Project | Get | The project to resolve the external key against (used when Lookup = By External Key). |
56
+ | Download Options → File Name | Download | Override the file name on the binary property. |
57
+ | Download Options → Put Output File in Field | Download | Name of the binary property to write the file to. |
58
+ | Download Options → Verify Checksum | Download | Whether to compare the downloaded bytes against the stored SHA-256. |
59
+ | Download Options → Version ID | Download | A specific version; defaults to the latest. |
60
+ | Query | Get Many | What you are looking for, in words. Leave empty to list by filters only. |
61
+ | Search Mode | Get Many | Hybrid (keyword and meaning combined), Semantic (by meaning) or Text (by keywords). |
62
+ | Return All | Get Many | Whether to return all results or only up to a given limit. |
63
+ | Limit | Get Many | Max number of results to return. |
64
+ | Filters → Content Types | Get Many | Comma-separated MIME types. |
65
+ | Filters → Created After / Created Before | Get Many | Restrict results to a date range. |
66
+ | Filters → Include Superseded | Get Many | Whether to include artifacts that a newer artifact supersedes. |
67
+ | Filters → Tags (All Of) | Get Many | Comma-separated; every tag must match. |
68
+ | Update Fields → Title, Description, Tags, Metadata (JSON) | Update | Replace the corresponding field. |
69
+ | Update Fields → Expires At | Update | Set a new expiry. |
70
+ | Update Fields → Clear Expiry | Update | Whether to remove the expiry so the artifact is kept. |
71
+
72
+ An empty value under **Update Fields** is ignored — leave a field empty to
73
+ keep it unchanged. Clearing description or metadata back to empty is not
74
+ supported yet.
75
+
76
+ Operations: **Upload**, **Get or Upload**, **Download**, **Get**,
77
+ **Get Many**, **Update**, **Delete**.
78
+
79
+ Upload returns the artifact with `status: "processing"` for a few seconds
80
+ while Artefaktum finishes deriving search metadata; Get Many only finds it
81
+ once its status is `ready`.
82
+
83
+ ### Project
84
+
85
+ | Parameter | Applies to | Description |
86
+ | --- | --- | --- |
87
+ | — | Get Many | Lists the projects of your tenant. No parameters beyond Resource/Operation. |
88
+
89
+ ## Get or Upload (caching)
90
+
91
+ Get or Upload always needs the content, because the API requires
92
+ `size_bytes` to resolve the key — so to skip an expensive step entirely,
93
+ call **Get** by external key first and branch on whether it succeeds. Use
94
+ **Get or Upload** instead when you want a stable stored copy and
95
+ de-duplication: give it an **External Key** that identifies the result (for
96
+ example `weather:vilnius:2026-09-23`) and a **Max Age (Seconds)**; if an
97
+ artifact with that key exists and is younger than the max age, it is
98
+ returned as-is (`cache: "hit"` in the output), otherwise the content you
99
+ provide is uploaded and stored under that key (`cache: "created"`).
100
+
101
+ See [`examples/cache-api-response.json`](examples/cache-api-response.json)
102
+ for a complete workflow: Manual Trigger → HTTP Request (a weather API) →
103
+ Artefaktum (Get or Upload), caching the response for an hour under a
104
+ per-day key.
105
+
106
+ ## Limits
107
+
108
+ Artefaktum enforces per-plan quotas — storage, request rate and artifact
109
+ count — see [pricing](https://artefaktum.dev/pricing/) for the current
110
+ limits, plus a per-file size limit: 100 MB on the Free plan, 5 GB on Pro.
111
+ When a quota is exceeded the API returns `quota_exceeded` as the error text.
112
+
113
+ In practice the node's own memory use is the tighter constraint on small
114
+ n8n instances: it buffers each file fully in memory for both upload and
115
+ download, roughly 2–3× the file size per item. Keep individual files to
116
+ tens of MB and avoid large batches when running n8n with limited memory.
117
+
118
+ ## Development
119
+
120
+ ```bash
121
+ npm install # install dependencies
122
+ npm test # unit tests (the live test skips without ARTEFAKTUM_TEST_API_KEY)
123
+ npm run lint
124
+ npm run build # build to dist/
125
+ ```
126
+
127
+ `npm run dev` starts n8n with the node linked. It needs Node ≥ 24 and installs n8n on
128
+ first use, which can take a long time. A reliable alternative is n8n from Docker with
129
+ the built package installed into n8n's nodes directory:
130
+
131
+ ```bash
132
+ npm run build && npm pack # produces n8n-nodes-artefaktum-<version>.tgz
133
+ mkdir -p ~/.n8n/nodes && cd ~/.n8n/nodes && npm install /path/to/n8n-nodes-artefaktum-<version>.tgz
134
+ docker run -it --rm -p 5678:5678 -v ~/.n8n:/home/node/.n8n n8nio/n8n:latest
135
+ ```
136
+
137
+ Do not use `N8N_CUSTOM_EXTENSIONS`: it registers the node under the package name
138
+ `CUSTOM`, so workflows referencing `n8n-nodes-artefaktum.artefaktum` will not load.
139
+
140
+ Releases are cut by pushing a version tag; see `npm run release`.
141
+
142
+ ## License
143
+
144
+ [MIT](LICENSE)
@@ -0,0 +1,13 @@
1
+ import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class ArtefaktumApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ icon: {
6
+ readonly light: "file:../nodes/Artefaktum/artefaktum.svg";
7
+ readonly dark: "file:../nodes/Artefaktum/artefaktum.dark.svg";
8
+ };
9
+ documentationUrl: string;
10
+ properties: INodeProperties[];
11
+ authenticate: IAuthenticateGeneric;
12
+ test: ICredentialTestRequest;
13
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ArtefaktumApi = void 0;
4
+ class ArtefaktumApi {
5
+ constructor() {
6
+ this.name = 'artefaktumApi';
7
+ this.displayName = 'Artefaktum API';
8
+ this.icon = { light: 'file:../nodes/Artefaktum/artefaktum.svg', dark: 'file:../nodes/Artefaktum/artefaktum.dark.svg' };
9
+ this.documentationUrl = 'https://github.com/Taadas/n8n-nodes-artefaktum#credentials';
10
+ this.properties = [
11
+ {
12
+ displayName: 'API Key',
13
+ name: 'apiKey',
14
+ type: 'string',
15
+ typeOptions: { password: true },
16
+ default: '',
17
+ required: true,
18
+ description: 'An API key from the Artefaktum console (https://artefaktum.dev/console/)',
19
+ },
20
+ {
21
+ displayName: 'Base URL',
22
+ name: 'baseUrl',
23
+ type: 'string',
24
+ default: 'https://api.artefaktum.dev',
25
+ description: 'Change only for a self-hosted Artefaktum, without a trailing slash',
26
+ },
27
+ ];
28
+ this.authenticate = {
29
+ type: 'generic',
30
+ properties: { headers: { Authorization: '=Bearer {{$credentials.apiKey}}' } },
31
+ };
32
+ this.test = {
33
+ request: { baseURL: '={{$credentials.baseUrl}}', url: '/health/whoami', method: 'GET' },
34
+ };
35
+ }
36
+ }
37
+ exports.ArtefaktumApi = ArtefaktumApi;
38
+ //# sourceMappingURL=ArtefaktumApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArtefaktumApi.credentials.js","sourceRoot":"","sources":["../../credentials/ArtefaktumApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,aAAa;IAA1B;QACC,SAAI,GAAG,eAAe,CAAC;QAEvB,gBAAW,GAAG,gBAAgB,CAAC;QAE/B,SAAI,GAAG,EAAE,KAAK,EAAE,yCAAyC,EAAE,IAAI,EAAE,8CAA8C,EAAW,CAAC;QAE3H,qBAAgB,GAAG,4DAA4D,CAAC;QAEhF,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,0EAA0E;aACvF;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,4BAA4B;gBACrC,WAAW,EAAE,oEAAoE;aACjF;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,iCAAiC,EAAE,EAAE;SAC7E,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE,EAAE,OAAO,EAAE,2BAA2B,EAAE,GAAG,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAAE;SACvF,CAAC;IACH,CAAC;CAAA;AApCD,sCAoCC"}
@@ -0,0 +1,10 @@
1
+ import type { IExecuteFunctions, ILoadOptionsFunctions, INodeExecutionData, INodeListSearchResult, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class Artefaktum implements INodeType {
3
+ description: INodeTypeDescription;
4
+ methods: {
5
+ listSearch: {
6
+ getProjects(this: ILoadOptionsFunctions, filter?: string): Promise<INodeListSearchResult>;
7
+ };
8
+ };
9
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
10
+ }
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Artefaktum = void 0;
7
+ const n8n_workflow_1 = require("n8n-workflow");
8
+ const del_1 = __importDefault(require("./actions/artifact/del"));
9
+ const download_1 = __importDefault(require("./actions/artifact/download"));
10
+ const get_1 = __importDefault(require("./actions/artifact/get"));
11
+ const getMany_1 = __importDefault(require("./actions/artifact/getMany"));
12
+ const getOrUpload_1 = __importDefault(require("./actions/artifact/getOrUpload"));
13
+ const update_1 = __importDefault(require("./actions/artifact/update"));
14
+ const upload_1 = __importDefault(require("./actions/artifact/upload"));
15
+ const getMany_2 = __importDefault(require("./actions/project/getMany"));
16
+ const artifact_1 = require("./descriptions/artifact");
17
+ const project_1 = require("./descriptions/project");
18
+ const projects_1 = require("./projects");
19
+ const ACTIONS = {
20
+ artifact: { upload: upload_1.default, getOrUpload: getOrUpload_1.default, download: download_1.default, get: get_1.default, getMany: getMany_1.default, update: update_1.default, delete: del_1.default },
21
+ project: { getMany: getMany_2.default },
22
+ };
23
+ class Artefaktum {
24
+ constructor() {
25
+ this.description = {
26
+ displayName: 'Artefaktum',
27
+ name: 'artefaktum',
28
+ icon: { light: 'file:artefaktum.svg', dark: 'file:artefaktum.dark.svg' },
29
+ group: ['transform'],
30
+ version: 1,
31
+ subtitle: '={{ $parameter["operation"] + ": " + $parameter["resource"] }}',
32
+ description: 'Store, find and reuse artifacts between workflows and AI agents',
33
+ defaults: { name: 'Artefaktum' },
34
+ inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
35
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
36
+ usableAsTool: true,
37
+ credentials: [{ name: 'artefaktumApi', required: true }],
38
+ properties: [
39
+ {
40
+ displayName: 'Resource',
41
+ name: 'resource',
42
+ type: 'options',
43
+ noDataExpression: true,
44
+ default: 'artifact',
45
+ options: [
46
+ { name: 'Artifact', value: 'artifact' },
47
+ { name: 'Project', value: 'project' },
48
+ ],
49
+ },
50
+ artifact_1.artifactOperations,
51
+ project_1.projectOperations,
52
+ ...artifact_1.artifactFields,
53
+ ...project_1.projectFields,
54
+ ],
55
+ };
56
+ this.methods = {
57
+ listSearch: {
58
+ async getProjects(filter) {
59
+ return (0, projects_1.searchProjects)(this, filter);
60
+ },
61
+ },
62
+ };
63
+ }
64
+ async execute() {
65
+ var _a;
66
+ const items = this.getInputData();
67
+ const out = [];
68
+ const projectCache = new Map();
69
+ for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
70
+ const resource = this.getNodeParameter('resource', itemIndex);
71
+ const operation = this.getNodeParameter('operation', itemIndex);
72
+ const action = (_a = ACTIONS[resource]) === null || _a === void 0 ? void 0 : _a[operation];
73
+ if (!action)
74
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The operation '${operation}' on '${resource}' is not supported`, { itemIndex });
75
+ try {
76
+ out.push(...(await action({ ctx: this, itemIndex, projectCache })));
77
+ }
78
+ catch (error) {
79
+ if (this.continueOnFail()) {
80
+ out.push({ json: { error: error.message }, pairedItem: { item: itemIndex } });
81
+ continue;
82
+ }
83
+ if (error instanceof n8n_workflow_1.NodeOperationError)
84
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), error);
85
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
86
+ }
87
+ }
88
+ return [out];
89
+ }
90
+ }
91
+ exports.Artefaktum = Artefaktum;
92
+ //# sourceMappingURL=Artefaktum.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Artefa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,EAAE,CAAC,CAAC,CAAC,CAAC;YACrE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC3B,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;oBACzF,SAAS;gBACV,CAAC;gBAKD,IAAI,KAAK,YAAY,iCAAkB;oBAAE,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,CAAC;gBAG7F,MAAM,IAAI,2BAAY,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAmB,CAAC,CAAC;YAC7D,CAAC;QACF,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,CAAC;IACd,CAAC;CACD;AAtED,gCAsEC"}
@@ -0,0 +1,10 @@
1
+ {
2
+ "node": "n8n-nodes-artefaktum.artefaktum",
3
+ "nodeVersion": "1.0",
4
+ "codexVersion": "1.0",
5
+ "categories": ["Development", "Data & Storage"],
6
+ "resources": {
7
+ "credentialDocumentation": [{ "url": "https://github.com/Taadas/n8n-nodes-artefaktum#credentials" }],
8
+ "primaryDocumentation": [{ "url": "https://github.com/Taadas/n8n-nodes-artefaktum#readme" }]
9
+ }
10
+ }
@@ -0,0 +1,3 @@
1
+ import type { Action } from '../common';
2
+ declare const del: Action;
3
+ export default del;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const n8n_workflow_1 = require("n8n-workflow");
4
+ const transport_1 = require("../../transport");
5
+ const del = async ({ ctx, itemIndex }) => {
6
+ const id = ctx.getNodeParameter('artifactId', itemIndex).trim();
7
+ if (!id)
8
+ throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), "Parameter 'Artifact ID' is empty", { itemIndex });
9
+ await (0, transport_1.apiRequest)(ctx, 'DELETE', `/v1/artifacts/${encodeURIComponent(id)}`, { itemIndex });
10
+ return [{ json: { id, deleted: true }, pairedItem: { item: itemIndex } }];
11
+ };
12
+ exports.default = del;
13
+ //# sourceMappingURL=del.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"del.js","sourceRoot":"","sources":["../../../../../nodes/Artefaktum/actions/artifact/del.ts"],"names":[],"mappings":";;AAAA,+CAAkD;AAClD,+CAA6C;AAG7C,MAAM,GAAG,GAAW,KAAK,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE;IAChD,MAAM,EAAE,GAAI,GAAG,CAAC,gBAAgB,CAAC,YAAY,EAAE,SAAS,CAAY,CAAC,IAAI,EAAE,CAAC;IAC5E,IAAI,CAAC,EAAE;QAAE,MAAM,IAAI,iCAAkB,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,kCAAkC,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;IACxG,MAAM,IAAA,sBAAU,EAAC,GAAG,EAAE,QAAQ,EAAE,iBAAiB,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;IAC1F,OAAO,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;AAC3E,CAAC,CAAC;AAEF,kBAAe,GAAG,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Action } from '../common';
2
+ declare const download: Action;
3
+ export default download;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const n8n_workflow_1 = require("n8n-workflow");
4
+ const content_1 = require("../../content");
5
+ const transport_1 = require("../../transport");
6
+ const download = async ({ ctx, itemIndex }) => {
7
+ var _a, _b, _c;
8
+ const artifactId = ctx.getNodeParameter('artifactId', itemIndex).trim();
9
+ if (!artifactId)
10
+ throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), "Parameter 'Artifact ID' is empty", { itemIndex });
11
+ const options = ctx.getNodeParameter('downloadOptions', itemIndex, {});
12
+ const property = options.binaryPropertyName || 'data';
13
+ const verify = options.verifyChecksum !== false;
14
+ const encodedId = encodeURIComponent(artifactId);
15
+ const artifact = await (0, transport_1.apiRequest)(ctx, 'GET', `/v1/artifacts/${encodedId}`, { itemIndex });
16
+ const qs = {};
17
+ if (typeof options.versionId === 'string' && options.versionId.trim())
18
+ qs.version_id = options.versionId.trim();
19
+ const link = await (0, transport_1.apiRequest)(ctx, 'GET', `/v1/artifacts/${encodedId}/download`, { itemIndex, qs: Object.keys(qs).length ? qs : undefined });
20
+ const bytes = await (0, transport_1.storageRequest)(ctx, { method: String((_a = link.method) !== null && _a !== void 0 ? _a : 'GET'), url: String(link.url), headers: {}, expires_at: String((_b = link.expires_at) !== null && _b !== void 0 ? _b : '') }, { itemIndex });
21
+ let version = (_c = artifact.latest_version) !== null && _c !== void 0 ? _c : {};
22
+ const servedVersionId = typeof link.version_id === 'string' ? link.version_id : undefined;
23
+ if (servedVersionId && servedVersionId !== version.id) {
24
+ const versions = (await (0, transport_1.apiRequest)(ctx, 'GET', `/v1/artifacts/${encodedId}/versions`, { itemIndex }));
25
+ const match = (Array.isArray(versions) ? versions : []).find((v) => v.id === servedVersionId);
26
+ if (match)
27
+ version = match;
28
+ }
29
+ if (verify && typeof version.sha256 === 'string' && version.sha256) {
30
+ const actual = (0, content_1.sha256Hex)(bytes);
31
+ if (actual !== version.sha256)
32
+ throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `Checksum mismatch for artifact ${artifactId}: expected ${version.sha256}, got ${actual}. Run the node again; if it persists, the stored object is damaged.`, { itemIndex });
33
+ }
34
+ const fileName = (typeof options.fileName === 'string' && options.fileName.trim()) || (typeof version.original_filename === 'string' ? version.original_filename : undefined);
35
+ const mimeType = typeof version.content_type === 'string' ? version.content_type : undefined;
36
+ const binary = await ctx.helpers.prepareBinaryData(bytes, fileName, mimeType);
37
+ return [{ json: artifact, binary: { [property]: binary }, pairedItem: { item: itemIndex } }];
38
+ };
39
+ exports.default = download;
40
+ //# sourceMappingURL=download.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"download.js","sourceRoot":"","sources":["../../../../../nodes/Artefaktum/actions/artifact/download.ts"],"names":[],"mappings":";;AACA,+CAAkD;AAClD,2CAA0C;AAC1C,+CAA6D;AAG7D,MAAM,QAAQ,GAAW,KAAK,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE;;IACrD,MAAM,UAAU,GAAI,GAAG,CAAC,gBAAgB,CAAC,YAAY,EAAE,SAAS,CAAY,CAAC,IAAI,EAAE,CAAC;IACpF,IAAI,CAAC,UAAU;QAAE,MAAM,IAAI,iCAAkB,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,kCAAkC,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;IAChH,MAAM,OAAO,GAAG,GAAG,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,SAAS,EAAE,EAAE,CAAgB,CAAC;IACtF,MAAM,QAAQ,GAAI,OAAO,CAAC,kBAA6B,IAAI,MAAM,CAAC;IAClE,MAAM,MAAM,GAAG,OAAO,CAAC,cAAc,KAAK,KAAK,CAAC;IAChD,MAAM,SAAS,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAEjD,MAAM,QAAQ,GAAG,MAAM,IAAA,sBAAU,EAAC,GAAG,EAAE,KAAK,EAAE,iBAAiB,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;IAC3F,MAAM,EAAE,GAAgB,EAAE,CAAC;IAC3B,IAAI,OAAO,OAAO,CAAC,SAAS,KAAK,QAAQ,IAAI,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE;QAAE,EAAE,CAAC,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;IAChH,MAAM,IAA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IAC5B,CAAC;IACD,IAAI,MAAM,IAAI,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACpE,MAAM,MAAM,GAAG,IAAA,mBAAS,EAAC,KAAK,CAAC,CAAC;QAChC,IAAI,MAAM,KAAK,OAAO,CAAC,MAAM;YAAE,MAAM,IAAI,iCAAkB,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,kCAAkC,UAAU,cAAc,OAAO,CAAC,MAAM,SAAS,MAAM,qEAAqE,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;IACzP,CAAC;IACD,MAAM,QAAQ,GAAG,CAAC,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,OAAO,OAAO,CAAC,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC9K,MAAM,QAAQ,GAAG,OAAO,OAAO,CAAC,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC;IAC7F,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC9E,OAAO,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;AAC9F,CAAC,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Action } from '../common';
2
+ declare const get: Action;
3
+ export default get;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const n8n_workflow_1 = require("n8n-workflow");
4
+ const projects_1 = require("../../projects");
5
+ const transport_1 = require("../../transport");
6
+ const common_1 = require("../common");
7
+ const get = async ({ ctx, itemIndex, projectCache }) => {
8
+ const lookup = ctx.getNodeParameter('lookup', itemIndex, 'id');
9
+ if (lookup === 'externalKey') {
10
+ const key = ctx.getNodeParameter('externalKey', itemIndex).trim();
11
+ if (!key)
12
+ throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), "Parameter 'External Key' is empty", { itemIndex });
13
+ const projectId = await (0, projects_1.resolveProjectId)(ctx, (0, common_1.locator)(ctx, itemIndex), projectCache, itemIndex);
14
+ const artifact = await (0, transport_1.apiRequest)(ctx, 'GET', `/v1/artifacts/by-external-key/${encodeURIComponent(key)}`, { qs: { project_id: projectId }, itemIndex });
15
+ return [{ json: artifact, pairedItem: { item: itemIndex } }];
16
+ }
17
+ const id = ctx.getNodeParameter('artifactId', itemIndex).trim();
18
+ if (!id)
19
+ throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), "Parameter 'Artifact ID' is empty", { itemIndex });
20
+ return [{ json: await (0, transport_1.apiRequest)(ctx, 'GET', `/v1/artifacts/${encodeURIComponent(id)}`, { itemIndex }), pairedItem: { item: itemIndex } }];
21
+ };
22
+ exports.default = get;
23
+ //# sourceMappingURL=get.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../../nodes/Artefaktum/actions/artifact/get.ts"],"names":[],"mappings":";;AAAA,+CAAkD;AAClD,6CAAkD;AAClD,+CAA6C;AAC7C,sCAAiD;AAEjD,MAAM,GAAG,GAAW,KAAK,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,EAAE;IAC9D,MAAM,MAAM,GAAG,GAAG,CAAC,gBAAgB,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAW,CAAC;IACzE,IAAI,MAAM,KAAK,aAAa,EAAE,CAAC;QAC9B,MAAM,GAAG,GAAI,GAA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default getMany;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const projects_1 = require("../../projects");
4
+ const transport_1 = require("../../transport");
5
+ const common_1 = require("../common");
6
+ const RETURN_ALL_CAP = 1000;
7
+ const MAX_PAGES = 20;
8
+ const getMany = async ({ ctx, itemIndex, projectCache }) => {
9
+ var _a;
10
+ const projectId = await (0, projects_1.resolveProjectId)(ctx, (0, common_1.locator)(ctx, itemIndex), projectCache, itemIndex);
11
+ const returnAll = ctx.getNodeParameter('returnAll', itemIndex, false);
12
+ const limit = returnAll ? 100 : Math.max(1, Math.min(100, Number(ctx.getNodeParameter('limit', itemIndex, 50))));
13
+ const f = ctx.getNodeParameter('filters', itemIndex, {});
14
+ const filters = {};
15
+ const tags = (0, common_1.splitList)(f.tags);
16
+ if (tags.length)
17
+ filters.tags_all = tags;
18
+ const types = (0, common_1.splitList)(f.contentTypes);
19
+ if (types.length)
20
+ filters.content_types = types;
21
+ if (typeof f.createdAfter === 'string' && f.createdAfter)
22
+ filters.created_after = f.createdAfter;
23
+ if (typeof f.createdBefore === 'string' && f.createdBefore)
24
+ filters.created_before = f.createdBefore;
25
+ if (f.includeSuperseded === true)
26
+ filters.exclude_superseded = false;
27
+ const body = { project_id: projectId, query: ctx.getNodeParameter('query', itemIndex, ''), mode: ctx.getNodeParameter('mode', itemIndex, 'hybrid'), limit };
28
+ if (Object.keys(filters).length)
29
+ body.filters = filters;
30
+ const out = [];
31
+ let cursor = null;
32
+ let pageCount = 0;
33
+ do {
34
+ const page = await (0, transport_1.apiRequest)(ctx, 'POST', '/v1/artifacts/search', { body: cursor ? { ...body, cursor } : body, itemIndex });
35
+ pageCount++;
36
+ for (const hit of (_a = page.items) !== null && _a !== void 0 ? _a : []) {
37
+ out.push({ json: { ...hit.artifact, score: hit.score, match_mode: hit.match_mode }, pairedItem: { item: itemIndex } });
38
+ if (!returnAll && out.length >= limit)
39
+ return out;
40
+ if (returnAll && out.length >= RETURN_ALL_CAP)
41
+ return out;
42
+ }
43
+ cursor = returnAll && pageCount < MAX_PAGES && typeof page.next_cursor === 'string' ? page.next_cursor : null;
44
+ } while (cursor);
45
+ return out;
46
+ };
47
+ exports.default = getMany;
48
+ //# sourceMappingURL=getMany.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getMany.js","sourceRoot":"","sources":["../../../../../nodes/Artefaktum/actions/artifact/getMany.ts"],"names":[],"mappings":";;AACA,6CAAkD;AAClD,+CAA6C;AAC7C,sCAA4D;AAE5D,MAAM,cAAc,GAAG,IAAI,CAAC;AAG5B,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB,MAAM,OAAO,GAAW,KAAK,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,EAAE;;IAClE,MAAM,SAAS,GAAG,MAAM,IAAA,2BAAgB,EAAC,GAAG,EAAE,IAAA,gBAAO,EAAC,GAAG,EAAE,SAAS,CAAC,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;IAChG,MAAM,SAAS,GAAG,GAAG,CAAC,gBAAgB,CAAC,WAAW,EAAE,SAAS,EAAE,KAAK,CAAY,CAAC;IACjF,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACjH,MAAM,CAAC,GAAG,GAAG,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE,CAAgB,CAAC;IACxE,MAAM,OAAO,GAAgB,EAAE,CAAC;IAChC,MAAM,IAAI,GAAG,IAAA,kBAAS,EAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,IAAI,CAAC,MAAM;QAAE,OAAO,CAAC,QAAQ,GAA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M,GAAG,IAAI,MAAC,IAAI,CAAC,KAAuB,mCAAI,EAAE,EAAE,CAAC;YACvD,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,GAAI,GAAG,CAAC,QAAwB,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;YACxI,IAAI,CAAC,SAAS,IAAI,GAAG,CAAC,MAAM,IAAI,KAAK;gBAAE,OAAO,GAAG,CAAC;YAClD,IAAI,SAAS,IAAI,GAAG,CAAC,MAAM,IAAI,cAAc;gBAAE,OAAO,GAAG,CAAC;QAC3D,CAAC;QACD,MAAM,GAAG,SAAS,IAAI,SAAS,GAAG,SAAS,IAAI,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC;IAC/G,CAAC,QAAQ,MAAM,EAAE;IACjB,OAAO,GAAG,CAAC;AACZ,CAAC,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Action } from '../common';
2
+ declare const getOrUpload: Action;
3
+ export default getOrUpload;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const n8n_workflow_1 = require("n8n-workflow");
4
+ const content_1 = require("../../content");
5
+ const projects_1 = require("../../projects");
6
+ const transport_1 = require("../../transport");
7
+ const upload_1 = require("../../upload");
8
+ const common_1 = require("../common");
9
+ const MAX_PENDING_ROUNDS = 5;
10
+ const getOrUpload = async ({ ctx, itemIndex, projectCache }) => {
11
+ var _a;
12
+ const projectId = await (0, projects_1.resolveProjectId)(ctx, (0, common_1.locator)(ctx, itemIndex), projectCache, itemIndex);
13
+ const externalKey = ctx.getNodeParameter('externalKey', itemIndex).trim();
14
+ if (!externalKey)
15
+ throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), "Parameter 'External Key' is empty", { itemIndex });
16
+ const maxAge = Number(ctx.getNodeParameter('maxAgeSeconds', itemIndex, 0));
17
+ const content = await (0, content_1.readContent)(ctx, itemIndex);
18
+ const body = { project_id: projectId, external_key: externalKey, ...(0, common_1.uploadMetadata)(ctx, itemIndex, content, { externalKey: false, forResolve: true }) };
19
+ if (maxAge > 0)
20
+ body.max_age_seconds = Math.floor(maxAge);
21
+ for (let round = 0; round <= MAX_PENDING_ROUNDS; round++) {
22
+ const res = await (0, transport_1.apiRequest)(ctx, 'POST', '/v1/artifacts/resolve', { body, itemIndex });
23
+ if (res.status === 'hit')
24
+ return [{ json: { ...res.artifact, cache: 'hit' }, pairedItem: { item: itemIndex } }];
25
+ if (res.status === 'create') {
26
+ const ref = res.reservation;
27
+ const artifact = await (0, upload_1.putAndComplete)(ctx, String(ref.id), String(ref.version_id), res.upload, content, itemIndex);
28
+ return [{ json: { ...artifact, cache: 'created' }, pairedItem: { item: itemIndex } }];
29
+ }
30
+ if (round < MAX_PENDING_ROUNDS)
31
+ await (0, n8n_workflow_1.sleep)(Math.min(Number((_a = res.retry_after_seconds) !== null && _a !== void 0 ? _a : 5), 5) * 1000);
32
+ }
33
+ throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `The artifact under '${externalKey}' is still being uploaded by another run. Try again in a minute.`, { itemIndex });
34
+ };
35
+ exports.default = getOrUpload;
36
+ //# sourceMappingURL=getOrUpload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getOrUpload.js","sourceRoot":"","sources":["../../../../../nodes/Artefaktum/actions/artifact/getOrUpload.ts"],"names":[],"mappings":";;AACA,+CAAyD;AACzD,2CAA4C;AAC5C,6CAAkD;AAClD,+CAAsE;AACtE,yCAA8C;AAC9C,sCAAiE;AAEjE,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAE7B,MAAM,WAAW,GAAW,KAAK,EAAE,EAAE,GAAG,EAAE,SAAS,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AAC,QAAwB,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;QACjI,IAAI,GAAG,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC7B,MAAM,GAAG,GAAG,GAAG,CAAC,WAA0B,CAAC;YAC3C,MAAM,QAAQ,GAAG,MAAM,IAAA,uBAAc,EAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,GAAG,CAAC,MAAuC,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;YACpJ,OAAO,CAAC,EAAE,IAAI,EAAE,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;QACvF,CAAC;QACD,IAAI,KAAK,GAAG,kBAAkB;YAAE,MAAM,IAAA,oBAAK,EAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAA,GAAG,CAAC,mBAAmB,mCAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IACvG,CAAC;IACD,MAAM,IAAI,iCAAkB,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,uBAAuB,WAAW,kEAAkE,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;AAClK,CAAC,CAAC;AAEF,kBAAe,WAAW,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Action } from '../common';
2
+ declare const update: Action;
3
+ export default update;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const n8n_workflow_1 = require("n8n-workflow");
4
+ const transport_1 = require("../../transport");
5
+ const common_1 = require("../common");
6
+ const update = async ({ ctx, itemIndex }) => {
7
+ const id = ctx.getNodeParameter('artifactId', itemIndex).trim();
8
+ if (!id)
9
+ throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), "Parameter 'Artifact ID' is empty", { itemIndex });
10
+ const f = ctx.getNodeParameter('updateFields', itemIndex, {});
11
+ const body = {};
12
+ if (typeof f.title === 'string' && f.title.trim())
13
+ body.title = f.title.trim();
14
+ if (typeof f.description === 'string' && f.description !== '')
15
+ body.description = f.description;
16
+ if (f.tags !== undefined && f.tags !== '')
17
+ body.tags = (0, common_1.splitList)(f.tags);
18
+ const metadata = (0, common_1.parseJsonParam)(ctx, f.metadata, 'Metadata (JSON)', itemIndex);
19
+ if (metadata && Object.keys(metadata).length)
20
+ body.metadata = metadata;
21
+ if (f.clearExpiresAt === true)
22
+ body.clear_expires_at = true;
23
+ else if (typeof f.expiresAt === 'string' && f.expiresAt)
24
+ body.expires_at = f.expiresAt;
25
+ if (!Object.keys(body).length)
26
+ throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), "Set at least one field under 'Fields' to update", { itemIndex });
27
+ return [{ json: await (0, transport_1.apiRequest)(ctx, 'PATCH', `/v1/artifacts/${encodeURIComponent(id)}`, { body, itemIndex }), pairedItem: { item: itemIndex } }];
28
+ };
29
+ exports.default = update;
30
+ //# sourceMappingURL=update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../../nodes/Artefaktum/actions/artifact/update.ts"],"names":[],"mappings":";;AACA,+CAAkD;AAClD,+CAA6C;AAC7C,sCAAmE;AAEnE,MAAM,MAAM,GAAW,KAAK,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE;IACnD,MAAM,EAAE,GAAI,GAAG,CAAC,gBAAgB,CAAC,YAAY,EAAE,SAAS,CAAY,CAAC,IAAI,EAAE,CAAC;IAC5E,IAAI,CAAC,EAAE;QAAE,MAAM,IAAI,iCAAkB,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,kCAAkC,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;IACxG,MAAM,CAAC,GAAG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