repo stringlengths 5 106 | file_url stringlengths 78 301 | file_path stringlengths 4 211 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:56:49 2026-01-05 02:23:25 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/playgrounds/memory/jest.config.js | playgrounds/memory/jest.config.js | "use strict";
module.exports = async () => ({
preset: 'ts-jest',
verbose: true,
"transform": {
"^.+\\.[tj]s$": ["ts-jest", {
"tsconfig": {
"allowJs": true
}
}]
},
"transformIgnorePatterns": [
"node_modules/(?!quick-lru)"
],
});
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/playgrounds/memory/config/plugins.js | playgrounds/memory/config/plugins.js | "use strict";
module.exports = ({ env }) => ({
"rest-cache": {
enabled: env.bool("ENABLE_CACHE", true),
config: {
provider: {
name: "memory",
options: {
ttl: 3600 * 1000,
maxSize: 32767,
}
},
// loads shared config (from /shared folder)
stra... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/docs/.vitepress/config.js | docs/.vitepress/config.js | import { createRequire } from 'module'
import defineVersionedConfig from 'vitepress-versioning-plugin-patched'
const require = createRequire(import.meta.url)
const pkg = require('@strapi-community/plugin-rest-cache/package.json')
export default defineVersionedConfig({
title: "REST Cache",
description: "Speed-up H... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/start-profiler.js | shared/start-profiler.js | "use strict";
process.env.NODE_ENV = 'test';
const Strapi = require("@strapi/strapi");
async function setup() {
Strapi({
dir: __dirname,
});
await strapi.start();
return Promise.resolve(strapi);
}
// eslint-disable-next-line no-console
setup().catch(console.error);
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/src/index.js | shared/src/index.js | "use strict";
const { bootstrap } = require("./bootstrap");
module.exports = {
/**
* An asynchronous register function that runs before
* your application is initialized.
*
* This gives you an opportunity to extend code.
*/
register(/* { strapi } */) {},
/**
* An asynchronous bootstrap functi... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/src/bootstrap.js | shared/src/bootstrap.js | // this was copied from https://github.com/strapi/starters-and-templates/blob/main/packages/templates/ecommerce/template/src/bootstrap.js
/* eslint-disable */
"use strict";
const fs = require("fs");
const { join } = require("path");
const mime = require("mime-types");
// this file will be copied to playgrounds/** by... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/src/admin/app.example.js | shared/src/admin/app.example.js | /* eslint-disable */
export default {
config: {
locales: [
// 'ar',
// 'fr',
// 'cs',
// 'de',
// 'dk',
// 'es',
// 'he',
// 'id',
// 'it',
// 'ja',
// 'ko',
// 'ms',
// 'nl',
// 'no',
// 'pl',
// 'pt-BR',
// 'p... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/src/admin/webpack.config.example.js | shared/src/admin/webpack.config.example.js | "use strict";
/* eslint-disable no-unused-vars */
module.exports = (config, webpack) =>
// Note: we provide webpack above so you should not `require` it
// Perform customizations to webpack config
// Important: return the modified config
config;
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/src/api/writer/services/writer.js | shared/src/api/writer/services/writer.js | "use strict";
/**
* writer service.
*/
const { createCoreService } = require("@strapi/strapi").factories;
module.exports = createCoreService("api::writer.writer");
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/src/api/writer/controllers/writer.js | shared/src/api/writer/controllers/writer.js | "use strict";
/**
* writer controller
*/
const { createCoreController } = require("@strapi/strapi").factories;
module.exports = createCoreController("api::writer.writer");
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/src/api/writer/routes/writer.js | shared/src/api/writer/routes/writer.js | "use strict";
/**
* writer router.
*/
const { createCoreRouter } = require("@strapi/strapi").factories;
module.exports = createCoreRouter("api::writer.writer");
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/src/api/global/services/global.js | shared/src/api/global/services/global.js | "use strict";
/**
* global service.
*/
const { createCoreService } = require("@strapi/strapi").factories;
module.exports = createCoreService("api::global.global");
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/src/api/global/controllers/global.js | shared/src/api/global/controllers/global.js | "use strict";
/**
* global controller
*/
const { createCoreController } = require("@strapi/strapi").factories;
module.exports = createCoreController("api::global.global");
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/src/api/global/routes/global.js | shared/src/api/global/routes/global.js | "use strict";
/**
* global router.
*/
const { createCoreRouter } = require("@strapi/strapi").factories;
module.exports = createCoreRouter("api::global.global");
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/src/api/category/services/category.js | shared/src/api/category/services/category.js | "use strict";
/**
* category service.
*/
const { createCoreService } = require("@strapi/strapi").factories;
module.exports = createCoreService("api::category.category");
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/src/api/category/controllers/category.js | shared/src/api/category/controllers/category.js | "use strict";
/**
* category controller
*/
const { createCoreController } = require("@strapi/strapi").factories;
module.exports = createCoreController(
"api::category.category",
({ strapi }) => ({
async findBySlug(ctx) {
const { slug } = ctx.params;
const { query } = ctx;
let populate;
... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/src/api/category/routes/custom-category.js | shared/src/api/category/routes/custom-category.js | "use strict";
module.exports = {
routes: [
{
method: "GET",
path: "/categories/slug/:slug+",
handler: "category.findBySlug",
},
],
};
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/src/api/category/routes/category.js | shared/src/api/category/routes/category.js | "use strict";
/**
* category router.
*/
const { createCoreRouter } = require("@strapi/strapi").factories;
module.exports = createCoreRouter("api::category.category");
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/src/api/article/services/article.js | shared/src/api/article/services/article.js | "use strict";
/**
* article service.
*/
const { createCoreService } = require("@strapi/strapi").factories;
module.exports = createCoreService("api::article.article");
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/src/api/article/controllers/article.js | shared/src/api/article/controllers/article.js | "use strict";
/**
* article controller
*/
const { createCoreController } = require("@strapi/strapi").factories;
module.exports = createCoreController("api::article.article");
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/src/api/article/routes/article.js | shared/src/api/article/routes/article.js | "use strict";
/**
* article router.
*/
const { createCoreRouter } = require("@strapi/strapi").factories;
module.exports = createCoreRouter("api::article.article");
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/src/api/homepage/services/homepage.js | shared/src/api/homepage/services/homepage.js | "use strict";
/**
* homepage service.
*/
const { createCoreService } = require("@strapi/strapi").factories;
module.exports = createCoreService("api::homepage.homepage");
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/src/api/homepage/controllers/homepage.js | shared/src/api/homepage/controllers/homepage.js | "use strict";
/**
* homepage controller
*/
const { createCoreController } = require("@strapi/strapi").factories;
module.exports = createCoreController("api::homepage.homepage", {
config: {
find: {
auth: false,
},
},
});
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/src/api/homepage/routes/homepage.js | shared/src/api/homepage/routes/homepage.js | "use strict";
/**
* homepage router.
*/
const { createCoreRouter } = require("@strapi/strapi").factories;
module.exports = createCoreRouter("api::homepage.homepage");
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/tests/single-type-default.test.js | shared/tests/single-type-default.test.js | "use strict";
const { setup, teardown, agent, adminAgent } = require("./helpers/strapi");
jest.setTimeout(60000);
process.env.STRAPI_DISABLE_UPDATE_NOTIFICATION = true;
process.env.STRAPI_HIDE_STARTUP_MESSAGE = true;
process.env.STRAPI_TELEMETRY_DISABLED = true;
describe.each([
["default settings"],
["empty str... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/tests/helpers/strapi.js | shared/tests/helpers/strapi.js | "use strict";
const { existsSync, unlinkSync } = require("fs");
const { createStrapi, compileStrapi } = require('@strapi/strapi');
const supertest = require("supertest");
let adminToken;
function agent() {
return supertest.agent(strapi.server.httpServer);
}
function adminAgent() {
return supertest
.agent(str... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/config/cache-strategy.js | shared/config/cache-strategy.js | 'use strict';
module.exports = ({ env }) => ({
debug: false,
maxAge: env.int("ENABLE_MAX_AGE", 3600000),
enableEtag: env.bool("ENABLE_ETAG", true),
enableXCacheHeaders: env.bool("ENABLE_XCACHE_HEADERS", true),
enableAdminCTBMiddleware: env.bool("ENABLE_ADMIN_CTB_MIDDLEWARE", true),
resetOnStartup: env.bool... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/config/middlewares.js | shared/config/middlewares.js | "use strict";
module.exports = [
"strapi::errors",
"strapi::security",
"strapi::cors",
"strapi::poweredBy",
// "strapi::logger",
"strapi::query",
"strapi::session",
"strapi::body",
"strapi::favicon",
"strapi::public",
];
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/config/database.js | shared/config/database.js | "use strict";
const path = require("path");
module.exports = ({ env }) => ({
connection: {
client: "sqlite",
connection: {
filename: path.join(
__dirname,
"..",
env("DATABASE_FILENAME", ".tmp/data.db")
),
},
useNullAsDefault: true,
},
});
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/config/admin.js | shared/config/admin.js | "use strict";
module.exports = ({ env }) => ({
auth: {
secret: env("ADMIN_JWT_SECRET", "b46375d2efd1c69d8efcdcb46d3acd67"),
},
apiToken: {
salt: env("API_TOKEN_SALT", "changeme"),
},
transfer: {
token: {
salt: env("TRANSFER_TOKEN_SALT", "changeme"),
},
},
});
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/config/api.js | shared/config/api.js | "use strict";
module.exports = {
rest: {
defaultLimit: 25,
maxLimit: 100,
withCount: true,
},
};
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/config/logger.js | shared/config/logger.js | "use strict";
module.exports = ({ env }) => ({
level: env("STRAPI_LOG_LEVEL", "error"),
}); | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/config/server.js | shared/config/server.js | "use strict";
module.exports = ({ env }) => ({
host: env("HOST", "0.0.0.0"),
port: env.int("PORT", 1337),
app: {
keys: env.array("APP_KEYS", ["testKey1", "testKey2"]),
},
});
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/shared/config/env/test/database.js | shared/config/env/test/database.js | "use strict";
const { join } = require("path");
module.exports = () => ({
connection: {
client: "sqlite",
connection: {
filename: join(__dirname, "../../../", ".tmp/tests.db"),
},
useNullAsDefault: true,
},
});
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/provider-rest-cache-memory/lib/index.js | packages/provider-rest-cache-memory/lib/index.js | 'use strict';
/**
* @typedef {import('@strapi/strapi').Strapi} Strapi
*/
const { MemoryCacheProvider } = require('./MemoryCacheProvider');
module.exports = {
provider: 'memory',
name: 'Memory',
async init(options /* , { strapi } */) {
return new MemoryCacheProvider(options);
},
};
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/provider-rest-cache-memory/lib/MemoryCacheProvider.js | packages/provider-rest-cache-memory/lib/MemoryCacheProvider.js | 'use strict';
const Keyv = require('keyv').default;
const QuickLRU = require('quick-lru');
const { createCache } = require('cache-manager');
const { CacheProvider } = require('@strapi-community/plugin-rest-cache/types');
class MemoryCacheProvider extends CacheProvider {
constructor(options) {
super();
cons... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/provider-rest-cache-redis/lib/RedisCacheProvider.js | packages/provider-rest-cache-redis/lib/RedisCacheProvider.js | 'use strict';
const { createCache } = require('cache-manager');
const Keyv = require('keyv').default;
const KeyvRedis = require('@keyv/redis');
const { CacheProvider } = require('@strapi-community/plugin-rest-cache/types');
class RedisCacheProvider extends CacheProvider {
constructor(client, options) {
super();... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/provider-rest-cache-redis/lib/index.js | packages/provider-rest-cache-redis/lib/index.js | 'use strict';
/**
* @typedef {import('@strapi/strapi').Strapi} Strapi
*/
const { RedisCacheProvider } = require('./RedisCacheProvider');
function waitForRedis(client) {
return new Promise((resolve, reject) => {
const onReady = () => {
strapi.log.info('REST Cache provider "redis": connection established'... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/admin/src/index.js | packages/plugin-rest-cache/admin/src/index.js | import pluginPkg from '../../package.json';
import pluginId from './pluginId';
import Initializer from './components/Initializer';
import ListViewInjectedComponent from './components/ListViewInjectedComponent';
import PurgeDocumentAction from './components/PurgeDocumentAction';
import EditViewInfoDocumentPanel from '.... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/admin/src/pluginId.js | packages/plugin-rest-cache/admin/src/pluginId.js | import pluginPkg from '../../package.json';
// const pluginId = pluginPkg.name.replace(/^strapi-plugin-/i, '');
export default pluginPkg.strapi.name;
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/admin/src/permissions.js | packages/plugin-rest-cache/admin/src/permissions.js | // import pluginId from './pluginId';
const pluginPermissions = {
purge: [{ action: `plugin::rest-cache.cache.purge`, subject: null }],
readStrategy: [
{
action: `plugin::rest-cache.cache.read-strategy`,
subject: null,
},
],
readProvider: [
{
action: `plugin::rest-cache.cache.read... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/admin/src/hooks/index.js | packages/plugin-rest-cache/admin/src/hooks/index.js | export { default as useCacheStrategy } from './useCacheStrategy';
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/admin/src/hooks/useCacheStrategy/reducer.js | packages/plugin-rest-cache/admin/src/hooks/useCacheStrategy/reducer.js | /* eslint-disable consistent-return */
import produce from 'immer';
export const initialState = {
strategy: {},
isLoading: true,
};
const reducer = (state, action) =>
produce(state, (draftState) => {
switch (action.type) {
case 'GET_DATA': {
draftState.isLoading = true;
draftState.stra... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/admin/src/hooks/useCacheStrategy/index.js | packages/plugin-rest-cache/admin/src/hooks/useCacheStrategy/index.js | import { useEffect, useReducer, useRef } from 'react';
import { useNotification, useFetchClient } from '@strapi/strapi/admin';
import init from './init';
import pluginId from '../../pluginId';
import reducer, { initialState } from './reducer';
const useCacheStrategy = (shouldFetchData = true) => {
const [{ strategy... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/admin/src/hooks/useCacheStrategy/init.js | packages/plugin-rest-cache/admin/src/hooks/useCacheStrategy/init.js | const init = (initialState, shouldFetchData) => ({
...initialState,
isLoading: shouldFetchData,
});
export default init;
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/admin/src/pages/HomePage/index.js | packages/plugin-rest-cache/admin/src/pages/HomePage/index.js | /*
*
* HomePage
*
*/
import React, { memo } from 'react';
import PurgeCacheButton from '../../components/PurgeCacheButton';
// import PropTypes from 'prop-types';
import pluginId from '../../pluginId';
function HomePage() {
return (
<div>
<h1>{pluginId}'s HomePage</h1>
<p>Happy coding</p>
... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/admin/src/pages/App/index.js | packages/plugin-rest-cache/admin/src/pages/App/index.js | /**
*
* This component is the skeleton around the actual pages, and should only
* contain code that should be seen on all pages. (e.g. navigation bar)
*
*/
import React from 'react';
import { Switch, Route } from 'react-router-dom';
import pluginId from '../../pluginId';
import HomePage from '../HomePage';
funct... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/admin/src/components/PluginIcon/index.jsx | packages/plugin-rest-cache/admin/src/components/PluginIcon/index.jsx | import React from 'react';
import Information from '@strapi/icons/Information';
function PluginIcon() {
return <Information />;
}
export default PluginIcon;
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/admin/src/components/PurgeCacheButton/index.jsx | packages/plugin-rest-cache/admin/src/components/PurgeCacheButton/index.jsx | import React, { useState, useEffect } from 'react';
import { useIntl } from 'react-intl';
import { Button, Dialog } from '@strapi/design-system';
import { ArrowsCounterClockwise } from '@strapi/icons';
import { useNotification, useFetchClient } from '@strapi/strapi/admin';
import PropTypes from 'prop-types';
import pl... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/admin/src/components/Initializer/index.jsx | packages/plugin-rest-cache/admin/src/components/Initializer/index.jsx | /**
*
* Initializer
*
*/
import { useEffect, useRef } from 'react';
import PropTypes from 'prop-types';
import pluginId from '../../pluginId';
function Initializer({ setPlugin }) {
const ref = useRef();
ref.current = setPlugin;
useEffect(() => {
ref.current(pluginId);
}, []);
return null;
}
Initi... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/admin/src/components/PurgeDocumentAction/index.jsx | packages/plugin-rest-cache/admin/src/components/PurgeDocumentAction/index.jsx | import { useNotification, useRBAC, unstable_useContentManagerContext as useContentManagerContext } from "@strapi/strapi/admin"
import cachePermissions from "../../permissions"
import { useCacheStrategy } from '../../hooks';
import { useFetchClient } from '@strapi/strapi/admin';
import pluginId from '../../pluginId';
i... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/admin/src/components/ListViewInjectedComponent/index.jsx | packages/plugin-rest-cache/admin/src/components/ListViewInjectedComponent/index.jsx | import React from 'react';
// import { useIntl } from 'react-intl';
import { useRBAC } from '@strapi/strapi/admin';
import { useMatch } from 'react-router-dom';
// import cachePermissions from '../../permissions';
import cachePermissions from '../../permissions';
import PurgeCacheButton from '../PurgeCacheButton';
fu... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/admin/src/components/EditViewInfoDocumentPanel/index.jsx | packages/plugin-rest-cache/admin/src/components/EditViewInfoDocumentPanel/index.jsx | import { useNotification, useRBAC, unstable_useContentManagerContext as useContentManagerContext } from "@strapi/strapi/admin"
import cachePermissions from "../../permissions"
import { useCacheStrategy } from '../../hooks';
import { useFetchClient } from '@strapi/strapi/admin';
import pluginId from '../../pluginId';
i... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/permissions-actions.js | packages/plugin-rest-cache/server/src/permissions-actions.js | 'use strict';
export default {
actions: [
{
section: 'plugins',
displayName: 'Purge cache',
uid: 'cache.purge',
subCategory: 'purge',
pluginName: 'rest-cache',
},
{
section: 'plugins',
displayName: 'Read cache strategy configuration',
uid: 'cache.read-strat... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/index.js | packages/plugin-rest-cache/server/src/index.js | 'use strict';
import bootstrap from './bootstrap';
import services from './services';
import config from './config';
import controllers from './controllers';
import middlewares from './middlewares';
import routes from './routes';
import register from './register';
export default {
bootstrap,
register,
config,
... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/pluginId.js | packages/plugin-rest-cache/server/src/pluginId.js | 'use strict';
import pluginPkg from '../../package.json';
const pluginId = pluginPkg.strapi.name;
export default pluginId;
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/register.js | packages/plugin-rest-cache/server/src/register.js | 'use strict';
/**
* @typedef {import('@strapi/strapi').Strapi} Strapi
*/
import debug from 'debug';
import { resolveUserStrategy } from './utils/config/resolveUserStrategy';
import { injectMiddlewares } from './utils/middlewares/injectMiddlewares';
/**
* @param {{ strapi: Strapi }} strapi
*/
export default async... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/bootstrap.js | packages/plugin-rest-cache/server/src/bootstrap.js | 'use strict';
const looksLikeInstanceof = (value, target) => {
let current = value?.constructor;
do {
if (current?.name === target.name) return true;
current = Object.getPrototypeOf(current);
} while (current?.name);
return false;
};
import chalk from 'chalk';
import { createRequire } from 'module';
i... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/services/index.js | packages/plugin-rest-cache/server/src/services/index.js | 'use strict';
import cacheConfig from './cacheConfig';
import cacheStore from './cacheStore';
export default {
cacheConfig,
cacheStore,
};
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/services/cacheConfig.js | packages/plugin-rest-cache/server/src/services/cacheConfig.js | 'use strict';
/**
* @typedef {import('@strapi/strapi').Strapi} Strapi
*/
import { getRouteRegExp } from '../utils/config/getRouteRegExp';
/**
* @param {{ strapi: Strapi }} strapi
*/
export default function createCacheConfigService({ strapi }) {
return {
/**
* Get all uid of cached contentTypes
*... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/services/cacheStore.js | packages/plugin-rest-cache/server/src/services/cacheStore.js | 'use strict';
/**
* @typedef {import('@strapi/strapi').Strapi} Strapi
* @typedef {import('./types').CacheProvider} CacheProvider
*/
import chalk from 'chalk';
import debug from 'debug';
import { serialize } from '../utils/store/serialize';
import { deserialize } from '../utils/store/deserialize';
import { withTime... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/controllers/index.js | packages/plugin-rest-cache/server/src/controllers/index.js | 'use strict';
import purge from './purge';
import config from './config';
export default {
purge,
config,
};
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/controllers/purge.js | packages/plugin-rest-cache/server/src/controllers/purge.js | 'use strict';
/**
* @typedef {import('@strapi/strapi').Strapi} Strapi
* @typedef {import('koa').Context} Context
*/
/**
* @param {{ strapi: Strapi }} strapi
*/
export default function createPurgeController({ strapi }) {
return {
/**
* @param {Context} ctx
*/
async index(ctx) {
const { c... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/controllers/config.js | packages/plugin-rest-cache/server/src/controllers/config.js | 'use strict';
/**
* @typedef {import('@strapi/strapi').Strapi} Strapi
* @typedef {import('koa').Context} Context
*/
/**
* @param {{ strapi: Strapi }} strapi
*/
export default function createConfigController({ strapi }) {
return {
/**
* @param {Context} ctx
*/
async strategy(ctx) {
const... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/routes/index.js | packages/plugin-rest-cache/server/src/routes/index.js | 'use strict';
import admin from './admin';
export default {
admin,
};
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/routes/admin/index.js | packages/plugin-rest-cache/server/src/routes/admin/index.js | 'use strict';
import configRoutes from './config';
import purgeRoutes from './purge';
export default {
type: 'admin',
routes: [...configRoutes, ...purgeRoutes],
};
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/routes/admin/purge.js | packages/plugin-rest-cache/server/src/routes/admin/purge.js | 'use strict';
import pluginId from '../../pluginId';
export default [
{
method: 'POST',
path: '/purge',
handler: 'purge.index',
config: {
policies: [
'admin::isAuthenticatedAdmin',
{
name: 'plugin::content-manager.hasPermissions',
config: { actions: [`plugin... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/routes/admin/config.js | packages/plugin-rest-cache/server/src/routes/admin/config.js | 'use strict';
import pluginId from '../../pluginId';
export default [
{
method: 'GET',
path: '/config/strategy',
handler: 'config.strategy',
config: {
policies: [
'admin::isAuthenticatedAdmin',
{
name: 'plugin::content-manager.hasPermissions',
config: { acti... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/utils/store/deserialize.js | packages/plugin-rest-cache/server/src/utils/store/deserialize.js | 'use strict';
/**
* @param {string} str
* @return {any}
*/
export const deserialize = function (str) {
if (!str) {
return null;
}
return JSON.parse(str).data;
}
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/utils/store/withTimeout.js | packages/plugin-rest-cache/server/src/utils/store/withTimeout.js | 'use strict';
/**
* Reject promise after timeout
*
* @todo this is slow, we should find a way to do this in a faster way
* @param {Promise<any>} callback
* @param {number} ms
* @return {Promise<never>}
*/
export const withTimeout = function (callback, ms) {
let timeout;
return Promise.race([
callback()... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/utils/store/serialize.js | packages/plugin-rest-cache/server/src/utils/store/serialize.js | 'use strict';
/**
* @param {any} data
* @return {string}
*/
export const serialize = function (data) {
return JSON.stringify({ data });
}
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/utils/etags/etagGenerate.js | packages/plugin-rest-cache/server/src/utils/etags/etagGenerate.js | 'use strict';
import crypto from 'crypto';
export const etagGenerate = function (ctx) {
const type = typeof ctx.body;
const etag = crypto
.createHash('md5')
.update(type === 'string' ? ctx.body : JSON.stringify(ctx.body))
.digest('hex');
return etag;
}
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/utils/etags/etagMatch.js | packages/plugin-rest-cache/server/src/utils/etags/etagMatch.js | 'use strict';
export const etagMatch = function (ctx, etagCached) {
const ifNoneMatch = ctx.request.headers['if-none-match'];
if (!ifNoneMatch) {
return false;
}
return ifNoneMatch.indexOf(`"${etagCached}"`) !== -1;
}
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/utils/etags/etagLookup.js | packages/plugin-rest-cache/server/src/utils/etags/etagLookup.js | 'use strict';
export const etagLookup = async function (cacheKey) {
const store = strapi.plugin('rest-cache').service('cacheStore');
const etagCached = await store.get(`${cacheKey}_etag`);
if (etagCached) {
return etagCached;
}
return null;
}
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/utils/middlewares/injectMiddlewares.js | packages/plugin-rest-cache/server/src/utils/middlewares/injectMiddlewares.js | 'use strict';
import chalk from 'chalk';
import debug from 'debug';
import { flattenRoutes } from './flattenRoutes';
const adminRoutes = {
post: [
'/single-types/:model/actions/publish',
'/single-types/:model/actions/unpublish',
'/collection-types/:model',
'/collection-types/:model/:id/actions/publi... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/utils/middlewares/shouldLookup.js | packages/plugin-rest-cache/server/src/utils/middlewares/shouldLookup.js | 'use strict';
export const shouldLookup = async function (
ctx,
hitpass // @todo: function or boolean => can be optimized
) {
const type = typeof hitpass;
if (type === 'boolean') {
return !hitpass;
}
if (type === 'function') {
return !(await hitpass(ctx));
}
return false;
};
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/utils/middlewares/flattenRoutes.js | packages/plugin-rest-cache/server/src/utils/middlewares/flattenRoutes.js | 'use strict';
/**
* @param {Strapi} strapi
* @return {void}
*/
export const flattenRoutes = function (strapi) {
let routes = [];
for (const contentTypes of Object.values(strapi.apis)) {
routes = routes.concat(flatten(contentTypes));
}
// @TODO add prefix support before doing this
const apiPrefix = s... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/utils/config/getRelatedModelsUid.js | packages/plugin-rest-cache/server/src/utils/config/getRelatedModelsUid.js | 'use strict';
/**
* @typedef {import('@strapi/strapi').Strapi} Strapi
*/
/**
* Get models uid that is related to a ModelCacheConfig
*
* @param {Strapi} strapi
* @param {string} uid The contentType used to find related caches to purge
* @return {string[]} Array of related models uid
*/
export const getRelatedM... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/utils/config/deepFreeze.js | packages/plugin-rest-cache/server/src/utils/config/deepFreeze.js | 'use strict';
export const deepFreeze = function (object) {
// Retrieve the property names defined on object
const propNames = Object.getOwnPropertyNames(object);
// Freeze properties before freezing self
for (const name of propNames) {
const value = object[name];
if (value && typeof value === 'objec... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/utils/config/resolveUserStrategy.js | packages/plugin-rest-cache/server/src/utils/config/resolveUserStrategy.js | 'use strict';
/**
* @typedef {import('koa').Context} Context
* @typedef {import('@strapi/strapi').Strapi} Strapi
*/
import { getRelatedModelsUid } from './getRelatedModelsUid';
import { deepFreeze } from './deepFreeze';
import {
CachePluginStrategy,
CacheRouteConfig,
CacheContentTypeConfig,
CacheKeysConfig... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/utils/config/getRouteRegExp.js | packages/plugin-rest-cache/server/src/utils/config/getRouteRegExp.js | 'use strict';
/**
* @typedef {import('../../types').CacheRouteConfig} CacheRouteConfig
* @typedef {import('koa').Context} Context
*/
/**
* Get regexs to match CustomRoute keys with given params
*
* @param {CacheRouteConfig} route
* @param {any} params
* @param {boolean=} wildcard
* @return {RegExp[]}
*/
exp... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/utils/keys/generateQueryParamsKey.js | packages/plugin-rest-cache/server/src/utils/keys/generateQueryParamsKey.js | 'use strict';
export const generateQueryParamsKey = function (
ctx,
useQueryParams = true // @todo: array or boolean => can be optimized
) {
let keys = [];
if (useQueryParams === true) {
keys = Object.keys(ctx.query);
} else if (useQueryParams.length > 0) {
keys = Object.keys(ctx.query).filter((key)... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/utils/keys/generateCacheKey.js | packages/plugin-rest-cache/server/src/utils/keys/generateCacheKey.js | 'use strict';
import { toLower } from 'lodash/fp';
import path from 'path';
import { generateHeadersKey } from './generateHeadersKey';
import { generateQueryParamsKey } from './generateQueryParamsKey';
export const generateCacheKey = function (
ctx,
keys = {
useQueryParams: false, // @todo: array or boolean =... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/utils/keys/generateHeadersKey.js | packages/plugin-rest-cache/server/src/utils/keys/generateHeadersKey.js | 'use strict';
export const generateHeadersKey = function (ctx, useHeaders = []) {
return useHeaders
.filter((k) => ctx.request.header[k.toLowerCase()] !== undefined)
.map((k) => `${k.toLowerCase()}=${ctx.request.header[k.toLowerCase()]}`) // headers are key insensitive
.join(',');
}
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/types/index.js | packages/plugin-rest-cache/server/src/types/index.js | 'use strict';
export { CachePluginStrategy } from './CachePluginStrategy';
export { CacheRouteConfig } from './CacheRouteConfig';
export { CacheProvider } from './CacheProvider';
export { CacheContentTypeConfig } from './CacheContentTypeConfig';
export { CacheKeysConfig } from './CacheKeysConfig';
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/types/CachePluginStrategy.js | packages/plugin-rest-cache/server/src/types/CachePluginStrategy.js | 'use strict';
/**
* @typedef {import('./CacheContentTypeConfig').CacheContentTypeConfig} CacheContentTypeConfig
*/
import { CacheKeysConfig } from './CacheKeysConfig';
export class CachePluginStrategy {
debug = false;
enableEtag = false;
enableXCacheHeaders = false;
enableAdminCTBMiddleware = true;
re... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/types/CacheRouteConfig.js | packages/plugin-rest-cache/server/src/types/CacheRouteConfig.js | 'use strict';
/**
* @typedef {(ctx: Context) => boolean} CachePluginHitpass
*/
import { CacheKeysConfig } from './CacheKeysConfig';
export class CacheRouteConfig {
maxAge = 3600000;
/**
* @type {string}
*/
path;
/**
* @type {'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'}
*/
method = 'GET';
... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/types/CacheProvider.js | packages/plugin-rest-cache/server/src/types/CacheProvider.js | 'use strict';
/* eslint-disable class-methods-use-this */
/* eslint-disable no-unused-vars */
/**
* Abstract Class CacheProvider.
*
* @class CacheProvider
*/
export class CacheProvider {
constructor() {
if (this.constructor === CacheProvider) {
throw new Error("CacheProvider class can't be instantiate... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/types/CacheKeysConfig.js | packages/plugin-rest-cache/server/src/types/CacheKeysConfig.js | 'use strict';
export class CacheKeysConfig {
/**
* @type {string[]}
*/
useHeaders = [];
/**
* @type {Boolean|string[]}
*/
useQueryParams = true;
constructor(options = {}) {
const { useHeaders = [], useQueryParams = true } = options;
this.useHeaders = useHeaders;
this.useQueryParams ... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/types/CacheContentTypeConfig.js | packages/plugin-rest-cache/server/src/types/CacheContentTypeConfig.js | 'use strict';
/**
* @typedef {import('./CacheRouteConfig').CacheRouteConfig} CacheRouteConfig
* @typedef {import('koa').Context} Context
* @typedef {(ctx: Context) => boolean} CachePluginHitpass
*/
import { CacheKeysConfig } from './CacheKeysConfig';
export class CacheContentTypeConfig {
singleType = false;
... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/middlewares/recv.js | packages/plugin-rest-cache/server/src/middlewares/recv.js | 'use strict';
/**
* @typedef {import('../types').CacheRouteConfig} CacheRouteConfig
*/
import chalk from 'chalk';
import debug from 'debug';
import { generateCacheKey } from '../utils/keys/generateCacheKey';
import { shouldLookup } from '../utils/middlewares/shouldLookup';
import { etagGenerate } from '../utils/et... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/middlewares/index.js | packages/plugin-rest-cache/server/src/middlewares/index.js | 'use strict';
import recv from './recv';
import purge from './purge';
import purgeAdmin from './purgeAdmin';
export default {
recv,
purge,
purgeAdmin,
};
| javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/middlewares/purge.js | packages/plugin-rest-cache/server/src/middlewares/purge.js | 'use strict';
/**
* @param {{ contentType: string }} options
* @param {{ strapi: import('@strapi/strapi').Strapi }} context
*/
export default function createPurge(options, { strapi }) {
if (!options.contentType) {
throw new Error(
'REST Cache: unable to initialize purge middleware: options.contentType ... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/middlewares/purgeAdmin.js | packages/plugin-rest-cache/server/src/middlewares/purgeAdmin.js | 'use strict';
/**
* @param {{ }} options
* @param {{ strapi: import('@strapi/strapi').Strapi }} context
*/
export default function createPurgeAdmin(options, { strapi }) {
const cacheConfig = strapi.plugin('rest-cache').service('cacheConfig');
const cacheStore = strapi.plugin('rest-cache').service('cacheStore')... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
strapi-community/plugin-rest-cache | https://github.com/strapi-community/plugin-rest-cache/blob/b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44/packages/plugin-rest-cache/server/src/config/index.js | packages/plugin-rest-cache/server/src/config/index.js | 'use strict';
export default {
default: () => ({
provider: {
name: 'memory',
getTimeout: 500,
options: {
maxSize: 32767,
},
},
strategy: {
debug: false,
enableEtag: false,
enableXCacheHeaders: false,
enableAdminCTBMiddleware: true,
resetOnStar... | javascript | MIT | b3a0ca3fb0443bdf6643b9aaf32f9dc1deca9f44 | 2026-01-05T03:37:20.067104Z | false |
zalmoxisus/remotedev | https://github.com/zalmoxisus/remotedev/blob/f8256d934316b37a94cd24870fc1d3efcbe7d0b9/webpack.config.production.js | webpack.config.production.js | 'use strict';
var webpack = require('webpack');
var baseConfig = require('./webpack.config.base');
var config = Object.create(baseConfig);
config.plugins = [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new webpack.optimiz... | javascript | MIT | f8256d934316b37a94cd24870fc1d3efcbe7d0b9 | 2026-01-05T03:37:24.491999Z | false |
zalmoxisus/remotedev | https://github.com/zalmoxisus/remotedev/blob/f8256d934316b37a94cd24870fc1d3efcbe7d0b9/webpack.config.development.js | webpack.config.development.js | 'use strict';
var webpack = require('webpack');
var baseConfig = require('./webpack.config.base');
var config = Object.create(baseConfig);
config.plugins = [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
})
];
module.exports = ... | javascript | MIT | f8256d934316b37a94cd24870fc1d3efcbe7d0b9 | 2026-01-05T03:37:24.491999Z | false |
zalmoxisus/remotedev | https://github.com/zalmoxisus/remotedev/blob/f8256d934316b37a94cd24870fc1d3efcbe7d0b9/webpack.config.base.js | webpack.config.base.js | 'use strict';
module.exports = {
module: {
loaders: [
{ test: /\.js$/, loaders: ['babel-loader'], exclude: /node_modules/ }
]
},
output: {
library: 'RemoteDev',
libraryTarget: 'umd'
},
resolve: {
extensions: ['', '.js']
}
}; | javascript | MIT | f8256d934316b37a94cd24870fc1d3efcbe7d0b9 | 2026-01-05T03:37:24.491999Z | false |
zalmoxisus/remotedev | https://github.com/zalmoxisus/remotedev/blob/f8256d934316b37a94cd24870fc1d3efcbe7d0b9/src/index.js | src/index.js | module.exports = require('./devTools');
| javascript | MIT | f8256d934316b37a94cd24870fc1d3efcbe7d0b9 | 2026-01-05T03:37:24.491999Z | false |
zalmoxisus/remotedev | https://github.com/zalmoxisus/remotedev/blob/f8256d934316b37a94cd24870fc1d3efcbe7d0b9/src/constants.js | src/constants.js | export const defaultSocketOptions = {
secure: true,
hostname: 'remotedev.io',
port: 443,
autoReconnect: true,
autoReconnectOptions: {
randomness: 60000
}
};
| javascript | MIT | f8256d934316b37a94cd24870fc1d3efcbe7d0b9 | 2026-01-05T03:37:24.491999Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.