@segment/action-destinations 3.30.0 → 3.30.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.
@@ -1,5 +1,5 @@
1
1
  export interface Payload {
2
- group_key: string;
2
+ group_key?: string;
3
3
  traits?: {
4
4
  [k: string]: unknown;
5
5
  };
@@ -1,4 +1,4 @@
1
- import type { ActionDefinition } from '@segment/actions-core';
1
+ import { ActionDefinition } from '@segment/actions-core';
2
2
  import type { Settings } from '../generated-types';
3
3
  import type { Payload } from './generated-types';
4
4
  declare const action: ActionDefinition<Settings, Payload>;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const actions_core_1 = require("@segment/actions-core");
3
4
  const action = {
4
5
  title: 'Group Identify User',
5
6
  description: 'Updates or adds properties to a group profile. The profile is created if it does not exist.',
@@ -8,29 +9,30 @@ const action = {
8
9
  group_key: {
9
10
  label: 'Group Key',
10
11
  type: 'string',
11
- description: 'The group key',
12
- required: true
12
+ description: 'The group key. If this is not set, it is defaulted to "name".',
13
+ default: 'name'
13
14
  },
14
15
  traits: {
15
16
  label: 'Group Properties',
16
17
  type: 'object',
17
- description: 'Properties to set on the group profile',
18
+ description: 'Properties to set on the group profile. Make sure to have a field that corresponds to the above group key.',
18
19
  default: {
19
20
  '@path': '$.traits'
20
21
  }
21
22
  }
22
23
  },
23
24
  perform: (request, { payload, settings }) => {
25
+ const group_key = payload.group_key || 'name';
24
26
  if (!payload.traits) {
25
- throw new Error('No group traits were passed');
27
+ throw new actions_core_1.IntegrationError('"traits" is a required field', 'Missing required fields');
26
28
  }
27
- if (!payload.traits[payload.group_key]) {
28
- throw new Error('Group traits does not include proper group key');
29
+ if (!payload.traits[group_key]) {
30
+ throw new actions_core_1.IntegrationError('Group traits does not include proper group key', 'Misconfigured required field');
29
31
  }
30
32
  const data = {
31
33
  $token: settings.projectToken,
32
- $group_key: payload.group_key,
33
- $group_id: payload.traits[payload.group_key],
34
+ $group_key: group_key,
35
+ $group_id: payload.traits[group_key],
34
36
  $set: payload.traits
35
37
  };
36
38
  return request('https://api.mixpanel.com/groups#group-set', {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/mixpanel/groupIdentifyUser/index.ts"],"names":[],"mappings":";;AAIA,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,qBAAqB;IAC5B,WAAW,EAAE,6FAA6F;IAC1G,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,SAAS,EAAE;YACT,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,eAAe;YAC5B,QAAQ,EAAE,IAAI;SACf;QACD,MAAM,EAAE;YACN,KAAK,EAAE,kBAAkB;YACzB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,wCAAwC;YACrD,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;KACF;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC1C,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YACnB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAA;SAC/C;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;YACtC,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAA;SAClE;QACD,MAAM,IAAI,GAAG;YACX,MAAM,EAAE,QAAQ,CAAC,YAAY;YAC7B,UAAU,EAAE,OAAO,CAAC,SAAS;YAC7B,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC;YAC5C,IAAI,EAAE,OAAO,CAAC,MAAM;SACrB,CAAA;QAED,OAAO,OAAO,CAAC,2CAA2C,EAAE;YAC1D,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;SAC1D,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/mixpanel/groupIdentifyUser/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAI1E,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,qBAAqB;IAC5B,WAAW,EAAE,6FAA6F;IAC1G,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,SAAS,EAAE;YACT,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,+DAA+D;YAC5E,OAAO,EAAE,MAAM;SAChB;QACD,MAAM,EAAE;YACN,KAAK,EAAE,kBAAkB;YACzB,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,4GAA4G;YAC9G,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;KACF;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC1C,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,MAAM,CAAA;QAC7C,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YACnB,MAAM,IAAI,+BAAgB,CAAC,8BAA8B,EAAE,yBAAyB,CAAC,CAAA;SACtF;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;YAC9B,MAAM,IAAI,+BAAgB,CAAC,gDAAgD,EAAE,8BAA8B,CAAC,CAAA;SAC7G;QACD,MAAM,IAAI,GAAG;YACX,MAAM,EAAE,QAAQ,CAAC,YAAY;YAC7B,UAAU,EAAE,SAAS;YACrB,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC;YACpC,IAAI,EAAE,OAAO,CAAC,MAAM;SACrB,CAAA;QAED,OAAO,OAAO,CAAC,2CAA2C,EAAE;YAC1D,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;SAC1D,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@segment/action-destinations",
3
3
  "description": "Destination Actions engine and definitions.",
4
- "version": "3.30.0",
4
+ "version": "3.30.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/segmentio/action-destinations",
@@ -57,6 +57,5 @@
57
57
  "setupFilesAfterEnv": [
58
58
  "<rootDir>/test/setup-after-env.ts"
59
59
  ]
60
- },
61
- "gitHead": "17b13d3737af35a78f8b7c8d33b7d7dfd6bba142"
60
+ }
62
61
  }