mirror of
https://github.com/oven-sh/setup-bun.git
synced 2025-07-19 13:08:27 +02:00
feat: add @actions/cache
This commit is contained in:
parent
b15fb7d098
commit
16e8c96a41
1932 changed files with 261172 additions and 10 deletions
72
node_modules/@azure/core-paging/dist-esm/src/getPagedAsyncIterator.js
generated
vendored
Normal file
72
node_modules/@azure/core-paging/dist-esm/src/getPagedAsyncIterator.js
generated
vendored
Normal file
|
@ -0,0 +1,72 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
|
||||
/**
|
||||
* returns an async iterator that iterates over results. It also has a `byPage`
|
||||
* method that returns pages of items at once.
|
||||
*
|
||||
* @param pagedResult - an object that specifies how to get pages.
|
||||
* @returns a paged async iterator that iterates over results.
|
||||
*/
|
||||
export function getPagedAsyncIterator(pagedResult) {
|
||||
var _a;
|
||||
const iter = getItemAsyncIterator(pagedResult);
|
||||
return {
|
||||
next() {
|
||||
return iter.next();
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
return this;
|
||||
},
|
||||
byPage: (_a = pagedResult === null || pagedResult === void 0 ? void 0 : pagedResult.byPage) !== null && _a !== void 0 ? _a : ((settings) => {
|
||||
const { continuationToken, maxPageSize } = settings !== null && settings !== void 0 ? settings : {};
|
||||
return getPageAsyncIterator(pagedResult, {
|
||||
pageLink: continuationToken,
|
||||
maxPageSize,
|
||||
});
|
||||
}),
|
||||
};
|
||||
}
|
||||
function getItemAsyncIterator(pagedResult) {
|
||||
return __asyncGenerator(this, arguments, function* getItemAsyncIterator_1() {
|
||||
var e_1, _a;
|
||||
const pages = getPageAsyncIterator(pagedResult);
|
||||
const firstVal = yield __await(pages.next());
|
||||
// if the result does not have an array shape, i.e. TPage = TElement, then we return it as is
|
||||
if (!Array.isArray(firstVal.value)) {
|
||||
yield yield __await(firstVal.value);
|
||||
// `pages` is of type `AsyncIterableIterator<TPage>` but TPage = TElement in this case
|
||||
yield __await(yield* __asyncDelegator(__asyncValues(pages)));
|
||||
}
|
||||
else {
|
||||
yield __await(yield* __asyncDelegator(__asyncValues(firstVal.value)));
|
||||
try {
|
||||
for (var pages_1 = __asyncValues(pages), pages_1_1; pages_1_1 = yield __await(pages_1.next()), !pages_1_1.done;) {
|
||||
const page = pages_1_1.value;
|
||||
// pages is of type `AsyncIterableIterator<TPage>` so `page` is of type `TPage`. In this branch,
|
||||
// it must be the case that `TPage = TElement[]`
|
||||
yield __await(yield* __asyncDelegator(__asyncValues(page)));
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (pages_1_1 && !pages_1_1.done && (_a = pages_1.return)) yield __await(_a.call(pages_1));
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function getPageAsyncIterator(pagedResult, options = {}) {
|
||||
return __asyncGenerator(this, arguments, function* getPageAsyncIterator_1() {
|
||||
const { pageLink, maxPageSize } = options;
|
||||
let response = yield __await(pagedResult.getPage(pageLink !== null && pageLink !== void 0 ? pageLink : pagedResult.firstPageLink, maxPageSize));
|
||||
yield yield __await(response.page);
|
||||
while (response.nextPageLink) {
|
||||
response = yield __await(pagedResult.getPage(response.nextPageLink, maxPageSize));
|
||||
yield yield __await(response.page);
|
||||
}
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=getPagedAsyncIterator.js.map
|
1
node_modules/@azure/core-paging/dist-esm/src/getPagedAsyncIterator.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-paging/dist-esm/src/getPagedAsyncIterator.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"getPagedAsyncIterator.js","sourceRoot":"","sources":["../../src/getPagedAsyncIterator.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAIlC;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAMnC,WAAqD;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tC;;;;;;;;;SACF;IACH,CAAC;CAAA;AAED,SAAgB,oBAAoB,CAClC,WAAqD,EACrD,UAGI,EAAE;;QAEN,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;QAC1C,IAAI,QAAQ,GAAG,cAAM,WAAW,CAAC,OAAO,CAAC,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,WAAW,CAAC,aAAa,EAAE,WAAW,CAAC,CAAA,CAAC;QAC7F,oBAAM,QAAQ,CAAC,IAAI,CAAA,CAAC;QACpB,OAAO,QAAQ,CAAC,YAAY,EAAE;YAC5B,QAAQ,GAAG,cAAM,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,CAAA,CAAC;YACzE,oBAAM,QAAQ,CAAC,IAAI,CAAA,CAAC;SACrB;IACH,CAAC;CAAA","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { PageSettings, PagedAsyncIterableIterator, PagedResult } from \"./models\";\n\n/**\n * returns an async iterator that iterates over results. It also has a `byPage`\n * method that returns pages of items at once.\n *\n * @param pagedResult - an object that specifies how to get pages.\n * @returns a paged async iterator that iterates over results.\n */\nexport function getPagedAsyncIterator<\n TElement,\n TPage = TElement[],\n TPageSettings = PageSettings,\n TLink = string\n>(\n pagedResult: PagedResult<TPage, TPageSettings, TLink>\n): PagedAsyncIterableIterator<TElement, TPage, TPageSettings> {\n const iter = getItemAsyncIterator<TElement, TPage, TLink, TPageSettings>(pagedResult);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage:\n pagedResult?.byPage ??\n ((settings?: PageSettings) => {\n const { continuationToken, maxPageSize } = settings ?? {};\n return getPageAsyncIterator(pagedResult as PagedResult<TPage, PageSettings, TLink>, {\n pageLink: continuationToken as unknown as TLink | undefined,\n maxPageSize,\n });\n }),\n };\n}\n\nasync function* getItemAsyncIterator<TElement, TPage, TLink, TPageSettings>(\n pagedResult: PagedResult<TPage, TPageSettings, TLink>\n): AsyncIterableIterator<TElement> {\n const pages = getPageAsyncIterator(pagedResult);\n const firstVal = await pages.next();\n // if the result does not have an array shape, i.e. TPage = TElement, then we return it as is\n if (!Array.isArray(firstVal.value)) {\n yield firstVal.value;\n // `pages` is of type `AsyncIterableIterator<TPage>` but TPage = TElement in this case\n yield* pages as unknown as AsyncIterableIterator<TElement>;\n } else {\n yield* firstVal.value;\n for await (const page of pages) {\n // pages is of type `AsyncIterableIterator<TPage>` so `page` is of type `TPage`. In this branch,\n // it must be the case that `TPage = TElement[]`\n yield* page as unknown as TElement[];\n }\n }\n}\n\nasync function* getPageAsyncIterator<TPage, TLink, TPageSettings>(\n pagedResult: PagedResult<TPage, TPageSettings, TLink>,\n options: {\n maxPageSize?: number;\n pageLink?: TLink;\n } = {}\n): AsyncIterableIterator<TPage> {\n const { pageLink, maxPageSize } = options;\n let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink, maxPageSize);\n yield response.page;\n while (response.nextPageLink) {\n response = await pagedResult.getPage(response.nextPageLink, maxPageSize);\n yield response.page;\n }\n}\n"]}
|
5
node_modules/@azure/core-paging/dist-esm/src/index.js
generated
vendored
Normal file
5
node_modules/@azure/core-paging/dist-esm/src/index.js
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
export * from "./models";
|
||||
export * from "./getPagedAsyncIterator";
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@azure/core-paging/dist-esm/src/index.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-paging/dist-esm/src/index.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,cAAc,UAAU,CAAC;AACzB,cAAc,yBAAyB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport * from \"./models\";\nexport * from \"./getPagedAsyncIterator\";\n"]}
|
4
node_modules/@azure/core-paging/dist-esm/src/models.js
generated
vendored
Normal file
4
node_modules/@azure/core-paging/dist-esm/src/models.js
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
export {};
|
||||
//# sourceMappingURL=models.js.map
|
1
node_modules/@azure/core-paging/dist-esm/src/models.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-paging/dist-esm/src/models.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * An interface that tracks the settings for paged iteration\n */\nexport interface PageSettings {\n /**\n * The token that keeps track of where to continue the iterator\n */\n continuationToken?: string;\n /**\n * The size of the page during paged iteration\n */\n maxPageSize?: number;\n}\n/**\n * An interface that allows async iterable iteration both to completion and by page.\n */\nexport interface PagedAsyncIterableIterator<T, PageT = T[], PageSettingsT = PageSettings> {\n /**\n * The next method, part of the iteration protocol\n */\n next(): Promise<IteratorResult<T>>;\n /**\n * The connection to the async iterator, part of the iteration protocol\n */\n [Symbol.asyncIterator](): PagedAsyncIterableIterator<T, PageT, PageSettingsT>;\n /**\n * Return an AsyncIterableIterator that works a page at a time\n */\n byPage: (settings?: PageSettingsT) => AsyncIterableIterator<PageT>;\n}\n\n/**\n * An interface that describes how to communicate with the service.\n */\nexport interface PagedResult<TPage, TPageSettings = PageSettings, TLink = string> {\n /**\n * Link to the first page of results.\n */\n firstPageLink: TLink;\n /**\n * A method that returns a page of results.\n */\n getPage: (\n pageLink: TLink,\n maxPageSize?: number\n ) => Promise<{ page: TPage; nextPageLink?: TLink }>;\n /**\n * a function to implement the `byPage` method on the paged async iterator. The default is\n * one that sets the `maxPageSizeParam` from `settings.maxPageSize`.\n */\n byPage?: (settings?: TPageSettings) => AsyncIterableIterator<TPage>;\n}\n"]}
|
Loading…
Add table
Add a link
Reference in a new issue