@balena/pinejs-webresource-cloudfront 1.0.1 → 1.0.2
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/.versionbot/CHANGELOG.yml +12 -1
- package/CHANGELOG.md +5 -0
- package/build/index.d.ts +3 -3
- package/build/index.js +6 -3
- package/build/index.js.map +1 -1
- package/lib/index.ts +8 -5
- package/package.json +5 -6
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
- commits:
|
|
2
|
+
- subject: Use standalone S3 Handler instead of pinejs core one
|
|
3
|
+
hash: 700204a6cb69b71634037e0716a4d3ae4c2cfe4f
|
|
4
|
+
body: ""
|
|
5
|
+
footer:
|
|
6
|
+
Change-type: patch
|
|
7
|
+
change-type: patch
|
|
8
|
+
author: Otavio Jacobi
|
|
9
|
+
version: 1.0.2
|
|
10
|
+
title: ""
|
|
11
|
+
date: 2025-01-02T15:41:30.967Z
|
|
1
12
|
- commits:
|
|
2
13
|
- subject: Add minimum supported node and npm versions
|
|
3
14
|
hash: 14ac975309148d26efbbe45a4bd7c34b68fade5f
|
|
@@ -15,7 +26,7 @@
|
|
|
15
26
|
author: Otavio Jacobi
|
|
16
27
|
version: 1.0.1
|
|
17
28
|
title: ""
|
|
18
|
-
date: 2025-01-02T15:
|
|
29
|
+
date: 2025-01-02T15:32:11.176Z
|
|
19
30
|
- commits:
|
|
20
31
|
- subject: Convert to ESM
|
|
21
32
|
hash: 0aaeea334be207420e8fd549405068b094c781f0
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file
|
|
|
4
4
|
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
|
|
5
5
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
|
6
6
|
|
|
7
|
+
# v1.0.2
|
|
8
|
+
## (2025-01-02)
|
|
9
|
+
|
|
10
|
+
* Use standalone S3 Handler instead of pinejs core one [Otavio Jacobi]
|
|
11
|
+
|
|
7
12
|
# v1.0.1
|
|
8
13
|
## (2025-01-02)
|
|
9
14
|
|
package/build/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S3Handler, type S3HandlerProps } from '@balena/pinejs-webresource-s3';
|
|
2
2
|
import type { WebResourceType as WebResource } from '@balena/sbvr-types';
|
|
3
|
-
export interface CloudFrontHandlerProps extends
|
|
3
|
+
export interface CloudFrontHandlerProps extends S3HandlerProps {
|
|
4
4
|
cfPublicKeyId: string;
|
|
5
5
|
cfSecretKey: string;
|
|
6
6
|
cfDistributionDomain: string;
|
|
7
7
|
}
|
|
8
|
-
export declare class CloudFrontHandler extends
|
|
8
|
+
export declare class CloudFrontHandler extends S3Handler {
|
|
9
9
|
private readonly cfSecretKey;
|
|
10
10
|
private readonly cfPublicKeyId;
|
|
11
11
|
private readonly cfDistributionDomain;
|
package/build/index.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { webResourceHandler } from '@balena/pinejs';
|
|
2
1
|
import memoize from 'memoizee';
|
|
3
2
|
import { getSignedUrl } from '@aws-sdk/cloudfront-signer';
|
|
4
|
-
|
|
3
|
+
import { S3Handler } from '@balena/pinejs-webresource-s3';
|
|
4
|
+
const normalizeHref = (href) => {
|
|
5
|
+
return href.split('?', 1)[0];
|
|
6
|
+
};
|
|
7
|
+
export class CloudFrontHandler extends S3Handler {
|
|
5
8
|
cfSecretKey;
|
|
6
9
|
cfPublicKeyId;
|
|
7
10
|
cfDistributionDomain;
|
|
@@ -43,7 +46,7 @@ export class CloudFrontHandler extends webResourceHandler.S3Handler {
|
|
|
43
46
|
return new Date(expiry).toISOString();
|
|
44
47
|
}
|
|
45
48
|
cfGetKeyFromHref(href) {
|
|
46
|
-
const hrefWithoutParams =
|
|
49
|
+
const hrefWithoutParams = normalizeHref(href);
|
|
47
50
|
return hrefWithoutParams
|
|
48
51
|
.split('/')
|
|
49
52
|
.slice(3)
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAuB,MAAM,+BAA+B,CAAC;AAS/E,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,EAAE;IACtC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9B,CAAC,CAAC;AAEF,MAAM,OAAO,iBAAkB,SAAQ,SAAS;IAC9B,WAAW,CAAS;IACpB,aAAa,CAAS;IACtB,oBAAoB,CAAS;IAE9C,YAAY,QAAgC;QAC3C,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC;QACxC,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAC,aAAa,CAAC;QAC5C,IAAI,CAAC,oBAAoB,GAAG,QAAQ,CAAC,oBAAoB,CAAC;IAC3D,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,WAAwB;QACjD,IAAI,WAAW,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;YAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YACxD,WAAW,CAAC,IAAI,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAC7D,CAAC;QACD,OAAO,WAAW,CAAC;IACpB,CAAC;IAIO,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE;QACtD,MAAM,EAAE,IAAI,CAAC,+BAA+B,GAAG,IAAI;KACnD,CAAC,CA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ler } from '@balena/pinejs';
|
|
2
1
|
import memoize from 'memoizee';
|
|
3
2
|
import { getSignedUrl } from '@aws-sdk/cloudfront-signer';
|
|
3
|
+
import { S3Handler, type S3HandlerProps } from '@balena/pinejs-webresource-s3';
|
|
4
4
|
import type { WebResourceType as WebResource } from '@balena/sbvr-types';
|
|
5
5
|
|
|
6
|
-
export interface CloudFrontHandlerProps
|
|
7
|
-
extends webResourceHandler.S3HandlerProps {
|
|
6
|
+
export interface CloudFrontHandlerProps extends S3HandlerProps {
|
|
8
7
|
cfPublicKeyId: string;
|
|
9
8
|
cfSecretKey: string;
|
|
10
9
|
cfDistributionDomain: string;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
const normalizeHref = (href: string) => {
|
|
13
|
+
return href.split('?', 1)[0];
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export class CloudFrontHandler extends S3Handler {
|
|
14
17
|
private readonly cfSecretKey: string;
|
|
15
18
|
private readonly cfPublicKeyId: string;
|
|
16
19
|
private readonly cfDistributionDomain: string;
|
|
@@ -59,7 +62,7 @@ export class CloudFrontHandler extends webResourceHandler.S3Handler {
|
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
private cfGetKeyFromHref(href: string): string {
|
|
62
|
-
const hrefWithoutParams =
|
|
65
|
+
const hrefWithoutParams = normalizeHref(href);
|
|
63
66
|
return hrefWithoutParams
|
|
64
67
|
.split('/')
|
|
65
68
|
.slice(3)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@balena/pinejs-webresource-cloudfront",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "A PineJS WebResource handler for storing files on S3 and serving via AWS Cloudfront",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/index.js",
|
|
@@ -20,18 +20,17 @@
|
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@balena/lint": "^8.2.8",
|
|
22
22
|
"@balena/sbvr-types": "^7.1.3",
|
|
23
|
+
"@types/memoizee": "0.4.11",
|
|
23
24
|
"husky": "^9.1.7",
|
|
24
25
|
"lint-staged": "^15.3.0",
|
|
25
26
|
"typescript": "^5.7.2"
|
|
26
27
|
},
|
|
27
28
|
"dependencies": {
|
|
28
29
|
"@aws-sdk/cloudfront-signer": "^3.709.0",
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
"peerDependencies": {
|
|
32
|
-
"@balena/pinejs": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
30
|
+
"@balena/pinejs-webresource-s3": "^1.0.0",
|
|
31
|
+
"memoizee": "0.4.17"
|
|
33
32
|
},
|
|
34
33
|
"versionist": {
|
|
35
|
-
"publishedAt": "2025-01-02T15:
|
|
34
|
+
"publishedAt": "2025-01-02T15:41:31.022Z"
|
|
36
35
|
}
|
|
37
36
|
}
|