Skip to content

Commit

Permalink
Merge pull request #1341 from assemblee-virtuelle/rename-pod-service-…
Browse files Browse the repository at this point in the history
…to-storage-service

Rename PodService to StorageService
  • Loading branch information
srosset81 authored Dec 17, 2024
2 parents 87278e3 + ffac670 commit 7171af6
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/middleware/packages/auth/mixins/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ const AuthMixin = {
const baseUrlTrailing = urlJoin(this.settings.baseUrl, '/');
webId = webId || baseUrlTrailing + username;

const podUrl = await ctx.call('pod.getUrl', { webId });
const podUrl = await ctx.call('solid-storage.getUrl', { webId });

// Check if capabilityUri is within the resource owner's pod
if (!webId?.startsWith(baseUrlTrailing) || !capabilityUri?.startsWith(podUrl)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = {

if (this.settings.podProvider && !webId) throw new Error(`The webId param is required in Pod provider config`);
const rootContainerUri = this.settings.podProvider
? await ctx.call('pod.getUrl', { webId })
? await ctx.call('solid-storage.getUrl', { webId })
: urlJoin(this.settings.baseUrl, '/');

const containerPath = containerUri.replace(rootContainerUri, '/');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = {
const { path, webId } = ctx.params;

if (this.settings.podProvider) {
const podUrl = await ctx.call('pod.getUrl', { webId });
const podUrl = await ctx.call('solid-storage.getUrl', { webId });
return urlJoin(podUrl, path);
} else {
return urlJoin(this.settings.baseUrl, path);
Expand Down
2 changes: 1 addition & 1 deletion src/middleware/packages/ldp/services/registry/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module.exports = {
const { webId, accountData } = ctx.params;
// We want to add user's containers only in Pod provider config
if (this.settings.podProvider) {
const podUrl = await ctx.call('pod.getUrl', { webId });
const podUrl = await ctx.call('solid-storage.getUrl', { webId });
const registeredContainers = await this.actions.list({ dataset: accountData.username }, { parentCtx: ctx });
// Go through each registered containers
for (const container of Object.values(registeredContainers)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = {
if ((!this.settings.resourcesWithContainerPath || !containerUri) && !isContainer) {
// Use the root container URI
containerUri = this.settings.podProvider
? await ctx.call('pod.getUrl', { webId: urlJoin(this.settings.baseUrl, ctx.meta.dataset) })
? await ctx.call('solid-storage.getUrl', { webId: urlJoin(this.settings.baseUrl, ctx.meta.dataset) })
: this.settings.baseUrl;
}

Expand Down
2 changes: 1 addition & 1 deletion src/middleware/packages/solid/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
PodService: require('./services/pod'),
StorageService: require('./services/storage'),
NotificationsProviderService: require('./services/notifications/provider'),
NotificationsListenerService: require('./services/notifications/listener'),
TypeIndexesService: require('./services/type-index/type-indexes')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = {
}
}
},
dependencies: ['api', 'pod'],
dependencies: ['api'],
async created() {
if (!this.settings.baseUrl) throw new Error('The baseUrl setting is required');
if (this.settings.sendOrReceive !== 'receive' && this.settings.sendOrReceive !== 'send')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ const { pim } = require('@semapps/ontologies');

/** @type {import('moleculer').ServiceSchema} */
module.exports = {
name: 'pod',
name: 'solid-storage',
settings: {
baseUrl: null,
pathName: 'data'
},
dependencies: ['ontologies', 'ldp.registry'],
async started() {
if (!this.settings.baseUrl) throw new Error('The baseUrl setting of the pod service is required');
if (!this.settings.baseUrl) throw new Error('The baseUrl setting of the solid-storage service is required');

await this.broker.call('ontologies.register', pim);

Expand All @@ -27,7 +27,7 @@ module.exports = {
actions: {
async create(ctx) {
const { username } = ctx.params;
if (!username) throw new Error('Cannot create pod without a username');
if (!username) throw new Error('Cannot create Solid storage without a username');

await ctx.call('triplestore.dataset.create', {
dataset: username,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ module.exports = {
const accounts = await ctx.call('auth.account.find');
for (const { webId } of accounts) {
this.logger.info(`Migrating ${webId}...`);
const podUrl = await ctx.call('pod.getUrl', { webId });
const podUrl = await ctx.call('solid-storage.getUrl', { webId });
await this.actions.createAndAttachToWebId({ webId }, { parentCtx: ctx });

// Go through each registered container and persist them
Expand Down Expand Up @@ -122,7 +122,7 @@ module.exports = {
// Go through each registered container
for (const container of Object.values(registeredContainers)) {
if (container.podsContainer !== true) {
const podUrl = await ctx.call('pod.getUrl', { webId });
const podUrl = await ctx.call('solid-storage.getUrl', { webId });
const containerUri = urlJoin(podUrl, container.path);
for (const type of arrayOf(container.acceptedTypes)) {
this.logger.info(`Registering ${containerUri} with type ${type}...`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ module.exports = {
const registeredContainers = await ctx.call('ldp.registry.list');
// Go through each Pod
for (const { webId } of accounts) {
const podUrl = await ctx.call('pod.getUrl', { webId });
const podUrl = await ctx.call('solid-storage.getUrl', { webId });
// Go through each registered container
for (const container of Object.values(registeredContainers)) {
if (container.podsContainer !== true) {
Expand Down

0 comments on commit 7171af6

Please sign in to comment.