Skip to content

Commit

Permalink
chore(node20): upgrade to node 20
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerald Baulig committed Oct 12, 2023
1 parent 2f451ae commit 3036a75
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Setup NodeJS
uses: actions/setup-node@v1
with:
node-version: '18.2.0'
node-version: '20.8.0'

- name: Install Dependencies
run: npm ci
Expand All @@ -30,7 +30,7 @@ jobs:
- name: Setup NodeJS
uses: actions/setup-node@v1
with:
node-version: '18.2.0'
node-version: '20.8.0'

- name: Setup System
uses: restorecommerce/setup-system-action@v1
Expand Down
15 changes: 14 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"tsctests": "tsc -d -p tsconfig.test.json"
},
"engines": {
"node": ">= 16.0.0"
"node": ">= 18.0.0"
},
"config": {
"commitizen": {
Expand Down
22 changes: 11 additions & 11 deletions src/experimental/access_control_decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,20 @@ export function access_controlled_service<T extends { new (...args: any): {} }>(
}

export function access_controlled_function(kwargs: {
action: AuthZAction,
operation: Operation,
context?: ACSClientContext | ACSClientContextFactory,
resource?: Resource[] | ResourceFactory,
database?: 'arangoDB' | 'postgres',
useCache?: true
action: AuthZAction;
operation: Operation;
context?: ACSClientContext | ACSClientContextFactory;
resource?: Resource[] | ResourceFactory;
database?: 'arangoDB' | 'postgres';
useCache?: true;
}) {
return function (
target: any,
propertyName: string,
descriptor: TypedPropertyDescriptor<any>,
) {
const method = descriptor.value!;

descriptor.value = async function () {
try {
if (!this.user_service) {
Expand All @@ -75,7 +75,7 @@ export function access_controlled_function(kwargs: {
const resource = typeof(kwargs.resource) === 'function'
? await kwargs.resource(this, ...arguments)
: kwargs.resource;

const subject = context?.subject;
if (subject?.token) {
const user = await this.user_service.findByToken({ token: subject.token });
Expand All @@ -93,7 +93,7 @@ export function access_controlled_function(kwargs: {
kwargs.database ?? 'arangoDB',
kwargs.useCache ?? false
);
console.log(response?.decision);

if (response?.decision !== Response_Decision.PERMIT) {
return response;
}
Expand All @@ -105,11 +105,11 @@ export function access_controlled_function(kwargs: {
code: err.code ?? 500,
message: err.details ?? err.message ?? err,
}
}
};
}
return await method.apply(this, arguments);
};
}
};
}

export const DefaultACSClientContextFactory: ACSClientContextFactory = (
Expand Down
13 changes: 7 additions & 6 deletions src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
OrderIdList,
OrderListResponse,
OrderServiceImplementation,
OrderInvoiceRequestList,
OrderingInvoiceRequestList,
FulfillmentInvoiceMode,
} from '@restorecommerce/rc-grpc-clients/dist/generated-server/io/restorecommerce/order';
import {
Expand Down Expand Up @@ -67,6 +67,7 @@ import {
FulfillmentResponse,
FulfillmentList,
Packaging,
Parcel,
} from '@restorecommerce/rc-grpc-clients/dist/generated-server/io/restorecommerce/fulfillment';
import {
FulfillmentProductServiceDefinition,
Expand Down Expand Up @@ -155,7 +156,7 @@ export class OrderingService
subject: request.subject,
resources,
};
}
}

private readonly status_codes: { [key: string]: Status } = {
OK: {
Expand Down Expand Up @@ -1695,7 +1696,7 @@ export class OrderingService
}

private async toInvoiceResponsePrototypes(
request: OrderInvoiceRequestList,
request: OrderingInvoiceRequestList,
context?: any,
): Promise<InvoiceResponse[]> {
const order_map = await this.getOrderMap(
Expand Down Expand Up @@ -1799,7 +1800,7 @@ export class OrderingService
})
);

const fulfillment_items = Object.values((
const fulfillment_items: Parcel[] = Object.values((
section.fulfillment_mode === FulfillmentInvoiceMode.INCLUDE && (
section.selected_fulfillments?.flatMap(
selection => fulfillment_map[section.order_id].find(
Expand Down Expand Up @@ -1892,7 +1893,7 @@ export class OrderingService
useCache: true,
})
public async createInvoice(
request: OrderInvoiceRequestList,
request: OrderingInvoiceRequestList,
context?: any,
): Promise<InvoiceListResponse> {
try {
Expand Down Expand Up @@ -1946,7 +1947,7 @@ export class OrderingService
useCache: true,
})
public async triggerInvoice(
request: OrderInvoiceRequestList,
request: OrderingInvoiceRequestList,
context?: any,
): Promise<StatusListResponse> {
return null;
Expand Down

0 comments on commit 3036a75

Please sign in to comment.