diff --git a/.changeset/short-brooms-move.md b/.changeset/short-brooms-move.md new file mode 100644 index 0000000000..527b0442d8 --- /dev/null +++ b/.changeset/short-brooms-move.md @@ -0,0 +1,5 @@ +--- +"@shopify/shopify-app-remix": patch +--- + +Make `authenticate.webhook` return type's `payload` field more flexible, so apps aren't required to cast every value. diff --git a/packages/shopify-app-remix/docs/generated/generated_docs_data.json b/packages/shopify-app-remix/docs/generated/generated_docs_data.json index f7205612cf..901dc80e8a 100644 --- a/packages/shopify-app-remix/docs/generated/generated_docs_data.json +++ b/packages/shopify-app-remix/docs/generated/generated_docs_data.json @@ -4596,7 +4596,7 @@ "filePath": "src/server/authenticate/webhooks/types.ts", "syntaxKind": "PropertySignature", "name": "payload", - "value": "JSONValue", + "value": "Record", "description": "The payload from the webhook request.", "examples": [ { @@ -4634,279 +4634,6 @@ ], "value": "export interface WebhookContextWithoutSession\n extends Context {\n session: undefined;\n admin: undefined;\n}" }, - "JSONValue": { - "filePath": "src/server/types.ts", - "syntaxKind": "TypeAliasDeclaration", - "name": "JSONValue", - "value": "string | number | boolean | null | JSONObject | JSONArray", - "description": "" - }, - "JSONObject": { - "filePath": "src/server/types.ts", - "name": "JSONObject", - "description": "", - "members": [ - { - "filePath": "src/server/types.ts", - "name": "[x: string]", - "value": "JSONValue" - } - ], - "value": "interface JSONObject {\n [x: string]: JSONValue;\n}" - }, - "JSONArray": { - "filePath": "src/server/types.ts", - "name": "JSONArray", - "description": "", - "members": [ - { - "filePath": "src/server/types.ts", - "syntaxKind": "PropertySignature", - "name": "length", - "value": "number", - "description": "Gets or sets the length of the array. This is a number one higher than the highest index in the array." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "toString", - "value": "() => string", - "description": "Returns a string representation of an array." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "toLocaleString", - "value": "() => string", - "description": "Returns a string representation of an array. The elements are converted to string using their toLocaleString methods." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "pop", - "value": "() => JSONValue", - "description": "Removes the last element from an array and returns it. If the array is empty, undefined is returned and the array is not modified." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "push", - "value": "(...items: JSONValue[]) => number", - "description": "Appends new elements to the end of an array, and returns the new length of the array." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "concat", - "value": "{ (...items: ConcatArray[]): JSONValue[]; (...items: (JSONValue | ConcatArray)[]): JSONValue[]; }", - "description": "Combines two or more arrays. This method returns a new array without modifying any existing arrays." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "join", - "value": "(separator?: string) => string", - "description": "Adds all the elements of an array into a string, separated by the specified separator string." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "reverse", - "value": "() => JSONValue[]", - "description": "Reverses the elements in an array in place. This method mutates the array and returns a reference to the same array." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "shift", - "value": "() => JSONValue", - "description": "Removes the first element from an array and returns it. If the array is empty, undefined is returned and the array is not modified." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "slice", - "value": "(start?: number, end?: number) => JSONValue[]", - "description": "Returns a copy of a section of an array. For both start and end, a negative index can be used to indicate an offset from the end of the array. For example, -2 refers to the second to last element of the array." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "sort", - "value": "(compareFn?: (a: JSONValue, b: JSONValue) => number) => JSONArray", - "description": "Sorts an array in place. This method mutates the array and returns a reference to the same array." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "splice", - "value": "{ (start: number, deleteCount?: number): JSONValue[]; (start: number, deleteCount: number, ...items: JSONValue[]): JSONValue[]; }", - "description": "Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "unshift", - "value": "(...items: JSONValue[]) => number", - "description": "Inserts new elements at the start of an array, and returns the new length of the array." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "indexOf", - "value": "(searchElement: JSONValue, fromIndex?: number) => number", - "description": "Returns the index of the first occurrence of a value in an array, or -1 if it is not present." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "lastIndexOf", - "value": "(searchElement: JSONValue, fromIndex?: number) => number", - "description": "Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "every", - "value": "{ (predicate: (value: JSONValue, index: number, array: JSONValue[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: JSONValue, index: number, array: JSONValue[]) => unknown, thisArg?: any): boolean; }", - "description": "Determines whether all the members of an array satisfy the specified test." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "some", - "value": "(predicate: (value: JSONValue, index: number, array: JSONValue[]) => unknown, thisArg?: any) => boolean", - "description": "Determines whether the specified callback function returns true for any element of an array." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "forEach", - "value": "(callbackfn: (value: JSONValue, index: number, array: JSONValue[]) => void, thisArg?: any) => void", - "description": "Performs the specified action for each element in an array." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "map", - "value": "(callbackfn: (value: JSONValue, index: number, array: JSONValue[]) => U, thisArg?: any) => U[]", - "description": "Calls a defined callback function on each element of an array, and returns an array that contains the results." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "filter", - "value": "{ (predicate: (value: JSONValue, index: number, array: JSONValue[]) => value is S, thisArg?: any): S[]; (predicate: (value: JSONValue, index: number, array: JSONValue[]) => unknown, thisArg?: any): JSONValue[]; }", - "description": "Returns the elements of an array that meet the condition specified in a callback function." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "reduce", - "value": "{ (callbackfn: (previousValue: JSONValue, currentValue: JSONValue, currentIndex: number, array: JSONValue[]) => JSONValue): JSONValue; (callbackfn: (previousValue: JSONValue, currentValue: JSONValue, currentIndex: number, array: JSONValue[]) => JSONValue, initialValue: JSONValue): JSONValue; (callbackfn: (previousValue: U, currentValue: JSONValue, currentIndex: number, array: JSONValue[]) => U, initialValue: U): U; }", - "description": "Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "reduceRight", - "value": "{ (callbackfn: (previousValue: JSONValue, currentValue: JSONValue, currentIndex: number, array: JSONValue[]) => JSONValue): JSONValue; (callbackfn: (previousValue: JSONValue, currentValue: JSONValue, currentIndex: number, array: JSONValue[]) => JSONValue, initialValue: JSONValue): JSONValue; (callbackfn: (previousValue: U, currentValue: JSONValue, currentIndex: number, array: JSONValue[]) => U, initialValue: U): U; }", - "description": "Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "find", - "value": "{ (predicate: (value: JSONValue, index: number, obj: JSONValue[]) => value is S, thisArg?: any): S; (predicate: (value: JSONValue, index: number, obj: JSONValue[]) => unknown, thisArg?: any): JSONValue; }", - "description": "Returns the value of the first element in the array where predicate is true, and undefined otherwise." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "findIndex", - "value": "(predicate: (value: JSONValue, index: number, obj: JSONValue[]) => unknown, thisArg?: any) => number", - "description": "Returns the index of the first element in the array where predicate is true, and -1 otherwise." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "fill", - "value": "(value: JSONValue, start?: number, end?: number) => JSONArray", - "description": "Changes all array elements from `start` to `end` index to a static `value` and returns the modified array" - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "copyWithin", - "value": "(target: number, start: number, end?: number) => JSONArray", - "description": "Returns the this object after copying a section of the array identified by start and end to the same array starting at position target" - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "entries", - "value": "() => IterableIterator<[number, JSONValue]>", - "description": "Returns an iterable of key, value pairs for every entry in the array" - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "keys", - "value": "() => IterableIterator", - "description": "Returns an iterable of keys in the array" - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "values", - "value": "() => IterableIterator", - "description": "Returns an iterable of values in the array" - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "includes", - "value": "(searchElement: JSONValue, fromIndex?: number) => boolean", - "description": "Determines whether an array includes a certain element, returning true or false as appropriate." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "flatMap", - "value": "(callback: (this: This, value: JSONValue, index: number, array: JSONValue[]) => U | readonly U[], thisArg?: This) => U[]", - "description": "Calls a defined callback function on each element of an array. Then, flattens the result into a new array. This is identical to a map followed by flat with depth 1." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "flat", - "value": "(this: A, depth?: D) => FlatArray[]", - "description": "Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "__@iterator@176", - "value": "() => IterableIterator", - "description": "Iterator" - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "PropertySignature", - "name": "__@unscopables@178", - "value": "{ [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; at?: boolean; }", - "description": "Is an object whose properties have the value 'true' when they will be absent when used in a 'with' statement." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "at", - "value": "(index: number) => JSONValue", - "description": "Takes an integer value and returns the item at that index, allowing for positive and negative integers. Negative integers count back from the last item in the array." - } - ], - "value": "interface JSONArray extends Array {}" - }, "WebhookContextWithSession": { "filePath": "src/server/authenticate/webhooks/types.ts", "name": "WebhookContextWithSession", @@ -5028,7 +4755,7 @@ "filePath": "src/server/authenticate/webhooks/types.ts", "syntaxKind": "PropertySignature", "name": "payload", - "value": "JSONValue", + "value": "Record", "description": "The payload from the webhook request.", "examples": [ { @@ -13316,7 +13043,7 @@ "filePath": "src/server/authenticate/webhooks/types.ts", "syntaxKind": "PropertySignature", "name": "payload", - "value": "JSONValue", + "value": "Record", "description": "The payload from the webhook request.", "examples": [ { @@ -13354,279 +13081,6 @@ ], "value": "export interface WebhookContextWithoutSession\n extends Context {\n session: undefined;\n admin: undefined;\n}" }, - "JSONValue": { - "filePath": "src/server/types.ts", - "syntaxKind": "TypeAliasDeclaration", - "name": "JSONValue", - "value": "string | number | boolean | null | JSONObject | JSONArray", - "description": "" - }, - "JSONObject": { - "filePath": "src/server/types.ts", - "name": "JSONObject", - "description": "", - "members": [ - { - "filePath": "src/server/types.ts", - "name": "[x: string]", - "value": "JSONValue" - } - ], - "value": "interface JSONObject {\n [x: string]: JSONValue;\n}" - }, - "JSONArray": { - "filePath": "src/server/types.ts", - "name": "JSONArray", - "description": "", - "members": [ - { - "filePath": "src/server/types.ts", - "syntaxKind": "PropertySignature", - "name": "length", - "value": "number", - "description": "Gets or sets the length of the array. This is a number one higher than the highest index in the array." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "toString", - "value": "() => string", - "description": "Returns a string representation of an array." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "toLocaleString", - "value": "() => string", - "description": "Returns a string representation of an array. The elements are converted to string using their toLocaleString methods." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "pop", - "value": "() => JSONValue", - "description": "Removes the last element from an array and returns it. If the array is empty, undefined is returned and the array is not modified." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "push", - "value": "(...items: JSONValue[]) => number", - "description": "Appends new elements to the end of an array, and returns the new length of the array." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "concat", - "value": "{ (...items: ConcatArray[]): JSONValue[]; (...items: (JSONValue | ConcatArray)[]): JSONValue[]; }", - "description": "Combines two or more arrays. This method returns a new array without modifying any existing arrays." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "join", - "value": "(separator?: string) => string", - "description": "Adds all the elements of an array into a string, separated by the specified separator string." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "reverse", - "value": "() => JSONValue[]", - "description": "Reverses the elements in an array in place. This method mutates the array and returns a reference to the same array." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "shift", - "value": "() => JSONValue", - "description": "Removes the first element from an array and returns it. If the array is empty, undefined is returned and the array is not modified." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "slice", - "value": "(start?: number, end?: number) => JSONValue[]", - "description": "Returns a copy of a section of an array. For both start and end, a negative index can be used to indicate an offset from the end of the array. For example, -2 refers to the second to last element of the array." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "sort", - "value": "(compareFn?: (a: JSONValue, b: JSONValue) => number) => JSONArray", - "description": "Sorts an array in place. This method mutates the array and returns a reference to the same array." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "splice", - "value": "{ (start: number, deleteCount?: number): JSONValue[]; (start: number, deleteCount: number, ...items: JSONValue[]): JSONValue[]; }", - "description": "Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "unshift", - "value": "(...items: JSONValue[]) => number", - "description": "Inserts new elements at the start of an array, and returns the new length of the array." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "indexOf", - "value": "(searchElement: JSONValue, fromIndex?: number) => number", - "description": "Returns the index of the first occurrence of a value in an array, or -1 if it is not present." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "lastIndexOf", - "value": "(searchElement: JSONValue, fromIndex?: number) => number", - "description": "Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "every", - "value": "{ (predicate: (value: JSONValue, index: number, array: JSONValue[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: JSONValue, index: number, array: JSONValue[]) => unknown, thisArg?: any): boolean; }", - "description": "Determines whether all the members of an array satisfy the specified test." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "some", - "value": "(predicate: (value: JSONValue, index: number, array: JSONValue[]) => unknown, thisArg?: any) => boolean", - "description": "Determines whether the specified callback function returns true for any element of an array." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "forEach", - "value": "(callbackfn: (value: JSONValue, index: number, array: JSONValue[]) => void, thisArg?: any) => void", - "description": "Performs the specified action for each element in an array." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "map", - "value": "(callbackfn: (value: JSONValue, index: number, array: JSONValue[]) => U, thisArg?: any) => U[]", - "description": "Calls a defined callback function on each element of an array, and returns an array that contains the results." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "filter", - "value": "{ (predicate: (value: JSONValue, index: number, array: JSONValue[]) => value is S, thisArg?: any): S[]; (predicate: (value: JSONValue, index: number, array: JSONValue[]) => unknown, thisArg?: any): JSONValue[]; }", - "description": "Returns the elements of an array that meet the condition specified in a callback function." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "reduce", - "value": "{ (callbackfn: (previousValue: JSONValue, currentValue: JSONValue, currentIndex: number, array: JSONValue[]) => JSONValue): JSONValue; (callbackfn: (previousValue: JSONValue, currentValue: JSONValue, currentIndex: number, array: JSONValue[]) => JSONValue, initialValue: JSONValue): JSONValue; (callbackfn: (previousValue: U, currentValue: JSONValue, currentIndex: number, array: JSONValue[]) => U, initialValue: U): U; }", - "description": "Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "reduceRight", - "value": "{ (callbackfn: (previousValue: JSONValue, currentValue: JSONValue, currentIndex: number, array: JSONValue[]) => JSONValue): JSONValue; (callbackfn: (previousValue: JSONValue, currentValue: JSONValue, currentIndex: number, array: JSONValue[]) => JSONValue, initialValue: JSONValue): JSONValue; (callbackfn: (previousValue: U, currentValue: JSONValue, currentIndex: number, array: JSONValue[]) => U, initialValue: U): U; }", - "description": "Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "find", - "value": "{ (predicate: (value: JSONValue, index: number, obj: JSONValue[]) => value is S, thisArg?: any): S; (predicate: (value: JSONValue, index: number, obj: JSONValue[]) => unknown, thisArg?: any): JSONValue; }", - "description": "Returns the value of the first element in the array where predicate is true, and undefined otherwise." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "findIndex", - "value": "(predicate: (value: JSONValue, index: number, obj: JSONValue[]) => unknown, thisArg?: any) => number", - "description": "Returns the index of the first element in the array where predicate is true, and -1 otherwise." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "fill", - "value": "(value: JSONValue, start?: number, end?: number) => JSONArray", - "description": "Changes all array elements from `start` to `end` index to a static `value` and returns the modified array" - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "copyWithin", - "value": "(target: number, start: number, end?: number) => JSONArray", - "description": "Returns the this object after copying a section of the array identified by start and end to the same array starting at position target" - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "entries", - "value": "() => IterableIterator<[number, JSONValue]>", - "description": "Returns an iterable of key, value pairs for every entry in the array" - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "keys", - "value": "() => IterableIterator", - "description": "Returns an iterable of keys in the array" - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "values", - "value": "() => IterableIterator", - "description": "Returns an iterable of values in the array" - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "includes", - "value": "(searchElement: JSONValue, fromIndex?: number) => boolean", - "description": "Determines whether an array includes a certain element, returning true or false as appropriate." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "flatMap", - "value": "(callback: (this: This, value: JSONValue, index: number, array: JSONValue[]) => U | readonly U[], thisArg?: This) => U[]", - "description": "Calls a defined callback function on each element of an array. Then, flattens the result into a new array. This is identical to a map followed by flat with depth 1." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "flat", - "value": "(this: A, depth?: D) => FlatArray[]", - "description": "Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "__@iterator@176", - "value": "() => IterableIterator", - "description": "Iterator" - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "PropertySignature", - "name": "__@unscopables@178", - "value": "{ [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; at?: boolean; }", - "description": "Is an object whose properties have the value 'true' when they will be absent when used in a 'with' statement." - }, - { - "filePath": "src/server/types.ts", - "syntaxKind": "MethodSignature", - "name": "at", - "value": "(index: number) => JSONValue", - "description": "Takes an integer value and returns the item at that index, allowing for positive and negative integers. Negative integers count back from the last item in the array." - } - ], - "value": "interface JSONArray extends Array {}" - }, "WebhookContextWithSession": { "filePath": "src/server/authenticate/webhooks/types.ts", "name": "WebhookContextWithSession", @@ -13748,7 +13202,7 @@ "filePath": "src/server/authenticate/webhooks/types.ts", "syntaxKind": "PropertySignature", "name": "payload", - "value": "JSONValue", + "value": "Record", "description": "The payload from the webhook request.", "examples": [ { diff --git a/packages/shopify-app-remix/src/server/authenticate/webhooks/types.ts b/packages/shopify-app-remix/src/server/authenticate/webhooks/types.ts index 41ac4d0ed0..cf04b7ae1c 100644 --- a/packages/shopify-app-remix/src/server/authenticate/webhooks/types.ts +++ b/packages/shopify-app-remix/src/server/authenticate/webhooks/types.ts @@ -1,6 +1,5 @@ import {Session, Shopify, ShopifyRestResources} from '@shopify/shopify-api'; -import type {JSONValue} from '../../types'; import type {AdminApiContext} from '../../clients'; import type {FeatureEnabled, FutureFlagOptions} from '../../future/flags'; @@ -30,6 +29,7 @@ interface Context { * ``` */ apiVersion: string; + /** * The shop where the webhook was triggered. * @@ -48,6 +48,7 @@ interface Context { * ``` */ shop: string; + /** * The topic of the webhook. * @@ -73,6 +74,7 @@ interface Context { * ``` */ topic: Topics; + /** * A unique ID for the webhook. Useful to keep track of which events your app has already processed. * @@ -91,6 +93,7 @@ interface Context { * ``` */ webhookId: string; + /** * The payload from the webhook request. * @@ -108,7 +111,8 @@ interface Context { * }; * ``` */ - payload: JSONValue; + payload: Record; + /** * The sub-topic of the webhook. This is only available for certain webhooks. * diff --git a/packages/shopify-app-remix/src/server/types.ts b/packages/shopify-app-remix/src/server/types.ts index c3368860ad..10d3b63722 100644 --- a/packages/shopify-app-remix/src/server/types.ts +++ b/packages/shopify-app-remix/src/server/types.ts @@ -32,14 +32,6 @@ export interface BasicParams< logger: Shopify['logger']; } -export type JSONValue = - | string - | number - | boolean - | null - | JSONObject - | JSONArray; - // eslint-disable-next-line no-warning-comments // TODO: Use this enum to replace the isCustomStoreApp config option in shopify-api-js export enum AppDistribution { @@ -53,14 +45,6 @@ export type MandatoryTopics = | 'CUSTOMERS_REDACT' | 'SHOP_REDACT'; -// This can't be a type because it would reference itself -// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style -interface JSONObject { - [x: string]: JSONValue; -} - -interface JSONArray extends Array {} - type RegisterWebhooks = ( options: RegisterWebhooksOptions, ) => Promise;