Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion oclif.manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "5.21.0",
"version": "5.21.1",
"commands": {
"authCommand": {
"id": "authCommand",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@
}
},
"scripts": {
"build": "shx rm -rf dist && tsc -b && oclif manifest && oclif readme --multi",
"build": "shx rm -rf dist && tsc -b && oclif manifest",
"build:tar": "oclif pack tarballs",
"format": "prettier --write \"src/**/*.{ts,js,json}\" \"test/**/*.{ts,js,json}\" \"test-utils/**/*.{ts,js,json}\" \"*.{ts,js,json,md}\"",
"format:check": "prettier --check \"src/**/*.{ts,js,json}\" \"test/**/*.{ts,js,json}\" \"test-utils/**/*.{ts,js,json}\" \"*.{ts,js,json,md}\"",
"lint": "eslint . --config eslint.config.mjs",
"postpack": "shx rm -f oclif.manifest.json",
"posttest": "yarn lint",
"prepack": "yarn build && oclif manifest && oclif readme --multi",
"prepack": "yarn build && oclif readme --multi",
"pretest": "yarn format:check",
"test": "mocha test/*.ts \"src/**/*.test.ts\"",
"test:ci": "yarn test --forbid-only",
Expand Down
30 changes: 28 additions & 2 deletions src/api/zodClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,35 @@ const AllFilter = z.object({ type: z.literal('all').default('all') })
const OptInFilter = z.object({ type: z.literal('optIn').default('optIn') })
const UserFilter = z.object({
subType: z.enum(['user_id', 'email', 'platform', 'deviceModel']),
comparator: z.enum(['=', '!=', 'exist', '!exist', 'contain', '!contain']),
comparator: z.enum([
'=',
'!=',
'exist',
'!exist',
'contain',
'!contain',
'startWith',
'!startWith',
'endWith',
'!endWith',
]),
values: z.array(z.string()).optional(),
type: z.literal('user').default('user'),
})
const UserCountryFilter = z.object({
subType: z.literal('country').default('country'),
comparator: z.enum(['=', '!=', 'exist', '!exist', 'contain', '!contain']),
comparator: z.enum([
'=',
'!=',
'exist',
'!exist',
'contain',
'!contain',
'startWith',
'!startWith',
'endWith',
'!endWith',
]),
values: z.array(z.string()),
type: z.literal('user').default('user'),
})
Expand Down Expand Up @@ -222,6 +244,10 @@ const UserCustomFilter = z.object({
'!exist',
'contain',
'!contain',
'startWith',
'!startWith',
'endWith',
'!endWith',
]),
dataKey: z.string().min(1),
dataKeyType: z.enum(['String', 'Boolean', 'Number']),
Expand Down
2 changes: 1 addition & 1 deletion src/commands/generate/types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { BASE_URL } from '../../api/common'
import { dvcTest, setCurrentTestFile } from '../../../test-utils'
import { jestSnapshotPlugin } from 'mocha-chai-jest-snapshot'
import * as fs from 'fs'
import chai from 'chai'
import * as chai from 'chai'
import Nock, { Body, ReplyHeaders } from 'nock'

const mockVariablesResponse = [
Expand Down
2 changes: 1 addition & 1 deletion src/commands/targeting/update.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from '@oclif/test'
import { dvcTest, setCurrentTestFile } from '../../../test-utils'
import { BASE_URL } from '../../api/common'
import { jestSnapshotPlugin } from 'mocha-chai-jest-snapshot'
import chai from 'chai'
import * as chai from 'chai'
import inquirer from 'inquirer'

describe('targeting update', () => {
Expand Down
17 changes: 16 additions & 1 deletion src/ui/prompts/targetingPrompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,22 @@ export const comparatorChoices = (input: Record<string, any>) => {
} else if (input.subType === 'audienceMatch') {
return ['=', '!=']
}
return ['=', '!=', 'exist', '!exist', 'contain', '!contain']
return [
'=',
'!=',
'>',
'>=',
'<',
'<=',
'exist',
'!exist',
'contain',
'!contain',
'startWith',
'!startWith',
'endWith',
'!endWith',
]
}

export const targetingStatusPrompt = {
Expand Down
12 changes: 8 additions & 4 deletions src/ui/targetingTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,18 @@ const subTypeMap = {
const comparatorMap = {
'=': 'is',
'!=': 'is not',
contain: 'contains',
'!contain': 'does not contain',
exist: 'exists',
'!exist': 'does not exist',
'>': 'is greater than',
'>=': 'is greater than or equal to',
'<': 'is less than',
'<=': 'is less than or equal to',
contain: 'contains',
'!contain': 'does not contain',
startWith: 'starts with',
'!startWith': 'does not start with',
endWith: 'ends with',
'!endWith': 'does not end with',
exist: 'exists',
'!exist': 'does not exist',
}

export const renderTargetingTree = (
Expand Down