@boboddy/sdk 0.4.2 → 0.4.3

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/dist/index.js CHANGED
@@ -16782,14 +16782,48 @@ function materializeAccessor(accessor) {
16782
16782
  };
16783
16783
  }
16784
16784
 
16785
+ // src/definitions/pipelines/work-item-fields.ts
16786
+ var WORK_ITEM_TOP_LEVEL_FIELDS = [
16787
+ "id",
16788
+ "projectId",
16789
+ "platform",
16790
+ "platformId",
16791
+ "platformKey",
16792
+ "url",
16793
+ "title",
16794
+ "description",
16795
+ "sourceCreatedAt",
16796
+ "sourceUpdatedAt",
16797
+ "createdByUserId",
16798
+ "parentWorkItemId",
16799
+ "createdAt",
16800
+ "updatedAt"
16801
+ ];
16802
+ var WORK_ITEM_FIELDS_PATH_PREFIX = "fields.";
16803
+ function resolveWorkItemFieldPath(record2, path) {
16804
+ if (typeof record2 !== "object" || record2 === null)
16805
+ return;
16806
+ const asRecord = record2;
16807
+ if (path.startsWith(WORK_ITEM_FIELDS_PATH_PREFIX)) {
16808
+ const fieldName = path.slice(WORK_ITEM_FIELDS_PATH_PREFIX.length);
16809
+ const fields = asRecord["fields"];
16810
+ if (typeof fields !== "object" || fields === null)
16811
+ return;
16812
+ return fields[fieldName];
16813
+ }
16814
+ return asRecord[path];
16815
+ }
16816
+
16785
16817
  // src/definitions/pipelines/builder-helpers.ts
16786
16818
  var WORK_ITEM_ACCESSOR = Object.freeze({
16787
- title: Object.freeze({ source: "work_item", field: "title" }),
16788
- description: Object.freeze({
16819
+ ...Object.fromEntries(WORK_ITEM_TOP_LEVEL_FIELDS.map((field) => [
16820
+ field,
16821
+ Object.freeze({ source: "work_item", field })
16822
+ ])),
16823
+ field: (fieldName) => Object.freeze({
16789
16824
  source: "work_item",
16790
- field: "description"
16791
- }),
16792
- field: (fieldName) => Object.freeze({ source: "work_item", field: `fields.${fieldName}` })
16825
+ field: `${WORK_ITEM_FIELDS_PATH_PREFIX}${fieldName}`
16826
+ })
16793
16827
  });
