mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 21:07:28 -08:00
refactor: Extract ISOCountryCodes into a single place (no-changelog) (#9947)
This commit is contained in:
parent
908ddd8a24
commit
ddfb240694
|
@ -1,6 +1,6 @@
|
||||||
import type { INodeProperties } from 'n8n-workflow';
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
|
|
||||||
import { isoCountryCodes } from '../utils/isoCountryCodes';
|
import { isoCountryCodes } from '@utils/ISOCountryCodes';
|
||||||
|
|
||||||
import { addressFixedCollection, phoneNumbersFixedCollection } from '../utils/sharedFields';
|
import { addressFixedCollection, phoneNumbersFixedCollection } from '../utils/sharedFields';
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -22,7 +22,7 @@ import { videoFields, videoOperations } from './VideoDescription';
|
||||||
|
|
||||||
import { videoCategoryFields, videoCategoryOperations } from './VideoCategoryDescription';
|
import { videoCategoryFields, videoCategoryOperations } from './VideoCategoryDescription';
|
||||||
|
|
||||||
import { countriesCodes } from './CountryCodes';
|
import { isoCountryCodes } from '@utils/ISOCountryCodes';
|
||||||
|
|
||||||
const UPLOAD_CHUNK_SIZE = 1024 * 1024;
|
const UPLOAD_CHUNK_SIZE = 1024 * 1024;
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ export class YouTube implements INodeType {
|
||||||
// select them easily
|
// select them easily
|
||||||
async getCountriesCodes(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
async getCountriesCodes(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||||
const returnData: INodePropertyOptions[] = [];
|
const returnData: INodePropertyOptions[] = [];
|
||||||
for (const countryCode of countriesCodes) {
|
for (const countryCode of isoCountryCodes) {
|
||||||
const countryCodeName = `${countryCode.name} - ${countryCode.alpha2}`;
|
const countryCodeName = `${countryCode.name} - ${countryCode.alpha2}`;
|
||||||
const countryCodeId = countryCode.alpha2;
|
const countryCodeId = countryCode.alpha2;
|
||||||
returnData.push({
|
returnData.push({
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -10,7 +10,7 @@ import type {
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { NodeOperationError } from 'n8n-workflow';
|
import { NodeOperationError } from 'n8n-workflow';
|
||||||
|
|
||||||
import { countriesCodes } from './CountriesCodes';
|
import { isoCountryCodes } from '@utils/ISOCountryCodes';
|
||||||
|
|
||||||
import { conversationFields, conversationOperations } from './ConversationDescription';
|
import { conversationFields, conversationOperations } from './ConversationDescription';
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ export class HelpScout implements INodeType {
|
||||||
// select them easily
|
// select them easily
|
||||||
async getCountriesCodes(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
async getCountriesCodes(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||||
const returnData: INodePropertyOptions[] = [];
|
const returnData: INodePropertyOptions[] = [];
|
||||||
for (const countryCode of countriesCodes) {
|
for (const countryCode of isoCountryCodes) {
|
||||||
const countryCodeName = `${countryCode.name} - ${countryCode.alpha2}`;
|
const countryCodeName = `${countryCode.name} - ${countryCode.alpha2}`;
|
||||||
const countryCodeId = countryCode.alpha2;
|
const countryCodeId = countryCode.alpha2;
|
||||||
returnData.push({
|
returnData.push({
|
||||||
|
|
|
@ -16,7 +16,7 @@ import { invoiceFields, invoiceOperations } from './InvoiceDescription';
|
||||||
|
|
||||||
import type { IClient, IContact } from './ClientInterface';
|
import type { IClient, IContact } from './ClientInterface';
|
||||||
|
|
||||||
import { countryCodes } from './ISOCountryCodes';
|
import { isoCountryCodes } from '@utils/ISOCountryCodes';
|
||||||
|
|
||||||
import type { IInvoice, IItem } from './invoiceInterface';
|
import type { IInvoice, IItem } from './invoiceInterface';
|
||||||
|
|
||||||
|
@ -210,9 +210,9 @@ export class InvoiceNinja implements INodeType {
|
||||||
// select them easily
|
// select them easily
|
||||||
async getCountryCodes(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
async getCountryCodes(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||||
const returnData: INodePropertyOptions[] = [];
|
const returnData: INodePropertyOptions[] = [];
|
||||||
for (let i = 0; i < countryCodes.length; i++) {
|
for (let i = 0; i < isoCountryCodes.length; i++) {
|
||||||
const countryName = countryCodes[i].name as string;
|
const countryName = isoCountryCodes[i].name;
|
||||||
const countryId = countryCodes[i].numeric as string;
|
const countryId = isoCountryCodes[i].numeric;
|
||||||
returnData.push({
|
returnData.push({
|
||||||
name: countryName,
|
name: countryName,
|
||||||
value: countryId,
|
value: countryId,
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -9,7 +9,7 @@ import type {
|
||||||
|
|
||||||
import { spotifyApiRequest, spotifyApiRequestAllItems } from './GenericFunctions';
|
import { spotifyApiRequest, spotifyApiRequestAllItems } from './GenericFunctions';
|
||||||
|
|
||||||
import { isoCountryCodes } from './IsoCountryCodes';
|
import { isoCountryCodes } from '@utils/ISOCountryCodes';
|
||||||
|
|
||||||
export class Spotify implements INodeType {
|
export class Spotify implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,6 +1,13 @@
|
||||||
import type { IDataObject } from 'n8n-workflow';
|
export interface ISOCountryCode {
|
||||||
|
name: string;
|
||||||
|
alpha2: string;
|
||||||
|
alpha3: string;
|
||||||
|
numeric: `${number}`;
|
||||||
|
altName?: string;
|
||||||
|
shortName?: string;
|
||||||
|
}
|
||||||
|
|
||||||
export const countryCodes = [
|
export const isoCountryCodes: ISOCountryCode[] = [
|
||||||
{
|
{
|
||||||
name: 'Afghanistan',
|
name: 'Afghanistan',
|
||||||
alpha2: 'AF',
|
alpha2: 'AF',
|
||||||
|
@ -1578,4 +1585,4 @@ export const countryCodes = [
|
||||||
alpha3: 'ZWE',
|
alpha3: 'ZWE',
|
||||||
numeric: '716',
|
numeric: '716',
|
||||||
},
|
},
|
||||||
] as IDataObject[];
|
];
|
Loading…
Reference in a new issue