@xyo-network/payload-utils 5.6.2 → 6.0.0

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.
@@ -36,4 +36,4 @@ var combinationsBySchema = async (payloads, schemas) => {
36
36
  export {
37
37
  combinationsBySchema
38
38
  };
39
- //# sourceMappingURL=index.mjs.map
39
+ //# sourceMappingURL=index.mjs.map
@@ -1 +1,7 @@
1
- {"version":3,"sources":["../../src/combinationsBySchema.ts"],"sourcesContent":["import { ObjectHasher } from '@xyo-network/hash'\nimport type { Payload } from '@xyo-network/payload-model'\n\n/**\n * Generates a unique key for a tuple of payloads\n * @param payloads An array of payloads\n * @returns A string that is a unique key for the payloads\n */\nconst generateKeyForTuple = async (payloads: Payload[]): Promise<string> => {\n // return (await Promise.all(array.map((p) => PayloadBuilder.dataHash(p)))).join('|')\n await Promise.resolve() // Here to reserve the right to make this async\n return payloads.map(p => ObjectHasher.stringifyHashFields(p)).join('|')\n}\n\n/**\n * Returns the unique combinations of payloads for the given schemas\n * @param payloads An array of payloads\n * @param schemas An array of schemas\n * @returns An array of unique combinations of payloads\n */\nexport const combinationsBySchema = async (payloads: Payload[], schemas: string[]): Promise<Payload[][]> => {\n // Group payloads by schema\n const groupedPayloads: Record<string, Payload[]> = Object.fromEntries(schemas.map(schema => [schema, []]))\n for (const payload of payloads) {\n if (schemas.includes(payload.schema)) {\n groupedPayloads[payload.schema].push(payload)\n }\n }\n\n // Set to track seen (serialized) combinations for uniqueness check\n const seen = new Set<string>()\n // Start with an array containing an empty combination\n let combinations = [[]] as Payload[][]\n\n // Iterate over each schema\n for (const schema of schemas) {\n const newCombinations: Payload[][] = []\n // Iterate over existing combinations\n for (const combination of combinations) {\n // Iterate over payloads for the current schema\n for (const payload of groupedPayloads[schema]) {\n // Create a new combination by adding the current payload\n const newPerm = [...combination, payload]\n // Proceed with serialization only if the combination is complete\n if (newPerm.length === schemas.length) {\n // Serialize the new combination asynchronously\n const serialized = await generateKeyForTuple(newPerm)\n // Check if the serialized combination is unique\n if (!seen.has(serialized)) {\n // Add it to the set of seen combinations\n seen.add(serialized)\n // Add the new combination to the list of new combinations\n newCombinations.push(newPerm)\n }\n } else {\n // Add incomplete combinations to the list for further processing\n newCombinations.push(newPerm)\n }\n }\n }\n // Update the list of combinations for the next schema iteration\n combinations = newCombinations\n }\n\n // Return the unique combinations\n return combinations\n}\n"],"mappings":";AAAA,SAAS,oBAAoB;AAQ7B,IAAM,sBAAsB,OAAO,aAAyC;AAE1E,QAAM,QAAQ,QAAQ;AACtB,SAAO,SAAS,IAAI,OAAK,aAAa,oBAAoB,CAAC,CAAC,EAAE,KAAK,GAAG;AACxE;AAQO,IAAM,uBAAuB,OAAO,UAAqB,YAA4C;AAE1G,QAAM,kBAA6C,OAAO,YAAY,QAAQ,IAAI,YAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AACzG,aAAW,WAAW,UAAU;AAC9B,QAAI,QAAQ,SAAS,QAAQ,MAAM,GAAG;AACpC,sBAAgB,QAAQ,MAAM,EAAE,KAAK,OAAO;AAAA,IAC9C;AAAA,EACF;AAGA,QAAM,OAAO,oBAAI,IAAY;AAE7B,MAAI,eAAe,CAAC,CAAC,CAAC;AAGtB,aAAW,UAAU,SAAS;AAC5B,UAAM,kBAA+B,CAAC;AAEtC,eAAW,eAAe,cAAc;AAEtC,iBAAW,WAAW,gBAAgB,MAAM,GAAG;AAE7C,cAAM,UAAU,CAAC,GAAG,aAAa,OAAO;AAExC,YAAI,QAAQ,WAAW,QAAQ,QAAQ;AAErC,gBAAM,aAAa,MAAM,oBAAoB,OAAO;AAEpD,cAAI,CAAC,KAAK,IAAI,UAAU,GAAG;AAEzB,iBAAK,IAAI,UAAU;AAEnB,4BAAgB,KAAK,OAAO;AAAA,UAC9B;AAAA,QACF,OAAO;AAEL,0BAAgB,KAAK,OAAO;AAAA,QAC9B;AAAA,MACF;AAAA,IACF;AAEA,mBAAe;AAAA,EACjB;AAGA,SAAO;AACT;","names":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/combinationsBySchema.ts"],
4
+ "sourcesContent": ["import { ObjectHasher } from '@xyo-network/hash'\nimport type { Payload } from '@xyo-network/payload-model'\n\n/**\n * Generates a unique key for a tuple of payloads\n * @param payloads An array of payloads\n * @returns A string that is a unique key for the payloads\n */\nconst generateKeyForTuple = async (payloads: Payload[]): Promise<string> => {\n // return (await Promise.all(array.map((p) => PayloadBuilder.dataHash(p)))).join('|')\n await Promise.resolve() // Here to reserve the right to make this async\n return payloads.map(p => ObjectHasher.stringifyHashFields(p)).join('|')\n}\n\n/**\n * Returns the unique combinations of payloads for the given schemas\n * @param payloads An array of payloads\n * @param schemas An array of schemas\n * @returns An array of unique combinations of payloads\n */\nexport const combinationsBySchema = async (payloads: Payload[], schemas: string[]): Promise<Payload[][]> => {\n // Group payloads by schema\n const groupedPayloads: Record<string, Payload[]> = Object.fromEntries(schemas.map(schema => [schema, []]))\n for (const payload of payloads) {\n if (schemas.includes(payload.schema)) {\n groupedPayloads[payload.schema].push(payload)\n }\n }\n\n // Set to track seen (serialized) combinations for uniqueness check\n const seen = new Set<string>()\n // Start with an array containing an empty combination\n let combinations = [[]] as Payload[][]\n\n // Iterate over each schema\n for (const schema of schemas) {\n const newCombinations: Payload[][] = []\n // Iterate over existing combinations\n for (const combination of combinations) {\n // Iterate over payloads for the current schema\n for (const payload of groupedPayloads[schema]) {\n // Create a new combination by adding the current payload\n const newPerm = [...combination, payload]\n // Proceed with serialization only if the combination is complete\n if (newPerm.length === schemas.length) {\n // Serialize the new combination asynchronously\n const serialized = await generateKeyForTuple(newPerm)\n // Check if the serialized combination is unique\n if (!seen.has(serialized)) {\n // Add it to the set of seen combinations\n seen.add(serialized)\n // Add the new combination to the list of new combinations\n newCombinations.push(newPerm)\n }\n } else {\n // Add incomplete combinations to the list for further processing\n newCombinations.push(newPerm)\n }\n }\n }\n // Update the list of combinations for the next schema iteration\n combinations = newCombinations\n }\n\n // Return the unique combinations\n return combinations\n}\n"],
5
+ "mappings": ";AAAA,SAAS,oBAAoB;AAQ7B,IAAM,sBAAsB,OAAO,aAAyC;AAE1E,QAAM,QAAQ,QAAQ;AACtB,SAAO,SAAS,IAAI,OAAK,aAAa,oBAAoB,CAAC,CAAC,EAAE,KAAK,GAAG;AACxE;AAQO,IAAM,uBAAuB,OAAO,UAAqB,YAA4C;AAE1G,QAAM,kBAA6C,OAAO,YAAY,QAAQ,IAAI,YAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AACzG,aAAW,WAAW,UAAU;AAC9B,QAAI,QAAQ,SAAS,QAAQ,MAAM,GAAG;AACpC,sBAAgB,QAAQ,MAAM,EAAE,KAAK,OAAO;AAAA,IAC9C;AAAA,EACF;AAGA,QAAM,OAAO,oBAAI,IAAY;AAE7B,MAAI,eAAe,CAAC,CAAC,CAAC;AAGtB,aAAW,UAAU,SAAS;AAC5B,UAAM,kBAA+B,CAAC;AAEtC,eAAW,eAAe,cAAc;AAEtC,iBAAW,WAAW,gBAAgB,MAAM,GAAG;AAE7C,cAAM,UAAU,CAAC,GAAG,aAAa,OAAO;AAExC,YAAI,QAAQ,WAAW,QAAQ,QAAQ;AAErC,gBAAM,aAAa,MAAM,oBAAoB,OAAO;AAEpD,cAAI,CAAC,KAAK,IAAI,UAAU,GAAG;AAEzB,iBAAK,IAAI,UAAU;AAEnB,4BAAgB,KAAK,OAAO;AAAA,UAC9B;AAAA,QACF,OAAO;AAEL,0BAAgB,KAAK,OAAO;AAAA,QAC9B;AAAA,MACF;AAAA,IACF;AAEA,mBAAe;AAAA,EACjB;AAGA,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -36,4 +36,4 @@ var combinationsBySchema = async (payloads, schemas) => {
36
36
  export {
37
37
  combinationsBySchema
38
38
  };
39
- //# sourceMappingURL=index.mjs.map
39
+ //# sourceMappingURL=index.mjs.map
@@ -1 +1,7 @@
1
- {"version":3,"sources":["../../src/combinationsBySchema.ts"],"sourcesContent":["import { ObjectHasher } from '@xyo-network/hash'\nimport type { Payload } from '@xyo-network/payload-model'\n\n/**\n * Generates a unique key for a tuple of payloads\n * @param payloads An array of payloads\n * @returns A string that is a unique key for the payloads\n */\nconst generateKeyForTuple = async (payloads: Payload[]): Promise<string> => {\n // return (await Promise.all(array.map((p) => PayloadBuilder.dataHash(p)))).join('|')\n await Promise.resolve() // Here to reserve the right to make this async\n return payloads.map(p => ObjectHasher.stringifyHashFields(p)).join('|')\n}\n\n/**\n * Returns the unique combinations of payloads for the given schemas\n * @param payloads An array of payloads\n * @param schemas An array of schemas\n * @returns An array of unique combinations of payloads\n */\nexport const combinationsBySchema = async (payloads: Payload[], schemas: string[]): Promise<Payload[][]> => {\n // Group payloads by schema\n const groupedPayloads: Record<string, Payload[]> = Object.fromEntries(schemas.map(schema => [schema, []]))\n for (const payload of payloads) {\n if (schemas.includes(payload.schema)) {\n groupedPayloads[payload.schema].push(payload)\n }\n }\n\n // Set to track seen (serialized) combinations for uniqueness check\n const seen = new Set<string>()\n // Start with an array containing an empty combination\n let combinations = [[]] as Payload[][]\n\n // Iterate over each schema\n for (const schema of schemas) {\n const newCombinations: Payload[][] = []\n // Iterate over existing combinations\n for (const combination of combinations) {\n // Iterate over payloads for the current schema\n for (const payload of groupedPayloads[schema]) {\n // Create a new combination by adding the current payload\n const newPerm = [...combination, payload]\n // Proceed with serialization only if the combination is complete\n if (newPerm.length === schemas.length) {\n // Serialize the new combination asynchronously\n const serialized = await generateKeyForTuple(newPerm)\n // Check if the serialized combination is unique\n if (!seen.has(serialized)) {\n // Add it to the set of seen combinations\n seen.add(serialized)\n // Add the new combination to the list of new combinations\n newCombinations.push(newPerm)\n }\n } else {\n // Add incomplete combinations to the list for further processing\n newCombinations.push(newPerm)\n }\n }\n }\n // Update the list of combinations for the next schema iteration\n combinations = newCombinations\n }\n\n // Return the unique combinations\n return combinations\n}\n"],"mappings":";AAAA,SAAS,oBAAoB;AAQ7B,IAAM,sBAAsB,OAAO,aAAyC;AAE1E,QAAM,QAAQ,QAAQ;AACtB,SAAO,SAAS,IAAI,OAAK,aAAa,oBAAoB,CAAC,CAAC,EAAE,KAAK,GAAG;AACxE;AAQO,IAAM,uBAAuB,OAAO,UAAqB,YAA4C;AAE1G,QAAM,kBAA6C,OAAO,YAAY,QAAQ,IAAI,YAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AACzG,aAAW,WAAW,UAAU;AAC9B,QAAI,QAAQ,SAAS,QAAQ,MAAM,GAAG;AACpC,sBAAgB,QAAQ,MAAM,EAAE,KAAK,OAAO;AAAA,IAC9C;AAAA,EACF;AAGA,QAAM,OAAO,oBAAI,IAAY;AAE7B,MAAI,eAAe,CAAC,CAAC,CAAC;AAGtB,aAAW,UAAU,SAAS;AAC5B,UAAM,kBAA+B,CAAC;AAEtC,eAAW,eAAe,cAAc;AAEtC,iBAAW,WAAW,gBAAgB,MAAM,GAAG;AAE7C,cAAM,UAAU,CAAC,GAAG,aAAa,OAAO;AAExC,YAAI,QAAQ,WAAW,QAAQ,QAAQ;AAErC,gBAAM,aAAa,MAAM,oBAAoB,OAAO;AAEpD,cAAI,CAAC,KAAK,IAAI,UAAU,GAAG;AAEzB,iBAAK,IAAI,UAAU;AAEnB,4BAAgB,KAAK,OAAO;AAAA,UAC9B;AAAA,QACF,OAAO;AAEL,0BAAgB,KAAK,OAAO;AAAA,QAC9B;AAAA,MACF;AAAA,IACF;AAEA,mBAAe;AAAA,EACjB;AAGA,SAAO;AACT;","names":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/combinationsBySchema.ts"],
4
+ "sourcesContent": ["import { ObjectHasher } from '@xyo-network/hash'\nimport type { Payload } from '@xyo-network/payload-model'\n\n/**\n * Generates a unique key for a tuple of payloads\n * @param payloads An array of payloads\n * @returns A string that is a unique key for the payloads\n */\nconst generateKeyForTuple = async (payloads: Payload[]): Promise<string> => {\n // return (await Promise.all(array.map((p) => PayloadBuilder.dataHash(p)))).join('|')\n await Promise.resolve() // Here to reserve the right to make this async\n return payloads.map(p => ObjectHasher.stringifyHashFields(p)).join('|')\n}\n\n/**\n * Returns the unique combinations of payloads for the given schemas\n * @param payloads An array of payloads\n * @param schemas An array of schemas\n * @returns An array of unique combinations of payloads\n */\nexport const combinationsBySchema = async (payloads: Payload[], schemas: string[]): Promise<Payload[][]> => {\n // Group payloads by schema\n const groupedPayloads: Record<string, Payload[]> = Object.fromEntries(schemas.map(schema => [schema, []]))\n for (const payload of payloads) {\n if (schemas.includes(payload.schema)) {\n groupedPayloads[payload.schema].push(payload)\n }\n }\n\n // Set to track seen (serialized) combinations for uniqueness check\n const seen = new Set<string>()\n // Start with an array containing an empty combination\n let combinations = [[]] as Payload[][]\n\n // Iterate over each schema\n for (const schema of schemas) {\n const newCombinations: Payload[][] = []\n // Iterate over existing combinations\n for (const combination of combinations) {\n // Iterate over payloads for the current schema\n for (const payload of groupedPayloads[schema]) {\n // Create a new combination by adding the current payload\n const newPerm = [...combination, payload]\n // Proceed with serialization only if the combination is complete\n if (newPerm.length === schemas.length) {\n // Serialize the new combination asynchronously\n const serialized = await generateKeyForTuple(newPerm)\n // Check if the serialized combination is unique\n if (!seen.has(serialized)) {\n // Add it to the set of seen combinations\n seen.add(serialized)\n // Add the new combination to the list of new combinations\n newCombinations.push(newPerm)\n }\n } else {\n // Add incomplete combinations to the list for further processing\n newCombinations.push(newPerm)\n }\n }\n }\n // Update the list of combinations for the next schema iteration\n combinations = newCombinations\n }\n\n // Return the unique combinations\n return combinations\n}\n"],
5
+ "mappings": ";AAAA,SAAS,oBAAoB;AAQ7B,IAAM,sBAAsB,OAAO,aAAyC;AAE1E,QAAM,QAAQ,QAAQ;AACtB,SAAO,SAAS,IAAI,OAAK,aAAa,oBAAoB,CAAC,CAAC,EAAE,KAAK,GAAG;AACxE;AAQO,IAAM,uBAAuB,OAAO,UAAqB,YAA4C;AAE1G,QAAM,kBAA6C,OAAO,YAAY,QAAQ,IAAI,YAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AACzG,aAAW,WAAW,UAAU;AAC9B,QAAI,QAAQ,SAAS,QAAQ,MAAM,GAAG;AACpC,sBAAgB,QAAQ,MAAM,EAAE,KAAK,OAAO;AAAA,IAC9C;AAAA,EACF;AAGA,QAAM,OAAO,oBAAI,IAAY;AAE7B,MAAI,eAAe,CAAC,CAAC,CAAC;AAGtB,aAAW,UAAU,SAAS;AAC5B,UAAM,kBAA+B,CAAC;AAEtC,eAAW,eAAe,cAAc;AAEtC,iBAAW,WAAW,gBAAgB,MAAM,GAAG;AAE7C,cAAM,UAAU,CAAC,GAAG,aAAa,OAAO;AAExC,YAAI,QAAQ,WAAW,QAAQ,QAAQ;AAErC,gBAAM,aAAa,MAAM,oBAAoB,OAAO;AAEpD,cAAI,CAAC,KAAK,IAAI,UAAU,GAAG;AAEzB,iBAAK,IAAI,UAAU;AAEnB,4BAAgB,KAAK,OAAO;AAAA,UAC9B;AAAA,QACF,OAAO;AAEL,0BAAgB,KAAK,OAAO;AAAA,QAC9B;AAAA,MACF;AAAA,IACF;AAEA,mBAAe;AAAA,EACjB;AAGA,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -36,4 +36,4 @@ var combinationsBySchema = async (payloads, schemas) => {
36
36
  export {
37
37
  combinationsBySchema
38
38
  };
39
- //# sourceMappingURL=index.mjs.map
39
+ //# sourceMappingURL=index.mjs.map
@@ -1 +1,7 @@
1
- {"version":3,"sources":["../../src/combinationsBySchema.ts"],"sourcesContent":["import { ObjectHasher } from '@xyo-network/hash'\nimport type { Payload } from '@xyo-network/payload-model'\n\n/**\n * Generates a unique key for a tuple of payloads\n * @param payloads An array of payloads\n * @returns A string that is a unique key for the payloads\n */\nconst generateKeyForTuple = async (payloads: Payload[]): Promise<string> => {\n // return (await Promise.all(array.map((p) => PayloadBuilder.dataHash(p)))).join('|')\n await Promise.resolve() // Here to reserve the right to make this async\n return payloads.map(p => ObjectHasher.stringifyHashFields(p)).join('|')\n}\n\n/**\n * Returns the unique combinations of payloads for the given schemas\n * @param payloads An array of payloads\n * @param schemas An array of schemas\n * @returns An array of unique combinations of payloads\n */\nexport const combinationsBySchema = async (payloads: Payload[], schemas: string[]): Promise<Payload[][]> => {\n // Group payloads by schema\n const groupedPayloads: Record<string, Payload[]> = Object.fromEntries(schemas.map(schema => [schema, []]))\n for (const payload of payloads) {\n if (schemas.includes(payload.schema)) {\n groupedPayloads[payload.schema].push(payload)\n }\n }\n\n // Set to track seen (serialized) combinations for uniqueness check\n const seen = new Set<string>()\n // Start with an array containing an empty combination\n let combinations = [[]] as Payload[][]\n\n // Iterate over each schema\n for (const schema of schemas) {\n const newCombinations: Payload[][] = []\n // Iterate over existing combinations\n for (const combination of combinations) {\n // Iterate over payloads for the current schema\n for (const payload of groupedPayloads[schema]) {\n // Create a new combination by adding the current payload\n const newPerm = [...combination, payload]\n // Proceed with serialization only if the combination is complete\n if (newPerm.length === schemas.length) {\n // Serialize the new combination asynchronously\n const serialized = await generateKeyForTuple(newPerm)\n // Check if the serialized combination is unique\n if (!seen.has(serialized)) {\n // Add it to the set of seen combinations\n seen.add(serialized)\n // Add the new combination to the list of new combinations\n newCombinations.push(newPerm)\n }\n } else {\n // Add incomplete combinations to the list for further processing\n newCombinations.push(newPerm)\n }\n }\n }\n // Update the list of combinations for the next schema iteration\n combinations = newCombinations\n }\n\n // Return the unique combinations\n return combinations\n}\n"],"mappings":";AAAA,SAAS,oBAAoB;AAQ7B,IAAM,sBAAsB,OAAO,aAAyC;AAE1E,QAAM,QAAQ,QAAQ;AACtB,SAAO,SAAS,IAAI,OAAK,aAAa,oBAAoB,CAAC,CAAC,EAAE,KAAK,GAAG;AACxE;AAQO,IAAM,uBAAuB,OAAO,UAAqB,YAA4C;AAE1G,QAAM,kBAA6C,OAAO,YAAY,QAAQ,IAAI,YAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AACzG,aAAW,WAAW,UAAU;AAC9B,QAAI,QAAQ,SAAS,QAAQ,MAAM,GAAG;AACpC,sBAAgB,QAAQ,MAAM,EAAE,KAAK,OAAO;AAAA,IAC9C;AAAA,EACF;AAGA,QAAM,OAAO,oBAAI,IAAY;AAE7B,MAAI,eAAe,CAAC,CAAC,CAAC;AAGtB,aAAW,UAAU,SAAS;AAC5B,UAAM,kBAA+B,CAAC;AAEtC,eAAW,eAAe,cAAc;AAEtC,iBAAW,WAAW,gBAAgB,MAAM,GAAG;AAE7C,cAAM,UAAU,CAAC,GAAG,aAAa,OAAO;AAExC,YAAI,QAAQ,WAAW,QAAQ,QAAQ;AAErC,gBAAM,aAAa,MAAM,oBAAoB,OAAO;AAEpD,cAAI,CAAC,KAAK,IAAI,UAAU,GAAG;AAEzB,iBAAK,IAAI,UAAU;AAEnB,4BAAgB,KAAK,OAAO;AAAA,UAC9B;AAAA,QACF,OAAO;AAEL,0BAAgB,KAAK,OAAO;AAAA,QAC9B;AAAA,MACF;AAAA,IACF;AAEA,mBAAe;AAAA,EACjB;AAGA,SAAO;AACT;","names":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/combinationsBySchema.ts"],
4
+ "sourcesContent": ["import { ObjectHasher } from '@xyo-network/hash'\nimport type { Payload } from '@xyo-network/payload-model'\n\n/**\n * Generates a unique key for a tuple of payloads\n * @param payloads An array of payloads\n * @returns A string that is a unique key for the payloads\n */\nconst generateKeyForTuple = async (payloads: Payload[]): Promise<string> => {\n // return (await Promise.all(array.map((p) => PayloadBuilder.dataHash(p)))).join('|')\n await Promise.resolve() // Here to reserve the right to make this async\n return payloads.map(p => ObjectHasher.stringifyHashFields(p)).join('|')\n}\n\n/**\n * Returns the unique combinations of payloads for the given schemas\n * @param payloads An array of payloads\n * @param schemas An array of schemas\n * @returns An array of unique combinations of payloads\n */\nexport const combinationsBySchema = async (payloads: Payload[], schemas: string[]): Promise<Payload[][]> => {\n // Group payloads by schema\n const groupedPayloads: Record<string, Payload[]> = Object.fromEntries(schemas.map(schema => [schema, []]))\n for (const payload of payloads) {\n if (schemas.includes(payload.schema)) {\n groupedPayloads[payload.schema].push(payload)\n }\n }\n\n // Set to track seen (serialized) combinations for uniqueness check\n const seen = new Set<string>()\n // Start with an array containing an empty combination\n let combinations = [[]] as Payload[][]\n\n // Iterate over each schema\n for (const schema of schemas) {\n const newCombinations: Payload[][] = []\n // Iterate over existing combinations\n for (const combination of combinations) {\n // Iterate over payloads for the current schema\n for (const payload of groupedPayloads[schema]) {\n // Create a new combination by adding the current payload\n const newPerm = [...combination, payload]\n // Proceed with serialization only if the combination is complete\n if (newPerm.length === schemas.length) {\n // Serialize the new combination asynchronously\n const serialized = await generateKeyForTuple(newPerm)\n // Check if the serialized combination is unique\n if (!seen.has(serialized)) {\n // Add it to the set of seen combinations\n seen.add(serialized)\n // Add the new combination to the list of new combinations\n newCombinations.push(newPerm)\n }\n } else {\n // Add incomplete combinations to the list for further processing\n newCombinations.push(newPerm)\n }\n }\n }\n // Update the list of combinations for the next schema iteration\n combinations = newCombinations\n }\n\n // Return the unique combinations\n return combinations\n}\n"],
5
+ "mappings": ";AAAA,SAAS,oBAAoB;AAQ7B,IAAM,sBAAsB,OAAO,aAAyC;AAE1E,QAAM,QAAQ,QAAQ;AACtB,SAAO,SAAS,IAAI,OAAK,aAAa,oBAAoB,CAAC,CAAC,EAAE,KAAK,GAAG;AACxE;AAQO,IAAM,uBAAuB,OAAO,UAAqB,YAA4C;AAE1G,QAAM,kBAA6C,OAAO,YAAY,QAAQ,IAAI,YAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AACzG,aAAW,WAAW,UAAU;AAC9B,QAAI,QAAQ,SAAS,QAAQ,MAAM,GAAG;AACpC,sBAAgB,QAAQ,MAAM,EAAE,KAAK,OAAO;AAAA,IAC9C;AAAA,EACF;AAGA,QAAM,OAAO,oBAAI,IAAY;AAE7B,MAAI,eAAe,CAAC,CAAC,CAAC;AAGtB,aAAW,UAAU,SAAS;AAC5B,UAAM,kBAA+B,CAAC;AAEtC,eAAW,eAAe,cAAc;AAEtC,iBAAW,WAAW,gBAAgB,MAAM,GAAG;AAE7C,cAAM,UAAU,CAAC,GAAG,aAAa,OAAO;AAExC,YAAI,QAAQ,WAAW,QAAQ,QAAQ;AAErC,gBAAM,aAAa,MAAM,oBAAoB,OAAO;AAEpD,cAAI,CAAC,KAAK,IAAI,UAAU,GAAG;AAEzB,iBAAK,IAAI,UAAU;AAEnB,4BAAgB,KAAK,OAAO;AAAA,UAC9B;AAAA,QACF,OAAO;AAEL,0BAAgB,KAAK,OAAO;AAAA,QAC9B;AAAA,MACF;AAAA,IACF;AAEA,mBAAe;AAAA,EACjB;AAGA,SAAO;AACT;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/payload-utils",
3
- "version": "5.6.2",
3
+ "version": "6.0.0",
4
4
  "description": "Primary SDK for using XYO Protocol 2.0",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -34,49 +34,52 @@
34
34
  "README.md"
35
35
  ],
36
36
  "dependencies": {
37
- "@xyo-network/hash": "~5.6.2",
38
- "@xyo-network/payload-model": "~5.6.2"
37
+ "@xyo-network/hash": "~6.0.0",
38
+ "@xyo-network/payload-model": "~6.0.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@opentelemetry/api": "^1.9.1",
42
42
  "@opentelemetry/sdk-trace-base": "^2.7.1",
43
- "@xylabs/sdk-js": "^5.1.1",
44
- "@xylabs/threads": "^5.1.1",
45
- "@xylabs/toolchain": "~7.13.4",
46
- "@xylabs/tsconfig": "~7.13.4",
47
- "@xylabs/vitest-extended": "^5.1.1",
43
+ "@xylabs/sdk-js": "~6.0",
44
+ "@xylabs/threads": "~6.0",
45
+ "@xylabs/toolchain": "~8.0.17",
46
+ "@xylabs/tsconfig": "~8.0.17",
47
+ "@xylabs/vitest-extended": "^6.0.0",
48
48
  "async-mutex": "^0.5.0",
49
49
  "bn.js": "^5.2.3",
50
50
  "buffer": "^6.0.3",
51
51
  "chalk": "^5.6.2",
52
52
  "debug": "~4.4.3",
53
- "eslint": "^10.3.0",
53
+ "eslint": "^10.4.0",
54
54
  "ethers": "^6.16.0",
55
55
  "hash-wasm": "~4.12.0",
56
56
  "observable-fns": "~0.6.1",
57
57
  "pako": "~2.1.0",
58
- "typescript": "~5.9.3",
59
- "vite": "^8.0.10",
60
- "vitest": "~4.1.5",
58
+ "typescript": "~6.0.3",
59
+ "vite": "^8.0.13",
60
+ "vitest": "~4.1.6",
61
61
  "wasm-feature-detect": "~1.8.0",
62
62
  "zod": "^4.4.3"
63
63
  },
64
64
  "peerDependencies": {
65
- "@opentelemetry/api": ">=1.9.1 <2",
66
- "@opentelemetry/sdk-trace-base": ">=2.7.1 <3",
67
- "@xylabs/sdk-js": ">=5.1.1 <6",
68
- "@xylabs/threads": ">=5.1.1 <6",
69
- "async-mutex": ">=0.5.0 <1",
70
- "bn.js": ">=5.2.3 <6",
71
- "buffer": ">=6.0.3 <7",
72
- "chalk": ">=5.6.2 <6",
73
- "debug": ">=4.4.3 <4.5",
74
- "ethers": ">=6.16.0 <7",
75
- "hash-wasm": ">=4.12.0 <4.13",
76
- "observable-fns": ">=0.6.1 <0.7",
77
- "pako": ">=2.1.0 <2.2",
78
- "wasm-feature-detect": ">=1.8.0 <1.9",
79
- "zod": ">=4.4.3 <5"
65
+ "@opentelemetry/api": "^1.9",
66
+ "@opentelemetry/sdk-trace-base": "^2.7",
67
+ "@xylabs/sdk-js": "^6.0",
68
+ "@xylabs/threads": "^6.0",
69
+ "async-mutex": "^0.5",
70
+ "bn.js": "^5.2",
71
+ "buffer": "^6.0",
72
+ "chalk": "^5.6",
73
+ "debug": "~4.4",
74
+ "ethers": "^6.16",
75
+ "hash-wasm": "~4.12",
76
+ "observable-fns": "~0.6",
77
+ "pako": "~2.1",
78
+ "wasm-feature-detect": "~1.8",
79
+ "zod": "^4.4"
80
+ },
81
+ "engines": {
82
+ "node": "^24"
80
83
  },
81
84
  "publishConfig": {
82
85
  "access": "public"