16794
16828
  var WORK_ITEM_FIELD_BINDINGS = {
16795
16829
  workItemTitle: { source: "work_item", field: "title" },
@@ -16840,7 +16874,7 @@ function resolveAdditionalStepInputBindings(label, definition) {
16840
16874
  const raw = definition.bindings({
16841
16875
  workItemField: (fieldName) => ({
16842
16876
  source: "work_item",
16843
- field: `fields.${fieldName}`
16877
+ field: `${WORK_ITEM_FIELDS_PATH_PREFIX}${fieldName}`
16844
16878
  }),
16845
16879
  literal: literal2
16846
16880
  });
@@ -17250,7 +17284,7 @@ function makeLeaf(fact, path, operator, value) {
17250
17284
  };
17251
17285
  }
17252
17286
  function makeFieldRef(fact, path) {
17253
- return {
17287
+ const untyped = {
17254
17288
  eq: (v) => makeLeaf(fact, path, "equal", v),
17255
17289
  ne: (v) => makeLeaf(fact, path, "notEqual", v),
17256
17290
  gt: (v) => makeLeaf(fact, path, "greaterThan", v),
@@ -17262,6 +17296,16 @@ function makeFieldRef(fact, path) {
17262
17296
  contains: (v) => makeLeaf(fact, path, "contains", v),
17263
17297
  doesNotContain: (v) => makeLeaf(fact, path, "doesNotContain", v)
17264
17298
  };
17299
+ return untyped;
17300
+ }
17301
+ function buildWorkItemAccessor() {
17302
+ const accessor = {
17303
+ field: (name) => makeFieldRef("workItem", `$.${WORK_ITEM_FIELDS_PATH_PREFIX}${name}`)
17304
+ };
17305
+ for (const key of WORK_ITEM_TOP_LEVEL_FIELDS) {
17306
+ accessor[key] = makeFieldRef("workItem", `$.${key}`);
17307
+ }
17308
+ return accessor;
17265
17309
  }
17266
17310
  function makeAssign(pipeline2) {
17267
17311
  if (typeof pipeline2 !== "object" || typeof pipeline2["key"] !== "string" || !Array.isArray(pipeline2["nodeDefinitions"])) {
@@ -17284,9 +17328,7 @@ function makeGroup(mode, refs) {
17284
17328
  }
17285
17329
  function buildCtx() {
17286
17330
  return {
17287
- workItem: {
17288
- field: (name) => makeFieldRef("workItem", `$.fields.${name}`)
17289
- },
17331
+ workItem: buildWorkItemAccessor(),
17290
17332
  context: {
17291
17333
  isNew: makeFieldRef("context", "$.isNew")
17292
17334
  },
@@ -17679,6 +17721,7 @@ export {
17679
17721
  stripTrailingCommas,
17680
17722
  stripJsoncComments,
17681
17723
  serializeDefaultPipelineAssignment,
17724
+ resolveWorkItemFieldPath,
17682
17725
  renderPromptTemplate,
17683
17726
  pipeline,
17684
17727
  parseJsonc,
@@ -17707,6 +17750,8 @@ export {
17707
17750
  WorkItems,
17708
17751
  WorkItemComments,
17709
17752
  WorkItemBlocks,
17753
+ WORK_ITEM_TOP_LEVEL_FIELDS,
17754
+ WORK_ITEM_FIELDS_PATH_PREFIX,
17710
17755
  Username,
17711
17756
  UserNotifications,
17712
17757
  StepExecutions,
@@ -16661,14 +16661,48 @@ function materializeAccessor(accessor) {
16661
16661
  };
16662
16662
  }
16663
16663
 
16664
+ // src/definitions/pipelines/work-item-fields.ts
16665
+ var WORK_ITEM_TOP_LEVEL_FIELDS = [
16666
+ "id",
16667
+ "projectId",
16668
+ "platform",
16669
+ "platformId",
16670
+ "platformKey",
16671
+ "url",
16672
+ "title",
16673
+ "description",
16674
+ "sourceCreatedAt",
16675
+ "sourceUpdatedAt",
16676
+ "createdByUserId",
16677
+ "parentWorkItemId",
16678
+ "createdAt",
16679
+ "updatedAt"
16680
+ ];
16681
+ var WORK_ITEM_FIELDS_PATH_PREFIX = "fields.";
16682
+ function resolveWorkItemFieldPath(record2, path) {
16683
+ if (typeof record2 !== "object" || record2 === null)
16684
+ return;
16685
+ const asRecord = record2;
16686
+ if (path.startsWith(WORK_ITEM_FIELDS_PATH_PREFIX)) {
16687
+ const fieldName = path.slice(WORK_ITEM_FIELDS_PATH_PREFIX.length);
16688
+ const fields = asRecord["fields"];
16689
+ if (typeof fields !== "object" || fields === null)
16690
+ return;
16691
+ return fields[fieldName];
16692
+ }
16693
+ return asRecord[path];
16694
+ }
16695
+
16664
16696
  // src/definitions/pipelines/builder-helpers.ts
16665
16697
  var WORK_ITEM_ACCESSOR = Object.freeze({
16666
- title: Object.freeze({ source: "work_item", field: "title" }),
16667
- description: Object.freeze({
16698
+ ...Object.fromEntries(WORK_ITEM_TOP_LEVEL_FIELDS.map((field) => [
16699
+ field,
16700
+ Object.freeze({ source: "work_item", field })
16701
+ ])),
16702
+ field: (fieldName) => Object.freeze({
16668
16703
  source: "work_item",
16669
- field: "description"
16670
- }),
16671
- field: (fieldName) => Object.freeze({ source: "work_item", field: `fields.${fieldName}` })
16704
+ field: `${WORK_ITEM_FIELDS_PATH_PREFIX}${fieldName}`
16705
+ })
16672
16706
  });
16673
16707
  var WORK_ITEM_FIELD_BINDINGS = {
16674
16708
  workItemTitle: { source: "work_item", field: "title" },
@@ -16719,7 +16753,7 @@ function resolveAdditionalStepInputBindings(label, definition) {
16719
16753
  const raw = definition.bindings({
16720
16754
  workItemField: (fieldName) => ({
16721
16755
  source: "work_item",
16722
- field: `fields.${fieldName}`
16756
+ field: `${WORK_ITEM_FIELDS_PATH_PREFIX}${fieldName}`
16723
16757
  }),
16724
16758
  literal: literal2
16725
16759
  });
@@ -17129,7 +17163,7 @@ function makeLeaf(fact, path, operator, value) {
17129
17163
  };
17130
17164
  }
17131
17165
  function makeFieldRef(fact, path) {
17132
- return {
17166
+ const untyped = {
17133
17167
  eq: (v) => makeLeaf(fact, path, "equal", v),
17134
17168
  ne: (v) => makeLeaf(fact, path, "notEqual", v),
17135
17169
  gt: (v) => makeLeaf(fact, path, "greaterThan", v),
@@ -17141,6 +17175,16 @@ function makeFieldRef(fact, path) {
17141
17175
  contains: (v) => makeLeaf(fact, path, "contains", v),
17142
17176
  doesNotContain: (v) => makeLeaf(fact, path, "doesNotContain", v)
17143
17177
  };
17178
+ return untyped;
17179
+ }
17180
+ function buildWorkItemAccessor() {
17181
+ const accessor = {
17182
+ field: (name) => makeFieldRef("workItem", `$.${WORK_ITEM_FIELDS_PATH_PREFIX}${name}`)
17183
+ };
17184
+ for (const key of WORK_ITEM_TOP_LEVEL_FIELDS) {
17185
+ accessor[key] = makeFieldRef("workItem", `$.${key}`);
17186
+ }
17187
+ return accessor;
17144
17188
  }
17145
17189
  function makeAssign(pipeline2) {
17146
17190
  if (typeof pipeline2 !== "object" || typeof pipeline2["key"] !== "string" || !Array.isArray(pipeline2["nodeDefinitions"])) {
@@ -17163,9 +17207,7 @@ function makeGroup(mode, refs) {
17163
17207
  }
17164
17208
  function buildCtx() {
17165
17209
  return {
17166
- workItem: {
17167
- field: (name) => makeFieldRef("workItem", `$.fields.${name}`)
17168
- },
17210
+ workItem: buildWorkItemAccessor(),
17169
17211
  context: {
17170
17212
  isNew: makeFieldRef("context", "$.isNew")
17171
17213
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@boboddy/sdk",
4
- "version": "0.4.2",
4
+ "version": "0.4.3",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {