@learncard/helpers 1.3.6 → 1.3.7

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/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  [<img src="https://user-images.githubusercontent.com/2185016/190510561-294db809-09fd-4771-9749-6c0e0f4144fd.png" width="215"/>](https://learncard.com)
2
2
 
3
3
  # @learncard/helpers
4
+
4
5
  [![npm version](https://img.shields.io/npm/v/@learncard/helpers)](https://www.npmjs.com/package/@learncard/helpers)
5
6
  [![npm downloads](https://img.shields.io/npm/dw/@learncard/helpers)](https://www.npmjs.com/package/@learncard/helpers)
6
7
  [![vulnerabilities](https://img.shields.io/snyk/vulnerabilities/npm/@learncard/helpers)](https://www.npmjs.com/package/@learncard/helpers)
@@ -8,26 +9,27 @@
8
9
  Shared helpers for learn card
9
10
 
10
11
  ## Documentation
12
+
11
13
  All LearnCard documentation can be found at:
12
14
  https://docs.learncard.com
13
15
 
14
16
  ## Install
15
17
 
16
18
  ```bash
17
- pnpm install @learncard/helpers
19
+ bun install @learncard/helpers
18
20
  ```
19
21
 
20
22
  ## Usage
21
23
 
22
24
  ```js
23
- import { isHex } from "@learncard/helpers";
25
+ import { isHex } from '@learncard/helpers';
24
26
 
25
27
  const test = 'abc123';
26
28
  console.log(isHex(test)); // true
27
29
  ```
28
30
 
29
-
30
31
  ## Contributing
32
+
31
33
  Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
32
34
 
33
35
  Please make sure to update tests as appropriate.
@@ -36,8 +38,6 @@ Please make sure to update tests as appropriate.
36
38
 
37
39
  **[Learning Economy Foundation (LEF)](https://www.learningeconomy.io)** is a 501(c)(3) non-profit organization leveraging global standards and web3 protocols to bring quality skills and equal opportunity to every human on earth, and address the persistent inequities that exist around the globe in education and employment. We help you build the future of education and work with:
38
40
 
39
-
40
41
  ## License
41
42
 
42
43
  MIT © [Learning Economy Foundation](https://github.com/Learning-Economy-Foundation)
43
-
@@ -7,11 +7,7 @@ var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
8
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
9
  var __commonJS = (cb, mod) => function __require() {
10
- try {
11
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
- } catch (e) {
13
- throw mod = 0, e;
14
- }
10
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
11
  };
16
12
  var __export = (target, all) => {
17
13
  for (var name in all)
@@ -7105,7 +7101,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7105
7101
  var ef = i.object({ type: i.literal("check-credential"), templateAlias: i.string().optional(), boostUri: i.string().optional() }).refine((t) => !!t.templateAlias != !!t.boostUri, { message: "Exactly one of templateAlias or boostUri is required" });
7106
7102
  var tf = i.object({ type: i.literal("check-issuance-status"), templateAlias: i.string().optional(), boostUri: i.string().optional(), recipient: i.string() }).refine((t) => !!t.templateAlias != !!t.boostUri, { message: "Exactly one of templateAlias or boostUri is required" });
7107
7103
  var rf = i.object({ type: i.literal("get-template-recipients"), templateAlias: i.string().optional(), boostUri: i.string().optional(), limit: i.number().optional(), cursor: i.string().optional() }).refine((t) => !!t.templateAlias != !!t.boostUri, { message: "Exactly one of templateAlias or boostUri is required" });
7108
- var nf = i.object({ type: i.literal("request-learner-context"), includeCredentials: i.boolean().optional().default(true), includePersonalData: i.boolean().optional().default(false), format: i.enum(["prompt", "structured"]).optional().default("prompt"), instructions: i.string().optional(), detailLevel: i.enum(["compact", "expanded"]).optional().default("compact") });
7104
+ var nf = i.object({ type: i.literal("request-learner-context"), includeCredentials: i.boolean().optional().default(true), includePersonalData: i.boolean().optional().default(false), format: i.enum(["prompt", "structured"]).optional().default("prompt"), instructions: i.string().optional(), detailLevel: i.enum(["compact", "expanded"]).optional().default("compact"), waitForSync: i.boolean().optional().default(false) });
7109
7105
  var of = i.object({ occupations: i.array(i.string()).nullable(), careers: i.array(i.string()).nullable(), jobs: i.array(i.string()).nullable(), skills: i.array(i.string()).nullable(), fieldOfStudy: i.string().nullable() });
7110
7106
  var af = i.object({ title: i.string().describe("Short, concise title for the learning session or credential"), summary: i.string().describe("Comprehensive summary of what happened during the session"), learned: i.array(i.string()).describe("Bullet points of key knowledge gained"), skills: i.array(i.object({ title: i.string().describe("Name of the skill category"), description: i.string().describe("Detailed description of what this skill category involves") })).describe("Categorized skills learned during the session"), nextSteps: i.array(i.object({ title: i.string().describe("Title of the suggested next step"), description: i.string().describe("Description explaining why this next step is recommended"), keywords: of.optional().describe("Optional taxonomy keywords for occupations/careers/jobs/skills/fieldOfStudy. Omit if not relevant.") })).describe("Recommended follow-up activities or learning modules"), reflections: i.array(i.object({ title: i.string().describe("Title of the reflection"), description: i.string().describe("Detailed description of what this reflection involves") })).describe("Reflections on the learning experience") });
7111
7107
  var cf = i.object({ type: i.literal("send-ai-session-credential"), sessionTitle: i.string(), summaryData: af, metadata: i.record(i.string(), i.unknown()).optional() });
@@ -24468,7 +24464,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
24468
24464
  includePersonalData: external_exports.boolean().optional().default(false),
24469
24465
  format: external_exports.enum(["prompt", "structured"]).optional().default("prompt"),
24470
24466
  instructions: external_exports.string().optional(),
24471
- detailLevel: external_exports.enum(["compact", "expanded"]).optional().default("compact")
24467
+ detailLevel: external_exports.enum(["compact", "expanded"]).optional().default("compact"),
24468
+ waitForSync: external_exports.boolean().optional().default(false)
24472
24469
  });
24473
24470
  var SummaryCredentialKeywordValidator = external_exports.object({
24474
24471
  occupations: external_exports.array(external_exports.string()).nullable(),
@@ -24741,7 +24738,7 @@ var getFileType = /* @__PURE__ */ __name(async (url) => {
24741
24738
  const handle = getFilestackHandle(url);
24742
24739
  try {
24743
24740
  const data = await (await fetch(`https://www.filestackapi.com/api/file/${handle}/metadata`)).json();
24744
- return data.mimetype;
24741
+ return data.mimetype ?? "";
24745
24742
  } catch (error) {
24746
24743
  console.error(error);
24747
24744
  return "";
@@ -25559,7 +25556,9 @@ var isVC2Format = /* @__PURE__ */ __name((credential) => {
25559
25556
  if (!credential["@context"] || !Array.isArray(credential["@context"])) {
25560
25557
  return false;
25561
25558
  }
25562
- return credential["@context"].includes("https://www.w3.org/ns/credentials/v2");
25559
+ return credential["@context"].some(
25560
+ (context) => context === "https://www.w3.org/ns/credentials/v2"
25561
+ );
25563
25562
  }, "isVC2Format");
25564
25563
  var unwrapBoostCredential = /* @__PURE__ */ __name((vc) => {
25565
25564
  if (vc?.type?.includes("CertifiedBoostCredential") && vc?.boostCredential) {