Skip to content

Commit

Permalink
Freeze PAPI and the objects going into it (#706)
Browse files Browse the repository at this point in the history
  • Loading branch information
jolierabideau authored Jan 12, 2024
2 parents a1d26a9 + 0518d3d commit 4f18f59
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/extension-host/services/papi-backend.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,37 +80,55 @@ const papi = {
};
/* eslint-enable */

// The PAPI object should not change at this point
Object.freeze(papi);

export default papi;

// This is the destructured export, if you add to the PAPI you need to add to this

/** JSDOC DESTINATION PapiEventEmitter */
export const { EventEmitter } = papi;
Object.freeze(papi.EventEmitter);
/** JSDOC DESTINATION DataProviderEngine */
export const { DataProviderEngine } = papi;
Object.freeze(papi.DataProviderEngine);
/** This is just an alias for internet.fetch */
export const { fetch } = papi;
Object.freeze(papi.fetch);
/** JSDOC DESTINATION commandService */
export const { commands } = papi;
Object.freeze(papi.commands);
/** JSDOC DESTINATION papiUtil */
export const { utils } = papi;
Object.freeze(papi.utils);
/** JSDOC DESTINATION papiWebViewService */
export const { webViews } = papi;
Object.freeze(papi.webViews);
/** JSDOC DESTINATION papiWebViewProviderService */
export const { webViewProviders } = papi;
Object.freeze(papi.webViewProviders);
/** JSDOC DESTINATION dialogService */
export const { dialogs } = papi;
Object.freeze(papi.dialogs);
/** JSDOC DESTINATION papiNetworkService */
export const { network } = papi;
Object.freeze(papi.network);
/** JSDOC DESTINATION logger */
export const { logger } = papi;
Object.freeze(papi.logger);
/** JSDOC DESTINATION internetService */
export const { internet } = papi;
Object.freeze(papi.internet);
/** JSDOC DESTINATION dataProviderService */
export const { dataProviders } = papi;
Object.freeze(papi.dataProviders);
/** JSDOC DESTINATION papiBackendProjectDataProviderService */
export const { projectDataProviders } = papi;
Object.freeze(papi.projectDataProviders);
/** JSDOC DESTINATION projectLookupService */
export const { projectLookup } = papi;
Object.freeze(papi.projectLookup);
/** JSDOC DESTINATION extensionStorageService */
export const { storage } = papi;
Object.freeze(papi.storage);
19 changes: 19 additions & 0 deletions src/renderer/services/papi-frontend.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,41 +82,60 @@ const papi = {
};
/* eslint-enable */

// The PAPI object should not change at this point
Object.freeze(papi);

export default papi;

// If you add to the PAPI you need to add to this

/** JSDOC DESTINATION PapiEventEmitter */
export const { EventEmitter } = papi;
Object.freeze(papi.EventEmitter);
/** This is just an alias for internet.fetch */
export const { fetch } = papi;
Object.freeze(papi.fetch);
/** JSDOC DESTINATION PapiRendererWebSocket */
export const { WebSocket } = papi;
Object.freeze(papi.WebSocket);
/** JSDOC DESTINATION PapiRendererXMLHttpRequest */
export const { XMLHttpRequest } = papi;
Object.freeze(papi.XMLHttpRequest);
/** JSDOC DESTINATION commandService */
export const { commands } = papi;
Object.freeze(papi.commands);
/** JSDOC DESTINATION papiUtil */
export const { utils } = papi;
Object.freeze(papi.utils);
/** JSDOC DESTINATION papiWebViewService */
export const { webViews } = papi;
Object.freeze(papi.webViews);
/** JSDOC DESTINATION dialogService */
export const { dialogs } = papi;
Object.freeze(papi.dialogs);
/** JSDOC DESTINATION papiNetworkService */
export const { network } = papi;
Object.freeze(papi.network);
/** JSDOC DESTINATION logger */
export const { logger } = papi;
Object.freeze(papi.logger);
/** JSDOC DESTINATION internetService */
export const { internet } = papi;
Object.freeze(papi.internet);
/** JSDOC DESTINATION dataProviderService */
export const { dataProviders } = papi;
Object.freeze(papi.dataProviders);
/** JSDOC DESTINATION papiBackendProjectDataProviderService */
export const { projectDataProviders } = papi;
Object.freeze(papi.projectDataProviders);
/** JSDOC DESTINATION projectLookupService */
export const { projectLookup } = papi;
Object.freeze(papi.projectLookup);
/** JSDOC DESTINATION papiReact */
export const { react } = papi;
Object.freeze(papi.react);
/** JSDOC DESTINATION settingsService */
export const { settings } = papi;
Object.freeze(papi.settings);

export type Papi = typeof papi;

0 comments on commit 4f18f59

Please sign in to comment.