@fastly/compute-js-static-publish 4.0.0 → 4.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.
- package/README.md +4 -4
- package/build/cli/commands/build-static.d.ts.map +1 -1
- package/build/cli/commands/build-static.js +5 -4
- package/build/cli/commands/clean-object-store.d.ts.map +1 -1
- package/build/compute-js.d.ts +3 -0
- package/build/compute-js.d.ts.map +1 -0
- package/build/compute-js.js +2 -0
- package/build/server/assets/asset-manager.d.ts +1 -0
- package/build/server/assets/asset-manager.d.ts.map +1 -1
- package/build/server/assets/asset-manager.js +3 -0
- package/build/server/assets/content-asset-object-store.d.ts +18 -0
- package/build/server/assets/content-asset-object-store.d.ts.map +1 -0
- package/build/server/assets/content-asset-object-store.js +67 -0
- package/build/server/assets/content-asset-wasm-inline.d.ts +17 -0
- package/build/server/assets/content-asset-wasm-inline.d.ts.map +1 -0
- package/build/server/assets/content-asset-wasm-inline.js +48 -0
- package/build/server/assets/content-assets-runtime.d.ts +2 -0
- package/build/server/assets/content-assets-runtime.d.ts.map +1 -0
- package/build/server/assets/content-assets.d.ts +33 -21
- package/build/server/assets/content-assets.d.ts.map +1 -1
- package/build/server/assets/content-assets.js +39 -85
- package/build/types/content-assets.d.ts +23 -7
- package/build/types/content-assets.d.ts.map +1 -1
- package/build/util/metadata.js +1 -1
- package/package.json +1 -1
- package/build/assets/asset-manager.d.ts +0 -7
- package/build/assets/asset-manager.d.ts.map +0 -1
- package/build/assets/asset-manager.js +0 -11
- package/build/assets/content-assets.d.ts +0 -29
- package/build/assets/content-assets.d.ts.map +0 -1
- package/build/assets/content-assets.js +0 -88
- package/build/assets/module-assets.d.ts +0 -23
- package/build/assets/module-assets.d.ts.map +0 -1
- package/build/assets/module-assets.js +0 -45
- package/build/cli/build-static.d.ts +0 -3
- package/build/cli/build-static.d.ts.map +0 -1
- package/build/cli/build-static.js +0 -524
- package/build/cli/clean-object-store.d.ts +0 -2
- package/build/cli/clean-object-store.d.ts.map +0 -1
- package/build/cli/cli.d.ts +0 -3
- package/build/cli/cli.d.ts.map +0 -1
- package/build/cli/cli.js +0 -77
- package/build/cli/init-app.d.ts +0 -3
- package/build/cli/init-app.d.ts.map +0 -1
- package/build/cli/init-app.js +0 -283
- package/build/presets/implementations/create-react-app.d.ts +0 -16
- package/build/presets/implementations/create-react-app.d.ts.map +0 -1
- package/build/presets/implementations/create-react-app.js +0 -34
- package/build/presets/implementations/docusaurus.d.ts +0 -11
- package/build/presets/implementations/docusaurus.d.ts.map +0 -1
- package/build/presets/implementations/docusaurus.js +0 -13
- package/build/presets/implementations/gatsby.d.ts +0 -11
- package/build/presets/implementations/gatsby.d.ts.map +0 -1
- package/build/presets/implementations/gatsby.js +0 -13
- package/build/presets/implementations/next.d.ts +0 -11
- package/build/presets/implementations/next.d.ts.map +0 -1
- package/build/presets/implementations/next.js +0 -13
- package/build/presets/implementations/sveltekit.d.ts +0 -11
- package/build/presets/implementations/sveltekit.d.ts.map +0 -1
- package/build/presets/implementations/sveltekit.js +0 -13
- package/build/presets/implementations/vite.d.ts +0 -11
- package/build/presets/implementations/vite.d.ts.map +0 -1
- package/build/presets/implementations/vite.js +0 -13
- package/build/presets/index.d.ts +0 -3
- package/build/presets/index.d.ts.map +0 -1
- package/build/presets/index.js +0 -16
- package/build/presets/preset-base.d.ts +0 -18
- package/build/presets/preset-base.d.ts.map +0 -1
- package/build/presets/preset-base.js +0 -1
- package/build/server/object-store/include-bytes-store-entry.d.ts +0 -19
- package/build/server/object-store/include-bytes-store-entry.d.ts.map +0 -1
- package/build/server/object-store/include-bytes-store-entry.js +0 -87
- package/build/util/data.d.ts +0 -7
- package/build/util/data.d.ts.map +0 -1
- package/build/util/data.js +0 -58
- package/build/util/fastly-api.d.ts +0 -10
- package/build/util/fastly-api.d.ts.map +0 -1
- package/build/util/fastly-api.js +0 -47
- package/build/util/files.d.ts +0 -10
- package/build/util/files.d.ts.map +0 -1
- package/build/util/files.js +0 -32
- package/build/util/hash.d.ts +0 -2
- package/build/util/hash.d.ts.map +0 -1
- package/build/util/hash.js +0 -8
- package/build/util/id.d.ts +0 -3
- package/build/util/id.d.ts.map +0 -1
- package/build/util/id.js +0 -17
- package/build/util/object-store.d.ts +0 -12
- package/build/util/object-store.d.ts.map +0 -1
- package/build/util/object-store.js +0 -80
- /package/build/{cli/clean-object-store.js → server/assets/content-assets-runtime.js} +0 -0
package/README.md
CHANGED
|
@@ -265,7 +265,7 @@ the respective files with these values.
|
|
|
265
265
|
After you have done the above steps, go ahead and build your application as normal. If you use `fastly compute build --verbose`
|
|
266
266
|
(or run `npm run build` directly), you should see output in your logs saying that files are being sent to the Object Store.
|
|
267
267
|
|
|
268
|
-
The `statics-metadata.js` file should now show `"
|
|
268
|
+
The `statics-metadata.js` file should now show `"type": "object-store"` for content assets.
|
|
269
269
|
Your Wasm binary should also be smaller, as the content of the files are no longer inlined in the build artifact.
|
|
270
270
|
You can deploy this and run it from Fastly, and the referenced files will be served from Object Store.
|
|
271
271
|
|
|
@@ -452,9 +452,9 @@ import { contentAssets } from './statics';
|
|
|
452
452
|
// Obtain a content asset named '/public/index.html'
|
|
453
453
|
const asset = contentAssets.getAsset('/public/index.html');
|
|
454
454
|
|
|
455
|
-
//
|
|
456
|
-
//
|
|
457
|
-
|
|
455
|
+
// 'wasm-inline' if object's data is 'inlined' into Wasm binary
|
|
456
|
+
// 'object-store' if object's data exists in Fastly Object Store
|
|
457
|
+
asset.type;
|
|
458
458
|
|
|
459
459
|
// Get the "store entry"
|
|
460
460
|
const storeEntry = await asset.getStoreEntry();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-static.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/build-static.ts"],"names":[],"mappings":"AA+DA,OAAO,eAAe,MAAM,mBAAmB,CAAC;AA6IhD,wBAAsB,iBAAiB,CAAC,iBAAiB,EAAE,eAAe,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"build-static.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/build-static.ts"],"names":[],"mappings":"AA+DA,OAAO,eAAe,MAAM,mBAAmB,CAAC;AA6IhD,wBAAsB,iBAAiB,CAAC,iBAAiB,EAAE,eAAe,CAAC,kBAAkB,iBAqe5F"}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
// - compressedFileInfos: Map<string, FileInfo> - information about any compressed versions
|
|
20
20
|
// - key: string - compression algorithm name (e.g., "gzip", "br", etc.)
|
|
21
21
|
// - value: FileInfo - information about the compressed version of the file
|
|
22
|
-
// -
|
|
22
|
+
// - type: string - where the data is available. Usually 'wasm-inline' or 'object-store'.
|
|
23
23
|
// FileInfo structure
|
|
24
24
|
// - hash: string - SHA-256 hash of file
|
|
25
25
|
// - size: number - file size in bytes
|
|
@@ -329,7 +329,7 @@ export async function buildStaticLoader(commandLineValues) {
|
|
|
329
329
|
});
|
|
330
330
|
metadata = {
|
|
331
331
|
...entryBase,
|
|
332
|
-
|
|
332
|
+
type: 'wasm-inline',
|
|
333
333
|
fileInfo: {
|
|
334
334
|
...entryBase.fileInfo,
|
|
335
335
|
staticFilePath,
|
|
@@ -361,7 +361,7 @@ export async function buildStaticLoader(commandLineValues) {
|
|
|
361
361
|
});
|
|
362
362
|
metadata = {
|
|
363
363
|
...entryBase,
|
|
364
|
-
|
|
364
|
+
type: 'object-store',
|
|
365
365
|
fileInfo: {
|
|
366
366
|
...entryBase.fileInfo,
|
|
367
367
|
staticFilePath,
|
|
@@ -414,6 +414,7 @@ export async function buildStaticLoader(commandLineValues) {
|
|
|
414
414
|
|
|
415
415
|
`;
|
|
416
416
|
fileContents += 'import { ContentAssets, ModuleAssets, PublisherServer } from "@fastly/compute-js-static-publish";\n\n';
|
|
417
|
+
fileContents += 'import "@fastly/compute-js-static-publish/build/compute-js";\n\n';
|
|
417
418
|
fileContents += 'import { objectStoreName, contentAssetMetadataMap } from "./statics-metadata";\n';
|
|
418
419
|
// Add import statements for assets that are modules and that need to be statically imported.
|
|
419
420
|
const staticImportModuleNumbers = {};
|
|
@@ -510,7 +511,7 @@ export async function buildStaticLoader(commandLineValues) {
|
|
|
510
511
|
autoIndex,
|
|
511
512
|
};
|
|
512
513
|
fileContents += `\nexport const serverConfig = ${JSON.stringify(serverConfig, null, 2)};\n`;
|
|
513
|
-
fileContents += '\nexport const contentAssets = new ContentAssets(
|
|
514
|
+
fileContents += '\nexport const contentAssets = new ContentAssets(contentAssetMetadataMap, {objectStoreName});';
|
|
514
515
|
fileContents += '\nexport const moduleAssets = new ModuleAssets(moduleAssetsMap);\n';
|
|
515
516
|
fileContents += '\nlet server = null;';
|
|
516
517
|
fileContents += '\nexport function getServer() {' +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clean-object-store.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/clean-object-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"clean-object-store.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/clean-object-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAc5D,wBAAsB,gBAAgB,CAAC,iBAAiB,EAAE,kBAAkB,iBAgE3E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute-js.d.ts","sourceRoot":"","sources":["../src/compute-js.ts"],"names":[],"mappings":"AAAA,OAAO,8CAA8C,CAAC;AACtD,OAAO,+CAA+C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-manager.d.ts","sourceRoot":"","sources":["../../../src/server/assets/asset-manager.ts"],"names":[],"mappings":"AAAA,8BAAsB,YAAY,CAAC,MAAM;IAEvC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAElD,SAAS;IAIT,SAAS,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAInD,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"asset-manager.d.ts","sourceRoot":"","sources":["../../../src/server/assets/asset-manager.ts"],"names":[],"mappings":"AAAA,8BAAsB,YAAY,CAAC,MAAM;IAEvC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAElD,SAAS;IAIT,SAAS,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAInD,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAIzC,YAAY,IAAI,MAAM,EAAE;CAIzB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ContentAsset, ContentAssetMetadataMapEntry, StoreEntry } from "../../types/index.js";
|
|
2
|
+
import { ContentAssetMetadataMapEntryObjectStore } from "../../types/content-assets.js";
|
|
3
|
+
import { ContentCompressionTypes } from "../../constants/compression.js";
|
|
4
|
+
export declare class ContentObjectStoreAsset implements ContentAsset {
|
|
5
|
+
readonly type = "object-store";
|
|
6
|
+
private readonly metadata;
|
|
7
|
+
private readonly objectStoreName;
|
|
8
|
+
private readonly sourceAndInfo;
|
|
9
|
+
private readonly compressedSourcesAndInfo;
|
|
10
|
+
constructor(metadata: ContentAssetMetadataMapEntryObjectStore, objectStoreName: string);
|
|
11
|
+
get isLocal(): boolean;
|
|
12
|
+
get assetKey(): string;
|
|
13
|
+
getStoreEntry(acceptEncodingsGroups?: ContentCompressionTypes[][]): Promise<StoreEntry>;
|
|
14
|
+
getBytes(): Uint8Array;
|
|
15
|
+
getText(): string;
|
|
16
|
+
getMetadata(): ContentAssetMetadataMapEntry;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=content-asset-object-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-asset-object-store.d.ts","sourceRoot":"","sources":["../../../src/server/assets/content-asset-object-store.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,4BAA4B,EAC5B,UAAU,EACX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,uCAAuC,EACxC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAGzE,qBAAa,uBAAwB,YAAW,YAAY;IAC1D,QAAQ,CAAC,IAAI,kBAAkB;IAE/B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0C;IAEnE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IAEzC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAwB;IACtD,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAA6C;gBAE1E,QAAQ,EAAE,uCAAuC,EAAE,eAAe,EAAE,MAAM;IAqBtF,IAAI,OAAO,YAEV;IAED,IAAI,QAAQ,WAEX;IAEK,aAAa,CAAC,qBAAqB,GAAE,uBAAuB,EAAE,EAAO,GAAG,OAAO,CAAC,UAAU,CAAC;IA4BjG,QAAQ,IAAI,UAAU;IAItB,OAAO,IAAI,MAAM;IAIjB,WAAW,IAAI,4BAA4B;CAI5C"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ObjectStore } from "fastly:object-store";
|
|
2
|
+
import { ContentAssets, findMatchingSourceAndInfo } from "./content-assets.js";
|
|
3
|
+
export class ContentObjectStoreAsset {
|
|
4
|
+
constructor(metadata, objectStoreName) {
|
|
5
|
+
this.type = 'object-store';
|
|
6
|
+
this.metadata = metadata;
|
|
7
|
+
this.objectStoreName = objectStoreName;
|
|
8
|
+
this.sourceAndInfo = {
|
|
9
|
+
source: metadata.fileInfo.objectStoreKey,
|
|
10
|
+
hash: metadata.fileInfo.hash,
|
|
11
|
+
size: metadata.fileInfo.size,
|
|
12
|
+
};
|
|
13
|
+
this.compressedSourcesAndInfo = Object.entries(metadata.compressedFileInfos)
|
|
14
|
+
.reduce((obj, [key, value]) => {
|
|
15
|
+
obj[key] = {
|
|
16
|
+
source: value.objectStoreKey,
|
|
17
|
+
hash: value.hash,
|
|
18
|
+
size: value.size,
|
|
19
|
+
};
|
|
20
|
+
return obj;
|
|
21
|
+
}, {});
|
|
22
|
+
}
|
|
23
|
+
get isLocal() {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
get assetKey() {
|
|
27
|
+
return this.metadata.assetKey;
|
|
28
|
+
}
|
|
29
|
+
async getStoreEntry(acceptEncodingsGroups = []) {
|
|
30
|
+
const { sourceAndInfo, contentEncoding } = findMatchingSourceAndInfo(acceptEncodingsGroups, this.sourceAndInfo, encoding => this.compressedSourcesAndInfo[encoding]);
|
|
31
|
+
const objectStore = new ObjectStore(this.objectStoreName);
|
|
32
|
+
let retries = 3;
|
|
33
|
+
while (retries > 0) {
|
|
34
|
+
const storeEntry = await objectStore.get(sourceAndInfo.source);
|
|
35
|
+
if (storeEntry != null) {
|
|
36
|
+
const { hash, size } = sourceAndInfo;
|
|
37
|
+
return Object.assign(storeEntry, { contentEncoding, hash, size });
|
|
38
|
+
}
|
|
39
|
+
// Note the null does NOT mean 404. The fact that we are here means
|
|
40
|
+
// metadata exists for this path, and we're just trying to get the data from
|
|
41
|
+
// the object store.
|
|
42
|
+
// So if we're here then the data is either not available yet (in which case
|
|
43
|
+
// we can wait just a bit and try again), or the data was deleted.
|
|
44
|
+
retries--;
|
|
45
|
+
// We're going to wait 250ms/500ms/750ms and try again.
|
|
46
|
+
const delay = (3 - retries) * 250;
|
|
47
|
+
await new Promise(resolve => setTimeout(resolve, delay));
|
|
48
|
+
}
|
|
49
|
+
throw new Error("Asset could not be retrieved from the Object Store.");
|
|
50
|
+
}
|
|
51
|
+
getBytes() {
|
|
52
|
+
throw new Error("Can't getBytes() for Object Store asset");
|
|
53
|
+
}
|
|
54
|
+
getText() {
|
|
55
|
+
throw new Error("Can't getText() for Object Store asset");
|
|
56
|
+
}
|
|
57
|
+
getMetadata() {
|
|
58
|
+
return this.metadata;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
ContentAssets.registerAssetBuilder('object-store', (metadata, context) => {
|
|
62
|
+
const { objectStoreName } = context;
|
|
63
|
+
if (objectStoreName == null) {
|
|
64
|
+
throw new Error("Unexpected! Object Store should be specified!!");
|
|
65
|
+
}
|
|
66
|
+
return new ContentObjectStoreAsset(metadata, objectStoreName);
|
|
67
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ContentAsset, ContentAssetMetadataMapEntry, StoreEntry } from "../../types/index.js";
|
|
2
|
+
import { ContentAssetMetadataMapEntryWasmInline } from "../../types/content-assets.js";
|
|
3
|
+
import { ContentCompressionTypes } from "../../constants/compression.js";
|
|
4
|
+
export declare class ContentWasmInlineAsset implements ContentAsset {
|
|
5
|
+
readonly type = "wasm-inline";
|
|
6
|
+
private readonly metadata;
|
|
7
|
+
private readonly sourceAndInfo;
|
|
8
|
+
private readonly compressedSourcesAndInfo;
|
|
9
|
+
constructor(metadata: ContentAssetMetadataMapEntryWasmInline);
|
|
10
|
+
get isLocal(): boolean;
|
|
11
|
+
get assetKey(): string;
|
|
12
|
+
getStoreEntry(acceptEncodingsGroups?: ContentCompressionTypes[][]): Promise<StoreEntry>;
|
|
13
|
+
getBytes(): Uint8Array;
|
|
14
|
+
getText(): string;
|
|
15
|
+
getMetadata(): ContentAssetMetadataMapEntry;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=content-asset-wasm-inline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-asset-wasm-inline.d.ts","sourceRoot":"","sources":["../../../src/server/assets/content-asset-wasm-inline.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,4BAA4B,EAC5B,UAAU,EACX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,sCAAsC,EACvC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAMzE,qBAAa,sBAAuB,YAAW,YAAY;IACzD,QAAQ,CAAC,IAAI,iBAAiB;IAE9B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAyC;IAElE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA4B;IAC1D,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAiD;gBAE9E,QAAQ,EAAE,sCAAsC;IAoB5D,IAAI,OAAO,YAEV;IAED,IAAI,QAAQ,WAEX;IAEK,aAAa,CAAC,qBAAqB,GAAE,uBAAuB,EAAE,EAAO,GAAG,OAAO,CAAC,UAAU,CAAC;IAMjG,QAAQ,IAAI,UAAU;IAItB,OAAO,IAAI,MAAM;IAOjB,WAAW,IAAI,4BAA4B;CAG5C"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { includeBytes } from "fastly:experimental";
|
|
2
|
+
import { InlineStoreEntry } from "../object-store/inline-store-entry.js";
|
|
3
|
+
import { ContentAssets, findMatchingSourceAndInfo } from "./content-assets.js";
|
|
4
|
+
const decoder = new TextDecoder();
|
|
5
|
+
export class ContentWasmInlineAsset {
|
|
6
|
+
constructor(metadata) {
|
|
7
|
+
this.type = 'wasm-inline';
|
|
8
|
+
this.metadata = metadata;
|
|
9
|
+
this.sourceAndInfo = {
|
|
10
|
+
source: includeBytes(metadata.fileInfo.staticFilePath),
|
|
11
|
+
hash: metadata.fileInfo.hash,
|
|
12
|
+
size: metadata.fileInfo.size,
|
|
13
|
+
};
|
|
14
|
+
this.compressedSourcesAndInfo = Object.entries(metadata.compressedFileInfos)
|
|
15
|
+
.reduce((obj, [key, value]) => {
|
|
16
|
+
obj[key] = {
|
|
17
|
+
source: includeBytes(value.staticFilePath),
|
|
18
|
+
hash: value.hash,
|
|
19
|
+
size: value.size,
|
|
20
|
+
};
|
|
21
|
+
return obj;
|
|
22
|
+
}, {});
|
|
23
|
+
}
|
|
24
|
+
get isLocal() {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
get assetKey() {
|
|
28
|
+
return this.metadata.assetKey;
|
|
29
|
+
}
|
|
30
|
+
async getStoreEntry(acceptEncodingsGroups = []) {
|
|
31
|
+
const { sourceAndInfo, contentEncoding } = findMatchingSourceAndInfo(acceptEncodingsGroups, this.sourceAndInfo, encoding => this.compressedSourcesAndInfo[encoding]);
|
|
32
|
+
const { source, hash, size } = sourceAndInfo;
|
|
33
|
+
return new InlineStoreEntry(source, contentEncoding, hash, size);
|
|
34
|
+
}
|
|
35
|
+
getBytes() {
|
|
36
|
+
return this.sourceAndInfo.source;
|
|
37
|
+
}
|
|
38
|
+
getText() {
|
|
39
|
+
if (!this.metadata.text) {
|
|
40
|
+
throw new Error("Can't getText() for non-text content");
|
|
41
|
+
}
|
|
42
|
+
return decoder.decode(this.sourceAndInfo.source);
|
|
43
|
+
}
|
|
44
|
+
getMetadata() {
|
|
45
|
+
return this.metadata;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
ContentAssets.registerAssetBuilder('wasm-inline', metadata => new ContentWasmInlineAsset(metadata));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-assets-runtime.d.ts","sourceRoot":"","sources":["../../../src/server/assets/content-assets-runtime.ts"],"names":[],"mappings":""}
|
|
@@ -1,33 +1,45 @@
|
|
|
1
1
|
import { AssetManager } from "./asset-manager.js";
|
|
2
|
-
import type { ContentAsset, ContentAssetMetadataMap, ContentAssetMetadataMapEntry,
|
|
2
|
+
import type { ContentAsset, ContentAssetMetadataMap, ContentAssetMetadataMapEntry, ContentAssetMetadataMapEntryBytes, ContentAssetMetadataMapEntryString } from "../../types/content-assets.js";
|
|
3
3
|
import type { StoreEntry } from "../../types/compute.js";
|
|
4
4
|
import type { ContentCompressionTypes } from "../../constants/compression.js";
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
export type SourceAndInfo<TSource> = {
|
|
6
|
+
source: TSource;
|
|
7
|
+
hash: string;
|
|
8
|
+
size: number;
|
|
9
|
+
};
|
|
10
|
+
type SourceAndInfoForEncodingFn<TSource> = (contentEncoding: ContentCompressionTypes) => SourceAndInfo<TSource> | undefined;
|
|
11
|
+
export declare function findMatchingSourceAndInfo<TSource>(acceptEncodingsGroups: ContentCompressionTypes[][], defaultSourceAndInfo: SourceAndInfo<TSource>, sourceAndInfoForEncodingFn: SourceAndInfoForEncodingFn<TSource>): {
|
|
12
|
+
sourceAndInfo: SourceAndInfo<TSource>;
|
|
13
|
+
contentEncoding: "br" | "gzip" | null;
|
|
14
|
+
};
|
|
15
|
+
declare abstract class ContentRuntimeAsset<TMetadataMapEntry extends ContentAssetMetadataMapEntry> {
|
|
16
|
+
protected readonly metadata: TMetadataMapEntry;
|
|
17
|
+
protected sourceAndInfo: SourceAndInfo<Uint8Array>;
|
|
18
|
+
protected constructor(metadata: TMetadataMapEntry, sourceAndInfo: SourceAndInfo<Uint8Array>);
|
|
19
|
+
get isLocal(): boolean;
|
|
11
20
|
get assetKey(): string;
|
|
12
|
-
getStoreEntry(
|
|
21
|
+
getStoreEntry(): Promise<StoreEntry>;
|
|
13
22
|
getBytes(): Uint8Array;
|
|
14
23
|
getText(): string;
|
|
15
24
|
getMetadata(): ContentAssetMetadataMapEntry;
|
|
16
25
|
}
|
|
17
|
-
export declare class
|
|
18
|
-
readonly
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
getStoreEntry(acceptEncodingsGroups?: ContentCompressionTypes[][]): Promise<StoreEntry>;
|
|
26
|
-
getBytes(): Uint8Array;
|
|
27
|
-
getText(): string;
|
|
28
|
-
getMetadata(): ContentAssetMetadataMapEntry;
|
|
26
|
+
export declare class ContentBytesAsset extends ContentRuntimeAsset<ContentAssetMetadataMapEntryBytes> implements ContentAsset {
|
|
27
|
+
readonly type = "bytes";
|
|
28
|
+
constructor(metadata: ContentAssetMetadataMapEntryBytes);
|
|
29
|
+
}
|
|
30
|
+
export declare class ContentStringAsset extends ContentRuntimeAsset<ContentAssetMetadataMapEntryString> implements ContentAsset {
|
|
31
|
+
readonly type = "string";
|
|
32
|
+
static encoder: TextEncoder;
|
|
33
|
+
constructor(metadata: ContentAssetMetadataMapEntryString);
|
|
29
34
|
}
|
|
35
|
+
export type AssetBuilder<TType extends string> = (metadata: ContentAssetMetadataMapEntry & {
|
|
36
|
+
type: TType;
|
|
37
|
+
}, assetBuilderContext: AssetBuilderContext) => ContentAsset;
|
|
38
|
+
type AssetBuilderContext = any;
|
|
30
39
|
export declare class ContentAssets extends AssetManager<ContentAsset> {
|
|
31
|
-
|
|
40
|
+
static builders: Record<string, AssetBuilder<any>>;
|
|
41
|
+
constructor(contentAssetMetadataMap: ContentAssetMetadataMap, assetBuilderContext?: AssetBuilderContext);
|
|
42
|
+
static registerAssetBuilder<TType extends string>(type: TType, builder: AssetBuilder<TType>): void;
|
|
32
43
|
}
|
|
44
|
+
export {};
|
|
33
45
|
//# sourceMappingURL=content-assets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-assets.d.ts","sourceRoot":"","sources":["../../../src/server/assets/content-assets.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"content-assets.d.ts","sourceRoot":"","sources":["../../../src/server/assets/content-assets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,OAAO,KAAK,EACV,YAAY,EACZ,uBAAuB,EACvB,4BAA4B,EAC5B,iCAAiC,EACjC,kCAAkC,EACnC,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAI9E,MAAM,MAAM,aAAa,CAAC,OAAO,IAAI;IACnC,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,KAAK,0BAA0B,CAAC,OAAO,IAAI,CAAC,eAAe,EAAE,uBAAuB,KAAK,aAAa,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;AAC5H,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,EAAE,EAAE,oBAAoB,EAAE,aAAa,CAAC,OAAO,CAAC,EAAE,0BAA0B,EAAE,0BAA0B,CAAC,OAAO,CAAC;;;EA6BnN;AAED,uBAAe,mBAAmB,CAAC,iBAAiB,SAAS,4BAA4B;IACvF,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IAC/C,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IACnD,SAAS,aAAa,QAAQ,EAAE,iBAAiB,EAAE,aAAa,EAAE,aAAa,CAAC,UAAU,CAAC;IAK3F,IAAI,OAAO,YAEV;IAED,IAAI,QAAQ,WAEX;IAEK,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC;IAK1C,QAAQ,IAAI,UAAU;IAItB,OAAO,IAAI,MAAM;IAOjB,WAAW,IAAI,4BAA4B;CAG5C;AAED,qBAAa,iBACT,SAAQ,mBAAmB,CAAC,iCAAiC,CAC7D,YAAW,YAAY;IACzB,QAAQ,CAAC,IAAI,WAAW;gBAEZ,QAAQ,EAAE,iCAAiC;CAOxD;AAED,qBAAa,kBACT,SAAQ,mBAAmB,CAAC,kCAAkC,CAC9D,YAAW,YAAY;IACzB,QAAQ,CAAC,IAAI,YAAY;IAEzB,MAAM,CAAC,OAAO,cAAqB;gBACvB,QAAQ,EAAE,kCAAkC;CAOzD;AAED,MAAM,MAAM,YAAY,CAAC,KAAK,SAAS,MAAM,IAAI,CAAC,QAAQ,EAAE,4BAA4B,GAAG;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,EAAE,mBAAmB,EAAE,mBAAmB,KAAK,YAAY,CAAC;AACtK,KAAK,mBAAmB,GAAG,GAAG,CAAC;AAE/B,qBAAa,aAAc,SAAQ,YAAY,CAAC,YAAY,CAAC;IAE3D,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,CAAM;gBAE5C,uBAAuB,EAAE,uBAAuB,EAAE,mBAAmB,GAAE,mBAAwB;IAc3G,MAAM,CAAC,oBAAoB,CAAC,KAAK,SAAS,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC;CAG5F"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { includeBytes } from "fastly:experimental";
|
|
2
|
-
import { ObjectStore } from "fastly:object-store";
|
|
3
1
|
import { AssetManager } from "./asset-manager.js";
|
|
4
2
|
import { InlineStoreEntry } from "../object-store/inline-store-entry.js";
|
|
5
3
|
const decoder = new TextDecoder();
|
|
6
|
-
function findMatchingSourceAndInfo(acceptEncodingsGroups, defaultSourceAndInfo, sourceAndInfoForEncodingFn) {
|
|
4
|
+
export function findMatchingSourceAndInfo(acceptEncodingsGroups, defaultSourceAndInfo, sourceAndInfoForEncodingFn) {
|
|
7
5
|
let sourceAndInfo;
|
|
8
6
|
let contentEncoding = null;
|
|
9
7
|
if (acceptEncodingsGroups != null) {
|
|
@@ -27,32 +25,20 @@ function findMatchingSourceAndInfo(acceptEncodingsGroups, defaultSourceAndInfo,
|
|
|
27
25
|
sourceAndInfo ?? (sourceAndInfo = defaultSourceAndInfo);
|
|
28
26
|
return { sourceAndInfo, contentEncoding };
|
|
29
27
|
}
|
|
30
|
-
|
|
31
|
-
constructor(metadata) {
|
|
32
|
-
this.isInline = true;
|
|
28
|
+
class ContentRuntimeAsset {
|
|
29
|
+
constructor(metadata, sourceAndInfo) {
|
|
33
30
|
this.metadata = metadata;
|
|
34
|
-
this.sourceAndInfo =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
};
|
|
39
|
-
this.compressedSourcesAndInfo = Object.entries(metadata.compressedFileInfos)
|
|
40
|
-
.reduce((obj, [key, value]) => {
|
|
41
|
-
obj[key] = {
|
|
42
|
-
source: includeBytes(value.staticFilePath),
|
|
43
|
-
hash: value.hash,
|
|
44
|
-
size: value.size,
|
|
45
|
-
};
|
|
46
|
-
return obj;
|
|
47
|
-
}, {});
|
|
31
|
+
this.sourceAndInfo = sourceAndInfo;
|
|
32
|
+
}
|
|
33
|
+
get isLocal() {
|
|
34
|
+
return true;
|
|
48
35
|
}
|
|
49
36
|
get assetKey() {
|
|
50
37
|
return this.metadata.assetKey;
|
|
51
38
|
}
|
|
52
|
-
async getStoreEntry(
|
|
53
|
-
const {
|
|
54
|
-
|
|
55
|
-
return new InlineStoreEntry(source, contentEncoding, hash, size);
|
|
39
|
+
async getStoreEntry() {
|
|
40
|
+
const { source, hash, size } = this.sourceAndInfo;
|
|
41
|
+
return new InlineStoreEntry(source, null, hash, size);
|
|
56
42
|
}
|
|
57
43
|
getBytes() {
|
|
58
44
|
return this.sourceAndInfo.source;
|
|
@@ -67,76 +53,44 @@ export class ContentInlineAsset {
|
|
|
67
53
|
return this.metadata;
|
|
68
54
|
}
|
|
69
55
|
}
|
|
70
|
-
export class
|
|
71
|
-
constructor(metadata
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
this.objectStoreName = objectStoreName;
|
|
75
|
-
this.sourceAndInfo = {
|
|
76
|
-
source: metadata.fileInfo.objectStoreKey,
|
|
56
|
+
export class ContentBytesAsset extends ContentRuntimeAsset {
|
|
57
|
+
constructor(metadata) {
|
|
58
|
+
super(metadata, {
|
|
59
|
+
source: metadata.fileInfo.bytes,
|
|
77
60
|
hash: metadata.fileInfo.hash,
|
|
78
61
|
size: metadata.fileInfo.size,
|
|
79
|
-
};
|
|
80
|
-
this.
|
|
81
|
-
.reduce((obj, [key, value]) => {
|
|
82
|
-
obj[key] = {
|
|
83
|
-
source: value.objectStoreKey,
|
|
84
|
-
hash: value.hash,
|
|
85
|
-
size: value.size,
|
|
86
|
-
};
|
|
87
|
-
return obj;
|
|
88
|
-
}, {});
|
|
89
|
-
}
|
|
90
|
-
get assetKey() {
|
|
91
|
-
return this.metadata.assetKey;
|
|
92
|
-
}
|
|
93
|
-
async getStoreEntry(acceptEncodingsGroups = []) {
|
|
94
|
-
const { sourceAndInfo, contentEncoding } = findMatchingSourceAndInfo(acceptEncodingsGroups, this.sourceAndInfo, encoding => this.compressedSourcesAndInfo[encoding]);
|
|
95
|
-
const objectStore = new ObjectStore(this.objectStoreName);
|
|
96
|
-
let retries = 3;
|
|
97
|
-
while (retries > 0) {
|
|
98
|
-
const storeEntry = await objectStore.get(sourceAndInfo.source);
|
|
99
|
-
if (storeEntry != null) {
|
|
100
|
-
const { hash, size } = sourceAndInfo;
|
|
101
|
-
return Object.assign(storeEntry, { contentEncoding, hash, size });
|
|
102
|
-
}
|
|
103
|
-
// Note the null does NOT mean 404. The fact that we are here means
|
|
104
|
-
// metadata exists for this path, and we're just trying to get the data from
|
|
105
|
-
// the object store.
|
|
106
|
-
// So if we're here then the data is either not available yet (in which case
|
|
107
|
-
// we can wait just a bit and try again), or the data was deleted.
|
|
108
|
-
retries--;
|
|
109
|
-
// We're going to wait 250ms/500ms/750ms and try again.
|
|
110
|
-
const delay = (3 - retries) * 250;
|
|
111
|
-
await new Promise(resolve => setTimeout(resolve, delay));
|
|
112
|
-
}
|
|
113
|
-
throw new Error("Asset could not be retrieved from the Object Store.");
|
|
62
|
+
});
|
|
63
|
+
this.type = 'bytes';
|
|
114
64
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
65
|
+
}
|
|
66
|
+
class ContentStringAsset extends ContentRuntimeAsset {
|
|
67
|
+
constructor(metadata) {
|
|
68
|
+
super(metadata, {
|
|
69
|
+
source: ContentStringAsset.encoder.encode(metadata.fileInfo.content),
|
|
70
|
+
hash: metadata.fileInfo.hash,
|
|
71
|
+
size: metadata.fileInfo.size,
|
|
72
|
+
});
|
|
73
|
+
this.type = 'string';
|
|
123
74
|
}
|
|
124
75
|
}
|
|
125
|
-
|
|
126
|
-
|
|
76
|
+
ContentStringAsset.encoder = new TextEncoder();
|
|
77
|
+
export { ContentStringAsset };
|
|
78
|
+
class ContentAssets extends AssetManager {
|
|
79
|
+
constructor(contentAssetMetadataMap, assetBuilderContext = {}) {
|
|
127
80
|
super();
|
|
128
81
|
for (const [assetKey, metadata] of Object.entries(contentAssetMetadataMap)) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
asset = new ContentInlineAsset(metadata);
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
if (objectStoreName == null) {
|
|
135
|
-
throw new Error("Unexpected! Object Store should be specified!!");
|
|
136
|
-
}
|
|
137
|
-
asset = new ContentObjectStoreAsset(metadata, objectStoreName);
|
|
82
|
+
if (!(metadata.type in ContentAssets.builders)) {
|
|
83
|
+
throw new Error(`Unknown content asset type '${metadata.type}'`);
|
|
138
84
|
}
|
|
85
|
+
const asset = ContentAssets.builders[metadata.type](metadata, assetBuilderContext);
|
|
139
86
|
this.initAsset(assetKey, asset);
|
|
140
87
|
}
|
|
141
88
|
}
|
|
89
|
+
static registerAssetBuilder(type, builder) {
|
|
90
|
+
this.builders[type] = builder;
|
|
91
|
+
}
|
|
142
92
|
}
|
|
93
|
+
ContentAssets.builders = {};
|
|
94
|
+
export { ContentAssets };
|
|
95
|
+
ContentAssets.registerAssetBuilder('bytes', metadata => new ContentBytesAsset(metadata));
|
|
96
|
+
ContentAssets.registerAssetBuilder('string', metadata => new ContentStringAsset(metadata));
|
|
@@ -4,9 +4,18 @@ export type CompressedFileInfos<TData> = Partial<Record<ContentCompressionTypes,
|
|
|
4
4
|
export type ContentFileInfo = {
|
|
5
5
|
hash: string;
|
|
6
6
|
size: number;
|
|
7
|
+
};
|
|
8
|
+
export type ContentFileInfoForBytes = ContentFileInfo & {
|
|
9
|
+
bytes: Uint8Array;
|
|
10
|
+
};
|
|
11
|
+
export type ContentFileInfoForString = ContentFileInfo & {
|
|
12
|
+
content: string;
|
|
13
|
+
};
|
|
14
|
+
export type ContentFileInfoForStaticPublishing = ContentFileInfo & {
|
|
7
15
|
staticFilePath: string;
|
|
8
16
|
};
|
|
9
|
-
export type
|
|
17
|
+
export type ContentFileInfoForWasmInline = ContentFileInfoForStaticPublishing;
|
|
18
|
+
export type ContentFileInfoForObjectStore = ContentFileInfoForStaticPublishing & {
|
|
10
19
|
objectStoreKey: string;
|
|
11
20
|
};
|
|
12
21
|
export type ContentAssetMetadataMapEntryBase<TFileInfo> = {
|
|
@@ -17,22 +26,29 @@ export type ContentAssetMetadataMapEntryBase<TFileInfo> = {
|
|
|
17
26
|
fileInfo: TFileInfo;
|
|
18
27
|
compressedFileInfos: CompressedFileInfos<TFileInfo>;
|
|
19
28
|
};
|
|
20
|
-
export type
|
|
21
|
-
|
|
22
|
-
} & ContentAssetMetadataMapEntryBase<
|
|
29
|
+
export type ContentAssetMetadataMapEntryBytes = {
|
|
30
|
+
type: 'bytes';
|
|
31
|
+
} & ContentAssetMetadataMapEntryBase<ContentFileInfoForBytes>;
|
|
32
|
+
export type ContentAssetMetadataMapEntryString = {
|
|
33
|
+
type: 'string';
|
|
34
|
+
} & ContentAssetMetadataMapEntryBase<ContentFileInfoForString>;
|
|
35
|
+
export type ContentAssetMetadataMapEntryWasmInline = {
|
|
36
|
+
type: 'wasm-inline';
|
|
37
|
+
} & ContentAssetMetadataMapEntryBase<ContentFileInfoForWasmInline>;
|
|
23
38
|
export type ContentAssetMetadataMapEntryObjectStore = {
|
|
24
|
-
|
|
39
|
+
type: 'object-store';
|
|
25
40
|
} & ContentAssetMetadataMapEntryBase<ContentFileInfoForObjectStore>;
|
|
26
|
-
export type ContentAssetMetadataMapEntry =
|
|
41
|
+
export type ContentAssetMetadataMapEntry = ContentAssetMetadataMapEntryBytes | ContentAssetMetadataMapEntryString | ContentAssetMetadataMapEntryWasmInline | ContentAssetMetadataMapEntryObjectStore;
|
|
27
42
|
export type ContentAssetMetadataMap = {
|
|
28
43
|
[assetKey: string]: ContentAssetMetadataMapEntry;
|
|
29
44
|
};
|
|
30
45
|
export interface ContentAsset {
|
|
46
|
+
readonly type: string;
|
|
47
|
+
readonly isLocal: boolean;
|
|
31
48
|
readonly assetKey: string;
|
|
32
49
|
getMetadata(): ContentAssetMetadataMapEntry;
|
|
33
50
|
getStoreEntry(acceptEncodingsGroups?: ContentCompressionTypes[][]): Promise<StoreEntry>;
|
|
34
51
|
getBytes(): Uint8Array;
|
|
35
52
|
getText(): string;
|
|
36
|
-
readonly isInline: boolean;
|
|
37
53
|
}
|
|
38
54
|
//# sourceMappingURL=content-assets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-assets.d.ts","sourceRoot":"","sources":["../../src/types/content-assets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,MAAM,mBAAmB,CAAC,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC,CAAC;AAEzF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"content-assets.d.ts","sourceRoot":"","sources":["../../src/types/content-assets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,MAAM,mBAAmB,CAAC,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC,CAAC;AAEzF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAGF,MAAM,MAAM,uBAAuB,GAAG,eAAe,GAAG;IACtD,KAAK,EAAE,UAAU,CAAC;CACnB,CAAC;AACF,MAAM,MAAM,wBAAwB,GAAG,eAAe,GAAG;IACvD,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAGF,MAAM,MAAM,kCAAkC,GAAG,eAAe,GAAG;IACjE,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,kCAAkC,CAAC;AAE9E,MAAM,MAAM,6BAA6B,GAAG,kCAAkC,GAAG;IAC/E,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,gCAAgC,CAAC,SAAS,IAAI;IACxD,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,SAAS,CAAC;IACpB,mBAAmB,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAA;CACpD,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG;IAC9C,IAAI,EAAE,OAAO,CAAC;CACf,GAAG,gCAAgC,CAAC,uBAAuB,CAAC,CAAC;AAC9D,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,QAAQ,CAAC;CAChB,GAAG,gCAAgC,CAAC,wBAAwB,CAAC,CAAC;AAE/D,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,aAAa,CAAC;CACrB,GAAG,gCAAgC,CAAC,4BAA4B,CAAC,CAAC;AAEnE,MAAM,MAAM,uCAAuC,GAAG;IACpD,IAAI,EAAE,cAAc,CAAC;CACtB,GAAG,gCAAgC,CAAC,6BAA6B,CAAC,CAAC;AAEpE,MAAM,MAAM,4BAA4B,GACpC,iCAAiC,GACjC,kCAAkC,GAClC,sCAAsC,GACtC,uCAAuC,CAAC;AAE5C,MAAM,MAAM,uBAAuB,GAAG;IACpC,CAAC,QAAQ,EAAE,MAAM,GAAG,4BAA4B,CAAC;CAClD,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,WAAW,IAAI,4BAA4B,CAAC;IAC5C,aAAa,CAAC,qBAAqB,CAAC,EAAE,uBAAuB,EAAE,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACxF,QAAQ,IAAI,UAAU,CAAC;IACvB,OAAO,IAAI,MAAM,CAAC;CACnB"}
|
package/build/util/metadata.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export function getObjectStoreKeysFromMetadata(contentAssetMetadataMap) {
|
|
2
2
|
const results = new Set();
|
|
3
3
|
for (const metadata of Object.values(contentAssetMetadataMap)) {
|
|
4
|
-
if (
|
|
4
|
+
if (metadata.type === 'object-store') {
|
|
5
5
|
results.add(metadata.fileInfo.objectStoreKey);
|
|
6
6
|
for (const fileInfo of Object.values(metadata.compressedFileInfos)) {
|
|
7
7
|
results.add(fileInfo.objectStoreKey);
|
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare abstract class AssetManager<TAsset> {
|
|
2
|
-
protected readonly assets: Record<string, TAsset>;
|
|
3
|
-
protected constructor();
|
|
4
|
-
setAsset(assetKey: string, asset: TAsset): void;
|
|
5
|
-
getAsset(assetKey: string): TAsset | null;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=asset-manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"asset-manager.d.ts","sourceRoot":"","sources":["../../src/assets/asset-manager.ts"],"names":[],"mappings":"AAAA,8BAAsB,YAAY,CAAC,MAAM;IAEvC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAElD,SAAS;IAIT,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAIxC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CAI1C"}
|