How to use ghost-storage-base - 2 common examples

To help you get started, we’ve selected a few ghost-storage-base examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github chadly / ghost / core / server / adapters / storage / index.js View on Github external
throw new common.errors.IncorrectUsageError({
                err: err,
                context: 'We cannot find your adapter in: ' + config.getContentPath('storage') + ' or: ' + config.get('paths').internalStoragePath
            });
        } else {
            throw new common.errors.IncorrectUsageError({
                message: 'We have detected an error in your custom storage adapter.',
                err: err
            });
        }
    }

    customStorage = new CustomStorage(storageConfig);

    // CASE: if multiple StorageBase modules are installed, instanceof could return false
    if (Object.getPrototypeOf(CustomStorage).name !== StorageBase.name) {
        throw new common.errors.IncorrectUsageError({
            message: 'Your storage adapter does not inherit from the Storage Base.'
        });
    }

    if (!customStorage.requiredFns) {
        throw new common.errors.IncorrectUsageError({
            message: 'Your storage adapter does not provide the minimum required functions.'
        });
    }

    if (_.xor(customStorage.requiredFns, Object.keys(_.pick(Object.getPrototypeOf(customStorage), customStorage.requiredFns))).length) {
        throw new common.errors.IncorrectUsageError({
            message: 'Your storage adapter does not provide the minimum required functions.'
        });
    }
github TryGhost / Ghost / core / server / adapters / storage / index.js View on Github external
throw new common.errors.IncorrectUsageError({
                err,
                context: `We cannot find your adapter in: ${config.getContentPath('storage')} or: ${config.get('paths').internalStoragePath}`
            });
        } else {
            throw new common.errors.IncorrectUsageError({
                message: 'We have detected an error in your custom storage adapter.',
                err
            });
        }
    }

    customStorage = new CustomStorage(storageConfig);

    // CASE: if multiple StorageBase modules are installed, instanceof could return false
    if (Object.getPrototypeOf(CustomStorage).name !== StorageBase.name) {
        throw new common.errors.IncorrectUsageError({
            message: 'Your storage adapter does not inherit from the Storage Base.'
        });
    }

    if (!customStorage.requiredFns) {
        throw new common.errors.IncorrectUsageError({
            message: 'Your storage adapter does not provide the minimum required functions.'
        });
    }

    if (_.xor(customStorage.requiredFns, Object.keys(_.pick(Object.getPrototypeOf(customStorage), customStorage.requiredFns))).length) {
        throw new common.errors.IncorrectUsageError({
            message: 'Your storage adapter does not provide the minimum required functions.'
        });
    }

ghost-storage-base

Base storage adapter.

MIT
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis

Popular ghost-storage-base functions