@lowdefy/plugin-azure 0.0.0-experimental-20260707082859

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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # @lowdefy/plugin-azure
2
+
3
+ Microsoft Azure connections for Lowdefy.
4
+
5
+ ## Connections
6
+
7
+ - `AzureBlobContainer` — an Azure Blob Storage container.
8
+
9
+ ## Requests
10
+
11
+ - `AzureBlobUploadSas` — mints a write SAS URL for direct browser uploads.
12
+ Returns the standard upload-policy descriptor
13
+ `{ method: 'PUT', url, key, bucket, headers }` (with the
14
+ `x-ms-blob-type: BlockBlob` header) used by the `@lowdefy/blocks-files`
15
+ upload blocks.
16
+ - `AzureBlobDownloadSas` — mints a read SAS URL for downloads, or returns a
17
+ stable public URL when the request sets `public: true`.
18
+ - `AzureBlobPut` — server-side write request that stores base64 content as a
19
+ block blob. Used from API endpoint routines.
20
+
21
+ For more Lowdefy documentation, see [lowdefy.com](https://lowdefy.com).
22
+
23
+ ## License
24
+
25
+ [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0)
@@ -0,0 +1,28 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ import AzureBlobDownloadSas from './AzureBlobDownloadSas/AzureBlobDownloadSas.js';
16
+ import AzureBlobGet from './AzureBlobGet/AzureBlobGet.js';
17
+ import AzureBlobPut from './AzureBlobPut/AzureBlobPut.js';
18
+ import AzureBlobUploadSas from './AzureBlobUploadSas/AzureBlobUploadSas.js';
19
+ import schema from './schema.js';
20
+ export default {
21
+ schema,
22
+ requests: {
23
+ AzureBlobDownloadSas,
24
+ AzureBlobGet,
25
+ AzureBlobPut,
26
+ AzureBlobUploadSas
27
+ }
28
+ };
@@ -0,0 +1,52 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ import { BlobSASPermissions, generateBlobSASQueryParameters, StorageSharedKeyCredential } from '@azure/storage-blob';
16
+ import getBlobUrl from '../getBlobUrl.js';
17
+ import getPublicUrl from '../getPublicUrl.js';
18
+ import schema from './schema.js';
19
+ async function AzureBlobDownloadSas({ request, connection }) {
20
+ const { account, accountKey, container } = connection;
21
+ const { contentDisposition, contentType, expires = 3600, key } = request;
22
+ if (request.public === true) {
23
+ return getPublicUrl({
24
+ connection,
25
+ key
26
+ });
27
+ }
28
+ const credential = new StorageSharedKeyCredential(account, accountKey);
29
+ const options = {
30
+ containerName: container,
31
+ blobName: key,
32
+ permissions: BlobSASPermissions.parse('r'),
33
+ expiresOn: new Date(Date.now() + expires * 1000)
34
+ };
35
+ if (contentDisposition) {
36
+ options.contentDisposition = contentDisposition;
37
+ }
38
+ if (contentType) {
39
+ options.contentType = contentType;
40
+ }
41
+ const sas = generateBlobSASQueryParameters(options, credential).toString();
42
+ return `${getBlobUrl({
43
+ connection,
44
+ key
45
+ })}?${sas}`;
46
+ }
47
+ AzureBlobDownloadSas.schema = schema;
48
+ AzureBlobDownloadSas.meta = {
49
+ checkRead: true,
50
+ checkWrite: false
51
+ };
52
+ export default AzureBlobDownloadSas;
@@ -0,0 +1,65 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ export default {
16
+ $schema: 'http://json-schema.org/draft-07/schema#',
17
+ title: 'Lowdefy Request Schema - AzureBlobDownloadSas',
18
+ type: 'object',
19
+ required: [
20
+ 'key'
21
+ ],
22
+ properties: {
23
+ contentDisposition: {
24
+ type: 'string',
25
+ description: 'Sets the Content-Disposition header of the response.',
26
+ errorMessage: {
27
+ type: 'AzureBlobDownloadSas request property "contentDisposition" should be a string.'
28
+ }
29
+ },
30
+ contentType: {
31
+ type: 'string',
32
+ description: 'Sets the Content-Type header of the response.',
33
+ errorMessage: {
34
+ type: 'AzureBlobDownloadSas request property "contentType" should be a string.'
35
+ }
36
+ },
37
+ expires: {
38
+ type: 'number',
39
+ description: 'Number of seconds for which the SAS token should be valid.',
40
+ default: 3600,
41
+ errorMessage: {
42
+ type: 'AzureBlobDownloadSas request property "expires" should be a number.'
43
+ }
44
+ },
45
+ key: {
46
+ type: 'string',
47
+ description: 'Key (blob name) under which the object is stored.',
48
+ errorMessage: {
49
+ type: 'AzureBlobDownloadSas request property "key" should be a string.'
50
+ }
51
+ },
52
+ public: {
53
+ type: 'boolean',
54
+ default: false,
55
+ description: 'Return a stable, non-expiring public URL instead of a SAS URL. The blob must be publicly readable (public container access) — public is author-declared and never checked at runtime.',
56
+ errorMessage: {
57
+ type: 'AzureBlobDownloadSas request property "public" should be a boolean.'
58
+ }
59
+ }
60
+ },
61
+ errorMessage: {
62
+ type: 'AzureBlobDownloadSas request properties should be an object.',
63
+ required: 'AzureBlobDownloadSas request should have required property "key".'
64
+ }
65
+ };
@@ -0,0 +1,49 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ import { BlobServiceClient, StorageSharedKeyCredential } from '@azure/storage-blob';
16
+ import { type } from '@lowdefy/helpers';
17
+ import schema from './schema.js';
18
+ // Server-side read: returns the blob content as a base64 string so routine
19
+ // steps can process it with operators and pass it to other steps (base64
20
+ // survives JSON serialization; consumers decode with Buffer.from(content, 'base64')).
21
+ async function AzureBlobGet({ request, connection }) {
22
+ const { account, accountKey, container } = connection;
23
+ const { key } = request;
24
+ const credential = new StorageSharedKeyCredential(account, accountKey);
25
+ const serviceClient = new BlobServiceClient(`https://${account}.blob.core.windows.net`, credential);
26
+ const blobClient = serviceClient.getContainerClient(container).getBlockBlobClient(key);
27
+ // Properties are only used for contentType — size is derived from the returned
28
+ // content so it always matches, even if the blob is overwritten between calls.
29
+ const [buffer, properties] = await Promise.all([
30
+ blobClient.downloadToBuffer(),
31
+ blobClient.getProperties()
32
+ ]);
33
+ const result = {
34
+ bucket: container,
35
+ key,
36
+ content: buffer.toString('base64'),
37
+ size: buffer.length
38
+ };
39
+ if (!type.isNone(properties.contentType)) {
40
+ result.contentType = properties.contentType;
41
+ }
42
+ return result;
43
+ }
44
+ AzureBlobGet.schema = schema;
45
+ AzureBlobGet.meta = {
46
+ checkRead: true,
47
+ checkWrite: false
48
+ };
49
+ export default AzureBlobGet;
@@ -0,0 +1,35 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ export default {
16
+ $schema: 'http://json-schema.org/draft-07/schema#',
17
+ title: 'Lowdefy Request Schema - AzureBlobGet',
18
+ type: 'object',
19
+ required: [
20
+ 'key'
21
+ ],
22
+ properties: {
23
+ key: {
24
+ type: 'string',
25
+ description: 'Key (blob name) under which the blob is stored.',
26
+ errorMessage: {
27
+ type: 'AzureBlobGet request property "key" should be a string.'
28
+ }
29
+ }
30
+ },
31
+ errorMessage: {
32
+ type: 'AzureBlobGet request properties should be an object.',
33
+ required: 'AzureBlobGet request should have required property "key".'
34
+ }
35
+ };
@@ -0,0 +1,44 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ import { BlobServiceClient, StorageSharedKeyCredential } from '@azure/storage-blob';
16
+ import schema from './schema.js';
17
+ // Server-side write: stores base64 content as a block blob. Used by API
18
+ // endpoint routines that receive files as endpoint payloads
19
+ // (emitFileContent + CallAPI).
20
+ async function AzureBlobPut({ request, connection }) {
21
+ const { account, accountKey, container } = connection;
22
+ const { content, contentType, key } = request;
23
+ const credential = new StorageSharedKeyCredential(account, accountKey);
24
+ const serviceClient = new BlobServiceClient(`https://${account}.blob.core.windows.net`, credential);
25
+ const blockBlobClient = serviceClient.getContainerClient(container).getBlockBlobClient(key);
26
+ const buffer = Buffer.from(content, 'base64');
27
+ const options = {};
28
+ if (contentType) {
29
+ options.blobHTTPHeaders = {
30
+ blobContentType: contentType
31
+ };
32
+ }
33
+ await blockBlobClient.upload(buffer, buffer.length, options);
34
+ return {
35
+ bucket: container,
36
+ key
37
+ };
38
+ }
39
+ AzureBlobPut.schema = schema;
40
+ AzureBlobPut.meta = {
41
+ checkRead: false,
42
+ checkWrite: true
43
+ };
44
+ export default AzureBlobPut;
@@ -0,0 +1,53 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ export default {
16
+ $schema: 'http://json-schema.org/draft-07/schema#',
17
+ title: 'Lowdefy Request Schema - AzureBlobPut',
18
+ type: 'object',
19
+ required: [
20
+ 'key',
21
+ 'content'
22
+ ],
23
+ properties: {
24
+ content: {
25
+ type: 'string',
26
+ description: 'Blob content as a base64 encoded string.',
27
+ errorMessage: {
28
+ type: 'AzureBlobPut request property "content" should be a string.'
29
+ }
30
+ },
31
+ contentType: {
32
+ type: 'string',
33
+ description: 'MIME type of the blob (sets the Content-Type of the stored blob).',
34
+ errorMessage: {
35
+ type: 'AzureBlobPut request property "contentType" should be a string.'
36
+ }
37
+ },
38
+ key: {
39
+ type: 'string',
40
+ description: 'Key (blob name) under which the blob will be stored.',
41
+ errorMessage: {
42
+ type: 'AzureBlobPut request property "key" should be a string.'
43
+ }
44
+ }
45
+ },
46
+ errorMessage: {
47
+ type: 'AzureBlobPut request properties should be an object.',
48
+ required: {
49
+ key: 'AzureBlobPut request should have required property "key".',
50
+ content: 'AzureBlobPut request should have required property "content".'
51
+ }
52
+ }
53
+ };
@@ -0,0 +1,53 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ import { BlobSASPermissions, generateBlobSASQueryParameters, StorageSharedKeyCredential } from '@azure/storage-blob';
16
+ import getBlobUrl from '../getBlobUrl.js';
17
+ import schema from './schema.js';
18
+ async function AzureBlobUploadSas({ request, connection }) {
19
+ const { account, accountKey, container } = connection;
20
+ const { contentType, expires = 3600, key } = request;
21
+ const credential = new StorageSharedKeyCredential(account, accountKey);
22
+ const sas = generateBlobSASQueryParameters({
23
+ containerName: container,
24
+ blobName: key,
25
+ permissions: BlobSASPermissions.parse('cw'),
26
+ expiresOn: new Date(Date.now() + expires * 1000)
27
+ }, credential).toString();
28
+ const headers = {
29
+ 'x-ms-blob-type': 'BlockBlob'
30
+ };
31
+ if (contentType) {
32
+ headers['Content-Type'] = contentType;
33
+ }
34
+ // PUT descriptor: the signed url already targets the blob, the client sends
35
+ // the file as the raw request body with these headers. Object identity is
36
+ // carried at the descriptor top level (there is no fields object on PUT).
37
+ return {
38
+ method: 'PUT',
39
+ url: `${getBlobUrl({
40
+ connection,
41
+ key
42
+ })}?${sas}`,
43
+ bucket: container,
44
+ key,
45
+ headers
46
+ };
47
+ }
48
+ AzureBlobUploadSas.schema = schema;
49
+ AzureBlobUploadSas.meta = {
50
+ checkRead: false,
51
+ checkWrite: true
52
+ };
53
+ export default AzureBlobUploadSas;
@@ -0,0 +1,50 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ export default {
16
+ $schema: 'http://json-schema.org/draft-07/schema#',
17
+ title: 'Lowdefy Request Schema - AzureBlobUploadSas',
18
+ type: 'object',
19
+ required: [
20
+ 'key'
21
+ ],
22
+ properties: {
23
+ contentType: {
24
+ type: 'string',
25
+ description: 'MIME type set as the Content-Type header of the upload.',
26
+ errorMessage: {
27
+ type: 'AzureBlobUploadSas request property "contentType" should be a string.'
28
+ }
29
+ },
30
+ expires: {
31
+ type: 'number',
32
+ description: 'Number of seconds for which the SAS token should be valid.',
33
+ default: 3600,
34
+ errorMessage: {
35
+ type: 'AzureBlobUploadSas request property "expires" should be a number.'
36
+ }
37
+ },
38
+ key: {
39
+ type: 'string',
40
+ description: 'Key (blob name) under which the object will be stored.',
41
+ errorMessage: {
42
+ type: 'AzureBlobUploadSas request property "key" should be a string.'
43
+ }
44
+ }
45
+ },
46
+ errorMessage: {
47
+ type: 'AzureBlobUploadSas request properties should be an object.',
48
+ required: 'AzureBlobUploadSas request should have required property "key".'
49
+ }
50
+ };
@@ -0,0 +1,21 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ // Canonical URL of a blob (no SAS token).
16
+ function getBlobUrl({ connection, key }) {
17
+ const { account, container } = connection;
18
+ const encodedKey = key.split('/').map(encodeURIComponent).join('/');
19
+ return `https://${account}.blob.core.windows.net/${container}/${encodedKey}`;
20
+ }
21
+ export default getBlobUrl;
@@ -0,0 +1,30 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ import { type } from '@lowdefy/helpers';
16
+ import getBlobUrl from './getBlobUrl.js';
17
+ // Stable, non-expiring URL for a publicly readable blob. Public is
18
+ // author-declared, never runtime-checked — a public URL to a private blob 403s.
19
+ function getPublicUrl({ connection, key }) {
20
+ const { publicUrlBase } = connection;
21
+ if (!type.isNone(publicUrlBase)) {
22
+ const encodedKey = key.split('/').map(encodeURIComponent).join('/');
23
+ return `${publicUrlBase.replace(/\/+$/, '')}/${encodedKey}`;
24
+ }
25
+ return getBlobUrl({
26
+ connection,
27
+ key
28
+ });
29
+ }
30
+ export default getPublicUrl;
@@ -0,0 +1,78 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ export default {
16
+ $schema: 'http://json-schema.org/draft-07/schema#',
17
+ title: 'Lowdefy Connection Schema - AzureBlobContainer',
18
+ type: 'object',
19
+ required: [
20
+ 'account',
21
+ 'accountKey',
22
+ 'container'
23
+ ],
24
+ properties: {
25
+ account: {
26
+ type: 'string',
27
+ description: 'Azure storage account name.',
28
+ errorMessage: {
29
+ type: 'AzureBlobContainer connection property "account" should be a string.'
30
+ }
31
+ },
32
+ accountKey: {
33
+ type: 'string',
34
+ description: 'Azure storage account access key.',
35
+ errorMessage: {
36
+ type: 'AzureBlobContainer connection property "accountKey" should be a string.'
37
+ }
38
+ },
39
+ container: {
40
+ type: 'string',
41
+ description: 'Blob container name.',
42
+ errorMessage: {
43
+ type: 'AzureBlobContainer connection property "container" should be a string.'
44
+ }
45
+ },
46
+ publicUrlBase: {
47
+ type: 'string',
48
+ description: 'Base URL used to construct stable public object URLs (e.g. a CDN domain in front of the container). Used by download requests when the request sets "public: true".',
49
+ errorMessage: {
50
+ type: 'AzureBlobContainer connection property "publicUrlBase" should be a string.'
51
+ }
52
+ },
53
+ read: {
54
+ type: 'boolean',
55
+ default: true,
56
+ description: 'Allow reads from the container.',
57
+ errorMessage: {
58
+ type: 'AzureBlobContainer connection property "read" should be a boolean.'
59
+ }
60
+ },
61
+ write: {
62
+ type: 'boolean',
63
+ default: false,
64
+ description: 'Allow writes to the container.',
65
+ errorMessage: {
66
+ type: 'AzureBlobContainer connection property "write" should be a boolean.'
67
+ }
68
+ }
69
+ },
70
+ errorMessage: {
71
+ type: 'AzureBlobContainer connection properties should be an object.',
72
+ required: {
73
+ account: 'AzureBlobContainer connection should have required property "account".',
74
+ accountKey: 'AzureBlobContainer connection should have required property "accountKey".',
75
+ container: 'AzureBlobContainer connection should have required property "container".'
76
+ }
77
+ }
78
+ };
@@ -0,0 +1,15 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ export { default as AzureBlobContainer } from './connections/AzureBlobContainer/AzureBlobContainer.js';
package/dist/types.js ADDED
@@ -0,0 +1,25 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ export default {
16
+ connections: [
17
+ 'AzureBlobContainer'
18
+ ],
19
+ requests: [
20
+ 'AzureBlobDownloadSas',
21
+ 'AzureBlobGet',
22
+ 'AzureBlobPut',
23
+ 'AzureBlobUploadSas'
24
+ ]
25
+ };
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@lowdefy/plugin-azure",
3
+ "version": "0.0.0-experimental-20260707082859",
4
+ "license": "Apache-2.0",
5
+ "description": "Lowdefy Microsoft Azure connections.",
6
+ "homepage": "https://lowdefy.com",
7
+ "lowdefy": {
8
+ "serverExternalPackages": [
9
+ "@azure/storage-blob"
10
+ ]
11
+ },
12
+ "keywords": [
13
+ "lowdefy",
14
+ "lowdefy plugin",
15
+ "azure blob storage"
16
+ ],
17
+ "bugs": {
18
+ "url": "https://github.com/lowdefy/lowdefy/issues"
19
+ },
20
+ "contributors": [
21
+ {
22
+ "name": "Sam Tolmay",
23
+ "url": "https://github.com/SamTolmay"
24
+ },
25
+ {
26
+ "name": "Gerrie van Wyk",
27
+ "url": "https://github.com/Gervwyk"
28
+ }
29
+ ],
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/lowdefy/lowdefy.git"
33
+ },
34
+ "type": "module",
35
+ "exports": {
36
+ "./connections": "./dist/connections.js",
37
+ "./types": "./dist/types.js",
38
+ "./connections/*": "./dist/connections/*",
39
+ "./*": "./dist/*"
40
+ },
41
+ "files": [
42
+ "dist/*"
43
+ ],
44
+ "dependencies": {
45
+ "@azure/storage-blob": "12.33.0",
46
+ "@lowdefy/helpers": "0.0.0-experimental-20260707082859"
47
+ },
48
+ "devDependencies": {
49
+ "@jest/globals": "28.1.3",
50
+ "@lowdefy/ajv": "0.0.0-experimental-20260707082859",
51
+ "@swc/cli": "0.8.1",
52
+ "@swc/core": "1.15.32",
53
+ "@swc/jest": "0.2.39",
54
+ "jest": "28.1.3"
55
+ },
56
+ "publishConfig": {
57
+ "access": "public"
58
+ },
59
+ "scripts": {
60
+ "build": "swc src --out-dir dist --config-file ../../../../.swcrc --cli-config-file ../../../../.swc-cli.json --copy-files",
61
+ "clean": "rm -rf dist",
62
+ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
63
+ }
64
+ }