@openfn/language-collections 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/types/collections.d.ts +5 -4
package/package.json
CHANGED
package/types/collections.d.ts
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* @example <caption>Get a range of values from a collection with a key pattern</caption>
|
|
26
26
|
* collections.get('my-collection', '2024*')
|
|
27
27
|
* @example <caption>Get all values created since the end of January 2024</caption>
|
|
28
|
-
* collections.get('my-collection', { createdAfter: '202401')
|
|
28
|
+
* collections.get('my-collection', { createdAfter: '202401'})
|
|
29
29
|
*/
|
|
30
30
|
export function get(name: string, query?: string | QueryOptions): (state: any) => Promise<any>;
|
|
31
31
|
/**
|
|
@@ -36,6 +36,7 @@ export function get(name: string, query?: string | QueryOptions): (state: any) =
|
|
|
36
36
|
* a string key.
|
|
37
37
|
* @public
|
|
38
38
|
* @function
|
|
39
|
+
* @param {string} name - The name of the collection to fetch from
|
|
39
40
|
* @param keygen - a function which generates a key for each value: (value, index) => key. Pass a string to set a static key for a single item.
|
|
40
41
|
* @param values - an array of values to set, or a single value.
|
|
41
42
|
* @example <caption>Set a number of values using each value's id property as a key</caption>
|
|
@@ -43,9 +44,9 @@ export function get(name: string, query?: string | QueryOptions): (state: any) =
|
|
|
43
44
|
* @example <caption>Set a number of values, generating an id from a string template</caption>
|
|
44
45
|
* collections.set('my-collection', (item) => `${item.category}-${Date.now()}`, $.data)
|
|
45
46
|
* @example <caption>Set a single value with a static key</caption>
|
|
46
|
-
* collections.set('my-collection', 'city-codes', { NY: 'New York', LDN: 'London' }
|
|
47
|
+
* collections.set('my-collection', 'city-codes', { NY: 'New York', LDN: 'London' })
|
|
47
48
|
*/
|
|
48
|
-
export function set(name:
|
|
49
|
+
export function set(name: string, keyGen: any, values: any, ...args: any[]): (state: any) => Promise<any>;
|
|
49
50
|
/**
|
|
50
51
|
* Remove one or more values from a collection.
|
|
51
52
|
* You can pass a specific key as a string to only fetch one item, or pass a query
|
|
@@ -59,7 +60,7 @@ export function set(name: any, keyGen: any, values: any, ...args: any[]): (state
|
|
|
59
60
|
* @example <caption>Remove a range of values from a collection with a key pattern</caption>
|
|
60
61
|
* collections.remove('my-collection', '2024*')
|
|
61
62
|
* @example <caption>Remove all values created since the end of January 2024</caption>
|
|
62
|
-
* collections.remove('my-collection', { createdAfter: '202401')
|
|
63
|
+
* collections.remove('my-collection', { createdAfter: '202401'})
|
|
63
64
|
*/
|
|
64
65
|
export function remove(name: string, query?: string | QueryOptions, options?: {}): (state: any) => Promise<any>;
|
|
65
66
|
/**
|